-
Notifications
You must be signed in to change notification settings - Fork 7
/
confighandler.h
82 lines (62 loc) · 2.36 KB
/
confighandler.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
#ifndef CONFIGHANDLER_H
#define CONFIGHANDLER_H
#include "configinifile.h"
#include "configxmlfile.h"
#include <QMap>
#include <QFormLayout>
#include <QTextEdit>
#include <QComboBox>
class ConfigSetup
{
bool simSetup;
bool gridSetup;
ConfigIniFile m_OpenSimIni;
ConfigIniFile m_RobustIni;
ConfigXmlFile m_UserXml;
ConfigXmlFile m_MessagingXml;
ConfigIniFile m_RegionIni;
};
class ConfigHandler
{
public:
ConfigHandler();
~ConfigHandler();
// config templates, loaded at startup
ConfigIniFile* m_OpenSimIni;
ConfigIniFile* m_RobustIni;
ConfigXmlFile* m_UserXml;
ConfigXmlFile* m_MessagingXml;
ConfigIniFile* m_RegionIni;
ConfigIniFile* m_ModRexIni;
ConfigIniFile* m_Defaults;
// config setup for modifying templates from ui inputs
ConfigIniFile* m_ConfigSetupIni;
QMap<QString,QString> *m_GridConfMap;
QMap<QString,QString> *m_SimNetworkConfMap;
QMap<QString,QMap<QString,QString>* > *m_SimRegionConfMap;
void WriteUIValues2ConfigBasedOnConfigSetup(QMap<QString, QString> uiMap);
void ApplyConfigs(bool grid, bool sim, bool regions);
void SaveConfigs(bool grid, bool sim, bool regions, QMap<QString,QString>* uiMap, QString name, QString path="");
QStringList GetDatabasesFromConfigIni();
static QString OUTPUT_BIN;
static QString SAVE_DIR;
static QString CONF_FOLDER;
int m_Error;
private:
QString constructPath(QString name);
void WriteValuesToConf(ConfigFile* conf, QMap<QString, QString> uiMap, QString fileName);
void WriteValuesToRegion(QMap<QString, QString> uiMap);
void SetValueToConfiguration(QString commaListOfDestinies, ConfigFile* ini, QString valueToSet);
void SetValueToConf(QString commaListOfDestinies, ConfigIniFile* ini, QString valueToSet);
void SetValueToConf(QString commaListOfDestinies, ConfigXmlFile* xml, QString valueToSet);
// VALUE TRANSLATIONS
bool CheckSetValueTranslation(QString& destiny, QString& valueToSet);
void SetValueChange(QString& destiny, QString& valueToSet);
void SetValueAppend(QString& destiny, QString& valueToSet);
bool SetValueCheckRemove(QString& destiny, QString& valueToSet, bool inverse);
void ApplyGridConfig();
void ApplySimConfig();
void ApplyRegionConfig();
void SetUIMapValuesToConfConfiguration(QMap<QString,QString>* uiMap);
};
#endif // CONFIGHANDLER_H