Warning, file /frameworks/kactivities/src/lib/controller.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2010-2016 Ivan Cukic <ivan.cukic(at)kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #ifndef ACTIVITIES_CONTROLLER_H 0008 #define ACTIVITIES_CONTROLLER_H 0009 0010 #include <QFuture> 0011 #include <QObject> 0012 #include <QString> 0013 0014 #include "consumer.h" 0015 0016 #include "kactivities_export.h" 0017 0018 namespace KActivities 0019 { 0020 class ControllerPrivate; 0021 0022 /** 0023 * This class provides methods for controlling and managing 0024 * the activities. 0025 * 0026 * @note The QFuture objects returned by these methods are not thread-based, 0027 * you can not call synchronous methods like waitForFinished, cancel, pause on 0028 * them. You need either to register watchers to check when those have finished, 0029 * or to check whether they are ready from time to time manually. 0030 * 0031 * @see Consumer for info about activities 0032 * 0033 * @since 5.0 0034 */ 0035 class KACTIVITIES_EXPORT Controller : public Consumer 0036 { 0037 Q_OBJECT 0038 0039 Q_PROPERTY(QString currentActivity READ currentActivity WRITE setCurrentActivity) 0040 0041 public: 0042 explicit Controller(QObject *parent = nullptr); 0043 0044 ~Controller() override; 0045 0046 /** 0047 * Sets the name of the specified activity 0048 * @param id id of the activity 0049 * @param name name to be set 0050 */ 0051 QFuture<void> setActivityName(const QString &id, const QString &name); 0052 0053 /** 0054 * Sets the description of the specified activity 0055 * @param id id of the activity 0056 * @param description description to be set 0057 */ 0058 QFuture<void> setActivityDescription(const QString &id, const QString &description); 0059 0060 /** 0061 * Sets the icon of the specified activity 0062 * @param id id of the activity 0063 * @param icon icon to be set - freedesktop.org name or file path 0064 */ 0065 QFuture<void> setActivityIcon(const QString &id, const QString &icon); 0066 0067 /** 0068 * Sets the current activity 0069 * @param id id of the activity to make current 0070 * @returns true if successful 0071 */ 0072 QFuture<bool> setCurrentActivity(const QString &id); 0073 0074 /** 0075 * Adds a new activity 0076 * @param name name of the activity 0077 * @returns id of the newly created activity 0078 */ 0079 QFuture<QString> addActivity(const QString &name); 0080 0081 /** 0082 * Removes the specified activity 0083 * @param id id of the activity to delete 0084 */ 0085 QFuture<void> removeActivity(const QString &id); 0086 0087 /** 0088 * Stops the activity 0089 * @param id id of the activity to stop 0090 */ 0091 QFuture<void> stopActivity(const QString &id); 0092 0093 /** 0094 * Starts the activity 0095 * @param id id of the activity to start 0096 */ 0097 QFuture<void> startActivity(const QString &id); 0098 0099 /** 0100 * Switches to the previous activity 0101 */ 0102 QFuture<void> previousActivity(); 0103 0104 /** 0105 * Switches to the next activity 0106 */ 0107 QFuture<void> nextActivity(); 0108 0109 private: 0110 // const QScopedPointer<ControllerPrivate> d; 0111 }; 0112 0113 } // namespace KActivities 0114 0115 #endif // ACTIVITIES_CONTROLLER_H