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 #include "Utils/Pimpl.h"
26 
27 class MetaDataList;
28 
29 namespace Playlist
30 {
35  class DBInterface :
36  public QObject
37  {
38  Q_OBJECT
39  PIMPL(DBInterface)
40 
41  public:
42  enum class SaveAsAnswer : uint8_t
43  {
44  Success=0,
45  AlreadyThere,
46  ExternTracksError,
47  Error
48  };
49 
50  explicit DBInterface(const QString& name);
51  virtual ~DBInterface();
52 
53  int get_id() const;
54  void set_id(int db_id);
55 
56  QString get_name() const;
57  void set_name(const QString& name);
58 
59  bool is_temporary() const;
60  void set_temporary(bool b);
61 
62  bool insert_temporary_into_db();
63  SaveAsAnswer save();
64  SaveAsAnswer save_as(const QString& str, bool force_override);
65  SaveAsAnswer rename(const QString& str);
66  bool delete_playlist();
67  bool remove_from_db();
68 
69  virtual const MetaDataList& playlist() const = 0;
70  virtual int count() const = 0;
71  virtual bool is_empty() const = 0;
72  virtual void set_changed(bool b) = 0;
73  virtual bool was_changed() const = 0;
74  virtual bool is_storable() const =0;
75 
76  static QString request_new_db_name();
77  };
78 }
79 
80 #endif // PLAYLISTDBINTERFACE_H
The MetaDataList class.
Definition: MetaDataList.h:38
Definition: AbstractPlaylist.h:44
The PlaylistDBInterface class.
Definition: PlaylistDBInterface.h:35