Well, if we check for a settings version, maybe we should set it too...
[quassel.git] / src / qtui / qtuiapplication.cpp
index d9165ba..8acead9 100644 (file)
@@ -29,6 +29,7 @@
 #include "client.h"
 #include "cliparser.h"
 #include "qtui.h"
+#include "qtuisettings.h"
 #include "sessionsettings.h"
 
 QtUiApplication::QtUiApplication(int &argc, char **argv)
@@ -66,16 +67,22 @@ bool QtUiApplication::init() {
 
     // FIXME: MIGRATION 0.3 -> 0.4: Move database and core config to new location
     // Move settings, note this does not delete the old files
-#ifdef Q_WS_WIN
-    QSettings::Format format = QSettings::IniFormat;
+#ifdef Q_WS_MAC
+    QSettings newSettings("quassel-irc.org", "quasselclient");
 #else
+
+# ifdef Q_WS_WIN
+    QSettings::Format format = QSettings::IniFormat;
+# else
     QSettings::Format format = QSettings::NativeFormat;
-#endif
+# endif
+
     QString newFilePath = Quassel::configDirPath() + "quasselclient"
     + ((format == QSettings::NativeFormat) ? QLatin1String(".conf") : QLatin1String(".ini"));
     QSettings newSettings(newFilePath, format);
+#endif /* Q_WS_MAC */
 
-    if(newSettings.value("General/Version").toUInt() != 1) {
+    if(newSettings.value("Config/Version").toUInt() == 0) {
       qWarning() << "\n\n*** IMPORTANT: Config and data file locations have changed. Attempting to auto-migrate your client settings...";
 #     ifdef Q_WS_MAC
         QString org = "quassel-irc.org";
@@ -94,6 +101,14 @@ bool QtUiApplication::init() {
 
     // MIGRATION end
 
+    // check settings version
+    // so far, we only have 1
+    QtUiSettings s;
+    if(s.version() != 1) {
+      qCritical() << "Invalid client settings version, terminating!";
+      return false;
+    }
+
     // session resume
     QtUi *gui = new QtUi();
     Client::init(gui);
@@ -111,6 +126,7 @@ QtUiApplication::~QtUiApplication() {
 }
 
 void QtUiApplication::commitData(QSessionManager &manager) {
+  Q_UNUSED(manager)
   _aboutToQuit = true;
 }