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 "Utils/Library/Sortorder.h"
27 
28 namespace Library {class Filter;}
29 
30 class Artist;
31 class ArtistList;
32 
33 namespace DB
34 {
35  class Artists :
36  private SearchMode
37  {
38  PIMPL(Artists)
39 
40  private:
41  QString _create_order_string(::Library::SortOrder sort);
42 
43  protected:
44  void change_artistid_field(const QString& id, const QString& name);
45  void change_track_lookup_field(const QString& track_lookup_field);
46 
47  virtual QString fetch_query_artists(bool also_empty=false) const;
48 
49  public:
50 
51  Artists(const QSqlDatabase& db, DbId db_id, LibraryId library_id);
52  ~Artists();
53 
54  virtual bool db_fetch_artists(Query& q, ArtistList& result);
55 
56  virtual int getArtistID (const QString& artist);
57  virtual bool getArtistByID(int id, Artist& artist, bool also_empty=false);
58 
59  virtual bool getAllArtists(ArtistList& result, bool also_empty);
60  virtual bool getAllArtists(ArtistList& result, ::Library::SortOrder sortorder = ::Library::SortOrder::ArtistNameAsc, bool also_empty=false);
61  virtual bool getAllArtistsBySearchString(const ::Library::Filter& filter, ArtistList& result, ::Library::SortOrder sortorder = ::Library::SortOrder::ArtistNameAsc);
62 
63  virtual int insertArtistIntoDatabase(const QString& artist);
64  virtual int insertArtistIntoDatabase(const Artist& artist);
65  virtual int updateArtist(const Artist& artist);
66 
67  virtual void updateArtistCissearch();
68  };
69 }
70 
71 #endif // DATABASEARTISTS_H
Definition: SayonaraQuery.h:36
Definition: DatabaseSearchMode.h:32
Definition: DatabaseArtists.h:35
Definition: AbstractDatabase.h:29
ArtistList.
Definition: Artist.h:69
An interface class needed when implementing a library plugin.
Definition: LibraryManager.h:36
The Artist class.
Definition: Artist.h:35