Sayonara Player
Public Types | Public Member Functions | Protected Member Functions | List of all members
Library::ItemModel Class Referenceabstract

The ItemModel is intended to abstract the various views. It supports searching, selections and a library. More...

#include <ItemModel.h>

Inheritance diagram for Library::ItemModel:
SearchableModel< Model > SearchableModelInterface Library::AlbumModel Library::ArtistModel Library::CoverModel Library::TrackModel

Public Types

using ExtraTriggerMap = QMap< QChar, QString >
 

Public Member Functions

 ItemModel (QObject *parent, AbstractLibrary *library)
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 
bool setHeaderData (int section, Qt::Orientation orientation, const QVariant &value, int role=Qt::EditRole) override
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
QModelIndexList searchResults (const QString &substr) override
 
virtual int searchableColumn () const =0
 the index of the searchable column. This is the column where the text is searched for a certain searchstring
 
virtual QString searchableString (int row) const =0
 here, the searchable string can even be refined. Maybe we just want to search within a substring indicated by the row More...
 
virtual Id mapIndexToId (int row) const =0
 return the current id for a given row More...
 
virtual Cover::Location cover (const IndexSet &rows) const =0
 return the cover for multiple rows. if rows.size() > 1, an invalid, default constructed cover location is usually shown More...
 
virtual const MetaDataListselectedMetadata () const =0
 return the tracks which belong to the selections. If an album is selected for example, all tracks of that album should be returned More...
 
Gui::CustomMimeDatacustomMimedata () const
 
void refreshData (int *rowCountBefore=nullptr, int *rowCountAfter=nullptr)
 
virtual ExtraTriggerMap getExtraTriggers ()
 
virtual ::Library::SearchModeMask searchMode () const final
 

Protected Member Functions

AbstractLibrarylibrary ()
 
const AbstractLibrarylibrary () const
 

Detailed Description

The ItemModel is intended to abstract the various views. It supports searching, selections and a library.

Member Function Documentation

◆ cover()

virtual Cover::Location Library::ItemModel::cover ( const IndexSet rows) const
pure virtual

return the cover for multiple rows. if rows.size() > 1, an invalid, default constructed cover location is usually shown

Parameters
rows
Returns

Implemented in Library::TrackModel, Library::ArtistModel, Library::AlbumModel, and Library::CoverModel.

◆ mapIndexToId()

virtual Id Library::ItemModel::mapIndexToId ( int  row) const
pure virtual

return the current id for a given row

Parameters
row
Returns

Implemented in Library::TrackModel, Library::ArtistModel, Library::AlbumModel, and Library::CoverModel.

◆ searchableString()

virtual QString Library::ItemModel::searchableString ( int  row) const
pure virtual

here, the searchable string can even be refined. Maybe we just want to search within a substring indicated by the row

Parameters
row
Returns

Implemented in Library::TrackModel, Library::ArtistModel, Library::AlbumModel, and Library::CoverModel.

◆ selectedMetadata()

virtual const MetaDataList& Library::ItemModel::selectedMetadata ( ) const
pure virtual

return the tracks which belong to the selections. If an album is selected for example, all tracks of that album should be returned

Returns

Implemented in Library::TrackModel, Library::ArtistModel, Library::AlbumModel, and Library::CoverModel.