Qt: Fix boolean setting loading

This commit is contained in:
Jeffrey Pfau 2014-11-09 23:44:06 -08:00
parent ea66055c63
commit 6066c6e373
1 changed files with 6 additions and 2 deletions

View File

@ -42,7 +42,7 @@ QAction* ConfigOption::addBoolean(const QString& text, QMenu* parent) {
emit valueChanged(action->isChecked());
});
parent->addAction(action);
m_actions.append(qMakePair(action, true));
m_actions.append(qMakePair(action, 1));
return action;
}
@ -126,7 +126,7 @@ void ConfigController::updateOption(const char* key) {
}
void ConfigController::setOption(const char* key, bool value) {
setOption(key, (int) value);
GBAConfigSetIntValue(&m_config, key, value);
ConfigOption* option = m_optionSet[QString(key)];
if (option) {
option->setValue(value);
@ -158,6 +158,10 @@ void ConfigController::setOption(const char* key, const char* value) {
}
void ConfigController::setOption(const char* key, const QVariant& value) {
if (value.type() == QVariant::Bool) {
setOption(key, value.toBool());
return;
}
QString stringValue(value.toString());
setOption(key, stringValue.toLocal8Bit().constData());
}