--- a/QTfrontend/util/DataManager.cpp Wed Apr 17 11:24:06 2013 -0400
+++ b/QTfrontend/util/DataManager.cpp Thu Apr 18 00:41:27 2013 +0400
@@ -25,6 +25,7 @@
#include <QStringList>
#include <QStandardItemModel>
#include <QFileInfo>
+#include <QSettings>
#include "hwconsts.h"
#include "HWApplication.h"
@@ -162,6 +163,36 @@
return m_bindsModel;
}
+QString DataManager::settingsFileName()
+{
+ if(m_settingsFileName.isEmpty())
+ {
+ QFile settingsFile("physfs://settings.ini");
+
+ if(!settingsFile.exists())
+ {
+ QFile oldSettingsFile("physfs://hedgewars.ini");
+
+ settingsFile.open(QFile::WriteOnly);
+ settingsFile.close();
+
+ if(oldSettingsFile.exists())
+ {
+ QSettings sOld(oldSettingsFile.fileName(), QSettings::IniFormat);
+ QSettings sNew(settingsFile.fileName(), QSettings::IniFormat);
+ sNew.setIniCodec("UTF-8");
+
+ foreach(const QString & key, sOld.allKeys())
+ sNew.setValue(key, sOld.value(key));
+ }
+ }
+
+ m_settingsFileName = settingsFile.fileName();
+ }
+
+ return m_settingsFileName;
+}
+
void DataManager::reload()
{
// removed for now (also code was a bit unclean, could lead to segfault if