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 "BookmarkStorage.h"
25 
26 #include <QList>
27 #include <QObject>
28 
29 class Bookmark;
30 class MetaData;
31 class PlayManager;
32 
37 class Bookmarks :
38  public QObject
39 {
40  Q_OBJECT
41  PIMPL(Bookmarks)
42 
43  signals:
49 
54  void sigPreviousChanged(const Bookmark& bm);
55 
60  void sigNextChanged(const Bookmark& bm);
61 
62  public:
63  explicit Bookmarks(PlayManager* playManager, QObject* parent=nullptr);
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  int count() const;
93 
94  BookmarkStorage::CreationStatus create();
95 
96  bool remove(int index);
97  const QList<Bookmark>& bookmarks() const;
98 
99  const MetaData& currentTrack() const;
100 
101  private slots:
106  void positionChangedMs(MilliSeconds positionMs);
107 
112  void currentTrackChanged(const MetaData& track);
113 
118  void playstateChanged(PlayState state);
119 };
120 
121 #endif // BOOKMARKS_H
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.
QList
Definition: EngineUtils.h:33
PlayManager
Global handler for current playback state (Singleton)
Definition: PlayManager.h:36
Bookmarks::jumpNext
bool jumpNext()
Jump to next bookmark.
Bookmarks::sigNextChanged
void sigNextChanged(const Bookmark &bm)
next bookmark has changed
Bookmarks::sigPreviousChanged
void sigPreviousChanged(const Bookmark &bm)
previous bookmark has changed
Bookmark
Definition: Bookmark.h:32
Bookmarks
The Bookmarks logic class.
Definition: Bookmarks.h:39
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.