Changeset View
Changeset View
Standalone View
Standalone View
libtaskmanager/tasksmodel.h
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | 57 | { | |||
---|---|---|---|---|---|
76 | Q_PROPERTY(bool filterByActivity READ filterByActivity WRITE setFilterByActivity NOTIFY filterByActivityChanged) | 76 | Q_PROPERTY(bool filterByActivity READ filterByActivity WRITE setFilterByActivity NOTIFY filterByActivityChanged) | ||
77 | Q_PROPERTY(bool filterNotMinimized READ filterNotMinimized WRITE setFilterNotMinimized NOTIFY filterNotMinimizedChanged) | 77 | Q_PROPERTY(bool filterNotMinimized READ filterNotMinimized WRITE setFilterNotMinimized NOTIFY filterNotMinimizedChanged) | ||
78 | 78 | | |||
79 | Q_PROPERTY(SortMode sortMode READ sortMode WRITE setSortMode NOTIFY sortModeChanged) | 79 | Q_PROPERTY(SortMode sortMode READ sortMode WRITE setSortMode NOTIFY sortModeChanged) | ||
80 | Q_PROPERTY(bool separateLaunchers READ separateLaunchers WRITE setSeparateLaunchers NOTIFY separateLaunchersChanged) | 80 | Q_PROPERTY(bool separateLaunchers READ separateLaunchers WRITE setSeparateLaunchers NOTIFY separateLaunchersChanged) | ||
81 | Q_PROPERTY(bool launchInPlace READ launchInPlace WRITE setLaunchInPlace NOTIFY launchInPlaceChanged) | 81 | Q_PROPERTY(bool launchInPlace READ launchInPlace WRITE setLaunchInPlace NOTIFY launchInPlaceChanged) | ||
82 | 82 | | |||
83 | Q_PROPERTY(GroupMode groupMode READ groupMode WRITE setGroupMode NOTIFY groupModeChanged) | 83 | Q_PROPERTY(GroupMode groupMode READ groupMode WRITE setGroupMode NOTIFY groupModeChanged) | ||
84 | Q_PROPERTY(bool groupInline READ groupInline WRITE setGroupInline NOTIFY groupInlineChanged) | ||||
84 | Q_PROPERTY(int groupingWindowTasksThreshold READ groupingWindowTasksThreshold | 85 | Q_PROPERTY(int groupingWindowTasksThreshold READ groupingWindowTasksThreshold | ||
85 | WRITE setGroupingWindowTasksThreshold NOTIFY groupingWindowTasksThresholdChanged) | 86 | WRITE setGroupingWindowTasksThreshold NOTIFY groupingWindowTasksThresholdChanged) | ||
86 | Q_PROPERTY(QStringList groupingAppIdBlacklist READ groupingAppIdBlacklist | 87 | Q_PROPERTY(QStringList groupingAppIdBlacklist READ groupingAppIdBlacklist | ||
87 | WRITE setGroupingAppIdBlacklist NOTIFY groupingAppIdBlacklistChanged) | 88 | WRITE setGroupingAppIdBlacklist NOTIFY groupingAppIdBlacklistChanged) | ||
88 | Q_PROPERTY(QStringList groupingLauncherUrlBlacklist READ groupingLauncherUrlBlacklist | 89 | Q_PROPERTY(QStringList groupingLauncherUrlBlacklist READ groupingLauncherUrlBlacklist | ||
89 | WRITE setGroupingLauncherUrlBlacklist NOTIFY groupingLauncherUrlBlacklistChanged) | 90 | WRITE setGroupingLauncherUrlBlacklist NOTIFY groupingLauncherUrlBlacklistChanged) | ||
90 | 91 | | |||
91 | public: | 92 | public: | ||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Line(s) | |||||
182 | * @param screen A screen number. | 183 | * @param screen A screen number. | ||
183 | **/ | 184 | **/ | ||
184 | void setScreen(int screen); | 185 | void setScreen(int screen); | ||
185 | 186 | | |||
186 | /** | 187 | /** | ||
187 | * The id of the activity used in filtering by activity. Usually | 188 | * The id of the activity used in filtering by activity. Usually | ||
188 | * set to the id of the current activity. Defaults to an empty id. | 189 | * set to the id of the current activity. Defaults to an empty id. | ||
189 | * | 190 | * | ||
190 | * FIXME: Implement. | | |||
191 | * | | |||
192 | * @see setActivity | 191 | * @see setActivity | ||
193 | * @returns the id of the activity used in filtering. | 192 | * @returns the id of the activity used in filtering. | ||
194 | **/ | 193 | **/ | ||
195 | QString activity() const; | 194 | QString activity() const; | ||
196 | 195 | | |||
197 | /** | 196 | /** | ||
198 | * Set the id of the activity to use in filtering by activity. | 197 | * Set the id of the activity to use in filtering by activity. | ||
199 | * | 198 | * | ||
200 | * FIXME: Implement. | | |||
201 | * | | |||
202 | * @see activity | 199 | * @see activity | ||
203 | * @param activity An activity id. | 200 | * @param activity An activity id. | ||
204 | **/ | 201 | **/ | ||
205 | void setActivity(const QString &activity); | 202 | void setActivity(const QString &activity); | ||
206 | 203 | | |||
207 | /** | 204 | /** | ||
208 | * Whether tasks should be filtered by virtual desktop. Defaults to | 205 | * Whether tasks should be filtered by virtual desktop. Defaults to | ||
209 | * @c false. | 206 | * @c false. | ||
▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Line(s) | |||||
356 | * entirely, breaking apart any existing groups. | 353 | * entirely, breaking apart any existing groups. | ||
357 | * | 354 | * | ||
358 | * @see groupMode | 355 | * @see groupMode | ||
359 | * @param mode A group mode. | 356 | * @param mode A group mode. | ||
360 | **/ | 357 | **/ | ||
361 | void setGroupMode(TasksModel::GroupMode mode); | 358 | void setGroupMode(TasksModel::GroupMode mode); | ||
362 | 359 | | |||
363 | /** | 360 | /** | ||
361 | * Returns whether grouping is done "inline" or not, i.e. whether groups | ||||
362 | * are maintained inside the flat, top-level list, or by forming a tree. | ||||
363 | * In inline grouping mode, move() on a group member will move all siblings | ||||
364 | * as well, and sorting is first done among groups, then group members. | ||||
365 | * | ||||
366 | * Further, in inline grouping mode, the groupingWindowTasksThreshold | ||||
367 | * setting is ignored: Grouping is always done. | ||||
368 | * | ||||
369 | * @see setGroupInline | ||||
370 | * @see move | ||||
371 | * @see groupingWindowTasksThreshold | ||||
372 | * @returns whether grouping is done inline or not. | ||||
373 | **/ | ||||
374 | bool groupInline() const; | ||||
375 | | ||||
376 | /** | ||||
377 | * Sets whether grouping is done "inline" or not, i.e. whether groups | ||||
378 | * are maintained inside the flat, top-level list, or by forming a tree. | ||||
379 | * In inline grouping mode, move() on a group member will move all siblings | ||||
380 | * as well, and sorting is first done among groups, then group members. | ||||
381 | * | ||||
382 | * @see groupInline | ||||
383 | * @see move | ||||
384 | * @see groupingWindowTasksThreshold | ||||
385 | * @param inline Whether to do grouping inline or not. | ||||
386 | **/ | ||||
387 | void setGroupInline(bool groupInline); | ||||
388 | | ||||
389 | /** | ||||
364 | * As window tasks (AbstractTasksModel::IsWindow) come and go, groups will | 390 | * As window tasks (AbstractTasksModel::IsWindow) come and go, groups will | ||
365 | * be formed when this threshold value is exceeded, and broken apart when | 391 | * be formed when this threshold value is exceeded, and broken apart when | ||
366 | * it matches or falls below. | 392 | * it matches or falls below. | ||
367 | * | 393 | * | ||
368 | * Defaults to @c -1, which means grouping is done regardless of the number | 394 | * Defaults to @c -1, which means grouping is done regardless of the number | ||
369 | * of window tasks. | 395 | * of window tasks. | ||
370 | * | 396 | * | ||
397 | * When the groupInline property is set to @c true, the threshold is ignored: | ||||
398 | * Grouping is always done. | ||||
399 | * | ||||
371 | * @see setGroupingWindowTasksThreshold | 400 | * @see setGroupingWindowTasksThreshold | ||
401 | * @see groupInline | ||||
372 | * @return the threshold number of window tasks used in grouping decisions. | 402 | * @return the threshold number of window tasks used in grouping decisions. | ||
373 | **/ | 403 | **/ | ||
374 | int groupingWindowTasksThreshold() const; | 404 | int groupingWindowTasksThreshold() const; | ||
375 | 405 | | |||
376 | /** | 406 | /** | ||
377 | * Sets the number of window tasks (AbstractTasksModel::IsWindow) above which | 407 | * Sets the number of window tasks (AbstractTasksModel::IsWindow) above which | ||
378 | * groups will be formed, and at or below which groups will be broken apart. | 408 | * groups will be formed, and at or below which groups will be broken apart. | ||
379 | * | 409 | * | ||
380 | * If set to -1, grouping will be done regardless of the number of window tasks | 410 | * If set to -1, grouping will be done regardless of the number of window tasks | ||
381 | * in the source model. | 411 | * in the source model. | ||
382 | * | 412 | * | ||
413 | * When the groupInline property is set to @c true, the threshold is ignored: | ||||
414 | * Grouping is always done. | ||||
415 | * | ||||
383 | * @see groupingWindowTasksThreshold | 416 | * @see groupingWindowTasksThreshold | ||
417 | * @see groupInline | ||||
384 | * @param threshold A threshold number of window tasks used in grouping | 418 | * @param threshold A threshold number of window tasks used in grouping | ||
385 | * decisions. | 419 | * decisions. | ||
386 | **/ | 420 | **/ | ||
387 | void setGroupingWindowTasksThreshold(int threshold); | 421 | void setGroupingWindowTasksThreshold(int threshold); | ||
388 | 422 | | |||
389 | /** | 423 | /** | ||
390 | * A blacklist of app ids (AbstractTasksModel::AppId) that is consulted before | 424 | * A blacklist of app ids (AbstractTasksModel::AppId) that is consulted before | ||
391 | * grouping a task. If a task's app id is found on the blacklist, it is not | 425 | * grouping a task. If a task's app id is found on the blacklist, it is not | ||
▲ Show 20 Lines • Show All 228 Lines • ▼ Show 20 Line(s) | |||||
620 | * | 654 | * | ||
621 | * @param index An index in this tasks model. | 655 | * @param index An index in this tasks model. | ||
622 | **/ | 656 | **/ | ||
623 | Q_INVOKABLE void requestToggleGrouping(const QModelIndex &index); | 657 | Q_INVOKABLE void requestToggleGrouping(const QModelIndex &index); | ||
624 | 658 | | |||
625 | /** | 659 | /** | ||
626 | * Moves a (top-level) task to a new position in the list. The insert | 660 | * Moves a (top-level) task to a new position in the list. The insert | ||
627 | * position is bounded to the list start and end. | 661 | * position is bounded to the list start and end. | ||
662 | * | ||||
628 | * syncLaunchers() should be called after a set of move operations to | 663 | * syncLaunchers() should be called after a set of move operations to | ||
629 | * update the launcher list to reflect the new order. | 664 | * update the launcherList property to reflect the new order. | ||
665 | * | ||||
666 | * When the groupInline property is set to @c true, a move request | ||||
667 | * for a group member will bring all siblings along. | ||||
630 | * | 668 | * | ||
631 | * @see syncLaunchers | 669 | * @see syncLaunchers | ||
632 | * @see launcherList | 670 | * @see launcherList | ||
671 | * @see setGroupInline | ||||
633 | * @param index An index in this tasks model. | 672 | * @param index An index in this tasks model. | ||
634 | * @param newPos The new list position to move the task to. | 673 | * @param newPos The new list position to move the task to. | ||
635 | */ | 674 | */ | ||
636 | Q_INVOKABLE bool move(int row, int newPos); | 675 | Q_INVOKABLE bool move(int row, int newPos); | ||
637 | 676 | | |||
638 | /** | 677 | /** | ||
639 | * Updates the launcher list to reflect the new order after calls to | 678 | * Updates the launcher list to reflect the new order after calls to | ||
640 | * move(), if needed. | 679 | * move(), if needed. | ||
Show All 36 Lines | 708 | Q_SIGNALS: | |||
677 | void filterByVirtualDesktopChanged() const; | 716 | void filterByVirtualDesktopChanged() const; | ||
678 | void filterByScreenChanged() const; | 717 | void filterByScreenChanged() const; | ||
679 | void filterByActivityChanged() const; | 718 | void filterByActivityChanged() const; | ||
680 | void filterNotMinimizedChanged() const; | 719 | void filterNotMinimizedChanged() const; | ||
681 | void sortModeChanged() const; | 720 | void sortModeChanged() const; | ||
682 | void separateLaunchersChanged() const; | 721 | void separateLaunchersChanged() const; | ||
683 | void launchInPlaceChanged() const; | 722 | void launchInPlaceChanged() const; | ||
684 | void groupModeChanged() const; | 723 | void groupModeChanged() const; | ||
724 | void groupInlineChanged() const; | ||||
685 | void groupingWindowTasksThresholdChanged() const; | 725 | void groupingWindowTasksThresholdChanged() const; | ||
686 | void groupingAppIdBlacklistChanged() const; | 726 | void groupingAppIdBlacklistChanged() const; | ||
687 | void groupingLauncherUrlBlacklistChanged() const; | 727 | void groupingLauncherUrlBlacklistChanged() const; | ||
688 | 728 | | |||
689 | protected: | 729 | protected: | ||
690 | bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; | 730 | bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; | ||
691 | bool lessThan(const QModelIndex &left, const QModelIndex &right) const; | 731 | bool lessThan(const QModelIndex &left, const QModelIndex &right) const; | ||
692 | 732 | | |||
Show All 12 Lines |