mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-10 16:28:15 -05:00
yuzu qt: Add an Apply button to configuration dialogs
Most of the code already exists to do this, but the Apply button itself was never added. This adds a button and boolean that tells yuzu to save the configuration after applying settings, even if close/Cancel is pressed on the dialog. Changes after applying will not be saved when Cancel is pressed, though.
This commit is contained in:
@ -2578,12 +2578,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();
|
||||
@ -2598,6 +2598,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) {
|
||||
@ -2627,23 +2629,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) {
|
||||
dialog.ApplyConfiguration();
|
||||
|
||||
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);
|
||||
|
||||
if (!is_powered_on) {
|
||||
config->Save();
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
UISettings::values.configuration_applied = false;
|
||||
|
||||
if (!is_powered_on) {
|
||||
config->Save();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user