-
Notifications
You must be signed in to change notification settings - Fork 1
/
QtConfig.h
81 lines (63 loc) · 1.63 KB
/
QtConfig.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
#ifndef QTCONFIG_H
#define QTCONFIG_H
extern "C" {
#include "putty.h"
}
#include <QIODevice>
#include <QKeySequence>
#include <QString>
#include <QPoint>
#include <QSize>
#include <map>
#include <vector>
#include <string>
#include <stddef.h>
#include <QFile>
using namespace std;
class QtMenuActionConfig {
public:
uint32_t id;
QKeySequence shortcut;
QString name;
QString str_data;
uint32_t int_data;
QtMenuActionConfig(uint32_t _id, QKeySequence &k, QString n="",
QString s="", uint32_t i=0)
: id(_id), shortcut(k), name(n), str_data(s), int_data(i)
{ }
};
typedef struct qutty_mainwindow_settings_t__ {
QSize size;
QPoint pos;
int state;
int flag;
bool menubar_visible;
bool titlebar_tabs;
} qutty_mainwindow_settings_t;
class QtConfig : public QObject {
Q_OBJECT
public:
map<string, string> ssh_host_keys;
map<QString, Config> config_list;
map<uint32_t, QtMenuActionConfig> menu_action_list;
qutty_mainwindow_settings_t mainwindow;
QtConfig();
bool restoreConfig();
bool saveConfig();
void importFromFile(QFile*);
void importFromPutty();
void exportToFile(QFile*);
signals:
void savedSessionsChanged();
private:
int readFromXML(QIODevice *device);
int writeToXML(QIODevice *device);
bool restoreFromPuttyWinRegistry();
};
// all global config is here
extern QtConfig qutty_config;
extern vector<string> qutty_string_split(const string &str, char delim);
#define QUTTY_DEFAULT_CONFIG_SETTINGS "Default Settings"
#define QUTTY_SESSION_NAME_SPLIT '/'
int initConfigDefaults(Config *cfg);
#endif // QTCONFIG_H