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:
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 
71  bool jumpTo(int idx);
72 
77  bool jumpNext();
78 
83  bool jumpPrevious();
84 
90  bool setLoop(bool b);
91 
92  BookmarksBase::CreationStatus create();
93 
94  bool remove(int idx) override;
95 
96  private slots:
101  void positionChangedMs(MilliSeconds pos);
102 
107  void currentTrackChanged(const MetaData& md);
108 
113  void playstateChanged(PlayState state);
114 
115  private:
116 
117  using BookmarksBase::create;
118  using BookmarksBase::setMetadata;
119 
123  bool load() override;
124 };
125 
126 #endif // BOOKMARKS_H
BookmarksBase::create
virtual CreationStatus create(Seconds timestamp)
create a new bookmark for current track and current position
PlayState
PlayState
The PlayState enum.
Definition: PlayState.h:29
Bookmarks::setLoop
bool setLoop(bool b)
tries to set the loop between the current two indices
Bookmarks::jumpTo
bool jumpTo(int idx)
Jump to specific bookmark.
Bookmarks::jumpNext
bool jumpNext()
Jump to next bookmark.
Bookmarks::remove
bool remove(int idx) override
remove single bookmark from database for current track
Bookmarks::sigNextChanged
void sigNextChanged(const Bookmark &bm)
next bookmark has changed
Bookmarks::sigPreviousChanged
void sigPreviousChanged(const Bookmark &bm)
previous bookmark has changed
BookmarksBase
Definition: BookmarksBase.h:32
Bookmark
Definition: Bookmark.h:32
Bookmarks
The Bookmarks logic class.
Definition: Bookmarks.h:38
Bookmarks::sigBookmarksChanged
void sigBookmarksChanged()
emitted when bookmarks have changed
MetaData
The MetaData class.
Definition: MetaData.h:47
Bookmarks::jumpPrevious
bool jumpPrevious()
Jump to previous bookmark.