mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-20 22:15:46 +00:00
configuration: Simplify applying per-game settings
Originally, every time we add a per-game setting, we'd have to guard for it when setting it on the global config, and use a specific function to do it for the per-game config. This moves the global check into the ApplyPerGameSetting function so that we can use it for changing both the global and per-game states. Less work for the programmer.
This commit is contained in:
parent
11b43840a9
commit
4158f88b49
6 changed files with 69 additions and 112 deletions
|
@ -127,21 +127,15 @@ void ConfigureSystem::ApplyConfiguration() {
|
|||
return;
|
||||
}
|
||||
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.language_index,
|
||||
ui->combo_language);
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.region_index, ui->combo_region);
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.time_zone_index,
|
||||
ui->combo_time_zone);
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.sound_index, ui->combo_sound);
|
||||
|
||||
if (Settings::IsConfiguringGlobal()) {
|
||||
// Guard if during game and set to game-specific value
|
||||
if (Settings::values.language_index.UsingGlobal()) {
|
||||
Settings::values.language_index.SetValue(ui->combo_language->currentIndex());
|
||||
}
|
||||
if (Settings::values.region_index.UsingGlobal()) {
|
||||
Settings::values.region_index.SetValue(ui->combo_region->currentIndex());
|
||||
}
|
||||
if (Settings::values.time_zone_index.UsingGlobal()) {
|
||||
Settings::values.time_zone_index.SetValue(ui->combo_time_zone->currentIndex());
|
||||
}
|
||||
if (Settings::values.sound_index.UsingGlobal()) {
|
||||
Settings::values.sound_index.SetValue(ui->combo_sound->currentIndex());
|
||||
}
|
||||
|
||||
if (Settings::values.rng_seed.UsingGlobal()) {
|
||||
if (ui->rng_seed_checkbox->isChecked()) {
|
||||
Settings::values.rng_seed.SetValue(
|
||||
|
@ -151,13 +145,6 @@ void ConfigureSystem::ApplyConfiguration() {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.language_index,
|
||||
ui->combo_language);
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.region_index, ui->combo_region);
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.time_zone_index,
|
||||
ui->combo_time_zone);
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.sound_index, ui->combo_sound);
|
||||
|
||||
switch (use_rng_seed) {
|
||||
case ConfigurationShared::CheckState::On:
|
||||
case ConfigurationShared::CheckState::Off:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue