From daee2a27a3dd4f94734bf76a727aa05fa766a6c7 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Thu, 3 Jan 2019 17:13:49 +0100 Subject: [PATCH] Qt: spawn Confirmation Dialog on when booting games while Emu is running --- rpcs3/Json/tooltips.json | 1 + rpcs3/rpcs3qt/gui_settings.h | 1 + rpcs3/rpcs3qt/main_window.cpp | 13 +++++++++++++ rpcs3/rpcs3qt/settings_dialog.cpp | 7 +++++++ rpcs3/rpcs3qt/settings_dialog.ui | 7 +++++++ 5 files changed, 29 insertions(+) diff --git a/rpcs3/Json/tooltips.json b/rpcs3/Json/tooltips.json index 6d731233ed..1ca2a90927 100644 --- a/rpcs3/Json/tooltips.json +++ b/rpcs3/Json/tooltips.json @@ -122,6 +122,7 @@ "stylesheets": "Changes the overall look of RPCS3.\nChoose a stylesheet and click Apply to change between styles.", "show_welcome": "Shows the initial welcome screen upon starting RPCS3.", "show_exit_game": "Shows a confirmation dialog when the game window is being closed.", + "show_boot_game": "Shows a confirmation dialog when a game was booted while another game is running.", "show_pkg_install": "Shows a dialog when packages were installed successfully.", "show_pup_install": "Shows a dialog when firmware was installed successfully.", "useRichPresence": "Enables use of Discord Rich Presence to show what game you are playing on Discord.\nRequires a restart of RPCS3 to completely close the connection.", diff --git a/rpcs3/rpcs3qt/gui_settings.h b/rpcs3/rpcs3qt/gui_settings.h index 3d4f107f3d..320815dbef 100644 --- a/rpcs3/rpcs3qt/gui_settings.h +++ b/rpcs3/rpcs3qt/gui_settings.h @@ -140,6 +140,7 @@ namespace gui const gui_save ib_pup_success = gui_save(main_window, "infoBoxEnabledInstallPUP", true); const gui_save ib_show_welcome = gui_save(main_window, "infoBoxEnabledWelcome", true); const gui_save ib_confirm_exit = gui_save(main_window, "confirmationBoxExitGame", true); + const gui_save ib_confirm_boot = gui_save(main_window, "confirmationBoxBootGame", true); const gui_save fd_install_pkg = gui_save(main_window, "lastExplorePathPKG", ""); const gui_save fd_install_pup = gui_save(main_window, "lastExplorePathPUP", ""); diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 4126a519ea..a860cea166 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -270,6 +270,19 @@ void main_window::OnPlayOrPause() void main_window::Boot(const std::string& path, bool direct, bool add_only) { + if (!Emu.IsStopped()) + { + int result; + guiSettings->ShowConfirmationBox(tr("Close Running Game?"), + tr("Booting another game will close the current game.\nDo you really want to boot another game?\n\nAny unsaved progress will be lost!\n"), + gui::ib_confirm_boot, &result, this); + + if (result != QMessageBox::Yes) + { + return; + } + } + SetAppIconFromPath(path); Emu.SetForceBoot(true); Emu.Stop(); diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index 93e369d12e..a3690a1392 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -1013,6 +1013,8 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: SubscribeTooltip(ui->cb_show_exit_game, json_gui["show_exit_game"].toString()); + SubscribeTooltip(ui->cb_show_boot_game, json_gui["show_boot_game"].toString()); + SubscribeTooltip(ui->cb_show_pkg_install, json_gui["show_pkg_install"].toString()); SubscribeTooltip(ui->cb_show_pup_install, json_gui["show_pup_install"].toString()); @@ -1074,6 +1076,7 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: ui->cb_show_welcome->setChecked(xgui_settings->GetValue(gui::ib_show_welcome).toBool()); ui->cb_show_exit_game->setChecked(xgui_settings->GetValue(gui::ib_confirm_exit).toBool()); + ui->cb_show_boot_game->setChecked(xgui_settings->GetValue(gui::ib_confirm_boot).toBool()); ui->cb_show_pkg_install->setChecked(xgui_settings->GetValue(gui::ib_pkg_success).toBool()); ui->cb_show_pup_install->setChecked(xgui_settings->GetValue(gui::ib_pup_success).toBool()); @@ -1138,6 +1141,10 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: { xgui_settings->SetValue(gui::ib_confirm_exit, val); }); + connect(ui->cb_show_boot_game, &QCheckBox::clicked, [=](bool val) + { + xgui_settings->SetValue(gui::ib_confirm_boot, val); + }); connect(ui->cb_show_pkg_install, &QCheckBox::clicked, [=](bool val) { xgui_settings->SetValue(gui::ib_pkg_success, val); diff --git a/rpcs3/rpcs3qt/settings_dialog.ui b/rpcs3/rpcs3qt/settings_dialog.ui index 9f7c4d1376..a631fdc463 100644 --- a/rpcs3/rpcs3qt/settings_dialog.ui +++ b/rpcs3/rpcs3qt/settings_dialog.ui @@ -1925,6 +1925,13 @@ + + + + Show Boot Game Dialog + + +