File indexing completed on 2024-05-05 05:38:34
0001 /* 0002 SPDX-FileCopyrightText: 2016 Eike Hein <hein@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #pragma once 0008 0009 #include <QObject> 0010 0011 #include <memory> 0012 0013 #include "taskmanager_export.h" 0014 0015 namespace TaskManager 0016 { 0017 /** 0018 * @short Provides basic activity information. 0019 * 0020 * This class provides basic information about the activities defined in 0021 * the system. 0022 * 0023 * @NOTE: This is a placeholder, to be moved into KActivities (which it 0024 * wraps) or the Task Manager applet backend. 0025 * 0026 * @see KActivities 0027 * 0028 * @author Eike Hein <hein@kde.org> 0029 **/ 0030 0031 class TASKMANAGER_EXPORT ActivityInfo : public QObject 0032 { 0033 Q_OBJECT 0034 0035 Q_PROPERTY(QString currentActivity READ currentActivity NOTIFY currentActivityChanged) 0036 Q_PROPERTY(int numberOfRunningActivities READ numberOfRunningActivities NOTIFY numberOfRunningActivitiesChanged) 0037 0038 public: 0039 explicit ActivityInfo(QObject *parent = nullptr); 0040 ~ActivityInfo() override; 0041 0042 /** 0043 * The currently active virtual desktop. 0044 * 0045 * @returns the number of the currently active virtual desktop. 0046 **/ 0047 QString currentActivity() const; 0048 0049 /** 0050 * The number of currently-running activities defined in the session. 0051 * 0052 * @returns the number of activities defined in the session. 0053 **/ 0054 int numberOfRunningActivities() const; 0055 0056 /** 0057 * The list of currently-running activities defined in the session. 0058 * 0059 * @returns the list of currently-running activities defined in the session. 0060 **/ 0061 Q_INVOKABLE QStringList runningActivities() const; 0062 0063 /** 0064 * The name of the activity of the given id. 0065 * 0066 * @param id An activity id string. 0067 * @returns the name of the activity of the given id. 0068 **/ 0069 Q_INVOKABLE QString activityName(const QString &id); 0070 0071 /** 0072 * The icon of the activity of the given id. 0073 * 0074 * @param id An activity id string. 0075 * @returns the name or file path of the activity of the given id. 0076 **/ 0077 Q_INVOKABLE QString activityIcon(const QString &id); 0078 0079 Q_SIGNALS: 0080 void currentActivityChanged() const; 0081 void numberOfRunningActivitiesChanged() const; 0082 0083 /** 0084 * The names of the running activities have changed. 0085 * @since 5.40.0 0086 **/ 0087 void namesOfRunningActivitiesChanged() const; 0088 0089 private: 0090 class Private; 0091 std::unique_ptr<Private> d; 0092 }; 0093 0094 }