Sayonara Player
DatabaseArtists.h
1 /* DatabaseArtists.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 DATABASEARTISTS_H
22 #define DATABASEARTISTS_H
23 
24 #include "Database/DatabaseSearchMode.h"
25 #include "Database/DatabaseModule.h"
26 #include "Helper/Library/Sortorder.h"
27 
28 namespace Library {class Filter;}
29 
30 class Artist;
31 class ArtistList;
33  private DatabaseModule,
34  private DatabaseSearchMode
35 {
36 private:
37  QString _artistid_field;
38  QString _create_order_string(Library::SortOrder sort);
39 
40 protected:
41  void change_artistid_field(const QString& field);
42  virtual QString fetch_query_artists(bool also_empty=false) const;
43 
44 public:
45 
46  DatabaseArtists(const QSqlDatabase& db, quint8 db_id);
47 
48  virtual bool db_fetch_artists(SayonaraQuery& q, ArtistList& result);
49 
50  virtual int getArtistID (const QString& artist);
51  virtual bool getArtistByID(int id, Artist& artist, bool also_empty=false);
52 
53  virtual bool getAllArtists(ArtistList& result, bool also_empty);
54  virtual bool getAllArtists(ArtistList& result, Library::SortOrder sortorder = Library::SortOrder::ArtistNameAsc, bool also_empty=false);
55  virtual bool getAllArtistsBySearchString(const Library::Filter& filter, ArtistList& result, Library::SortOrder sortorder = Library::SortOrder::ArtistNameAsc);
56 
57  virtual int insertArtistIntoDatabase(const QString& artist);
58  virtual int insertArtistIntoDatabase(const Artist& artist);
59  virtual int updateArtist(const Artist& artist);
60 
61  virtual void updateArtistCissearch();
62 };
63 
64 #endif // DATABASEARTISTS_H
Definition: DatabaseSearchMode.h:28
Definition: DatabaseArtists.h:32
The Filter class.
Definition: Filter.h:43
Definition: SayonaraQuery.h:30
Definition: DatabaseModule.h:47
ArtistList.
Definition: Artist.h:60
Definition: DatabaseAlbums.h:29
The Artist class.
Definition: Artist.h:33