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 class Album;
31 class AlbumList;
33 {
34 
35 private:
36  QString _fetch_query;
37 
38  QString _create_order_string(SortOrder order);
39 
40 protected:
41  void set_album_fetch_query(const QString& query);
42 
43 public:
44  DatabaseAlbums(QSqlDatabase db, quint8 db_id);
45 
46  virtual bool db_fetch_albums(SayonaraQuery& q, AlbumList& result);
47 
48  virtual int getAlbumID (const QString& album);
49  virtual int getMaxAlbumID();
50 
51  virtual bool getAlbumByID(const int& id, Album& album);
52 
53  virtual bool getAllAlbums(AlbumList& result, SortOrder sortorder=SortOrder::AlbumNameAsc, bool also_empty=false);
54 
55  virtual bool getAllAlbumsByArtist(int artist, AlbumList& result, Filter filter=Filter(), SortOrder sortorder = SortOrder::AlbumNameAsc);
56  virtual bool getAllAlbumsByArtist(IDList artists, AlbumList& result, Filter filter=Filter(), SortOrder sortorder = SortOrder::AlbumNameAsc);
57 
58  virtual bool getAllAlbumsBySearchString(Filter filter, AlbumList& result, SortOrder sortorder = SortOrder::AlbumNameAsc);
59 
60  virtual int insertAlbumIntoDatabase (const QString & album);
61  virtual int insertAlbumIntoDatabase (const Album& album);
62 
63  virtual int updateAlbum(const Album& album);
64 
65 };
66 
67 #endif // DATABASEALBUMS_H
Definition: DatabaseAlbums.h:32
Definition: Filter.h:31
Definition: SayonaraQuery.h:32
Definition: DatabaseModule.h:54
The AlbumList class.
Definition: Album.h:73
The Album class.
Definition: Album.h:41