From 7411d37db68911c59016472e3aead0634cf555ae Mon Sep 17 00:00:00 2001 From: Daniel Teichmann Date: Mon, 27 Jul 2020 17:09:49 +0200 Subject: Move sources to src/ && lots of features --- src/session.h | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 src/session.h (limited to 'src/session.h') 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 +#include +#include +#include +#include +#include + +#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(); +}; -- cgit v1.2.3