QTfrontend/ui/page/pageoptions.cpp
changeset 14852 56293aa24e81
parent 14677 93429d8f6b3f
child 14899 4d5df8d35a95
equal deleted inserted replaced
14851:058e204908a6 14852:56293aa24e81
  1238 
  1238 
  1239 // Changes a key bind (bindID) to its default value. This updates the bind's combo-box in the UI.
  1239 // Changes a key bind (bindID) to its default value. This updates the bind's combo-box in the UI.
  1240 // Returns: The bind model index of the default.
  1240 // Returns: The bind model index of the default.
  1241 int PageOptions::resetBindToDefault(int bindID)
  1241 int PageOptions::resetBindToDefault(int bindID)
  1242 {
  1242 {
       
  1243     if (QString(cbinds[bindID].action) == QString("!MULTI"))
       
  1244         return -1;
  1243     QStandardItemModel * binds = DataManager::instance().bindsModel();
  1245     QStandardItemModel * binds = DataManager::instance().bindsModel();
  1244     QModelIndexList mdl = binds->match(binds->index(0, 0), Qt::UserRole + 1, cbinds[bindID].strbind, 1, Qt::MatchExactly);
  1246     QModelIndexList mdl = binds->match(binds->index(0, 0), Qt::UserRole + 1, cbinds[bindID].strbind, 1, Qt::MatchExactly);
  1245     if(mdl.size() == 1) binder->setBindIndex(bindID, mdl[0].row());
  1247     if(mdl.size() == 1)
       
  1248         binder->setBindIndex(bindID, mdl[0].row());
  1246     return mdl[0].row();
  1249     return mdl[0].row();
  1247 }
  1250 }
  1248 
  1251 
  1249 // Called when "reset all binds" button is pressed
  1252 // Called when "reset all binds" button is pressed
  1250 void PageOptions::resetAllBinds()
  1253 void PageOptions::resetAllBinds()
  1251 {
  1254 {
  1252     for (int i = 0; i < BINDS_NUMBER; i++)
  1255     for (int i = 0; i < BINDS_NUMBER; i++)
  1253     {
  1256     {
  1254         resetBindToDefault(i);
  1257         int ret = resetBindToDefault(i);
  1255         bindUpdated(i);
  1258         if(ret != -1)
  1256     }
  1259             bindUpdated(i);
  1257 }
  1260     }
       
  1261 }