config/configwindow.cpp

changeset 56
bdbbde5f754e
parent 54
0b3a5bc4e8a8
child 66
c68545f1aecb
--- a/config/configwindow.cpp	Sun Jun 07 19:56:40 2015 +0300
+++ b/config/configwindow.cpp	Mon Jun 22 01:44:30 2015 +0300
@@ -21,6 +21,7 @@
 #include <QLabel>
 #include <commonlib/config.h>
 #include <commonlib/version.h>
+#include <commonlib/misc.h>
 #include "addversionprompt.h"
 #include "configwindow.h"
 #include "versionguientry.h"
@@ -63,6 +64,7 @@
 		addWadPath (wadpaths[i]);
 
 	ui.noDemoPrompt->setChecked (Config::get ("noprompt").toBool());
+	ui.autoAssimilate->setChecked (Config::get ("autoassimilate").toBool());
 
 	for (int i = 0; i < versions.size(); ++i)
 	{
@@ -76,6 +78,7 @@
 	connect (ui.wad_pathEntry, SIGNAL (returnPressed()), this, SLOT (addWadPath()));
 	connect (ui.wad_findPath, SIGNAL (clicked()), this, SLOT (findWadPath()));
 	connect (ui.wad_del, SIGNAL (clicked()), this, SLOT (removeCurrentWadPath()));
+	connect (ui.wad_autofind, SIGNAL (clicked()), this, SLOT (autoFindWadPaths()));
 	connect (ui.buttonBox, SIGNAL (clicked (QAbstractButton*)), this,
 		SLOT (buttonPressed (QAbstractButton*)));
 	connect (ui.addExePath, SIGNAL (clicked()), this, SLOT (newVersion()));
@@ -242,6 +245,7 @@
 
 	Config::set ("wadpaths", wadPathList);
 	Config::set ("noprompt", ui.noDemoPrompt->isChecked());
+	Config::set ("autoassimilate", ui.autoAssimilate->isChecked());
 	Config::set ("versions", versions);
 	Config::sync();
 }
@@ -271,6 +275,24 @@
 // -------------------------------------------------------------------------------------------------
 //
 
+void ConfigWindow::autoFindWadPaths()
+{
+	QStringList paths;
+
+	for (int i = 0; i < ui.wad_pathsList->count(); ++i)
+		paths.append (ui.wad_pathsList->item (i)->text());
+
+	assimilateWadPaths (paths);
+	ui.wad_pathsList->clear();
+
+	for (int i = 0; i < paths.size(); ++i)
+		addWadPath (paths[i]);
+}
+
+//
+// -------------------------------------------------------------------------------------------------
+//
+
 void ConfigWindow::findWadPath()
 {
 	QString path = QFileDialog::getExistingDirectory (this);

mercurial