Changeset View
Changeset View
Standalone View
Standalone View
wallpapers/image/slidefiltermodel.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2019 David Redondo <kde@david-redondo.de> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or modify | ||||
5 | * it under the terms of the GNU General Public License as published by | ||||
6 | * the Free Software Foundation; either version 2 of the License, or | ||||
7 | * (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | * GNU General Public License for more details. | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU General Public License | ||||
15 | * along with this program; if not, write to the Free Software | ||||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | ||||
17 | */ | ||||
18 | | ||||
19 | #ifndef SLIDEFILTERMODEL_H | ||||
20 | #define SLIDEFILTERMODEL_H | ||||
21 | | ||||
22 | #include <image.h> | ||||
23 | | ||||
24 | #include <QSortFilterProxyModel> | ||||
25 | | ||||
26 | | ||||
27 | class SlideFilterModel : public QSortFilterProxyModel { | ||||
28 | | ||||
29 | Q_OBJECT | ||||
30 | | ||||
31 | Q_PROPERTY(bool usedInConfig MEMBER m_usedInConfig NOTIFY usedInConfigChanged); | ||||
32 | | ||||
33 | public: | ||||
34 | SlideFilterModel(QObject* parent); | ||||
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; | ||||
37 | void setSortingMode(Image::SlideshowMode mode); | ||||
38 | void invalidateFilter(); | ||||
39 | | ||||
40 | Q_INVOKABLE int indexOf(const QString& path); | ||||
41 | Q_INVOKABLE void openContainingFolder(int rowIndex); | ||||
42 | | ||||
43 | Q_SIGNALS: | ||||
44 | void usedInConfigChanged(); | ||||
45 | | ||||
46 | private: | ||||
47 | Image::SlideshowMode m_SortingMode; | ||||
48 | bool m_usedInConfig; | ||||
49 | }; | ||||
50 | #endif |