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