--- a/QTfrontend/util/DataManager.cpp Tue Jun 19 21:17:05 2012 +0200
+++ b/QTfrontend/util/DataManager.cpp Tue Jun 19 21:20:08 2012 +0200
@@ -23,13 +23,19 @@
#include <QMap>
#include <QStringList>
-
+#include <QStandardItemModel>
#include <QFileInfo>
#include "hwconsts.h"
+#include "HWApplication.h"
+#include "sdlkeys.h"
#include "DataManager.h"
+#include "GameStyleModel.h"
+#include "HatModel.h"
+#include "MapModel.h"
+#include "ThemeModel.h"
DataManager::DataManager()
{
@@ -42,6 +48,8 @@
m_hatModel = NULL;
m_mapModel = NULL;
m_themeModel = NULL;
+ m_colorsModel = NULL;
+ m_bindsModel = NULL;
}
@@ -154,6 +162,43 @@
return m_themeModel;
}
+QStandardItemModel * DataManager::colorsModel()
+{
+ if(m_colorsModel == NULL)
+ {
+ m_colorsModel = new QStandardItemModel();
+
+ int i = 0;
+ while(colors[i])
+ {
+ QStandardItem * item = new QStandardItem();
+ item->setData(QColor(colors[i]));
+ m_colorsModel->appendRow(item);
+ ++i;
+ }
+ }
+
+ return m_colorsModel;
+}
+
+QStandardItemModel * DataManager::bindsModel()
+{
+ if(m_bindsModel == NULL)
+ {
+ m_bindsModel = new QStandardItemModel();
+
+ for(int j = 0; sdlkeys[j][1][0] != '\0'; j++)
+ {
+ QStandardItem * item = new QStandardItem();
+ item->setData(HWApplication::translate("binds (keys)", sdlkeys[j][1]).contains(": ") ? HWApplication::translate("binds (keys)", sdlkeys[j][1]) : HWApplication::translate("binds (keys)", "Keyboard") + QString(": ") + HWApplication::translate("binds (keys)", sdlkeys[j][1]), Qt::DisplayRole);
+ item->setData(sdlkeys[j][0], Qt::UserRole + 1);
+ m_bindsModel->appendRow(item);
+ }
+ }
+
+ return m_bindsModel;
+}
+
void DataManager::reload()
{
m_gameStyleModel->loadGameStyles();