Changeset View
Changeset View
Standalone View
Standalone View
libtaskmanager/tasksmodel.h
Show First 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 101 | enum GroupMode { | |||
---|---|---|---|---|---|
103 | GroupApplications /**< Tasks are grouped by the application backing them. */ | 103 | GroupApplications /**< Tasks are grouped by the application backing them. */ | ||
104 | }; | 104 | }; | ||
105 | 105 | | |||
106 | explicit TasksModel(QObject *parent = 0); | 106 | explicit TasksModel(QObject *parent = 0); | ||
107 | virtual ~TasksModel(); | 107 | virtual ~TasksModel(); | ||
108 | 108 | | |||
109 | QHash<int, QByteArray> roleNames() const override; | 109 | QHash<int, QByteArray> roleNames() const override; | ||
110 | 110 | | |||
111 | Q_INVOKABLE int rowCount(const QModelIndex &parent = QModelIndex()) const; // Invokable. | 111 | Q_INVOKABLE int rowCount(const QModelIndex &parent = QModelIndex()) const override; // Invokable. | ||
112 | 112 | | |||
113 | /** | 113 | /** | ||
114 | * The number of launcher tasks in the tast list. | 114 | * The number of launcher tasks in the tast list. | ||
115 | * | 115 | * | ||
116 | * @returns the number of launcher tasks in the task list. | 116 | * @returns the number of launcher tasks in the task list. | ||
117 | **/ | 117 | **/ | ||
118 | int launcherCount() const; | 118 | int launcherCount() const; | ||
119 | 119 | | |||
▲ Show 20 Lines • Show All 388 Lines • ▼ Show 20 Line(s) | |||||
508 | 508 | | |||
509 | /** | 509 | /** | ||
510 | * Request activation of the task at the given index. Derived classes are | 510 | * Request activation of the task at the given index. Derived classes are | ||
511 | * free to interpret the meaning of "activate" themselves depending on | 511 | * free to interpret the meaning of "activate" themselves depending on | ||
512 | * the nature and state of the task, e.g. launch or raise a window task. | 512 | * the nature and state of the task, e.g. launch or raise a window task. | ||
513 | * | 513 | * | ||
514 | * @param index An index in this tasks model. | 514 | * @param index An index in this tasks model. | ||
515 | **/ | 515 | **/ | ||
516 | Q_INVOKABLE void requestActivate(const QModelIndex &index); | 516 | Q_INVOKABLE void requestActivate(const QModelIndex &index) override; | ||
517 | 517 | | |||
518 | /** | 518 | /** | ||
519 | * Request an additional instance of the application backing the task | 519 | * Request an additional instance of the application backing the task | ||
520 | * at the given index. | 520 | * at the given index. | ||
521 | * | 521 | * | ||
522 | * @param index An index in this tasks model. | 522 | * @param index An index in this tasks model. | ||
523 | **/ | 523 | **/ | ||
524 | Q_INVOKABLE void requestNewInstance(const QModelIndex &index); | 524 | Q_INVOKABLE void requestNewInstance(const QModelIndex &index) override; | ||
525 | 525 | | |||
526 | /** | 526 | /** | ||
527 | * Request the task at the given index be closed. | 527 | * Request the task at the given index be closed. | ||
528 | * | 528 | * | ||
529 | * @param index An index in this tasks model. | 529 | * @param index An index in this tasks model. | ||
530 | **/ | 530 | **/ | ||
531 | Q_INVOKABLE void requestClose(const QModelIndex &index); | 531 | Q_INVOKABLE void requestClose(const QModelIndex &index) override; | ||
532 | 532 | | |||
533 | /** | 533 | /** | ||
534 | * Request starting an interactive move for the task at the given index. | 534 | * Request starting an interactive move for the task at the given index. | ||
535 | * | 535 | * | ||
536 | * This is meant for tasks that have an associated window, and may be | 536 | * This is meant for tasks that have an associated window, and may be | ||
537 | * a no-op when there is no window. | 537 | * a no-op when there is no window. | ||
538 | * | 538 | * | ||
539 | * @param index An index in this tasks model. | 539 | * @param index An index in this tasks model. | ||
540 | **/ | 540 | **/ | ||
541 | Q_INVOKABLE void requestMove(const QModelIndex &index); | 541 | Q_INVOKABLE void requestMove(const QModelIndex &index) override; | ||
542 | 542 | | |||
543 | /** | 543 | /** | ||
544 | * Request starting an interactive resize for the task at the given index. | 544 | * Request starting an interactive resize for the task at the given index. | ||
545 | * | 545 | * | ||
546 | * This is meant for tasks that have an associated window, and may be a | 546 | * This is meant for tasks that have an associated window, and may be a | ||
547 | * no-op when there is no window. | 547 | * no-op when there is no window. | ||
548 | * | 548 | * | ||
549 | * @param index An index in this tasks model. | 549 | * @param index An index in this tasks model. | ||
550 | **/ | 550 | **/ | ||
551 | Q_INVOKABLE void requestResize(const QModelIndex &index); | 551 | Q_INVOKABLE void requestResize(const QModelIndex &index) override; | ||
552 | 552 | | |||
553 | /** | 553 | /** | ||
554 | * Request toggling the minimized state of the task at the given index. | 554 | * Request toggling the minimized state of the task at the given index. | ||
555 | * | 555 | * | ||
556 | * This is meant for tasks that have an associated window, and may be | 556 | * This is meant for tasks that have an associated window, and may be | ||
557 | * a no-op when there is no window. | 557 | * a no-op when there is no window. | ||
558 | * | 558 | * | ||
559 | * @param index An index in this tasks model. | 559 | * @param index An index in this tasks model. | ||
560 | **/ | 560 | **/ | ||
561 | Q_INVOKABLE void requestToggleMinimized(const QModelIndex &index); | 561 | Q_INVOKABLE void requestToggleMinimized(const QModelIndex &index) override; | ||
562 | 562 | | |||
563 | /** | 563 | /** | ||
564 | * Request toggling the maximized state of the task at the given index. | 564 | * Request toggling the maximized state of the task at the given index. | ||
565 | * | 565 | * | ||
566 | * This is meant for tasks that have an associated window, and may be | 566 | * This is meant for tasks that have an associated window, and may be | ||
567 | * a no-op when there is no window. | 567 | * a no-op when there is no window. | ||
568 | * | 568 | * | ||
569 | * @param index An index in this tasks model. | 569 | * @param index An index in this tasks model. | ||
570 | **/ | 570 | **/ | ||
571 | Q_INVOKABLE void requestToggleMaximized(const QModelIndex &index); | 571 | Q_INVOKABLE void requestToggleMaximized(const QModelIndex &index) override; | ||
572 | 572 | | |||
573 | /** | 573 | /** | ||
574 | * Request toggling the keep-above state of the task at the given index. | 574 | * Request toggling the keep-above state of the task at the given index. | ||
575 | * | 575 | * | ||
576 | * This is meant for tasks that have an associated window, and may be | 576 | * This is meant for tasks that have an associated window, and may be | ||
577 | * a no-op when there is no window. | 577 | * a no-op when there is no window. | ||
578 | * | 578 | * | ||
579 | * @param index An index in this tasks model. | 579 | * @param index An index in this tasks model. | ||
580 | **/ | 580 | **/ | ||
581 | Q_INVOKABLE void requestToggleKeepAbove(const QModelIndex &index); | 581 | Q_INVOKABLE void requestToggleKeepAbove(const QModelIndex &index) override; | ||
582 | 582 | | |||
583 | /** | 583 | /** | ||
584 | * Request toggling the keep-below state of the task at the given index. | 584 | * Request toggling the keep-below state of the task at the given index. | ||
585 | * | 585 | * | ||
586 | * This is meant for tasks that have an associated window, and may be | 586 | * This is meant for tasks that have an associated window, and may be | ||
587 | * a no-op when there is no window. | 587 | * a no-op when there is no window. | ||
588 | * | 588 | * | ||
589 | * @param index An index in this tasks model. | 589 | * @param index An index in this tasks model. | ||
590 | **/ | 590 | **/ | ||
591 | Q_INVOKABLE void requestToggleKeepBelow(const QModelIndex &index); | 591 | Q_INVOKABLE void requestToggleKeepBelow(const QModelIndex &index) override; | ||
592 | 592 | | |||
593 | /** | 593 | /** | ||
594 | * Request toggling the fullscreen state of the task at the given index. | 594 | * Request toggling the fullscreen state of the task at the given index. | ||
595 | * | 595 | * | ||
596 | * This is meant for tasks that have an associated window, and may be | 596 | * This is meant for tasks that have an associated window, and may be | ||
597 | * a no-op when there is no window. | 597 | * a no-op when there is no window. | ||
598 | * | 598 | * | ||
599 | * @param index An index in this tasks model. | 599 | * @param index An index in this tasks model. | ||
600 | **/ | 600 | **/ | ||
601 | Q_INVOKABLE void requestToggleFullScreen(const QModelIndex &index); | 601 | Q_INVOKABLE void requestToggleFullScreen(const QModelIndex &index) override; | ||
602 | 602 | | |||
603 | /** | 603 | /** | ||
604 | * Request toggling the shaded state of the task at the given index. | 604 | * Request toggling the shaded state of the task at the given index. | ||
605 | * | 605 | * | ||
606 | * This is meant for tasks that have an associated window, and may be | 606 | * This is meant for tasks that have an associated window, and may be | ||
607 | * a no-op when there is no window. | 607 | * a no-op when there is no window. | ||
608 | * | 608 | * | ||
609 | * @param index An index in this tasks model. | 609 | * @param index An index in this tasks model. | ||
610 | **/ | 610 | **/ | ||
611 | Q_INVOKABLE void requestToggleShaded(const QModelIndex &index); | 611 | Q_INVOKABLE void requestToggleShaded(const QModelIndex &index) override; | ||
612 | 612 | | |||
613 | /** | 613 | /** | ||
614 | * Request moving the task at the given index to the specified virtual | 614 | * Request moving the task at the given index to the specified virtual | ||
615 | * desktop. | 615 | * desktop. | ||
616 | * | 616 | * | ||
617 | * This is meant for tasks that have an associated window, and may be | 617 | * This is meant for tasks that have an associated window, and may be | ||
618 | * a no-op when there is no window. | 618 | * a no-op when there is no window. | ||
619 | * | 619 | * | ||
620 | * @param index An index in this tasks model. | 620 | * @param index An index in this tasks model. | ||
621 | * @param desktop A virtual desktop number. | 621 | * @param desktop A virtual desktop number. | ||
622 | **/ | 622 | **/ | ||
623 | Q_INVOKABLE void requestVirtualDesktop(const QModelIndex &index, qint32 desktop); | 623 | Q_INVOKABLE void requestVirtualDesktop(const QModelIndex &index, qint32 desktop) override; | ||
624 | 624 | | |||
625 | /** | 625 | /** | ||
626 | * Request informing the window manager of new geometry for a visual | 626 | * Request informing the window manager of new geometry for a visual | ||
627 | * delegate for the task at the given index. The geometry should be in | 627 | * delegate for the task at the given index. The geometry should be in | ||
628 | * screen coordinates. | 628 | * screen coordinates. | ||
629 | * | 629 | * | ||
630 | * If the task at the given index is a group parent, the geometry is | 630 | * If the task at the given index is a group parent, the geometry is | ||
631 | * set for all of its children. If the task at the given index is a | 631 | * set for all of its children. If the task at the given index is a | ||
632 | * group member, the geometry is set for all of its siblings. | 632 | * group member, the geometry is set for all of its siblings. | ||
633 | * | 633 | * | ||
634 | * @param index An index in this tasks model. | 634 | * @param index An index in this tasks model. | ||
635 | * @param geometry Visual delegate geometry in screen coordinates. | 635 | * @param geometry Visual delegate geometry in screen coordinates. | ||
636 | * @param delegate The delegate. Implementations are on their own with | 636 | * @param delegate The delegate. Implementations are on their own with | ||
637 | * regard to extracting information from this, and should take care to | 637 | * regard to extracting information from this, and should take care to | ||
638 | * reject invalid objects. | 638 | * reject invalid objects. | ||
639 | **/ | 639 | **/ | ||
640 | Q_INVOKABLE void requestPublishDelegateGeometry(const QModelIndex &index, const QRect &geometry, | 640 | Q_INVOKABLE void requestPublishDelegateGeometry(const QModelIndex &index, const QRect &geometry, | ||
641 | QObject *delegate = nullptr); | 641 | QObject *delegate = nullptr) override; | ||
642 | 642 | | |||
643 | /** | 643 | /** | ||
644 | * Request toggling whether the task at the given index, along with any | 644 | * Request toggling whether the task at the given index, along with any | ||
645 | * tasks matching its kind, should be grouped or not. Task groups will be | 645 | * tasks matching its kind, should be grouped or not. Task groups will be | ||
646 | * formed or broken apart as needed, along with affecting future grouping | 646 | * formed or broken apart as needed, along with affecting future grouping | ||
647 | * decisions as new tasks appear. | 647 | * decisions as new tasks appear. | ||
648 | * | 648 | * | ||
649 | * As grouping is toggled for a task, updates are made to the | 649 | * As grouping is toggled for a task, updates are made to the | ||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Line(s) | 708 | Q_SIGNALS: | |||
722 | void launchInPlaceChanged() const; | 722 | void launchInPlaceChanged() const; | ||
723 | void groupModeChanged() const; | 723 | void groupModeChanged() const; | ||
724 | void groupInlineChanged() const; | 724 | void groupInlineChanged() const; | ||
725 | void groupingWindowTasksThresholdChanged() const; | 725 | void groupingWindowTasksThresholdChanged() const; | ||
726 | void groupingAppIdBlacklistChanged() const; | 726 | void groupingAppIdBlacklistChanged() const; | ||
727 | void groupingLauncherUrlBlacklistChanged() const; | 727 | void groupingLauncherUrlBlacklistChanged() const; | ||
728 | 728 | | |||
729 | protected: | 729 | protected: | ||
730 | bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; | 730 | bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; | ||
731 | bool lessThan(const QModelIndex &left, const QModelIndex &right) const; | 731 | bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; | ||
732 | 732 | | |||
733 | private: | 733 | private: | ||
734 | Q_INVOKABLE void updateLauncherCount(); | 734 | Q_INVOKABLE void updateLauncherCount(); | ||
735 | 735 | | |||
736 | class Private; | 736 | class Private; | ||
737 | class TasksModelLessThan; | 737 | class TasksModelLessThan; | ||
738 | friend class TasksModelLessThan; | 738 | friend class TasksModelLessThan; | ||
739 | QScopedPointer<Private> d; | 739 | QScopedPointer<Private> d; | ||
740 | }; | 740 | }; | ||
741 | 741 | | |||
742 | } | 742 | } | ||
743 | 743 | | |||
744 | #endif | 744 | #endif |