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