-
Notifications
You must be signed in to change notification settings - Fork 2
/
datasource.h
53 lines (41 loc) · 1.13 KB
/
datasource.h
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
#ifndef DATASOURCE_H
#define DATASOURCE_H
#include <QObject>
#include <QTimer>
#include "vmdatamodel.h"
#include "user.h"
enum class Commands
{
List = 0,
Info,
Action
};
class DataSource : public QObject
{
Q_OBJECT
public:
explicit DataSource(QObject *parent = nullptr);
VMDataModel * getVMDataModel() { return &mVMDataModel; }
Q_INVOKABLE void loginRequest(const QString &passwd);
Q_INVOKABLE void pinRequest(const QString &number);
Q_INVOKABLE void pinSubmit(const QString &code);
Q_INVOKABLE void switchPower(bool on, QString name);
Q_INVOKABLE void saveSettings(/*???*/);
void setVmdDir(const QString &newVmdDir);
public slots:
Q_INVOKABLE void updateModel();
void fillInTheModelSlot(QStringList list);
void fillInTheModelItemInfoSlot(QByteArray info);
signals:
void listReady(QStringList list);
void infoReady(QByteArray info);
private:
QTimer updateModelTimer;
VMDataModel mVMDataModel;
QString vmdDir;
void runCLI(Commands cmd, QStringList args = QStringList());
#ifdef TEST
QString execCommand(const QString &cmd);
#endif
};
#endif // DATASOURCE_H