Sayonara Player
BookmarksBase.h
1 /* BookmarksBase.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 
22 
23 #ifndef BOOKMARKSBASE_H
24 #define BOOKMARKSBASE_H
25 
26 #include <QObject>
27 #include <QList>
28 #include "Utils/Pimpl.h"
29 #include "Bookmark.h"
30 
31 class MetaData;
33  public QObject
34 {
35  Q_OBJECT
36  PIMPL(BookmarksBase)
37 
38 public:
39  enum class CreationStatus : unsigned char
40  {
41  Success,
42  AlreadyThere,
43  NoDBTrack,
44  DBError,
45  OtherError
46  };
47 
48  explicit BookmarksBase(QObject* parent);
49  virtual ~BookmarksBase();
50 
55  virtual CreationStatus create(Seconds timestamp);
56 
57  virtual bool load();
58 
64  virtual bool remove(int idx);
65 
70  MetaData metadata() const;
71  void set_metadata(const MetaData& md);
72 
73  const QList<Bookmark> bookmarks() const;
74  void set_bookmarks(const QList<Bookmark> bookmarks);
75 
76  int count();
77  void add(const Bookmark& bookmark);
78  void clear();
79 
80  const Bookmark& bookmark(int idx) const;
81  Bookmark& bookmark(int idx);
82 
83  void sort();
84 };
85 
86 #endif // BOOKMARKSBASE_H
Definition: Bookmark.h:31
Definition: BookmarksBase.h:32
MetaData metadata() const
get the current track
The MetaData class.
Definition: MetaData.h:48
virtual CreationStatus create(Seconds timestamp)
create a new bookmark for current track and current position
Definition: org_mpris_media_player2_adaptor.h:20