Sayonara Player
Bookmarks.h
1 /* Bookmarks.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (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 sigBookmarksChanged();
48 
53  void sigPreviousChanged(const Bookmark& bm);
54 
59  void sigNextChanged(const Bookmark& bm);
60 
61 public:
62 
63  explicit Bookmarks(QObject* parent);
64  ~Bookmarks() override;
65 
66 
72  bool jumpTo(int idx);
73 
78  bool jumpNext();
79 
84  bool jumpPrevious();
85 
86 
92  bool setLoop(bool b);
93 
94  BookmarksBase::CreationStatus create();
95 
96 
97  bool remove(int idx) override;
98 
99 
100 private slots:
105  void positionChangedMs(MilliSeconds pos);
106 
111  void currentTrackChanged(const MetaData& md);
112 
117  void playstateChanged(PlayState state);
118 
119 
120 private:
121 
122  using BookmarksBase::create;
123  using BookmarksBase::setMetadata;
124 
128  bool load() override;
129 };
130 
131 #endif // BOOKMARKS_H
Definition: Bookmark.h:31
void sigBookmarksChanged()
emitted when bookmarks have changed
Definition: BookmarksBase.h:30
PlayState
The PlayState enum.
Definition: PlayState.h:28
The MetaData class.
Definition: MetaData.h:45
bool remove(int idx) override
remove single bookmark from database for current track
bool setLoop(bool b)
tries to set the loop between the current two indices
bool jumpPrevious()
Jump to previous bookmark.
bool jumpTo(int idx)
Jump to specific bookmark.
void sigNextChanged(const Bookmark &bm)
next bookmark has changed
void sigPreviousChanged(const Bookmark &bm)
previous bookmark has changed
virtual CreationStatus create(Seconds timestamp)
create a new bookmark for current track and current position
bool jumpNext()
Jump to next bookmark.
The Bookmarks logic class.
Definition: Bookmarks.h:36