-
Notifications
You must be signed in to change notification settings - Fork 0
/
Account.h
60 lines (49 loc) · 1.28 KB
/
Account.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
54
55
56
57
58
59
60
#pragma once
#include <QObject>
#include <QThread>
#include <QJsonValue>
#include <QJsonObject>
#include <QMetaProperty>
#include "ExileClient.h"
#include "ExileGame.h"
class Account : public QThread
{
Q_OBJECT
Q_PROPERTY(QString Email MEMBER m_Email)
Q_PROPERTY(QString Password MEMBER m_Password)
Q_PROPERTY(QString AccountName MEMBER m_AccountName)
Q_PROPERTY(QString POESESSID MEMBER m_POESESSID)
Q_PROPERTY(QString BackendError MEMBER m_BackendError)
public:
QString m_Email;
QString m_Password;
QString m_AccountName;
QString m_POESESSID;
ExileClient *m_ExileClient;
ExileGame *m_ExileGame;
QString m_BackendError;
public:
explicit Account(QObject *parent = nullptr)
: QThread(parent)
{
}
virtual ~Account()
{
this->quit();
this->wait();
}
public:
QJsonValue toJson();
void fromJson(QJsonValue JsonValue);
protected:
void run() override;
public slots:
void on_BackendError(quint16 Result)
{
quint16 BackendErrorIndex = Result - 1;
QJsonObject BackendError = Helper::Data::GetBackendError(BackendErrorIndex);
m_BackendError = BackendError.value("Id").toString();
qWarning() << "BackendError:" << m_BackendError;
this->quit();
}
};