diff options
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(); +}; |