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 "Utils/Library/Sortorder.h"
27 
28 namespace Library {class Filter;}
29 class Album;
30 class AlbumList;
31 
32 namespace DB
33 {
34  class Albums :
35  private SearchMode
36  {
37  PIMPL(Albums)
38 
39  private:
40  virtual QString fetch_query_albums(bool also_empty=false) const;
41 
42  protected:
43  void change_artistid_field(const QString& id, const QString& name);
44  void change_track_lookup_field(const QString& track_lookup_field);
45 
46  public:
47 
48  Albums(QSqlDatabase db, DbId db_id, LibraryId library_id);
49  virtual ~Albums();
50 
51  virtual bool db_fetch_albums(Query& q, AlbumList& result);
52 
53  virtual AlbumId getAlbumID (const QString& album);
54 
55  virtual bool getAlbumByID(AlbumId id, Album& album, bool also_empty=false);
56 
57  virtual bool getAllAlbums(AlbumList& result, bool also_empty);
58  virtual bool getAllAlbums(AlbumList& result, ::Library::SortOrder sortorder=::Library::SortOrder::AlbumNameAsc, bool also_empty=false);
59 
60 
61  virtual bool getAllAlbumsByArtist(ArtistId artist, AlbumList& result);
62  virtual bool getAllAlbumsByArtist(ArtistId artist, AlbumList& result, const ::Library::Filter& filter, ::Library::SortOrder sortorder = ::Library::SortOrder::AlbumNameAsc);
63  virtual bool getAllAlbumsByArtist(IdList artists, AlbumList& result);
64  virtual bool getAllAlbumsByArtist(IdList artists, AlbumList& result, const ::Library::Filter& filter, ::Library::SortOrder sortorder = ::Library::SortOrder::AlbumNameAsc);
65 
66  virtual bool getAllAlbumsBySearchString(const ::Library::Filter& filter, AlbumList& result, ::Library::SortOrder sortorder = ::Library::SortOrder::AlbumNameAsc);
67 
68  virtual int insertAlbumIntoDatabase (const QString & album);
69  virtual int insertAlbumIntoDatabase (const Album& album);
70 
71  virtual int updateAlbum(const Album& album);
72 
73  virtual void updateAlbumCissearch();
74 
75  };
76 }
77 
78 #endif // DATABASEALBUMS_H
Definition: SayonaraQuery.h:36
Definition: DatabaseSearchMode.h:32
The AlbumList class.
Definition: Album.h:85
Definition: AbstractDatabase.h:29
The Album class.
Definition: Album.h:38
Definition: DatabaseAlbums.h:34
An interface class needed when implementing a library plugin.
Definition: LibraryManager.h:36