Changeset View
Changeset View
Standalone View
Standalone View
applets/systemtray/sortedsystemtraymodel.h
Show All 20 Lines | |||||
21 | #define SORTEDSYSTEMTRAYMODEL_H | 21 | #define SORTEDSYSTEMTRAYMODEL_H | ||
22 | 22 | | |||
23 | #include <QSortFilterProxyModel> | 23 | #include <QSortFilterProxyModel> | ||
24 | 24 | | |||
25 | class SortedSystemTrayModel : public QSortFilterProxyModel { | 25 | class SortedSystemTrayModel : public QSortFilterProxyModel { | ||
26 | Q_OBJECT | 26 | Q_OBJECT | ||
27 | public: | 27 | public: | ||
28 | enum class SortingType { | 28 | enum class SortingType { | ||
29 | ConfigurationPage | 29 | ConfigurationPage, | ||
30 | SystemTray | ||||
30 | }; | 31 | }; | ||
31 | 32 | | |||
32 | explicit SortedSystemTrayModel(SortingType sorting, QObject *parent = nullptr); | 33 | explicit SortedSystemTrayModel(SortingType sorting, QObject *parent = nullptr); | ||
33 | 34 | | |||
34 | protected: | 35 | protected: | ||
35 | bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override; | 36 | bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override; | ||
36 | 37 | | |||
37 | private: | 38 | private: | ||
38 | bool lessThanConfigurationPage(const QModelIndex &left, const QModelIndex &right) const; | 39 | bool lessThanConfigurationPage(const QModelIndex &left, const QModelIndex &right) const; | ||
40 | bool lessThanSystemTray(const QModelIndex &left, const QModelIndex &right) const; | ||||
39 | 41 | | |||
40 | int compareCategoriesAlphabetically(const QModelIndex &left, const QModelIndex &right) const; | 42 | int compareCategoriesAlphabetically(const QModelIndex &left, const QModelIndex &right) const; | ||
43 | int compareCategoriesOrderly(const QModelIndex &left, const QModelIndex &right) const; | ||||
41 | 44 | | |||
42 | SortingType m_sorting; | 45 | SortingType m_sorting; | ||
43 | }; | 46 | }; | ||
44 | 47 | | |||
45 | #endif // SORTEDSYSTEMTRAYMODEL_H | 48 | #endif // SORTEDSYSTEMTRAYMODEL_H |