Allow external translation files
[quassel.git] / src / core / core.cpp
index 9c92faf..92e0908 100644 (file)
@@ -18,8 +18,6 @@
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
-#include <QMetaObject>
-#include <QMetaMethod>
 #include <QCoreApplication>
 
 #include "core.h"
@@ -53,7 +51,7 @@ void Core::destroy() {
 Core::Core() : storage(0) {
   _startTime = QDateTime::currentDateTime().toUTC();  // for uptime :)
 
-  loadTranslation(QLocale::system());
+  Quassel::loadTranslation(QLocale::system());
 
   // FIXME: MIGRATION 0.3 -> 0.4: Move database and core config to new location
   // Move settings, note this does not delete the old files
@@ -71,8 +69,7 @@ Core::Core() : storage(0) {
     QSettings newSettings(newFilePath, format);
 #endif /* Q_WS_MAC */
 
-  if(newSettings.value("Config/Version").toUInt() != 1) {
-    qWarning() << "\n\n*** IMPORTANT: Config and data file locations have changed. Attempting to auto-migrate your core settings...";
+  if(newSettings.value("Config/Version").toUInt() == 0) {
 #   ifdef Q_WS_MAC
     QString org = "quassel-irc.org";
 #   else
@@ -80,6 +77,7 @@ Core::Core() : storage(0) {
 #   endif
     QSettings oldSettings(org, "Quassel Core");
     if(oldSettings.allKeys().count()) {
+      qWarning() << "\n\n*** IMPORTANT: Config and data file locations have changed. Attempting to auto-migrate your core settings...";
       foreach(QString key, oldSettings.allKeys())
         newSettings.setValue(key, oldSettings.value(key));
       newSettings.setValue("Config/Version", 1);
@@ -122,6 +120,14 @@ Core::Core() : storage(0) {
 #endif /* !Q_WS_MAC */
   // MIGRATION end
 
+  // check settings version
+  // so far, we only have 1
+  CoreSettings s;
+  if(s.version() != 1) {
+    qCritical() << "Invalid core settings version, terminating!";
+    exit(EXIT_FAILURE);
+  }
+
   // Register storage backends here!
   registerStorageBackend(new SqliteStorage(this));