QTfrontend/gameuiconfig.cpp
changeset 7565 00568d3054d0
parent 7347 88685fbb2679
parent 7541 e51b11349637
child 7633 d4251e519062
--- a/QTfrontend/gameuiconfig.cpp	Sun Aug 12 23:05:15 2012 +0400
+++ b/QTfrontend/gameuiconfig.cpp	Sun Aug 19 22:13:41 2012 +0400
@@ -22,6 +22,7 @@
 #include <QDesktopWidget>
 #include <QInputDialog>
 #include <QCryptographicHash>
+#include <QStandardItemModel>
 
 #include "gameuiconfig.h"
 #include "hwform.h"
@@ -31,6 +32,7 @@
 #include "hwconsts.h"
 #include "fpsedit.h"
 #include "HWApplication.h"
+#include "DataManager.h"
 
 GameUIConfig::GameUIConfig(HWForm * FormWidgets, const QString & fileName)
     : QSettings(fileName, QSettings::IniFormat)
@@ -110,6 +112,12 @@
     depth = HWApplication::desktop()->depth();
     if (depth < 16) depth = 16;
     else if (depth > 16) depth = 32;
+
+    { // load colors
+        QStandardItemModel * model = DataManager::instance().colorsModel();
+        for(int i = model->rowCount() - 1; i >= 0; --i)
+            model->item(i)->setData(QColor(value(QString("colors/color%1").arg(i), model->item(i)->data().value<QColor>()).value<QColor>()));
+    }
 }
 
 void GameUIConfig::reloadVideosValues(void)
@@ -208,6 +216,12 @@
     setValue("misc/autoUpdate", isAutoUpdateEnabled());
 #endif
 
+    { // save colors
+        QStandardItemModel * model = DataManager::instance().colorsModel();
+        for(int i = model->rowCount() - 1; i >= 0; --i)
+            setValue(QString("colors/color%1").arg(i), model->item(i)->data());
+    }
+
     Form->gameSettings->sync();
 }