Sayonara Player
PlaylistDBWrapper.h
1 /* PlaylistDBWrapper.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 PLAYLISTDB_WRAPPER_H
22 #define PLAYLISTDB_WRAPPER_H
23 
24 #include "Utils/Pimpl.h"
25 #include "Utils/Playlist/CustomPlaylistFwd.h"
26 #include "Database/Playlist.h"
27 
28 namespace Playlist
29 {
36  class DBWrapper
37  {
38  PIMPL(DBWrapper)
39 
40  public:
41  DBWrapper();
42  ~DBWrapper();
43 
44  bool getSkeletons(CustomPlaylistSkeletons& skeletons,
45  PlaylistStoreType type,
46  PlaylistSortOrder so=PlaylistSortOrder::IDAsc);
47 
48  bool getAllSkeletons(CustomPlaylistSkeletons& skeletons,
49  PlaylistSortOrder so=PlaylistSortOrder::IDAsc);
50 
51  bool getNonTemporarySkeletons(CustomPlaylistSkeletons& skeletons,
52  PlaylistSortOrder so=PlaylistSortOrder::IDAsc);
53 
54  bool getTemporarySkeletons(CustomPlaylistSkeletons& skeletons,
55  PlaylistSortOrder so);
56 
57  bool getAllPlaylists(CustomPlaylists& playlists,
58  PlaylistSortOrder so=PlaylistSortOrder::IDAsc);
59 
60  bool getTemporaryPlaylists(CustomPlaylists& playlists,
61  PlaylistSortOrder so=PlaylistSortOrder::IDAsc);
62 
63  bool getNonTemporaryPlaylists(CustomPlaylists& playlists,
64  PlaylistSortOrder so=PlaylistSortOrder::IDAsc);
65 
66  CustomPlaylist getPlaylistById(int id);
67  CustomPlaylist getPlaylistByName(const QString& name);
68 
69  bool renamePlaylist(int id, const QString& new_name);
70  bool savePlaylistAs(const MetaDataList& v_md, const QString& name);
71  bool savePlaylistTemporary(const MetaDataList& v_md, const QString& name);
72  bool savePlaylist(const CustomPlaylist& pl);
73  bool savePlaylist(const MetaDataList& v_md, int id, bool is_temporary);
74 
75  bool deletePlaylist(int id);
76  bool deletePlaylist(const QString& name);
77  bool exists(const QString& name);
78 
79  private:
80  void applyTags(MetaDataList& v_md);
81  bool getPlaylists(CustomPlaylists& playlists,
82  PlaylistStoreType type,
83  PlaylistSortOrder sortorder);
84  };
85 
86  using DBWrapperPtr=std::shared_ptr<DBWrapper>;
87 }
88 
89 #endif // PLAYLISTDBCONNECTOR_H
Gui::MimeData::playlists
QStringList playlists(const QMimeData *data)
playlists
MetaDataList
The MetaDataList class.
Definition: MetaDataList.h:37
QList
Definition: EngineUtils.h:33
CustomPlaylist
The CustomPlaylist class.
Definition: CustomPlaylist.h:34
Playlist::DBWrapper
DBWrapper is responsible for fetching playlist data from database, especially the handling between sk...
Definition: PlaylistDBWrapper.h:37