GUI: Add GUI option to always return to the Launcher instead of quitting

ScummVM
This commit is contained in:
Lothar Serra Mari 2020-11-26 23:02:41 +01:00 committed by Thierry Crozat
parent 663a07c689
commit 4ee02f869c
23 changed files with 132 additions and 9 deletions

View file

@ -95,8 +95,9 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
event = _eventQueue.pop();
bool forwardEvent = true;
// If the backend has the kFeatureNoQuit, replace Quit event with Return to Launcher
if (event.type == Common::EVENT_QUIT && g_system->hasFeature(OSystem::kFeatureNoQuit))
// If the backend has the kFeatureNoQuit or the "Return to Launcher at Exit" option is enabled,
// replace "Quit" event with "Return to Launcher"
if (event.type == Common::EVENT_QUIT && (g_system->hasFeature(OSystem::kFeatureNoQuit) || (ConfMan.getBool("gui_return_to_launcher_at_exit") && g_engine)))
event.type = Common::EVENT_RETURN_TO_LAUNCHER;
switch (event.type) {

View file

@ -312,6 +312,7 @@ void registerDefaults() {
ConfMan.registerDefault("gui_browser_show_hidden", false);
ConfMan.registerDefault("gui_browser_native", true);
ConfMan.registerDefault("gui_return_to_launcher_at_exit", false);
// Specify threshold for scanning directories in the launcher
// If number of game entries in scummvm.ini exceeds the specified
// number, then skip scanning. -1 = scan always

View file

@ -95,7 +95,7 @@ MainMenuDialog::MainMenuDialog(Engine *engine)
_returnToLauncherButton = new GUI::ButtonWidget(this, "GlobalMenu.ReturnToLauncher", _c("~R~eturn to Launcher", "lowres"), Common::U32String(), kLauncherCmd);
_returnToLauncherButton->setEnabled(_engine->hasFeature(Engine::kSupportsReturnToLauncher));
if (!g_system->hasFeature(OSystem::kFeatureNoQuit))
if (!g_system->hasFeature(OSystem::kFeatureNoQuit) && !(ConfMan.getBool("gui_return_to_launcher_at_exit")))
new GUI::ButtonWidget(this, "GlobalMenu.Quit", _("~Q~uit"), Common::U32String(), kQuitCmd);
_aboutDialog = new GUI::AboutDialog();

View file

@ -38,7 +38,7 @@
#include "graphics/pixelformat.h"
#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.40"
#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.41"
class OSystem;

View file

@ -1705,6 +1705,7 @@ GlobalOptionsDialog::GlobalOptionsDialog(LauncherDialog *launcher)
_guiLanguagePopUp = nullptr;
_guiLanguageUseGameLanguageCheckbox = nullptr;
_useSystemDialogsCheckbox = nullptr;
_guiReturnToLauncherAtExit = nullptr;
#ifdef USE_UPDATES
_updatesPopUpDesc = nullptr;
_updatesPopUp = nullptr;
@ -2095,13 +2096,28 @@ void GlobalOptionsDialog::addMiscControls(GuiObject *boss, const Common::String
_autosavePeriodPopUp->appendEntry(_(savePeriodLabels[i]), savePeriodValues[i]);
}
if (!g_system->hasFeature(OSystem::kFeatureNoQuit)) {
_guiReturnToLauncherAtExit = new CheckboxWidget(boss, prefix + "ReturnToLauncherAtExit",
_("Always return to the launcher when leaving a game"),
_("Always return to the launcher when leaving a game instead of closing ScummVM.")
);
_guiReturnToLauncherAtExit->setState(ConfMan.getBool("gui_return_to_launcher_at_exit", _domain));
}
_guiConfirmExit = new CheckboxWidget(boss, prefix + "ConfirmExit",
_("Ask for confirmation on exit"),
_("Ask for permission when closing ScummVM or leaving a game.")
);
_guiConfirmExit->setState(ConfMan.getBool("confirm_exit", _domain));
#ifdef GUI_ENABLE_KEYSDIALOG
new ButtonWidget(boss, prefix + "KeysButton", _("Keys"), Common::U32String(), kChooseKeyMappingCmd);
#endif
// TODO: joystick setting
#ifdef USE_TRANSLATION
_guiLanguagePopUpDesc = new StaticTextWidget(boss, prefix + "GuiLanguagePopupDesc", _("GUI language:"), _("Language of ScummVM GUI"));
_guiLanguagePopUp = new PopUpWidget(boss, prefix + "GuiLanguagePopup");
@ -2402,6 +2418,14 @@ void GlobalOptionsDialog::apply() {
ConfMan.setBool("gui_browser_native", _useSystemDialogsCheckbox->getState(), _domain);
}
if (_guiReturnToLauncherAtExit) {
ConfMan.setBool("gui_return_to_launcher_at_exit", _guiReturnToLauncherAtExit->getState(), _domain);
}
if (_guiConfirmExit) {
ConfMan.setBool("confirm_exit", _guiConfirmExit->getState(), _domain);
}
GUI::ThemeEngine::GraphicsMode gfxMode = (GUI::ThemeEngine::GraphicsMode)_rendererPopUp->getSelectedTag();
Common::String oldGfxConfig = ConfMan.get("gui_renderer");
Common::String newGfxConfig = GUI::ThemeEngine::findModeConfigName(gfxMode);

View file

@ -307,6 +307,8 @@ protected:
PopUpWidget *_guiLanguagePopUp;
CheckboxWidget *_guiLanguageUseGameLanguageCheckbox;
CheckboxWidget *_useSystemDialogsCheckbox;
CheckboxWidget *_guiReturnToLauncherAtExit;
CheckboxWidget *_guiConfirmExit;
#ifdef USE_UPDATES

View file

@ -2001,6 +2001,16 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"/>"
"</layout>"
"<layout type='horizontal' padding='0,0,0,0' spacing='10' align='center'>"
"<widget name='ReturnToLauncherAtExit' "
"type='Checkbox' "
"/>"
"</layout>"
"<layout type='horizontal' padding='0,0,0,0' spacing='10' align='center'>"
"<widget name='ConfirmExit' "
"type='Checkbox' "
"/>"
"</layout>"
"<layout type='horizontal' padding='0,0,0,0' spacing='10' align='center'>"
"<widget name='UpdatesPopupDesc' "
"type='OptionsLabel' "
"/>"
@ -3873,6 +3883,11 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"/>"
"</layout>"
"<layout type='horizontal' padding='0,0,0,0' spacing='6' align='center'>"
"<widget name='ReturnToLauncherAtExit' "
"type='Checkbox' "
"/>"
"</layout>"
"<layout type='horizontal' padding='0,0,0,0' spacing='6' align='center'>"
"<widget name='UpdatesPopupDesc' "
"width='80' "
"height='Globals.Line.Height' "

Binary file not shown.

View file

@ -1 +1 @@
[SCUMMVM_STX0.8.40:ResidualVM Modern Theme:No Author]
[SCUMMVM_STX0.8.41:ResidualVM Modern Theme:No Author]

View file

@ -652,6 +652,16 @@
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'ConfirmExit'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'ReturnToLauncherAtExit'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'UpdatesPopupDesc'
type = 'OptionsLabel'

View file

@ -636,6 +636,16 @@
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' align = 'center'>
<widget name = 'ReturnToLauncherAtExit'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' align = 'center'>
<widget name = 'ConfirmExit'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' align = 'center'>
<widget name = 'UpdatesPopupDesc'
width = '80'

Binary file not shown.

View file

@ -1 +1 @@
[SCUMMVM_STX0.8.40:ScummVM Classic Theme:No Author]
[SCUMMVM_STX0.8.41:ScummVM Classic Theme:No Author]

View file

@ -636,6 +636,16 @@
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'ReturnToLauncherAtExit'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'ConfirmExit'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'UpdatesPopupDesc'
type = 'OptionsLabel'

View file

@ -638,6 +638,16 @@
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' align = 'center'>
<widget name = 'ReturnToLauncherAtExit'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' align = 'center'>
<widget name = 'ConfirmExit'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' align = 'center'>
<widget name = 'UpdatesPopupDesc'
width = '80'

Binary file not shown.

View file

@ -1 +1 @@
[SCUMMVM_STX0.8.40:ScummVM Modern Theme:No Author]
[SCUMMVM_STX0.8.41:ScummVM Modern Theme:No Author]

View file

@ -652,6 +652,16 @@
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'ReturnToLauncherAtExit'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'ConfirmExit'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'UpdatesPopupDesc'
type = 'OptionsLabel'

View file

@ -636,6 +636,16 @@
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' align = 'center'>
<widget name = 'ReturnToLauncherAtExit'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' align = 'center'>
<widget name = 'ConfirmExit'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' align = 'center'>
<widget name = 'UpdatesPopupDesc'
width = '80'

Binary file not shown.

View file

@ -1 +1 @@
[SCUMMVM_STX0.8.40:ScummVM Modern Theme Remastered:No Author]
[SCUMMVM_STX0.8.41:ScummVM Modern Theme Remastered:No Author]

View file

@ -652,6 +652,16 @@
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'ReturnToLauncherAtExit'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'ConfirmExit'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'UpdatesPopupDesc'
type = 'OptionsLabel'

View file

@ -636,6 +636,16 @@
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' align = 'center'>
<widget name = 'ReturnToLauncherAtExit'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' align = 'center'>
<widget name = 'ConfirmExit'
type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' align = 'center'>
<widget name = 'UpdatesPopupDesc'
width = '80'