19 #include <QFileDialog> |
19 #include <QFileDialog> |
20 #include <QMessageBox> |
20 #include <QMessageBox> |
21 #include <QLabel> |
21 #include <QLabel> |
22 #include <commonlib/config.h> |
22 #include <commonlib/config.h> |
23 #include <commonlib/version.h> |
23 #include <commonlib/version.h> |
|
24 #include <commonlib/misc.h> |
24 #include "addversionprompt.h" |
25 #include "addversionprompt.h" |
25 #include "configwindow.h" |
26 #include "configwindow.h" |
26 #include "versionguientry.h" |
27 #include "versionguientry.h" |
27 #include "ui_configbox.h" |
28 #include "ui_configbox.h" |
28 |
29 |
61 |
62 |
62 for (int i = 0; i < wadpaths.size(); ++i) |
63 for (int i = 0; i < wadpaths.size(); ++i) |
63 addWadPath (wadpaths[i]); |
64 addWadPath (wadpaths[i]); |
64 |
65 |
65 ui.noDemoPrompt->setChecked (Config::get ("noprompt").toBool()); |
66 ui.noDemoPrompt->setChecked (Config::get ("noprompt").toBool()); |
|
67 ui.autoAssimilate->setChecked (Config::get ("autoassimilate").toBool()); |
66 |
68 |
67 for (int i = 0; i < versions.size(); ++i) |
69 for (int i = 0; i < versions.size(); ++i) |
68 { |
70 { |
69 if (not versions[i].canConvert<ZandronumVersion>()) |
71 if (not versions[i].canConvert<ZandronumVersion>()) |
70 continue; |
72 continue; |
74 |
76 |
75 connect (ui.wad_add, SIGNAL (clicked()), this, SLOT (addWadPath())); |
77 connect (ui.wad_add, SIGNAL (clicked()), this, SLOT (addWadPath())); |
76 connect (ui.wad_pathEntry, SIGNAL (returnPressed()), this, SLOT (addWadPath())); |
78 connect (ui.wad_pathEntry, SIGNAL (returnPressed()), this, SLOT (addWadPath())); |
77 connect (ui.wad_findPath, SIGNAL (clicked()), this, SLOT (findWadPath())); |
79 connect (ui.wad_findPath, SIGNAL (clicked()), this, SLOT (findWadPath())); |
78 connect (ui.wad_del, SIGNAL (clicked()), this, SLOT (removeCurrentWadPath())); |
80 connect (ui.wad_del, SIGNAL (clicked()), this, SLOT (removeCurrentWadPath())); |
|
81 connect (ui.wad_autofind, SIGNAL (clicked()), this, SLOT (autoFindWadPaths())); |
79 connect (ui.buttonBox, SIGNAL (clicked (QAbstractButton*)), this, |
82 connect (ui.buttonBox, SIGNAL (clicked (QAbstractButton*)), this, |
80 SLOT (buttonPressed (QAbstractButton*))); |
83 SLOT (buttonPressed (QAbstractButton*))); |
81 connect (ui.addExePath, SIGNAL (clicked()), this, SLOT (newVersion())); |
84 connect (ui.addExePath, SIGNAL (clicked()), this, SLOT (newVersion())); |
82 connect (ui.editExePath, SIGNAL (clicked()), this, SLOT (editExePressed())); |
85 connect (ui.editExePath, SIGNAL (clicked()), this, SLOT (editExePressed())); |
83 connect (ui.removeExePath, SIGNAL (clicked()), this, SLOT (removeCurrentVersion())); |
86 connect (ui.removeExePath, SIGNAL (clicked()), this, SLOT (removeCurrentVersion())); |
240 versions.append (var); |
243 versions.append (var); |
241 } |
244 } |
242 |
245 |
243 Config::set ("wadpaths", wadPathList); |
246 Config::set ("wadpaths", wadPathList); |
244 Config::set ("noprompt", ui.noDemoPrompt->isChecked()); |
247 Config::set ("noprompt", ui.noDemoPrompt->isChecked()); |
|
248 Config::set ("autoassimilate", ui.autoAssimilate->isChecked()); |
245 Config::set ("versions", versions); |
249 Config::set ("versions", versions); |
246 Config::sync(); |
250 Config::sync(); |
247 } |
251 } |
248 |
252 |
249 // |
253 // |
269 |
273 |
270 // |
274 // |
271 // ------------------------------------------------------------------------------------------------- |
275 // ------------------------------------------------------------------------------------------------- |
272 // |
276 // |
273 |
277 |
|
278 void ConfigWindow::autoFindWadPaths() |
|
279 { |
|
280 QStringList paths; |
|
281 |
|
282 for (int i = 0; i < ui.wad_pathsList->count(); ++i) |
|
283 paths.append (ui.wad_pathsList->item (i)->text()); |
|
284 |
|
285 assimilateWadPaths (paths); |
|
286 ui.wad_pathsList->clear(); |
|
287 |
|
288 for (int i = 0; i < paths.size(); ++i) |
|
289 addWadPath (paths[i]); |
|
290 } |
|
291 |
|
292 // |
|
293 // ------------------------------------------------------------------------------------------------- |
|
294 // |
|
295 |
274 void ConfigWindow::findWadPath() |
296 void ConfigWindow::findWadPath() |
275 { |
297 { |
276 QString path = QFileDialog::getExistingDirectory (this); |
298 QString path = QFileDialog::getExistingDirectory (this); |
277 |
299 |
278 if (path.isEmpty()) |
300 if (path.isEmpty()) |