Sayonara Player
BookmarksBase.h
1 /* BookmarksBase.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 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 setMetadata(const MetaData& md);
70 
71  const QList<Bookmark> bookmarks() const;
72 
73  void setBookmarks(const QList<Bookmark> bookmarks);
74 
75  int count();
76  void add(const Bookmark& bookmark);
77  void clear();
78 
79  const Bookmark& bookmark(int idx) const;
80  Bookmark& bookmark(int idx);
81 
82  void sort();
83 };
84 
85 #endif // BOOKMARKSBASE_H
BookmarksBase::create
virtual CreationStatus create(Seconds timestamp)
create a new bookmark for current track and current position
BookmarksBase::metadata
MetaData metadata() const
get the current track
QList
Definition: EngineUtils.h:33
BookmarksBase
Definition: BookmarksBase.h:32
Bookmark
Definition: Bookmark.h:32
BookmarksBase::remove
virtual bool remove(int idx)
remove single bookmark from database for current track
MetaData
The MetaData class.
Definition: MetaData.h:47