QTfrontend/util/DataManager.cpp
changeset 7260 c3584a3ab730
parent 7258 722e8a0d89dc
child 7681 26978d581070
equal deleted inserted replaced
7258:722e8a0d89dc 7260:c3584a3ab730
    25 #include <QStringList>
    25 #include <QStringList>
    26 #include <QStandardItemModel>
    26 #include <QStandardItemModel>
    27 #include <QFileInfo>
    27 #include <QFileInfo>
    28 
    28 
    29 #include "hwconsts.h"
    29 #include "hwconsts.h"
       
    30 #include "HWApplication.h"
       
    31 #include "sdlkeys.h"
    30 
    32 
    31 #include "DataManager.h"
    33 #include "DataManager.h"
    32 
    34 
    33 #include "GameStyleModel.h"
    35 #include "GameStyleModel.h"
    34 #include "HatModel.h"
    36 #include "HatModel.h"
    45 
    47 
    46     m_hatModel = NULL;
    48     m_hatModel = NULL;
    47     m_mapModel = NULL;
    49     m_mapModel = NULL;
    48     m_themeModel = NULL;
    50     m_themeModel = NULL;
    49     m_colorsModel = NULL;
    51     m_colorsModel = NULL;
       
    52     m_bindsModel = NULL;
    50 }
    53 }
    51 
    54 
    52 
    55 
    53 DataManager & DataManager::instance()
    56 DataManager & DataManager::instance()
    54 {
    57 {
   176     }
   179     }
   177 
   180 
   178     return m_colorsModel;
   181     return m_colorsModel;
   179 }
   182 }
   180 
   183 
       
   184 QStandardItemModel * DataManager::bindsModel()
       
   185 {
       
   186     if(m_bindsModel == NULL)
       
   187     {
       
   188         m_bindsModel = new QStandardItemModel();
       
   189 
       
   190         for(int j = 0; sdlkeys[j][1][0] != '\0'; j++)
       
   191         {
       
   192             QStandardItem * item = new QStandardItem();
       
   193             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);
       
   194             item->setData(sdlkeys[j][0], Qt::UserRole + 1);
       
   195             m_bindsModel->appendRow(item);
       
   196         }
       
   197     }
       
   198 
       
   199     return m_bindsModel;
       
   200 }
       
   201 
   181 void DataManager::reload()
   202 void DataManager::reload()
   182 {
   203 {
   183     m_gameStyleModel->loadGameStyles();
   204     m_gameStyleModel->loadGameStyles();
   184     m_hatModel->loadHats();
   205     m_hatModel->loadHats();
   185     m_mapModel->loadMaps();
   206     m_mapModel->loadMaps();