-
Notifications
You must be signed in to change notification settings - Fork 0
/
goopal.h
94 lines (76 loc) · 2.29 KB
/
goopal.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef GOOPAL_H
#define GOOPAL_H
#include <QObject>
#include <QMap>
#include <QSettings>
#include <QFile>
#include <QProcess>
#include <QMutex>
#include <QDialog>
#include <QNetworkReply>
#include <QNetworkAccessManager>
#include "outputmessage.h"
#define MODULE_GOOPAL "ACHAINDEVELOPMENTTOOL"
#define GOOPALURL "http://www.goopal.online"
// 密码输入错误5次后 锁定一段时间 (秒)
#define PWD_LOCK_TIME 7200
#define RPC_PORT 60010
#define BTN_SELECTED_STYLESHEET "QPushButton{ background:white;font: 14px \"微软雅黑\";border: 0px solid #000000;border-bottom: 3px solid rgb(68,217,199);}"
#define BTN_UNSELECTED_STYLESHEET "QPushButton{ background:white;font: 14px \"微软雅黑\";border: 0px solid #000000;border-bottom: 3px solid rgb(233,233,240);}"
#define HELP_HTML "https://www.achain.com/help/index.html"
class QTimer;
class QFrame;
class WorkerThreadManager;
static QMutex mutexForBalanceMap;
static QMutex mutexForAddressMap;
static QMutex mutexForRpcReceiveOrNot;
static QMutex mutexForCurrentProcess;
struct FileRecord
{
enum FileType{ CONTRACT_FILE = 1, SCRIPT_FILE}; // 是合约文件还是脚本文件
FileType type;
QString path; // 绝对路径
bool newBuilt = false; // 是否为新建 保存后置为false
};
struct AccountInfo
{
enum ChainType{ TestChain = 1, FormalChain};
ChainType type;
QString name;
QString address;
QString balance;
QString registerTime;
QString ownerKey;
bool isDelegate = false;
};
struct ScriptInfo
{
QString scriptId;
QString description;
};
enum ChainType{ TestChain = 1, FormalChain};
template <class key,class value>
key getKeyByValue(QMap<key,value> m,value v);
class Goopal : public QObject
{
Q_OBJECT
public:
~Goopal();
static Goopal* getInstance();
QFrame* mainFrame = NULL; // 指向主窗口的指针
private:
Goopal();
static Goopal* goo;
class CGarbo // 它的唯一工作就是在析构函数中删除CSingleton的实例
{
public:
~CGarbo()
{
if (Goopal::goo)
delete Goopal::goo;
}
};
static CGarbo Garbo; // 定义一个静态成员,在程序结束时,系统会调用它的析构函数
};
#endif // GOOPAL_H
QString toJsonFormat(QString id, QString instruction, QStringList parameters);