Changeset View
Changeset View
Standalone View
Standalone View
src/browsers/CollectionSortFilterProxyModel.h
Show All 30 Lines | 29 | /** | |||
---|---|---|---|---|---|
31 | our meta objects. | 31 | our meta objects. | ||
32 | e.g. it sorts tracks by disc number and track number. | 32 | e.g. it sorts tracks by disc number and track number. | ||
33 | 33 | | |||
34 | @author Nikolaj Hald Nielsen <nhn@kde.org> | 34 | @author Nikolaj Hald Nielsen <nhn@kde.org> | ||
35 | */ | 35 | */ | ||
36 | class CollectionSortFilterProxyModel : public QSortFilterProxyModel | 36 | class CollectionSortFilterProxyModel : public QSortFilterProxyModel | ||
37 | { | 37 | { | ||
38 | public: | 38 | public: | ||
39 | explicit CollectionSortFilterProxyModel( QObject * parent = 0 ); | 39 | explicit CollectionSortFilterProxyModel( QObject *parent = nullptr ); | ||
40 | 40 | | |||
41 | virtual ~CollectionSortFilterProxyModel(); | 41 | virtual ~CollectionSortFilterProxyModel(); | ||
42 | 42 | | |||
43 | bool hasChildren(const QModelIndex &parent) const; | 43 | virtual bool hasChildren(const QModelIndex &parent) const override; | ||
44 | 44 | | |||
45 | protected: | 45 | protected: | ||
46 | virtual bool lessThan( const QModelIndex &left, const QModelIndex &right ) const; | 46 | virtual bool lessThan( const QModelIndex &left, const QModelIndex &right ) const override; | ||
47 | virtual bool filterAcceptsRow( int source_row, const QModelIndex & source_parent ) const override; | ||||
47 | 48 | | |||
48 | private: | 49 | private: | ||
49 | QCollator *m_col; | 50 | QCollator *m_col; | ||
50 | /** Tries to compute a year for the album using the track years. */ | | |||
51 | int albumYear( Meta::AlbumPtr album ) const; | | |||
52 | 51 | | |||
53 | CollectionTreeItem* treeItem( const QModelIndex &index ) const; | 52 | CollectionTreeItem* treeItem( const QModelIndex &index ) const; | ||
54 | bool lessThanTrack( const QModelIndex &left, const QModelIndex &right ) const; | 53 | bool lessThanTrack( const QModelIndex &left, const QModelIndex &right ) const; | ||
55 | bool lessThanAlbum( const QModelIndex &left, const QModelIndex &right ) const; | 54 | bool lessThanAlbum( const QModelIndex &left, const QModelIndex &right ) const; | ||
56 | bool lessThanItem( const QModelIndex &left, const QModelIndex &right ) const; | 55 | bool lessThanItem( const QModelIndex &left, const QModelIndex &right ) const; | ||
57 | }; | 56 | }; | ||
58 | 57 | | |||
59 | #endif | 58 | #endif |