config/configwindow.cpp

Sun, 07 Jun 2015 18:11:06 +0300

author
Teemu Piippo <tsapii@utu.fi>
date
Sun, 07 Jun 2015 18:11:06 +0300
changeset 50
5dc8b48f80b3
parent 46
07578e081ae8
child 54
0b3a5bc4e8a8
permissions
-rw-r--r--

Removed the not very useful apply button from the config window
Fixed compilation warnings under MSVC 2013

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
3
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
19 #include <QFileDialog>
44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
20 #include <QMessageBox>
46
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
21 #include <commonlib/config.h>
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
22 #include <commonlib/version.h>
44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
23 #include "addversionprompt.h"
42
9528f8d06962 rename config.cpp/h to configwindow.cpp/h
Teemu Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
24 #include "configwindow.h"
2
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 #include "ui_configbox.h"
44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
26
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
27 //
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
28 // -----------------------------------------------------------------------------
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
29 //
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
30
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
31 bool confirm (const QString& text)
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
32 {
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
33 return QMessageBox::question (NULL, QObject::tr ("Confirm"), text,
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
34 QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::No;
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
35 }
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
36
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
37 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
38 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
39 //
5
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
40
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
41 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
42 QDialog (parent, f),
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
43 ui (*new Ui_ConfigBox)
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
44 {
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
45 ui.setupUi (this);
3
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
46
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
47 QStringList wadpaths = Config::get ("wadpaths").toStringList();
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
48 QList<QVariant> versions = Config::get ("versions").toList();
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
49
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
50 for (int i = 0; i < wadpaths.size(); ++i)
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
51 addWadPath (wadpaths[i]);
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
52
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
53 ui.noDemoPrompt->setChecked (Config::get ("noprompt").toBool());
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
54
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
55 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
56 {
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
57 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
58 continue;
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
59
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
60 addVersion (versions[i].value<ZandronumVersion>());
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
61 }
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
62
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
63 connect (ui.wad_add, SIGNAL (clicked()), this, SLOT (addWadPath()));
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
64 connect (ui.wad_pathEntry, SIGNAL (returnPressed()), this, SLOT (addWadPath()));
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
65 connect (ui.wad_findPath, SIGNAL (clicked()), this, SLOT (findWadPath()));
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
66 connect (ui.wad_del, SIGNAL (clicked()), this, SLOT (removeCurrentWadPath()));
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
67 connect (ui.buttonBox, SIGNAL (clicked (QAbstractButton*)), this,
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
68 SLOT (buttonPressed (QAbstractButton*)));
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
69 connect (ui.addExePath, SIGNAL (clicked()), this, SLOT (newVersion()));
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
70 connect (ui.editExePath, SIGNAL (clicked()), this, SLOT (editExePressed()));
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
71 connect (ui.removeExePath, SIGNAL (clicked()), this, SLOT (removeCurrentVersion()));
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
72 connect (ui.clearExePaths, SIGNAL (clicked()), this, SLOT (clearExePathsClicked()));
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
73 setWindowTitle (versionSignature());
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
74 }
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
75
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
76 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
77 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
78 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
79
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
80 ConfigWindow::~ConfigWindow()
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
81 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
82 delete &ui;
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
83
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
84 for (int i = 0; i < m_versionEntries.size(); ++i)
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
85 delete m_versionEntries[i];
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
86 }
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
87
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
88 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
89 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
90 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
91
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
92 VersionGuiEntry* ConfigWindow::addVersion (const ZandronumVersion& version)
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
93 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
94 QTableWidgetItem* labelItem = new QTableWidgetItem (version.name);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
95 QTableWidgetItem* pathItem = new QTableWidgetItem (version.binaryPath);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
96 int rownum = ui.exePaths->rowCount();
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
97 ui.exePaths->setSortingEnabled (false);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
98 ui.exePaths->insertRow (rownum);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
99 ui.exePaths->setItem (rownum, LabelColumn, labelItem);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
100 ui.exePaths->setItem (rownum, PathColumn, pathItem);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
101 ui.exePaths->setSortingEnabled (true);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
102
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
103 VersionGuiEntry* entry = new VersionGuiEntry;
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
104 entry->isRelease = version.isRelease;
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
105 entry->name = version.name;
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
106 entry->labelItem = labelItem;
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
107 entry->pathItem = pathItem;
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
108 m_versionEntries.append (entry);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
109 m_versionEntryMap[pathItem] = entry;
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
110 return entry;
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
111 }
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
112
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
113 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
114 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
115 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
116
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
117 void ConfigWindow::removeVersion (VersionGuiEntry* entry)
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
118 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
119 for (int i = 0; i < m_versionEntries.size(); ++i)
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
120 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
121 if (m_versionEntries[i] == entry)
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
122 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
123 m_versionEntries.removeAt (i);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
124 break;
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
125 }
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
126 }
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
127
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
128 m_versionEntryMap.remove (entry->pathItem);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
129 ui.exePaths->removeRow (entry->pathItem->row());
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
130 delete entry;
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
131 }
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
132
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
133 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
134 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
135 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
136
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
137 void ConfigWindow::removeCurrentVersion()
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
138 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
139 VersionGuiEntry* entry = currentVersionEntry();
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
140
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
141 if (entry)
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
142 removeVersion (entry);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
143 }
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
144
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
145 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
146 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
147 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
148
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
149 void ConfigWindow::newVersion()
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
150 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
151 VersionGuiEntry* entry = addVersion (ZandronumVersion());
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
152 AddVersionPrompt* prompt = new AddVersionPrompt (entry, this);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
153
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
154 if (not prompt->exec())
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
155 removeVersion (entry);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
156 }
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
157
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
158 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
159 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
160 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
161
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
162 void ConfigWindow::editExePressed()
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
163 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
164 VersionGuiEntry* entry = currentVersionEntry();
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
165 (new AddVersionPrompt (entry, this))->exec();
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
166 }
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
167
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
168 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
169 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
170 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
171
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
172 void ConfigWindow::clearExePathsClicked()
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
173 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
174 if (confirm ("Are you sure you want to clear all Zandronum versions?"))
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
175 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
176 ui.exePaths->clearContents();
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
177 ui.exePaths->setRowCount (0);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
178
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
179 for (int i = 0; i < m_versionEntries.size(); ++i)
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
180 delete m_versionEntries[i];
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
181
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
182 m_versionEntries.clear();
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
183 m_versionEntryMap.clear();
25
256bb5c6b77f Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 21
diff changeset
184 }
37
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
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 // -------------------------------------------------------------------------------------------------
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
189 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
190
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
191 ZandronumVersion VersionGuiEntry::toNonGuiVersion() const
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
192 {
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
193 return ZandronumVersion (name, isRelease, pathItem->text());
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
194 }
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
195
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
196 //
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
197 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
198 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
199
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
200 VersionGuiEntry* ConfigWindow::currentVersionEntry()
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
201 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
202 int row = ui.exePaths->currentRow();
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
203
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
204 if (row != -1)
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
205 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
206 VersionEntryMap::iterator it = m_versionEntryMap.find (ui.exePaths->item (row, PathColumn));
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
207
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
208 if (it != m_versionEntryMap.end())
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
209 return it.value();
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
210 }
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
211
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
212 return NULL;
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
213 }
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
214
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
215 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
216 // -------------------------------------------------------------------------------------------------
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
217 //
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
218
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
219 void ConfigWindow::saveSettings()
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
220 {
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
221 QList<QVariant> wadPathList;
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
222 QList<QVariant> versions;
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
223
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
224 for (int i = 0; i < ui.wad_pathsList->count(); ++i)
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
225 wadPathList.append (ui.wad_pathsList->item (i)->text());
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
226
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
227 for (int i = 0; i < m_versionEntries.size(); ++i)
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
228 {
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
229 QVariant var;
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
230 var.setValue (m_versionEntries[i]->toNonGuiVersion());
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
231 versions.append (var);
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
232 }
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
233
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
234 Config::set ("wadpaths", wadPathList);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
235 Config::set ("noprompt", ui.noDemoPrompt->isChecked());
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
236 Config::set ("versions", versions);
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
237 Config::sync();
3
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
238 }
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
239
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
240 //
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
241 // -------------------------------------------------------------------------------------------------
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
242 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
243
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
244 void ConfigWindow::addWadPath()
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
245 {
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
246 addWadPath (ui.wad_pathEntry->text());
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
247 ui.wad_pathEntry->clear();
3
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
248 }
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
249
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
250 //
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
251 // -------------------------------------------------------------------------------------------------
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
252 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
253
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
254 void ConfigWindow::addWadPath (QString path)
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
255 {
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
256 ui.wad_pathsList->addItem (path);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
257 QListWidgetItem* item = ui.wad_pathsList->item (ui.wad_pathsList->count() - 1);
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
258 item->setFlags (item->flags() | Qt::ItemIsEditable);
3
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
259 }
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
260
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
261 //
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
262 // -------------------------------------------------------------------------------------------------
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
263 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
264
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
265 void ConfigWindow::findWadPath()
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
266 {
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
267 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
268
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
269 if (path.isEmpty())
3
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
270 return;
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
271
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
272 ui.wad_pathEntry->setText (path);
3
d0b278fd29d5 Implemented wad path list
Teemu Piippo <crimsondusk64@gmail.com>
parents: 2
diff changeset
273 }
5
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
274
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
275 //
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
276 // -------------------------------------------------------------------------------------------------
37
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
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
279 void ConfigWindow::removeCurrentWadPath()
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
280 {
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
281 delete ui.wad_pathsList->currentItem();
5
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
282 }
3c04e05ab24f Added configs for Zandronum binary paths
Teemu Piippo <crimsondusk64@gmail.com>
parents: 4
diff changeset
283
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
284 //
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
285 // -------------------------------------------------------------------------------------------------
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
286 //
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
287
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
288 void ConfigWindow::buttonPressed (QAbstractButton* btn)
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
289 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
290 if (btn == ui.buttonBox->button (QDialogButtonBox::Ok))
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
291 {
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
292 saveSettings();
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
293 accept();
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
294 }
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
295 else if (btn == ui.buttonBox->button (QDialogButtonBox::Cancel))
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
296 {
10
bc1414343e19 Overhauled the way versions are handled, it's all kept dynamically now.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 8
diff changeset
297 reject();
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
298 }
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
299 }

mercurial