From 251b26577707a8f1b6523ffb79560b7e1f148004 Mon Sep 17 00:00:00 2001 From: FearlessTobi Date: Sun, 3 Jan 2021 05:28:52 +0100 Subject: [PATCH] citra_qt/main: Save settings when starting guest Saves UISettings and Settings when booting a guest. Moves updating UISettings::values from GMainWindow::closeEvent into its own function, then reuses it in GMainWindow::BootGame. Co-Authored-By: lat9nq <22451773+lat9nq@users.noreply.github.com> --- src/citra_qt/main.cpp | 40 ++++++++++++++++++++++++---------------- src/citra_qt/main.h | 1 + 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index e4a1832ee..06efc9786 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -1013,6 +1013,11 @@ void GMainWindow::BootGame(const QString& filename) { Core::Movie::GetInstance().PrepareForRecording(); } + // Save configurations + UpdateUISettings(); + game_list->SaveInterfaceLayout(); + config->Save(); + if (!LoadROM(filename)) return; @@ -2186,22 +2191,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) { return; } - if (!ui->action_Fullscreen->isChecked()) { - UISettings::values.geometry = saveGeometry(); - UISettings::values.renderwindow_geometry = render_window->saveGeometry(); - } - UISettings::values.state = saveState(); -#if MICROPROFILE_ENABLED - UISettings::values.microprofile_geometry = microProfileDialog->saveGeometry(); - UISettings::values.microprofile_visible = microProfileDialog->isVisible(); -#endif - UISettings::values.single_window_mode = ui->action_Single_Window_Mode->isChecked(); - UISettings::values.fullscreen = ui->action_Fullscreen->isChecked(); - UISettings::values.display_titlebar = ui->action_Display_Dock_Widget_Headers->isChecked(); - UISettings::values.show_filter_bar = ui->action_Show_Filter_Bar->isChecked(); - UISettings::values.show_status_bar = ui->action_Show_Status_Bar->isChecked(); - UISettings::values.first_start = false; - + UpdateUISettings(); game_list->SaveInterfaceLayout(); hotkey_registry.SaveHotkeys(); @@ -2370,6 +2360,24 @@ void GMainWindow::UpdateWindowTitle() { } } +void GMainWindow::UpdateUISettings() { + if (!ui->action_Fullscreen->isChecked()) { + UISettings::values.geometry = saveGeometry(); + UISettings::values.renderwindow_geometry = render_window->saveGeometry(); + } + UISettings::values.state = saveState(); +#if MICROPROFILE_ENABLED + UISettings::values.microprofile_geometry = microProfileDialog->saveGeometry(); + UISettings::values.microprofile_visible = microProfileDialog->isVisible(); +#endif + UISettings::values.single_window_mode = ui->action_Single_Window_Mode->isChecked(); + UISettings::values.fullscreen = ui->action_Fullscreen->isChecked(); + UISettings::values.display_titlebar = ui->action_Display_Dock_Widget_Headers->isChecked(); + UISettings::values.show_filter_bar = ui->action_Show_Filter_Bar->isChecked(); + UISettings::values.show_status_bar = ui->action_Show_Status_Bar->isChecked(); + UISettings::values.first_start = false; +} + void GMainWindow::SyncMenuUISettings() { ui->action_Screen_Layout_Default->setChecked(Settings::values.layout_option == Settings::LayoutOption::Default); diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index a570878b8..241365a38 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -229,6 +229,7 @@ private: void UpdateStatusBar(); void LoadTranslation(); void UpdateWindowTitle(); + void UpdateUISettings(); void RetranslateStatusBar(); void InstallCIA(QStringList filepaths); void HideMouseCursor();