diff options
author | Ameer J <52414509+ameerj@users.noreply.github.com> | 2021-05-27 13:07:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-27 13:07:53 -0400 |
commit | 9110cfdefb2085d956c430df78dd4e694eca0728 (patch) | |
tree | a5597a7b5583cbabc36ac5a9d5063adf2ac4076d /src/yuzu/main.cpp | |
parent | 116989be8e0900a42a1e1b9226acb08808356ab6 (diff) | |
parent | c1bad4357ac90de0dc25f2d4fb3ae7f9dbe138b6 (diff) |
Merge pull request #6346 from lat9nq/apply-config-pgc
yuzu qt: Add an Apply button to configuration dialogs
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r-- | src/yuzu/main.cpp | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 37ef62967..0f0e228b0 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -2587,12 +2587,12 @@ void GMainWindow::OnConfigure() { &GMainWindow::OnLanguageChanged); const auto result = configure_dialog.exec(); - if (result != QDialog::Accepted) { + if (result != QDialog::Accepted && !UISettings::values.configuration_applied) { return; + } else if (result == QDialog::Accepted) { + configure_dialog.ApplyConfiguration(); + controller_dialog->refreshConfiguration(); } - - configure_dialog.ApplyConfiguration(); - controller_dialog->refreshConfiguration(); InitializeHotkeys(); if (UISettings::values.theme != old_theme) { UpdateUITheme(); @@ -2607,6 +2607,8 @@ void GMainWindow::OnConfigure() { game_list->PopulateAsync(UISettings::values.game_dirs); } + UISettings::values.configuration_applied = false; + config->Save(); if ((UISettings::values.hide_mouse || Settings::values.mouse_panning) && emulation_running) { @@ -2636,23 +2638,27 @@ void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file ConfigurePerGame dialog(this, title_id); dialog.LoadFromFile(v_file); const auto result = dialog.exec(); - if (result == QDialog::Accepted) { + + if (result != QDialog::Accepted && !UISettings::values.configuration_applied) { + Settings::RestoreGlobalState(system.IsPoweredOn()); + return; + } else if (result == QDialog::Accepted) { dialog.ApplyConfiguration(); + } - const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false); - if (reload) { - game_list->PopulateAsync(UISettings::values.game_dirs); - } + const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false); + if (reload) { + game_list->PopulateAsync(UISettings::values.game_dirs); + } - // Do not cause the global config to write local settings into the config file - const bool is_powered_on = system.IsPoweredOn(); - Settings::RestoreGlobalState(is_powered_on); + // Do not cause the global config to write local settings into the config file + const bool is_powered_on = system.IsPoweredOn(); + Settings::RestoreGlobalState(is_powered_on); - if (!is_powered_on) { - config->Save(); - } - } else { - Settings::RestoreGlobalState(system.IsPoweredOn()); + UISettings::values.configuration_applied = false; + + if (!is_powered_on) { + config->Save(); } } |