diff options
| author | Daniel Teichmann <daniel.teichmann@das-netzwerkteam.de> | 2021-08-01 02:01:35 +0200 |
|---|---|---|
| committer | Daniel Teichmann <daniel.teichmann@das-netzwerkteam.de> | 2021-08-01 02:06:10 +0200 |
| commit | 0a48722a1ddeccfc89f1812c44b7582358671697 (patch) | |
| tree | a1479d3ccfc97880ec50cac35c4c4879c16a3f94 /src/scenes/remote_control/remote_control_manager.h | |
| parent | efa44c931674e498c39fc59091cf1f8654ac97a5 (diff) | |
| download | RWA.Support.DesktopApp-0a48722a1ddeccfc89f1812c44b7582358671697.tar.gz RWA.Support.DesktopApp-0a48722a1ddeccfc89f1812c44b7582358671697.tar.bz2 RWA.Support.DesktopApp-0a48722a1ddeccfc89f1812c44b7582358671697.zip | |
Introducing remote_control_manager.(h, cpp)
The remote_control_manager class takes care of the GUI and the creation, deletion and maintaining of session objects.
Diffstat (limited to 'src/scenes/remote_control/remote_control_manager.h')
| -rw-r--r-- | src/scenes/remote_control/remote_control_manager.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/scenes/remote_control/remote_control_manager.h b/src/scenes/remote_control/remote_control_manager.h new file mode 100644 index 0000000..6f2fbdb --- /dev/null +++ b/src/scenes/remote_control/remote_control_manager.h @@ -0,0 +1,78 @@ +#ifndef REMOTECONTROLMANAGER_H +#define REMOTECONTROLMANAGER_H + +#include <QObject> + +#include "../../main_qmladaptor.h" +#include "../../DBusAPI.h" +#include "../../session.h" + +class RemoteControlManager : public QObject { + + Q_OBJECT + // this makes url available as a QML property + Q_PROPERTY(QString url READ getURL NOTIFY urlChanged) + // this makes pin available as a QML property + Q_PROPERTY(QString pin READ getPin NOTIFY pinChanged) + // this makes session_id available as a QML property + Q_PROPERTY(QString session_id READ getSessionID NOTIFY sessionIDChanged) + +public: + explicit RemoteControlManager(QQmlApplicationEngine *engine = nullptr, + MainQMLAdaptor *main_gui = nullptr, + DBusAPI *dbus_api = nullptr); + + bool setConnectButtonEnabled(bool enabled); + bool setConnectButtonChecked(bool checked); + bool setStatusIndicatorColor(bool active, QColor color = QColor(255,255,255)); + + QString translateStatusIndicatorText(QString status_code); + bool setStatusIndicatorText(QString status_text); + +private: + DBusAPI *_dbus_api; + MainQMLAdaptor *_main_gui; + QQmlApplicationEngine *_engine; + Session *_current_session; + QSet<Session*> *_sessions; + + void connectSession(Session *session); + void connectToDBusAPI(Session *session); + + bool refreshTimerIsRunning; + +signals: + void onConnectButtonClick(bool checked); + void pinChanged(QString pin); + void urlChanged(QString URL); + void sessionIDChanged(QString session_id); + +public slots: + void handleCopyToClipboardButtonClick(QString copy_data); + void handleConnectButtonClick(bool checked); + + void setCurrentSession(Session *session); + void addSession(Session *session); + bool removeSession(Session *session); + + void currentSessionStatusChanged(QString); + void currentSessionPinChanged(QString); + void currentSessionSessionIDChanged(QString); + void currentSessionUrlChanged(QString); + + QString getURL(); + QString getPin(); + QString getSessionID(); + Session* getCurrentSession(); + + void currentSessionStartFailed(QString error_message); + void currentSessionStopFailed(QString error_message); + void currentSessionStatusFailed(QString error_message); + void currentSessionUnexpectedStop(QString error_message); + + void currentSessionStartSucceeded(); + void currentSessionStopSucceeded(); + void currentSessionStatusSucceeded(); +}; + +#endif // REMOTECONTROLMANAGER_H |
