Changeset View
Changeset View
Standalone View
Standalone View
scripting/scripting_model.h
Show First 20 Lines • Show All 118 Lines • ▼ Show 20 Line(s) | |||||
119 | * | 119 | * | ||
120 | * To build up the tree the static factory method @ref create has to be used. It will recursively | 120 | * To build up the tree the static factory method @ref create has to be used. It will recursively | ||
121 | * build up the tree. After the tree has been build up use @ref init to initialize the tree which | 121 | * build up the tree. After the tree has been build up use @ref init to initialize the tree which | ||
122 | * will add the Clients to the ClientLevel. | 122 | * will add the Clients to the ClientLevel. | ||
123 | * | 123 | * | ||
124 | * Each element of the tree has a unique id which can be used by the QAbstractItemModel as the | 124 | * Each element of the tree has a unique id which can be used by the QAbstractItemModel as the | ||
125 | * internal id for its QModelIndex. Note: the ids have no ordering, if trying to get a specific element | 125 | * internal id for its QModelIndex. Note: the ids have no ordering, if trying to get a specific element | ||
126 | * the tree performs a depth-first search. | 126 | * the tree performs a depth-first search. | ||
127 | * | 127 | **/ | ||
128 | */ | | |||
129 | class AbstractLevel : public QObject | 128 | class AbstractLevel : public QObject | ||
130 | { | 129 | { | ||
131 | Q_OBJECT | 130 | Q_OBJECT | ||
132 | public: | 131 | public: | ||
133 | virtual ~AbstractLevel(); | 132 | virtual ~AbstractLevel(); | ||
134 | virtual int count() const = 0; | 133 | virtual int count() const = 0; | ||
135 | virtual void init() = 0; | 134 | virtual void init() = 0; | ||
136 | virtual quint32 idForRow(int row) const = 0; | 135 | virtual quint32 idForRow(int row) const = 0; | ||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | |||||
205 | * @brief The actual leafs of the model's tree containing the Client's in this branch of the tree. | 204 | * @brief The actual leafs of the model's tree containing the Client's in this branch of the tree. | ||
206 | * | 205 | * | ||
207 | * This class groups all the Clients of one branch of the tree and takes care of updating the tree | 206 | * This class groups all the Clients of one branch of the tree and takes care of updating the tree | ||
208 | * when a Client changes its state in a way that it should be excluded/included or gets added or | 207 | * when a Client changes its state in a way that it should be excluded/included or gets added or | ||
209 | * removed. | 208 | * removed. | ||
210 | * | 209 | * | ||
211 | * The Clients in this group are not sorted in any particular way. It's a simple list which only | 210 | * The Clients in this group are not sorted in any particular way. It's a simple list which only | ||
212 | * gets added to. If some sorting should be applied, use a QSortFilterProxyModel. | 211 | * gets added to. If some sorting should be applied, use a QSortFilterProxyModel. | ||
213 | */ | 212 | **/ | ||
214 | class ClientLevel : public AbstractLevel | 213 | class ClientLevel : public AbstractLevel | ||
215 | { | 214 | { | ||
216 | Q_OBJECT | 215 | Q_OBJECT | ||
217 | public: | 216 | public: | ||
218 | explicit ClientLevel(ClientModel *model, AbstractLevel *parent); | 217 | explicit ClientLevel(ClientModel *model, AbstractLevel *parent); | ||
219 | virtual ~ClientLevel(); | 218 | virtual ~ClientLevel(); | ||
220 | 219 | | |||
221 | void init(); | 220 | void init(); | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 263 | { | |||
265 | Q_OBJECT | 264 | Q_OBJECT | ||
266 | public: | 265 | public: | ||
267 | ClientModelByScreenAndDesktop(QObject *parent = nullptr); | 266 | ClientModelByScreenAndDesktop(QObject *parent = nullptr); | ||
268 | virtual ~ClientModelByScreenAndDesktop(); | 267 | virtual ~ClientModelByScreenAndDesktop(); | ||
269 | }; | 268 | }; | ||
270 | 269 | | |||
271 | /** | 270 | /** | ||
272 | * @brief Custom QSortFilterProxyModel to filter on Client caption, role and class. | 271 | * @brief Custom QSortFilterProxyModel to filter on Client caption, role and class. | ||
273 | * | 272 | **/ | ||
274 | */ | | |||
275 | class ClientFilterModel : public QSortFilterProxyModel | 273 | class ClientFilterModel : public QSortFilterProxyModel | ||
276 | { | 274 | { | ||
277 | Q_OBJECT | 275 | Q_OBJECT | ||
278 | Q_PROPERTY(KWin::ScriptingClientModel::ClientModel *clientModel READ clientModel WRITE setClientModel NOTIFY clientModelChanged) | 276 | Q_PROPERTY(KWin::ScriptingClientModel::ClientModel *clientModel READ clientModel WRITE setClientModel NOTIFY clientModelChanged) | ||
279 | Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged) | 277 | Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged) | ||
280 | public: | 278 | public: | ||
281 | ClientFilterModel(QObject *parent = nullptr); | 279 | ClientFilterModel(QObject *parent = nullptr); | ||
282 | virtual ~ClientFilterModel(); | 280 | virtual ~ClientFilterModel(); | ||
▲ Show 20 Lines • Show All 98 Lines • Show Last 20 Lines |