Sayonara Player
LibraryItemModel.h
1 /* LibraryItemModel.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 LIBRARYITEMMODEL_H_
22 #define LIBRARYITEMMODEL_H_
23 
24 #include "GUI/Helper/SearchableWidget/AbstractSearchModel.h"
25 
26 #include "Helper/SetFwd.h"
27 #include "Helper/Pimpl.h"
28 
29 class CoverLocation;
30 class CustomMimeData;
31 class MetaDataList;
32 
35 {
36  Q_OBJECT
37  PIMPL(LibraryItemModel)
38 
39 public:
40 
42  virtual ~LibraryItemModel();
43 
45  QVariant headerData ( int section, Qt::Orientation orientation, int role=Qt::DisplayRole ) const override;
46  bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) override;
47 
48  int rowCount(const QModelIndex &parent=QModelIndex()) const override;
49  int columnCount(const QModelIndex& parent=QModelIndex()) const override;
50  bool insertColumns(int position, int cols, const QModelIndex &index=QModelIndex()) override;
51  bool removeColumns(int position, int cols, const QModelIndex &index=QModelIndex()) override;
52  bool removeRows(int position, int rows, const QModelIndex& index=QModelIndex()) override;
53  bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex()) override;
54 
55  virtual QModelIndex getFirstRowIndexOf(const QString& substr) override;
56  virtual QModelIndex getNextRowIndexOf(const QString& substr, int row, const QModelIndex& parent=QModelIndex()) override;
57  virtual QModelIndex getPrevRowIndexOf(const QString& substr, int row, const QModelIndex& parent=QModelIndex()) override;
58 
59  virtual void add_selections(const SP::Set<int>& rows) final;
60  virtual bool is_selected(int id) const final;
61  virtual bool has_selections() const final;
62  virtual void clear_selections() final;
63 
64  virtual int get_searchable_column() const=0;
65  virtual QString get_string(int row) const=0;
66  virtual int get_id_by_row(int row)=0;
67  virtual CoverLocation get_cover(const SP::Set<int>& indexes) const=0;
68 
69 
70  virtual QMap<QChar, QString> getExtraTriggers() override;
71 
72  void set_mimedata(const MetaDataList& v_md);
73 
74  CustomMimeData* get_mimedata() const;
75 };
76 
77 #endif /* LIBRARYITEMMODEL_H_ */
Definition: AbstractSearchModel.h:55
Definition: MetaDataList.h:39
Mimedata class for drag and dropping metadata.
Definition: CustomMimeData.h:33
The CoverLocation class.
Definition: CoverLocation.h:37
Definition: LibraryItemModel.h:33
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
A set structure. Inherited from std::set with some useful methods. For integer and String this set is...
Definition: AbstractPlaylist.h:37
Definition: org_mpris_media_player2_adaptor.h:21