Sayonara Player
AlbumModel.h
1 /* AlbumModel.h */
2 
3 /* Copyright (C) 2011-2019 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 
22 /*
23  * AlbumModel.h
24  *
25  * Created on: Apr 26, 2011
26  * Author: Lucio Carreras
27  */
28 
29 #ifndef LIBRARYITEMMODELALBUMS_H_
30 #define LIBRARYITEMMODELALBUMS_H_
31 
32 #include "Gui/Library/ItemModel.h"
33 #include "Utils/Pimpl.h"
34 
35 namespace Library
36 {
41  class AlbumModel :
42  public ItemModel
43  {
44  Q_OBJECT
45  PIMPL(AlbumModel)
46 
47  public:
48  AlbumModel(QObject* parent, AbstractLibrary* library);
49  ~AlbumModel() override;
50 
51  Qt::ItemFlags flags(const QModelIndex &index) const override;
52  QVariant data(const QModelIndex& index, int role) const override;
53  bool setData(const QModelIndex& index, const QVariant& value, int role=Qt::DisplayRole) override;
54  int rowCount(const QModelIndex &parent) const override;
55 
56  Cover::Location cover(const IndexSet& indexes) const override;
57  int searchable_column() const override;
58  Id id_by_index(int index) const override;
59  QString searchable_string(int row) const override;
60 
61 
62  const Util::Set<Id>& selections() const override;
63 
64  protected:
65  const MetaDataList& mimedata_tracks() const override;
66 
67  private slots:
68  void rating_operation_finished();
69  };
70 }
71 
72 #endif /* LIBRARYITEMMODELALBUMS_H_ */
Cover::Location cover(const IndexSet &indexes) const override
return the cover for multiple rows. if rows.size() > 1, an invalid, default constructed cover locatio...
Definition: AbstractLibrary.h:41
int searchable_column() const override
the index of the searchable column. This is the column where the text is searched for a certain searc...
The MetaDataList class.
Definition: MetaDataList.h:37
The CoverLocation class.
Definition: CoverLocation.h:42
The AlbumModel class.
Definition: AlbumModel.h:41
const Util::Set< Id > & selections() const override
returns a set of the selected ids
A set structure. Inherited from std::set with some useful methods. For integer and String this set is...
Definition: Set.h:35
const MetaDataList & mimedata_tracks() const override
return the tracks which belong to the selections. If an album is selected for example, all tracks of that album should be returned
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:32
QString searchable_string(int row) const override
here, the searchable string can even be refined. Maybe we just want to search within a substring indi...
The ItemModel is intended to abstract the various views. It supports searching, selections and a libr...
Definition: ItemModel.h:46
Id id_by_index(int index) const override
return the current id for a given row