src/config.cpp

Fri, 05 Jun 2015 18:33:51 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Fri, 05 Jun 2015 18:33:51 +0300
changeset 37
c82a86ea87be
parent 36
b8fa9171be6e
child 39
2c368cf5cc19
permissions
-rw-r--r--

Major rework, lots of internal maintenance, version editor removed

13
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
1 /*
30
6b82f6a3ad53 renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents: 26
diff changeset
2 * ZCinema: Zandronum demo launcher
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
3 * Copyright (C) 2013-2015 Teemu Piippo
13
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
4 *
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
5 * This program is free software: you can redistribute it and/or modify
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
6 * it under the terms of the GNU General Public License as published by
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
8 * (at your option) any later version.
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
9 *
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
10 * This program is distributed in the hope that it will be useful,
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
13 * GNU General Public License for more details.
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
14 *
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
15 * You should have received a copy of the GNU General Public License
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
17 */
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 10
diff changeset
18
5
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
19 #include <QLabel>
3
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
20 #include <QFileDialog>
5
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
21 #include <QFormLayout>
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
22 #include <QProgressBar>
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
23 #include <QMessageBox>
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
24 #include <QLineEdit>
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
25 #include <QListWidget>
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
26 #include <QPushButton>
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
27 #include <QCheckBox>
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
28 #include <QDialogButtonBox>
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
29 #include <QVBoxLayout>
2
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 #include "config.h"
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 #include "ui_configbox.h"
6
67b6ef6917ba Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents: 5
diff changeset
32 #include "misc.h"
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
33 #include "demo.h"
2
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
35 class FindPathButton : public QPushButton
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
36 {
5
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
37 public:
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
38 explicit FindPathButton (QWidget* parent = NULL) :
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
39 QPushButton (parent)
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
40 {
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
41 setText ("...");
5
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
42 }
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
43
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
44 QLineEdit* editWidget() const
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
45 {
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
46 return m_editWidget;
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
47 }
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
48
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
49 void setEditWidget (QLineEdit* edit)
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
50 {
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
51 m_editWidget = edit;
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
52 }
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
53
5
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
54 private:
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
55 QLineEdit* m_editWidget;
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
56 };
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
57
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
58 ConfigWindow::ConfigWindow (QWidget* parent, Qt::WindowFlags f) :
20
a5457405cc9b Use the cfg:: namespace system I made up a while ago instead of using QSettings directly, it's unsafe
Teemu Piippo <crimsondusk64@gmail.com>
parents: 19
diff changeset
59 QDialog (parent, f),
25
256bb5c6b77f Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 21
diff changeset
60 ui (new Ui_ConfigBox),
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
61 m_releaseLayout (NULL),
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
62 m_testLayout (NULL)
20
a5457405cc9b Use the cfg:: namespace system I made up a while ago instead of using QSettings directly, it's unsafe
Teemu Piippo <crimsondusk64@gmail.com>
parents: 19
diff changeset
63 {
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
64 ui->setupUi (this);
19
c9b6dd9dd4cd Added infurnus' application icon
Teemu Piippo <crimsondusk64@gmail.com>
parents: 15
diff changeset
65
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
66 initVersions();
5
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
67 initFromSettings();
19
c9b6dd9dd4cd Added infurnus' application icon
Teemu Piippo <crimsondusk64@gmail.com>
parents: 15
diff changeset
68
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
69 connect (ui->wad_add, SIGNAL (clicked()), this, SLOT (addPath()));
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
70 connect (ui->wad_pathEntry, SIGNAL (returnPressed()), this, SLOT (addPath()));
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
71 connect (ui->wad_findPath, SIGNAL (clicked()), this, SLOT (findPath()));
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
72 connect (ui->wad_del, SIGNAL (clicked()), this, SLOT (delPath()));
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
73 connect (ui->buttonBox, SIGNAL (clicked (QAbstractButton*)), this,
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
74 SLOT (buttonPressed (QAbstractButton*)));
26
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 25
diff changeset
75 setWindowTitle (versionSignature());
2
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76 }
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
78 //
4
3c23aa03190d SEPARATORS
Teemu Piippo <crimsondusk64@gmail.com>
parents: 3
diff changeset
79 // -----------------------------------------------------------------------------
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
80 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
81
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
82 ConfigWindow::~ConfigWindow()
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
83 {
2
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84 delete ui;
3
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
85 }
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
86
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
87 //
4
3c23aa03190d SEPARATORS
Teemu Piippo <crimsondusk64@gmail.com>
parents: 3
diff changeset
88 // -----------------------------------------------------------------------------
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
89 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
90
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
91 void ConfigWindow::initVersions()
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
92 {
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
93 if (m_releaseLayout == NULL)
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
94 {
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
95 m_releaseLayout = new QVBoxLayout;
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
96 m_testLayout = new QVBoxLayout;
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
97 ui->releaseVersions->setLayout (m_releaseLayout);
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
98 ui->testingVersions->setLayout (m_testLayout);
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
99 }
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
100 else
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
101 {
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
102 // Versions are being re-initialized, clear everything
25
256bb5c6b77f Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 21
diff changeset
103 for (QWidget* w : m_binaryLayoutWidgets)
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
104 w->deleteLater();
25
256bb5c6b77f Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 21
diff changeset
105
256bb5c6b77f Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 21
diff changeset
106 m_binaryLayoutWidgets.clear();
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
107 m_pathInputFields.clear();
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
108 }
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
109
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
110 QList<QVariant> versions = getVersions();
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
111
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
112 for (int i = 0; i < versions.size(); ++i)
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
113 {
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
114 if (not versions[i].canConvert<ZandronumVersion>())
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
115 continue;
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
116
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
117 ZandronumVersion version = versions[i].value<ZandronumVersion>();
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
118 addVersion (version);
25
256bb5c6b77f Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 21
diff changeset
119 }
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
120 }
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
121
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
122 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
123 // -------------------------------------------------------------------------------------------------
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
124 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
125
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
126 void ConfigWindow::addVersion (const ZandronumVersion& version)
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
127 {
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
128 QLabel* label = new QLabel (version.name + ":");
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
129 QLineEdit* pathInput = new QLineEdit;
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
130 FindPathButton* pathFindButton = new FindPathButton;
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
131 pathFindButton->setEditWidget (pathInput);
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
132 connect (pathFindButton, SIGNAL (clicked()), this, SLOT (findZanBinary()));
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
133
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
134 QHBoxLayout* pathInputLayout = new QHBoxLayout;
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
135 pathInputLayout->addWidget (label);
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
136 pathInputLayout->addWidget (pathInput);
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
137 pathInputLayout->addWidget (pathFindButton);
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
138 pathInput->setText (version.binaryPath);
20
a5457405cc9b Use the cfg:: namespace system I made up a while ago instead of using QSettings directly, it's unsafe
Teemu Piippo <crimsondusk64@gmail.com>
parents: 19
diff changeset
139
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
140 m_pathInputFields[version.name] = pathInput;
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
141
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
142 if (version.isRelease)
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
143 m_releaseLayout->addLayout (pathInputLayout);
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
144 else
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
145 m_testLayout->addLayout (pathInputLayout);
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
146
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
147 m_binaryLayoutWidgets << pathInput << pathFindButton << label;
20
a5457405cc9b Use the cfg:: namespace system I made up a while ago instead of using QSettings directly, it's unsafe
Teemu Piippo <crimsondusk64@gmail.com>
parents: 19
diff changeset
148 }
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
149
20
a5457405cc9b Use the cfg:: namespace system I made up a while ago instead of using QSettings directly, it's unsafe
Teemu Piippo <crimsondusk64@gmail.com>
parents: 19
diff changeset
150 // =============================================================================
a5457405cc9b Use the cfg:: namespace system I made up a while ago instead of using QSettings directly, it's unsafe
Teemu Piippo <crimsondusk64@gmail.com>
parents: 19
diff changeset
151 // -----------------------------------------------------------------------------
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
152 void ConfigWindow::initFromSettings()
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
153 {
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
154 ui->wad_pathsList->clear();
20
a5457405cc9b Use the cfg:: namespace system I made up a while ago instead of using QSettings directly, it's unsafe
Teemu Piippo <crimsondusk64@gmail.com>
parents: 19
diff changeset
155
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
156 for (const QVariant& it : Config::get ("wadpaths").toList())
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
157 addPath (it.toString());
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
158
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
159 QList<QVariant> versions = Config::get ("versions").toList();
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
160
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
161 for (int i = 0; i < versions.size(); ++i)
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
162 {
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
163 ZandronumVersion version = versions[i].value<ZandronumVersion>();
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
164 m_pathInputFields[version.name]->setText (version.binaryPath);
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
165 }
20
a5457405cc9b Use the cfg:: namespace system I made up a while ago instead of using QSettings directly, it's unsafe
Teemu Piippo <crimsondusk64@gmail.com>
parents: 19
diff changeset
166
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
167 ui->noDemoPrompt->setChecked (Config::get ("noprompt").toBool());
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
168 }
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
169
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
170 //
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
171 // -----------------------------------------------------------------------------
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
172 //
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
173
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
174 void ConfigWindow::saveSettings()
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
175 {
20
a5457405cc9b Use the cfg:: namespace system I made up a while ago instead of using QSettings directly, it's unsafe
Teemu Piippo <crimsondusk64@gmail.com>
parents: 19
diff changeset
176 QList<QVariant> wadPathList;
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
177
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
178 for (int i = 0; i < ui->wad_pathsList->count(); ++i)
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
179 wadPathList << ui->wad_pathsList->item (i)->text();
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
180
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
181 Config::set ("wadpaths", wadPathList);
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
182 Config::set ("noprompt", ui->noDemoPrompt->isChecked());
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
183
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
184 QList<QVariant> versions = getVersions();
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
185
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
186 for (int i = 0; i < versions.size(); ++i)
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
187 {
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
188 if (not versions[i].canConvert<ZandronumVersion>())
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
189 continue;
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
190
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
191 ZandronumVersion version = versions[i].value<ZandronumVersion>();
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
192 version.binaryPath = m_pathInputFields[version.name]->text();
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
193 versions[i].setValue (version);
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
194 }
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
195
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
196 Config::set ("versions", versions);
3
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
197 }
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
198
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
199 //
4
3c23aa03190d SEPARATORS
Teemu Piippo <crimsondusk64@gmail.com>
parents: 3
diff changeset
200 // -----------------------------------------------------------------------------
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
201 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
202
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
203 void ConfigWindow::addPath()
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
204 {
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
205 addPath (ui->wad_pathEntry->text());
3
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
206 ui->wad_pathEntry->clear();
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
207 }
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
208
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
209 //
4
3c23aa03190d SEPARATORS
Teemu Piippo <crimsondusk64@gmail.com>
parents: 3
diff changeset
210 // -----------------------------------------------------------------------------
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
211 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
212
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
213 void ConfigWindow::addPath (QString path)
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
214 {
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
215 ui->wad_pathsList->addItem (path);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
216 QListWidgetItem* item = ui->wad_pathsList->item (ui->wad_pathsList->count() - 1);
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
217 item->setFlags (item->flags() | Qt::ItemIsEditable);
3
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
218 }
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
219
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
220 //
4
3c23aa03190d SEPARATORS
Teemu Piippo <crimsondusk64@gmail.com>
parents: 3
diff changeset
221 // -----------------------------------------------------------------------------
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
222 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
223
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
224 void ConfigWindow::findPath()
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
225 {
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
226 QString path = QFileDialog::getExistingDirectory (this);
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
227
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
228 if (path.isEmpty())
3
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
229 return;
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
230
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
231 ui->wad_pathEntry->setText (path);
3
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
232 }
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
233
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
234 //
4
3c23aa03190d SEPARATORS
Teemu Piippo <crimsondusk64@gmail.com>
parents: 3
diff changeset
235 // -----------------------------------------------------------------------------
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
236 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
237
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
238 void ConfigWindow::delPath()
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
239 {
3
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
240 delete ui->wad_pathsList->currentItem();
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
241 }
5
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
242
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
243 //
5
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
244 // -----------------------------------------------------------------------------
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
245 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
246
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
247 void ConfigWindow::findZanBinary()
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
248 {
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
249 FindPathButton* button = static_cast<FindPathButton*> (sender());
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
250 QString path = getBinaryPath (this);
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
251
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
252 if (path.isEmpty())
5
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
253 return;
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
254
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
255 button->editWidget()->setText (path);
5
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
256 }
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
257
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
258 //
5
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
259 // -----------------------------------------------------------------------------
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
260 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
261
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
262 QString ConfigWindow::getBinaryPath (QWidget* parent)
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
263 {
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
264 #ifdef _WIN32
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
265 # define ZAN_EXE_NAME "zandronum.exe"
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
266 #else
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
267 # define ZAN_EXE_NAME "zandronum"
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
268 #endif
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
269
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
270 return QFileDialog::getOpenFileName (parent, "", "",
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
271 "Zandronum Binaries (" ZAN_EXE_NAME ")(" ZAN_EXE_NAME ");;All files (*.*)(*.*)");
5
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
272 }
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
273
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
274 //
5
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
275 // -----------------------------------------------------------------------------
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
276 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
277
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
278 void ConfigWindow::buttonPressed (QAbstractButton* btn) {
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
279 if (btn == ui->buttonBox->button (QDialogButtonBox::Ok))
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
280 {
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
281 saveSettings();
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
282 accept();
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
283 }
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
284 else if (btn == ui->buttonBox->button (QDialogButtonBox::Cancel))
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
285 reject();
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
286 else if (btn == ui->buttonBox->button (QDialogButtonBox::Apply))
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
287 saveSettings();
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
288 }

mercurial