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