Sayonara Player
DatabaseAlbums.h
1 /* DatabaseAlbums.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 DATABASEALBUMS_H
24 #define DATABASEALBUMS_H
25 
26 #include "Database/DatabaseModule.h"
27 #include "Components/Library/Sorting.h"
28 #include "Helper/globals.h"
29 #include "Helper/Filter.h"
30 #include "Helper/LibrarySearchMode.h"
31 
32 class Album;
33 class AlbumList;
35 {
36 
37 private:
38  QString _fetch_query;
39 
40  QString _create_order_string(SortOrder order);
41 
42 protected:
43  void set_album_fetch_query(const QString& query);
44 
45 public:
46  DatabaseAlbums(QSqlDatabase db, quint8 db_id);
47 
48  virtual bool db_fetch_albums(SayonaraQuery& q, AlbumList& result);
49 
50  virtual int getAlbumID (const QString& album);
51  virtual int getMaxAlbumID();
52 
53  virtual bool getAlbumByID(const int& id, Album& album);
54 
55  virtual bool getAllAlbums(AlbumList& result, SortOrder sortorder=SortOrder::AlbumNameAsc, bool also_empty=false);
56 
57  virtual bool getAllAlbumsByArtist(int artist, AlbumList& result, Filter filter=Filter(), SortOrder sortorder = SortOrder::AlbumNameAsc);
58  virtual bool getAllAlbumsByArtist(IDList artists, AlbumList& result, Filter filter=Filter(), SortOrder sortorder = SortOrder::AlbumNameAsc);
59 
60  virtual bool getAllAlbumsBySearchString(Filter filter, AlbumList& result, SortOrder sortorder = SortOrder::AlbumNameAsc);
61 
62  virtual int insertAlbumIntoDatabase (const QString & album);
63  virtual int insertAlbumIntoDatabase (const Album& album);
64 
65  virtual int updateAlbum(const Album& album);
66 
67  virtual void updateAlbumCissearch(LibraryHelper::SearchModeMask mode);
68 
69 };
70 
71 #endif // DATABASEALBUMS_H
Definition: DatabaseAlbums.h:34
Definition: Filter.h:31
Definition: SayonaraQuery.h:32
Definition: DatabaseModule.h:54
The AlbumList class.
Definition: Album.h:72
The Album class.
Definition: Album.h:40