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