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