Changeset View
Changeset View
Standalone View
Standalone View
libtaskmanager/taskfilterproxymodel.h
Show All 16 Lines | |||||
17 | You should have received a copy of the GNU Lesser General Public | 17 | You should have received a copy of the GNU Lesser General Public | ||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | 20 | | |||
21 | #ifndef TASKFILTERPROXYMODEL_H | 21 | #ifndef TASKFILTERPROXYMODEL_H | ||
22 | #define TASKFILTERPROXYMODEL_H | 22 | #define TASKFILTERPROXYMODEL_H | ||
23 | 23 | | |||
24 | #include <QSortFilterProxyModel> | 24 | #include <QSortFilterProxyModel> | ||
25 | #include <QRect> | ||||
25 | 26 | | |||
26 | #include "abstracttasksmodeliface.h" | 27 | #include "abstracttasksmodeliface.h" | ||
27 | 28 | | |||
28 | #include "taskmanager_export.h" | 29 | #include "taskmanager_export.h" | ||
29 | 30 | | |||
30 | namespace TaskManager | 31 | namespace TaskManager | ||
31 | { | 32 | { | ||
32 | 33 | | |||
33 | /** | 34 | /** | ||
34 | * @short A proxy tasks model filtering its source model by various properties. | 35 | * @short A proxy tasks model filtering its source model by various properties. | ||
35 | * | 36 | * | ||
36 | * This proxy model class filters its source tasks model by properties such as | 37 | * This proxy model class filters its source tasks model by properties such as | ||
37 | * virtual desktop or minimixed state. The values to filter for or by are set | 38 | * virtual desktop or minimixed state. The values to filter for or by are set | ||
38 | * as properties on the proxy model instance. | 39 | * as properties on the proxy model instance. | ||
39 | * | 40 | * | ||
40 | * @author Eike Hein <hein@kde.org> | 41 | * @author Eike Hein <hein@kde.org> | ||
41 | **/ | 42 | **/ | ||
42 | 43 | | |||
43 | class TASKMANAGER_EXPORT TaskFilterProxyModel : public QSortFilterProxyModel, public AbstractTasksModelIface | 44 | class TASKMANAGER_EXPORT TaskFilterProxyModel : public QSortFilterProxyModel, public AbstractTasksModelIface | ||
44 | { | 45 | { | ||
45 | Q_OBJECT | 46 | Q_OBJECT | ||
46 | 47 | | |||
47 | Q_PROPERTY(int virtualDesktop READ virtualDesktop WRITE setVirtualDesktop NOTIFY virtualDesktopChanged) | 48 | Q_PROPERTY(int virtualDesktop READ virtualDesktop WRITE setVirtualDesktop NOTIFY virtualDesktopChanged) | ||
48 | Q_PROPERTY(int screen READ screen WRITE setScreen NOTIFY screenChanged) | 49 | Q_PROPERTY(QRect screenGeomeyry READ screenGeometry WRITE setScreenGeometry NOTIFY screenGeometryChanged) | ||
49 | Q_PROPERTY(QString activity READ activity WRITE setActivity NOTIFY activityChanged) | 50 | Q_PROPERTY(QString activity READ activity WRITE setActivity NOTIFY activityChanged) | ||
50 | 51 | | |||
51 | Q_PROPERTY(bool filterByVirtualDesktop READ filterByVirtualDesktop WRITE setFilterByVirtualDesktop NOTIFY filterByVirtualDesktopChanged) | 52 | Q_PROPERTY(bool filterByVirtualDesktop READ filterByVirtualDesktop WRITE setFilterByVirtualDesktop NOTIFY filterByVirtualDesktopChanged) | ||
52 | Q_PROPERTY(bool filterByScreen READ filterByScreen WRITE setFilterByScreen NOTIFY filterByScreenChanged) | 53 | Q_PROPERTY(bool filterByScreen READ filterByScreen WRITE setFilterByScreen NOTIFY filterByScreenChanged) | ||
53 | Q_PROPERTY(bool filterByActivity READ filterByActivity WRITE setFilterByActivity NOTIFY filterByActivityChanged) | 54 | Q_PROPERTY(bool filterByActivity READ filterByActivity WRITE setFilterByActivity NOTIFY filterByActivityChanged) | ||
54 | Q_PROPERTY(bool filterNotMinimized READ filterNotMinimized WRITE setFilterNotMinimized NOTIFY filterNotMinimizedChanged) | 55 | Q_PROPERTY(bool filterNotMinimized READ filterNotMinimized WRITE setFilterNotMinimized NOTIFY filterNotMinimizedChanged) | ||
55 | 56 | | |||
56 | public: | 57 | public: | ||
Show All 20 Lines | |||||
77 | * desktop is disabled. | 78 | * desktop is disabled. | ||
78 | * | 79 | * | ||
79 | * @see virtualDesktop | 80 | * @see virtualDesktop | ||
80 | * @param virtualDesktop A virtual desktop number. | 81 | * @param virtualDesktop A virtual desktop number. | ||
81 | **/ | 82 | **/ | ||
82 | void setVirtualDesktop(uint virtualDesktop); | 83 | void setVirtualDesktop(uint virtualDesktop); | ||
83 | 84 | | |||
84 | /** | 85 | /** | ||
85 | * The number of the screen used in filtering by screen. Usually | 86 | * The geometry of the screen used in filtering by screen. Defaults | ||
86 | * set to the number of the current screen. Defaults to @c -1. | 87 | * to a null QRect. | ||
87 | * | 88 | * | ||
88 | * @see setScreen | 89 | * @see setGeometryScreen | ||
89 | * @returns the number of the screen used in filtering. | 90 | * @returns the geometry of the screen used in filtering. | ||
90 | **/ | 91 | **/ | ||
91 | int screen() const; | 92 | QRect screenGeometry() const; | ||
92 | 93 | | |||
93 | /** | 94 | /** | ||
94 | * Set the number of the screen to use in filtering by screen. | 95 | * Set the geometry of the screen to use in filtering by screen. | ||
95 | * | 96 | * | ||
96 | * If set to @c -1, filtering by screen is disabled. | 97 | * If set to an invalid QRect, filtering by screen is disabled. | ||
97 | * | 98 | * | ||
98 | * @see screen | 99 | * @see screenGeometry | ||
99 | * @param screen A screen number. | 100 | * @param geometry A screen geometry. | ||
100 | **/ | 101 | **/ | ||
101 | void setScreen(int screen); | 102 | void setScreenGeometry(const QRect &geometry); | ||
102 | 103 | | |||
103 | /** | 104 | /** | ||
104 | * The id of the activity used in filtering by activity. Usually | 105 | * The id of the activity used in filtering by activity. Usually | ||
105 | * set to the id of the current activity. Defaults to an empty id. | 106 | * set to the id of the current activity. Defaults to an empty id. | ||
106 | * | 107 | * | ||
107 | * @see setActivity | 108 | * @see setActivity | ||
108 | * @returns the id of the activity used in filtering. | 109 | * @returns the id of the activity used in filtering. | ||
109 | **/ | 110 | **/ | ||
▲ Show 20 Lines • Show All 225 Lines • ▼ Show 20 Line(s) | |||||
335 | * regard to extracting information from this, and should take care to | 336 | * regard to extracting information from this, and should take care to | ||
336 | * reject invalid objects. | 337 | * reject invalid objects. | ||
337 | **/ | 338 | **/ | ||
338 | void requestPublishDelegateGeometry(const QModelIndex &index, const QRect &geometry, | 339 | void requestPublishDelegateGeometry(const QModelIndex &index, const QRect &geometry, | ||
339 | QObject *delegate = nullptr); | 340 | QObject *delegate = nullptr); | ||
340 | 341 | | |||
341 | Q_SIGNALS: | 342 | Q_SIGNALS: | ||
342 | void virtualDesktopChanged() const; | 343 | void virtualDesktopChanged() const; | ||
343 | void screenChanged() const; | 344 | void screenGeometryChanged() const; | ||
344 | void activityChanged() const; | 345 | void activityChanged() const; | ||
345 | void filterByVirtualDesktopChanged() const; | 346 | void filterByVirtualDesktopChanged() const; | ||
346 | void filterByScreenChanged() const; | 347 | void filterByScreenChanged() const; | ||
347 | void filterByActivityChanged() const; | 348 | void filterByActivityChanged() const; | ||
348 | void filterNotMinimizedChanged() const; | 349 | void filterNotMinimizedChanged() const; | ||
349 | 350 | | |||
350 | protected: | 351 | protected: | ||
351 | bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; | 352 | bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; | ||
Show All 9 Lines |