Changeset View
Changeset View
Standalone View
Standalone View
wallpapers/image/slidefiltermodel.h
Show All 16 Lines | |||||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | #ifndef SLIDEFILTERMODEL_H | 19 | #ifndef SLIDEFILTERMODEL_H | ||
20 | #define SLIDEFILTERMODEL_H | 20 | #define SLIDEFILTERMODEL_H | ||
21 | 21 | | |||
22 | #include <image.h> | 22 | #include <image.h> | ||
23 | 23 | | |||
24 | #include <QSortFilterProxyModel> | 24 | #include <QSortFilterProxyModel> | ||
25 | 25 | #include <QVector> | |||
26 | 26 | | |||
27 | class SlideFilterModel : public QSortFilterProxyModel { | 27 | class SlideFilterModel : public QSortFilterProxyModel { | ||
28 | 28 | | |||
29 | Q_OBJECT | 29 | Q_OBJECT | ||
30 | 30 | | |||
31 | Q_PROPERTY(bool usedInConfig MEMBER m_usedInConfig NOTIFY usedInConfigChanged); | 31 | Q_PROPERTY(bool usedInConfig MEMBER m_usedInConfig NOTIFY usedInConfigChanged); | ||
32 | 32 | | |||
33 | public: | 33 | public: | ||
34 | SlideFilterModel(QObject* parent); | 34 | SlideFilterModel(QObject* parent); | ||
35 | bool lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const override; | 35 | bool lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const override; | ||
36 | bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override; | 36 | bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override; | ||
37 | void setSourceModel(QAbstractItemModel *sourceModel) override; | ||||
37 | void setSortingMode(Image::SlideshowMode mode); | 38 | void setSortingMode(Image::SlideshowMode mode); | ||
39 | void invalidate(); | ||||
38 | void invalidateFilter(); | 40 | void invalidateFilter(); | ||
39 | 41 | | |||
40 | Q_INVOKABLE int indexOf(const QString& path); | 42 | Q_INVOKABLE int indexOf(const QString& path); | ||
41 | Q_INVOKABLE void openContainingFolder(int rowIndex); | 43 | Q_INVOKABLE void openContainingFolder(int rowIndex); | ||
42 | 44 | | |||
43 | Q_SIGNALS: | 45 | Q_SIGNALS: | ||
44 | void usedInConfigChanged(); | 46 | void usedInConfigChanged(); | ||
45 | 47 | | |||
46 | private: | 48 | private: | ||
49 | void buildRandomOrder(); | ||||
50 | | ||||
51 | QVector<int> m_randomOrder; | ||||
47 | Image::SlideshowMode m_SortingMode; | 52 | Image::SlideshowMode m_SortingMode; | ||
48 | bool m_usedInConfig; | 53 | bool m_usedInConfig; | ||
49 | }; | 54 | }; | ||
50 | #endif | 55 | #endif |