Qt: Allow saving empty string to config

This commit is contained in:
Stenzek 2024-11-14 00:06:01 +10:00
parent c2316dfdc8
commit 2da32d8e57
No known key found for this signature in database
2 changed files with 5 additions and 17 deletions

View File

@ -136,12 +136,7 @@ static void BindWidgetToInputProfileString(SettingsInterface* sif, WidgetType* w
Accessor::setStringValue(widget, value);
Accessor::connectValueChanged(widget, [widget, sif, section = std::move(section), key = std::move(key)]() {
const QString new_value = Accessor::getStringValue(widget);
if (!new_value.isEmpty())
sif->SetStringValue(section.c_str(), key.c_str(), new_value.toUtf8().constData());
else
sif->DeleteValue(section.c_str(), key.c_str());
sif->SetStringValue(section.c_str(), key.c_str(), Accessor::getStringValue(widget).toUtf8().constData());
QtHost::SaveGameSettings(sif, false);
g_emu_thread->reloadGameSettings();
});
@ -154,11 +149,8 @@ static void BindWidgetToInputProfileString(SettingsInterface* sif, WidgetType* w
Accessor::setStringValue(widget, value);
Accessor::connectValueChanged(widget, [widget, section = std::move(section), key = std::move(key)]() {
const QString new_value = Accessor::getStringValue(widget);
if (!new_value.isEmpty())
Host::SetBaseStringSettingValue(section.c_str(), key.c_str(), new_value.toUtf8().constData());
else
Host::DeleteBaseSettingValue(section.c_str(), key.c_str());
Host::SetBaseStringSettingValue(section.c_str(), key.c_str(),
Accessor::getStringValue(widget).toUtf8().constData());
Host::CommitBaseSettingChanges();
g_emu_thread->applySettings();
});

View File

@ -987,12 +987,8 @@ static void BindWidgetToStringSetting(SettingsInterface* sif, WidgetType* widget
Accessor::setStringValue(widget, value);
Accessor::connectValueChanged(widget, [widget, section = std::move(section), key = std::move(key)]() {
const QString new_value = Accessor::getStringValue(widget);
if (!new_value.isEmpty())
Host::SetBaseStringSettingValue(section.c_str(), key.c_str(), new_value.toUtf8().constData());
else
Host::DeleteBaseSettingValue(section.c_str(), key.c_str());
Host::SetBaseStringSettingValue(section.c_str(), key.c_str(),
Accessor::getStringValue(widget).toUtf8().constData());
Host::CommitBaseSettingChanges();
g_emu_thread->applySettings();
});