-
Notifications
You must be signed in to change notification settings - Fork 2
/
mainwindow.h
130 lines (92 loc) · 3.3 KB
/
mainwindow.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#define server_token "server_token.txt"
#define override_lua "worldgenoverride.lua"
#define mod_override_lua "modoverrides.lua"
#define settings_ini "settings.ini"
#define folder_world "gui_dst_server"
#define folder_cave "gui_dst_cave"
#define override_world_lua_template "worldgenoverride_world.lua"
#define override_cave_lua_template "worldgenoverride_cave.lua"
#define ini_world "settings_world.ini"
#define ini_cave "settings_cave.ini"
#include <QMainWindow>
#include <QButtonGroup>
#include <QComboBox>
#include <QDir>
#include <QFileInfo>
#include <QMessageBox>
#include <QDesktopServices>
#include <QFileDialog>
#include <QProcess>
#include <QScrollBar>
#include <QSettings>
#include <QStandardPaths>
#include <QTranslator>
#include "dstdatastructure.h"
#include "ioworldgenoverridelua.h"
#include "iomodoverrideslua.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void writeWorldMesgOnScreen();
void writeCaveMesgOnScreen();
void modeUpdated(int code,QProcess::ExitStatus status);
void on_pushButton_startServer_clicked();
void on_pushButton_stopServer_clicked();
void on_pushButton_restartServer_clicked();
void on_lineEdit_worldEdit_returnPressed();
void on_lineEdit_caveEdit_returnPressed();
void on_lineEdit_servername_editingFinished();
void on_lineEdit_serverDescription_editingFinished();
void on_lineEdit_serverPassword_editingFinished();
void on_spinBox_serverMaxPlayers_editingFinished();
void on_radioButton_pvpYes_toggled(bool checked);
void on_comboBox_gamemode_currentIndexChanged(const QString &arg1);
void on_comboBox_serverSaveSlot_currentIndexChanged(const QString &arg1);
void on_comboBox_serverIntention_currentIndexChanged(const QString &arg1);
void on_pushButton_rescanMods_clicked();
void on_lineEdit_dedicatedServerLocation_editingFinished();
void on_tableWidget_modList_itemSelectionChanged();
private:
Ui::MainWindow *ui;
//Main app ini settings
void readGUIINISettings();
void writeGUIINISettings();
std::vector<properties> _gui_ini;
//DST related
bool checkServerExists(QString dstds_path, bool reload_template = true);
bool firstServerSetup();
void changeINISettings(int world_num, QString name);
bool readINI(int world_num, QString file_path, bool ui_c = false);
bool writeINI(int world_num, QString file_path);
void writeINIToGUI(int world_num);
bool readLua(int world_num, QString file_path);
bool writeLua(int world_num, QString file_path);
void writeLuaToGUI(int world_num);
bool readInstalledModLua();
bool readModLua(int world_num, QString file_path);
bool writeModLua(int world_num, QString file_path);
void writeModLuaToGUI();
QProcess _update_mod;
QProcess _dst_server;
QProcess _dst_cave;
bool _server_found = false;
QString _dstds_exe;
QString _dstds_folder;
QString _server_token;
std::vector<DSTSettings> world;
std::vector<mods_properties> world_mods;
//UI
void disableWidgetsWhenStartServer(bool status);
void disableSetttingsWhenServerExists(bool status);
QButtonGroup *group;
};
#endif // MAINWINDOW_H