Changeset View
Changeset View
Standalone View
Standalone View
libtaskmanager/activityinfo.h
- This file was added.
1 | /******************************************************************** | ||||
---|---|---|---|---|---|
2 | Copyright 2016 Eike Hein <hein.org> | ||||
3 | | ||||
4 | This library is free software; you can redistribute it and/or | ||||
5 | modify it under the terms of the GNU Lesser General Public | ||||
6 | License as published by the Free Software Foundation; either | ||||
7 | version 2.1 of the License, or (at your option) version 3, or any | ||||
8 | later version accepted by the membership of KDE e.V. (or its | ||||
9 | successor approved by the membership of KDE e.V.), which shall | ||||
10 | act as a proxy defined in Section 6 of version 3 of the license. | ||||
11 | | ||||
12 | This library is distributed in the hope that it will be useful, | ||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
15 | Lesser General Public License for more details. | ||||
16 | | ||||
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/>. | ||||
19 | *********************************************************************/ | ||||
20 | | ||||
21 | #ifndef ACTIVITYINFO_H | ||||
22 | #define ACTIVITYINFO_H | ||||
23 | | ||||
24 | #include <QObject> | ||||
25 | | ||||
26 | #include "taskmanager_export.h" | ||||
27 | | ||||
28 | namespace TaskManager | ||||
29 | { | ||||
30 | | ||||
31 | /** | ||||
32 | * @short Provides basic activity information. | ||||
33 | * | ||||
34 | * This class provides basic information about the activities defined in | ||||
35 | * the system. | ||||
36 | * | ||||
37 | * @NOTE: This is a placeholder, to be moved into KActivities (which it | ||||
38 | * wraps) or the Task Manager applet backend. | ||||
39 | * | ||||
40 | * @see KActivities | ||||
41 | * | ||||
42 | * @author Eike Hein <hein@kde.org> | ||||
43 | **/ | ||||
44 | | ||||
45 | class TASKMANAGER_EXPORT ActivityInfo : public QObject | ||||
46 | { | ||||
47 | Q_OBJECT | ||||
48 | | ||||
49 | Q_PROPERTY(QString currentActivity READ currentActivity NOTIFY currentActivityChanged) | ||||
50 | Q_PROPERTY(int numberOfRunningActivities READ numberOfRunningActivities NOTIFY numberOfRunningActivitiesChanged) | ||||
51 | | ||||
52 | public: | ||||
53 | explicit ActivityInfo(QObject *parent = 0); | ||||
54 | virtual ~ActivityInfo(); | ||||
55 | | ||||
56 | /** | ||||
57 | * The currently active virtual desktop. | ||||
58 | * | ||||
59 | * @returns the number of the currently active virtual desktop. | ||||
60 | **/ | ||||
61 | QString currentActivity() const; | ||||
62 | | ||||
63 | /** | ||||
64 | * The number of currently-running activities defined in the session. | ||||
65 | * | ||||
66 | * @returns the number of activities defined in the session. | ||||
67 | **/ | ||||
68 | int numberOfRunningActivities() const; | ||||
69 | | ||||
70 | /** | ||||
71 | * The list of currently-running activities defined in the session. | ||||
72 | * | ||||
73 | * @returns the list of currently-running activities defined in the session. | ||||
74 | **/ | ||||
75 | QStringList runningActivities() const; | ||||
76 | | ||||
77 | /** | ||||
78 | * The name of the activity of the given id. | ||||
79 | * | ||||
80 | * @param id An activity id string. | ||||
81 | * @returns the name of the activity of the given id. | ||||
82 | **/ | ||||
83 | Q_INVOKABLE QString activityName(const QString &id); | ||||
84 | | ||||
85 | Q_SIGNALS: | ||||
86 | void currentActivityChanged() const; | ||||
87 | void numberOfRunningActivitiesChanged() const; | ||||
88 | | ||||
89 | private: | ||||
90 | class Private; | ||||
91 | QScopedPointer<Private> d; | ||||
92 | | ||||
93 | Q_PRIVATE_SLOT(d, void refreshActivityInfos()) | ||||
94 | }; | ||||
95 | | ||||
96 | } | ||||
97 | | ||||
98 | #endif |