Qt: spawn Confirmation Dialog on when booting games while Emu is running

This commit is contained in:
Megamouse 2019-01-03 17:13:49 +01:00
parent 5f9b441dd7
commit daee2a27a3
5 changed files with 29 additions and 0 deletions

View file

@ -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.",

View file

@ -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", "");

View file

@ -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();

View file

@ -1013,6 +1013,8 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> 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<gui_settings> 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<gui_settings> 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);

View file

@ -1925,6 +1925,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cb_show_boot_game">
<property name="text">
<string>Show Boot Game Dialog</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cb_show_pkg_install">
<property name="text">