blob: 5005cb4a65eaa54c017ad7c00cba884c7cd97d24 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#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, 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:
MainQMLAdaptor* _main_gui;
int _id;
QString _url;
QString _pin;
OrgArcticaProjectRWAInterface* _dbus_rwa;
void _initDBus();
bool _minimizedBefore = false;
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();
};
|