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>
This commit is contained in:
FearlessTobi 2021-01-03 05:28:52 +01:00
parent 755393da90
commit 251b265777
2 changed files with 25 additions and 16 deletions

View file

@ -1013,6 +1013,11 @@ void GMainWindow::BootGame(const QString& filename) {
Core::Movie::GetInstance().PrepareForRecording(); Core::Movie::GetInstance().PrepareForRecording();
} }
// Save configurations
UpdateUISettings();
game_list->SaveInterfaceLayout();
config->Save();
if (!LoadROM(filename)) if (!LoadROM(filename))
return; return;
@ -2186,22 +2191,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
return; return;
} }
if (!ui->action_Fullscreen->isChecked()) { UpdateUISettings();
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;
game_list->SaveInterfaceLayout(); game_list->SaveInterfaceLayout();
hotkey_registry.SaveHotkeys(); 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() { void GMainWindow::SyncMenuUISettings() {
ui->action_Screen_Layout_Default->setChecked(Settings::values.layout_option == ui->action_Screen_Layout_Default->setChecked(Settings::values.layout_option ==
Settings::LayoutOption::Default); Settings::LayoutOption::Default);

View file

@ -229,6 +229,7 @@ private:
void UpdateStatusBar(); void UpdateStatusBar();
void LoadTranslation(); void LoadTranslation();
void UpdateWindowTitle(); void UpdateWindowTitle();
void UpdateUISettings();
void RetranslateStatusBar(); void RetranslateStatusBar();
void InstallCIA(QStringList filepaths); void InstallCIA(QStringList filepaths);
void HideMouseCursor(); void HideMouseCursor();