diff options
author | Daniel Teichmann <daniel.teichmann@das-netzwerkteam.de> | 2020-07-27 17:09:49 +0200 |
---|---|---|
committer | Daniel Teichmann <daniel.teichmann@das-netzwerkteam.de> | 2020-07-27 17:13:25 +0200 |
commit | 7411d37db68911c59016472e3aead0634cf555ae (patch) | |
tree | 72238bf0774ad15a1ac5326ba4607f6caeb7f48f /src/session.h | |
parent | 77eefb1b2364737d824cc4cbefbe4b7bb1fd55b9 (diff) | |
download | RWA.Support.DesktopApp-7411d37db68911c59016472e3aead0634cf555ae.tar.gz RWA.Support.DesktopApp-7411d37db68911c59016472e3aead0634cf555ae.tar.bz2 RWA.Support.DesktopApp-7411d37db68911c59016472e3aead0634cf555ae.zip |
Move sources to src/ && lots of features
Diffstat (limited to 'src/session.h')
-rw-r--r-- | src/session.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/session.h b/src/session.h new file mode 100644 index 0000000..bc9a7cf --- /dev/null +++ b/src/session.h @@ -0,0 +1,72 @@ +#pragma once + +#include <QObject> +#include <QQmlApplicationEngine> +#include <QQuickItem> +#include <QTimerEvent> +#include <QTranslator> +#include <QtDBus/QtDBus> + +#include "RWADBusAdaptor.h" +#include "main_qmladaptor.h" +//#include "session.cpp" + +class Session : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString status READ getStatus NOTIFY statusChanged) // this makes status available as a QML property + Q_PROPERTY(int id READ getId NOTIFY idChanged ) // this makes id available as a QML property + Q_PROPERTY(QString url READ getURL NOTIFY urlChanged ) // this makes url available as a QML property + Q_PROPERTY(QString pin READ getPin NOTIFY pinChanged ) // this makes pin available as a QML property +public: + explicit Session(QObject *parent, QQmlApplicationEngine *engine = nullptr, MainQMLAdaptor *main_gui = nullptr); + void init_vars(); + + QString getStatus(); + QString getURL(); + int getId(); + QString getPin(); + + void setStatus(QString status); + void setURL(QString url); + void setId(int id); + void setPin(QString pin); + + // Starts a VNC Session + void start(); + // Refreshes a VNC Session's status + void refresh_status(int pid); + // Stop the Session + void stop(int pid); + // Gets a VNC Session's status + void status(int pid); + +protected: + QString _status; + QTimer *statusTimer; + void statusTimerEvent(); +private: + QQmlApplicationEngine* _engine; + MainQMLAdaptor* _main_gui; + int _id; + QString _url; + QString _pin; + OrgArcticaProjectRWAInterface* _dbus_rwa; + void _initDBus(); + +signals: + void finished(); + void statusChanged(QString status); + void idChanged(int id); + void urlChanged(QString URL); + void pinChanged(QString pin); + +public slots: + void handleConnectButtonClick(bool checked); + + void start_dbus_replied(QDBusPendingCallWatcher *call); + void stop_dbus_replied(QDBusPendingCallWatcher *call); + void status_dbus_replied(QDBusPendingCallWatcher *call); + +// void onCloseHandler(); +}; |