QTfrontend/util/DataManager.cpp
changeset 7260 c3584a3ab730
parent 7258 722e8a0d89dc
child 7681 26978d581070
--- a/QTfrontend/util/DataManager.cpp	Sun Jun 17 21:45:49 2012 +0400
+++ b/QTfrontend/util/DataManager.cpp	Sun Jun 17 22:11:09 2012 +0400
@@ -27,6 +27,8 @@
 #include <QFileInfo>
 
 #include "hwconsts.h"
+#include "HWApplication.h"
+#include "sdlkeys.h"
 
 #include "DataManager.h"
 
@@ -47,6 +49,7 @@
     m_mapModel = NULL;
     m_themeModel = NULL;
     m_colorsModel = NULL;
+    m_bindsModel = NULL;
 }
 
 
@@ -178,6 +181,24 @@
     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();