Improve initialization order.
[dorian] / model / settings.cpp
index 62fdcec..810e15e 100644 (file)
@@ -1,11 +1,13 @@
 #include <QSettings>
+#include <QString>
+#include <QStringList>
 
 #include "settings.h"
+#include "trace.h"
 
 static Settings *theInstance;
 
-Settings::Settings(QObject *parent) :
-    QObject(parent)
+Settings::Settings(): QObject(0)
 {
 }
 
@@ -35,3 +37,15 @@ QVariant Settings::value(const QString &key, const QVariant &defaultValue) const
     QSettings s;
     return s.value(QString("settings/") + key, defaultValue);
 }
+
+void Settings::apply()
+{
+    TRACE;
+    QSettings s;
+    foreach (QString key, s.allKeys()) {
+        if (key.startsWith("settings/")) {
+            key = key.mid(9);
+            setValue(key, value(key));
+        }
+    }
+}