Sayonara Player
Bookmarks.h
1 /* Bookmarks.h */
2 
3 /* Copyright (C) 2011-2017 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef BOOKMARKS_H
22 #define BOOKMARKS_H
23 
24 #include "BookmarksBase.h"
25 #include "Components/PlayManager/PlayState.h"
26 
27 #include <QList>
28 
29 class Bookmark;
30 class MetaData;
31 
36 class Bookmarks :
37  public BookmarksBase
38 {
39  Q_OBJECT
40  PIMPL(Bookmarks)
41 
42 signals:
47  void sig_bookmarks_changed();
48 
53  void sig_prev_changed(const Bookmark& bm);
54 
59  void sig_next_changed(const Bookmark& bm);
60 
61 public:
62 
63  explicit Bookmarks(QObject *parent);
64  ~Bookmarks();
65 
66 
72  bool jump_to(int idx);
73 
78  bool jump_next();
79 
84  bool jump_prev();
85 
86 
92  bool set_loop(bool b);
93 
94  BookmarksBase::CreationStatus create();
95 
96 
97  bool remove(int idx) override;
98 
99 
100 private slots:
105  void pos_changed_ms(MilliSeconds pos);
106 
111  void track_changed(const MetaData& md);
112 
117  void playstate_changed(PlayState state);
118 
119 
120 private:
121 
122  using BookmarksBase::create;
123  using BookmarksBase::set_metadata;
124 
128  bool load() override;
129 };
130 
131 #endif // BOOKMARKS_H
Definition: Bookmark.h:31
Definition: BookmarksBase.h:32
PlayState
The PlayState enum.
Definition: PlayState.h:28
bool jump_prev()
Jump to previous bookmark.
The MetaData class.
Definition: MetaData.h:48
bool jump_next()
Jump to next bookmark.
void sig_prev_changed(const Bookmark &bm)
previous bookmark has changed
bool jump_to(int idx)
Jump to specific bookmark.
bool set_loop(bool b)
tries to set the loop between the current two indices
virtual CreationStatus create(Seconds timestamp)
create a new bookmark for current track and current position
void sig_next_changed(const Bookmark &bm)
next bookmark has changed
void sig_bookmarks_changed()
emitted when bookmarks have changed
The Bookmarks logic class.
Definition: Bookmarks.h:36