QTfrontend/gameuiconfig.cpp
changeset 8350 14b938faec69
parent 8343 aa4ea3cade3c
parent 8346 3443e0de2c9d
child 8354 c25bee85d6f8
equal deleted inserted replaced
8345:9d9b498cfb03 8350:14b938faec69
    50     Form = FormWidgets;
    50     Form = FormWidgets;
    51 
    51 
    52     setIniCodec("UTF-8");
    52     setIniCodec("UTF-8");
    53 
    53 
    54     connect(Form->ui.pageOptions->CBFrontendMusic, SIGNAL(toggled(bool)), Form, SLOT(Music(bool)));
    54     connect(Form->ui.pageOptions->CBFrontendMusic, SIGNAL(toggled(bool)), Form, SLOT(Music(bool)));
       
    55 
       
    56     for(int i = 0; i < BINDS_NUMBER; i++)
       
    57     {
       
    58         m_binds.append(BindAction());
       
    59         m_binds[i].action = cbinds[i].action;
       
    60         m_binds[i].strbind = cbinds[i].strbind;
       
    61     }
    55 
    62 
    56     //Form->resize(value("frontend/width", 640).toUInt(), value("frontend/height", 450).toUInt());
    63     //Form->resize(value("frontend/width", 640).toUInt(), value("frontend/height", 450).toUInt());
    57     resizeToConfigValues();
    64     resizeToConfigValues();
    58 
    65 
    59     reloadValues();
    66     reloadValues();
   147 
   154 
   148     { // load colors
   155     { // load colors
   149         QStandardItemModel * model = DataManager::instance().colorsModel();
   156         QStandardItemModel * model = DataManager::instance().colorsModel();
   150         for(int i = model->rowCount() - 1; i >= 0; --i)
   157         for(int i = model->rowCount() - 1; i >= 0; --i)
   151             model->item(i)->setData(QColor(value(QString("colors/color%1").arg(i), model->item(i)->data().value<QColor>()).value<QColor>()));
   158             model->item(i)->setData(QColor(value(QString("colors/color%1").arg(i), model->item(i)->data().value<QColor>()).value<QColor>()));
       
   159     }
       
   160 
       
   161     { // load binds
       
   162         QStandardItemModel * binds = DataManager::instance().bindsModel();
       
   163         for(int i = 0; i < BINDS_NUMBER; i++)
       
   164         {
       
   165             m_binds[i].strbind = value(QString("Binds/%1").arg(m_binds[i].action), cbinds[i].strbind).toString();
       
   166             if (m_binds[i].strbind.isEmpty() || m_binds[i].strbind == "default") m_binds[i].strbind = cbinds[i].strbind;
       
   167         }
   152     }
   168     }
   153 }
   169 }
   154 
   170 
   155 void GameUIConfig::reloadVideosValues(void)
   171 void GameUIConfig::reloadVideosValues(void)
   156 {
   172 {
   602 
   618 
   603 bool GameUIConfig::recordAudio()
   619 bool GameUIConfig::recordAudio()
   604 {
   620 {
   605     return Form->ui.pageOptions->checkRecordAudio->isChecked();
   621     return Form->ui.pageOptions->checkRecordAudio->isChecked();
   606 }
   622 }
       
   623 
       
   624 // Gets a bind for a bindID
       
   625 QString GameUIConfig::bind(int bindID)
       
   626 {
       
   627     return m_binds[bindID].strbind;
       
   628 }
       
   629 
       
   630 // Sets a bind for a bindID and saves it
       
   631 void GameUIConfig::setBind(int bindID, QString & strbind)
       
   632 {
       
   633     m_binds[bindID].strbind = strbind;
       
   634     setValue(QString("Binds/%1").arg(m_binds[bindID].action), strbind);
       
   635 }