Sayonara Player
PlaylistDBInterface.h
1 /* PlaylistDBInterface.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 PLAYLISTDBINTERFACE_H
22 #define PLAYLISTDBINTERFACE_H
23 
24 #include <QObject>
25 
26 class MetaDataList;
27 class PlaylistDBWrapper;
28 
34  public QObject
35 {
36  Q_OBJECT
37 
38 private:
39 
40  PlaylistDBWrapper* _playlist_db_connector=nullptr;
41  QString _name;
42  bool _is_temporary;
43  int _id;
44 
45 public:
46 
47  enum class SaveAsAnswer : quint8
48  {
49  Success=0,
50  AlreadyThere,
51  ExternTracksError,
52  Error
53  };
54 
55  explicit PlaylistDBInterface(const QString& name);
56  virtual ~PlaylistDBInterface();
57 
58  int get_id() const;
59  void set_id(int db_id);
60 
61  QString get_name() const;
62  void set_name(const QString& name);
63 
64  bool is_temporary() const;
65  void set_temporary(bool b);
66 
67  bool insert_temporary_into_db();
68  SaveAsAnswer save();
69  SaveAsAnswer save_as(const QString& str, bool force_override);
70  SaveAsAnswer rename(const QString& str);
71  bool delete_playlist();
72  bool remove_from_db();
73 
74 
75  virtual const MetaDataList& get_playlist() const = 0;
76  virtual int get_count() const = 0;
77  virtual bool is_empty() const = 0;
78  virtual void set_changed(bool b) = 0;
79  virtual bool was_changed() const = 0;
80  virtual bool is_storable() const =0;
81 
82  static QString request_new_db_name();
83 };
84 
85 #endif // PLAYLISTDBINTERFACE_H
Definition: MetaDataList.h:39
PlaylistDBWrapper is responsible for fetching playlist data from database, especially the handling be...
Definition: PlaylistDBWrapper.h:36
The PlaylistDBInterface class.
Definition: PlaylistDBInterface.h:33