QTfrontend/main.cpp
changeset 2898 c53636f556f8
parent 2897 5eda7b3cc24f
child 2901 6d2636144e1f
--- a/QTfrontend/main.cpp	Mon Mar 01 12:20:38 2010 +0000
+++ b/QTfrontend/main.cpp	Mon Mar 01 12:55:54 2010 +0000
@@ -23,6 +23,7 @@
 #include <QPlastiqueStyle>
 #include <QRegExp>
 #include <QMap>
+#include <QSettings>
 
 #include "hwform.h"
 #include "hwconsts.h"
@@ -321,6 +322,7 @@
 		}
 	}
 
+
 	datadir->cd(bindir->absolutePath());
 	datadir->cd(*cDataDir);
 	if(!datadir->cd("hedgewars/Data")) {
@@ -331,11 +333,7 @@
 		return 1;
 	}
 
-	QTranslator Translator;
-	Translator.load(datadir->absolutePath() + "/Locale/hedgewars_" + QLocale::system().name());
-	app.installTranslator(&Translator);
-
-	Themes = new QStringList();
+	/*Themes = new QStringList();
 	QFile themesfile(datadir->absolutePath() + "/Themes/themes.cfg");
 	if (themesfile.open(QIODevice::ReadOnly)) {
 		QTextStream stream(&themesfile);
@@ -347,14 +345,29 @@
 		themesfile.close();
 	} else {
 		QMessageBox::critical(0, "Error", "Cannot access themes.cfg", "OK");
-	}
+	}*/
 
 	QDir tmpdir;
 	tmpdir.cd(datadir->absolutePath());
+	tmpdir.cd("Themes");
+	tmpdir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
+	Themes = new QStringList(tmpdir.entryList(QStringList("*")));
+
+	tmpdir.cd(datadir->absolutePath());
 	tmpdir.cd("Maps");
 	tmpdir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
 	mapList = new QStringList(tmpdir.entryList(QStringList("*")));
 
+
+	QTranslator Translator;
+	{
+		QSettings settings(cfgdir->absolutePath() + "/hedgewars.ini", QSettings::IniFormat);
+		
+		Translator.load(datadir->absolutePath() + "/Locale/hedgewars_" + settings.value("misc/locale", QLocale::system().name()).toString());
+		app.installTranslator(&Translator);
+	}
+
+
 	HWForm *Form = new HWForm();