From defb16b6da55059d7199a84a50bf2f2eb655c045 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Thu, 17 Dec 2020 23:45:29 +0100 Subject: [PATCH] Fixed multiple issues with the UI modes (full/kiosk/kid). Also improved the quit menu. --- INSTALL.md | 3 - USERGUIDE.md | 14 +-- es-app/assets/emulationstation.6.gz | Bin 1069 -> 1051 bytes es-app/src/guis/GuiGamelistFilter.cpp | 1 - es-app/src/guis/GuiMenu.cpp | 145 +++++++++++++++----------- es-app/src/main.cpp | 5 +- es-app/src/views/UIModeController.cpp | 4 +- es-app/src/views/ViewController.cpp | 4 +- es-core/src/Settings.cpp | 13 +-- 9 files changed, 100 insertions(+), 89 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 09d2c2618..d615afa6a 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -925,7 +925,6 @@ You can use `--help` or `-h` to view a list of command line options, as shown he --ignore-gamelist Ignore the gamelist files (useful for troubleshooting) --show-hidden-files Show hidden files and folders --show-hidden-games Show hidden games ---no-exit Don't show the exit option in the menu --no-splash Don't show the splash screen --debug Print debug information --windowed Windowed mode, should be combined with --resolution @@ -951,7 +950,6 @@ You can use `--help` or `-h` to view a list of command line options, as shown he --ignore-gamelist Ignore the gamelist files (useful for troubleshooting) --show-hidden-files Show hidden files and folders --show-hidden-games Show hidden games ---no-exit Don't show the exit option in the menu --no-splash Don't show the splash screen --debug Print debug information --vsync [1/on or 0/off] Turn vsync on or off (default is on) @@ -974,7 +972,6 @@ You can use `--help` or `-h` to view a list of command line options, as shown he --ignore-gamelist Ignore the gamelist files (useful for troubleshooting) --show-hidden-files Show hidden files and folders --show-hidden-games Show hidden games ---no-exit Don't show the exit option in the menu --no-splash Don't show the splash screen --debug Print debug information --vsync [1/on or 0/off] Turn vsync on or off (default is on) diff --git a/USERGUIDE.md b/USERGUIDE.md index 89f600898..f611b1b26 100644 --- a/USERGUIDE.md +++ b/USERGUIDE.md @@ -690,7 +690,7 @@ The theme to use. Defaults to rbsimple-DE, the theme shipped with EmulationStati **UI mode** -Defaults to Full which enables all functionality within the application. If set to Kid, only games marked as being suitable for children will be displayed, and there will be an option to disable the menu. In Kiosk mode, most settings are disabled. +Defaults to Full which enables all functionality within the application. If set to Kid, only games marked as being suitable for children will be displayed (this flag is set manually per game using the metadata editor). Additionally, the game options menu is disabled, as well as the screensaver controls and the ability to flag games as favorites. There is also a separate option available to enable or disable the main menu when in Kid mode, see 'Enable menu in kid mode' further below. In Kiosk mode, the main menu will be available, but it will only display the entry to change the system audio volume. The game options menu will be usable, but the metadata editor and the ability to modify custom game collections will be disabled. Finally, screensaver controls will be enabled when in Kiosk mode. **Default sort order** @@ -740,10 +740,6 @@ Activating or deactivating the built-in help systems that provides contextual in Some themes (including rbsimple-DE) display the game images briefly before playing the game videos. This setting forces the videos to be played immediately, regardless of the configuration in the theme. Note though that if there is a video available for a game, but no images, the video will always start to play immediately no matter the theme configuration or whether this settings has been enabled or not. -**Show start menu in kid mode** - -Hiding or showing the menu when the UI mode is set to Kid. - #### Screensaver settings Settings for the built-in screensaver. @@ -934,13 +930,13 @@ Using this option, you can place game images and videos in the ROM directory tre Displays the framerate and VRAM statistics as an overlay. You normally never need to use this. **Note:** As of version 1.0.0 the VRAM usage statistics is not accurate; this issue will be addressed in future ES-DE versions. -**Show 'Reboot System' menu entry - Unix and Windows only** +**Enable menu in kid mode** -Gives the ability to hide the "Reboot system" entry on the quit menu. Anyone who has accidentally rebooted a system from such a menu will appreciate this. +Enabling or disabling the menu when the UI mode is set to Kid. -**Show 'Power Off System' menu entry - Unix and Windows only** +**Show quit menu (reboot and power off entries)** _(Unix and Windows only)_ -Gives the ability to hide the "Power off system" entry on the quit menu. Anyone who has accidentally powered off a system from such a menu will appreciate this. +With this setting enabled, there is a Quit menu shown as the last entry on the main menu which provides options to quit ES-DE, to reboot the computer or to power off the computer. With this setting disabled, there will simply be an entry shown to quit the application instead of the complete quit menu. ### Configure input diff --git a/es-app/assets/emulationstation.6.gz b/es-app/ass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f?A&S<_~e&9 zZ!Fkm6(q%7GDrrfplU}Zu|)8+7rCvT;i=-Htn72J(FY0wL(VwXqGf;DiVU4B!4`&aYx9M2%(dW626v`~F}t9CpoAN?B~o)u~k!?vp_!@|??L;ITet6hkLH8ua~F zbm`rni z)|Q;7t|Y)pBe%dG(E~A&UAAy9WUlr+C-py$-_WR>Uy~zO=S0a&HK~wz;d%HTmrhM$ zE9x#NN&tPO60>7`vbD9^V zAM~+<4NpaSu-sf>(F!7~*|WAq8lDYJ>#(V`gA9&{&u=2Amj|2)qz^4+&p>b98CG(@ zm8((VtXedrUD1EY#J!(cqQzs>RR#mQ$IEvxTakYV`Ay{SB9z(w2L^B7K?&J9+zq(M z3Q@kHyR*~X7FGp#J*4SQWM_n^RKtDATZU^2tE6#ps%}S7&2a;g3efdg<8f{~T3&Z# z-JKTsc>B>n&{Oz^^m7-xra=J1EheqN-!=B9q&Qs4{HlK)KW-kD>tKwV9eU$hnM(9v zri#BDZK=M}q7)L@fAoD71b%I=1cxuGX`B@H0R3+=3~Y-!Gmc(kd#I2}{ma*?(;?@* zcshmgEME2kYB=O7bGS&3uN=K> optionList = it->second; optionList->selectNone(); } - bool testbool = mFilterIndex->isFiltered(); mFilterIndex->setTextFilter(""); mTextFilterField->setValue(""); diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index 792bf87bf..0404aee24 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -56,7 +56,13 @@ GuiMenu::GuiMenu(Window* window) : GuiComponent(window), if (isFullUI) addEntry("CONFIGURE INPUT", 0x777777FF, true, [this] { openConfigInput(); }); - addEntry("QUIT", 0x777777FF, true, [this] {openQuitMenu(); }); + if (!Settings::getInstance()->getBool("ForceKiosk") && + Settings::getInstance()->getString("UIMode") != "kiosk") { + if (Settings::getInstance()->getBool("ShowQuitMenu")) + addEntry("QUIT", 0x777777FF, true, [this] {openQuitMenu(); }); + else + addEntry("QUIT", 0x777777FF, false, [this] {openQuitMenu(); }); + } addChild(&mMenu); addVersionInfo(); @@ -174,10 +180,20 @@ void GuiMenu::openUISettings() uiModes.push_back("full"); uiModes.push_back("kiosk"); uiModes.push_back("kid"); + std::string setMode; + if (Settings::getInstance()->getBool("ForceKiosk")) + setMode = "kiosk"; + else if (Settings::getInstance()->getBool("ForceKid")) + setMode = "kid"; + else + setMode = Settings::getInstance()->getString("UIMode"); for (auto it = uiModes.cbegin(); it != uiModes.cend(); it++) - ui_mode->add(*it, *it, Settings::getInstance()->getString("UIMode") == *it); + ui_mode->add(*it, *it, setMode == *it); s->addWithLabel("UI MODE", ui_mode); s->addSaveFunc([ui_mode, this, s] { + // Always save settings if mode was forced to 'full'. + if (Settings::getInstance()->getBool("ForceFull")) + s->setNeedsSaving(); std::string selectedMode = ui_mode->getSelected(); if (selectedMode != Settings::getInstance()->getString("UIMode") && selectedMode != "full") { @@ -192,6 +208,9 @@ void GuiMenu::openUISettings() LOG(LogDebug) << "GuiMenu::openUISettings(): Setting UI mode to '" << selectedMode << "'."; Settings::getInstance()->setString("UIMode", selectedMode); + Settings::getInstance()->setBool("ForceFull", false); + Settings::getInstance()->setBool("ForceKiosk", false); + Settings::getInstance()->setBool("ForceKid", false); Settings::getInstance()->saveFile(); }, "NO", nullptr)); } @@ -200,6 +219,9 @@ void GuiMenu::openUISettings() LOG(LogDebug) << "GuiMenu::openUISettings(): Setting UI mode to '" << selectedMode << "'."; Settings::getInstance()->setString("UIMode", ui_mode->getSelected()); + Settings::getInstance()->setBool("ForceFull", false); + Settings::getInstance()->setBool("ForceKiosk", false); + Settings::getInstance()->setBool("ForceKid", false); s->setNeedsSaving(); } }); @@ -388,18 +410,6 @@ void GuiMenu::openUISettings() } }); - // Whether to show start menu in Kid mode. - auto show_kid_start_menu = std::make_shared(mWindow); - show_kid_start_menu->setState(Settings::getInstance()->getBool("ShowKidStartMenu")); - s->addWithLabel("SHOW START MENU IN KID MODE", show_kid_start_menu); - s->addSaveFunc([show_kid_start_menu, s] { - if (Settings::getInstance()->getBool("ShowKidStartMenu") != - show_kid_start_menu->getState()) { - Settings::getInstance()->setBool("ShowKidStartMenu", show_kid_start_menu->getState()); - s->setNeedsSaving(); - } - }); - // Screensaver. ComponentListRow screensaver_row; screensaver_row.elements.clear(); @@ -808,30 +818,31 @@ void GuiMenu::openOtherSettings() } }); - // macOS requires root privileges to reboot and power off so it doesn't make much - // sense to enable these settings and menu entries for this operating system. - #if !defined(__APPLE__) - // Hide Reboot System option in the quit menu. - auto show_reboot_system = std::make_shared(mWindow); - show_reboot_system->setState(Settings::getInstance()->getBool("ShowRebootSystem")); - s->addWithLabel("SHOW 'REBOOT SYSTEM' MENU ENTRY", show_reboot_system); - s->addSaveFunc([show_reboot_system, s] { - if (show_reboot_system->getState() != - Settings::getInstance()->getBool("ShowRebootSystem")) { - Settings::getInstance()->setBool("ShowRebootSystem", show_reboot_system->getState()); - s->setNeedsSaving(); + // Whether to enable the menu in Kid mode. + auto enable_menu_kid_mode = std::make_shared(mWindow); + enable_menu_kid_mode->setState(Settings::getInstance()->getBool("EnableMenuKidMode")); + s->addWithLabel("ENABLE MENU IN KID MODE", enable_menu_kid_mode); + s->addSaveFunc([enable_menu_kid_mode, s] { + if (Settings::getInstance()->getBool("EnableMenuKidMode") != + enable_menu_kid_mode->getState()) { + Settings::getInstance()->setBool("EnableMenuKidMode", enable_menu_kid_mode->getState()); + s->setNeedsSaving(); } }); - // Hide Power Off System option in the quit menu. - auto show_poweroff_system = std::make_shared(mWindow); - show_poweroff_system->setState(Settings::getInstance()->getBool("ShowPoweroffSystem")); - s->addWithLabel("SHOW 'POWER OFF SYSTEM' MENU ENTRY", show_poweroff_system); - s->addSaveFunc([show_poweroff_system, s] { - if (show_poweroff_system->getState() != - Settings::getInstance()->getBool("ShowPoweroffSystem")) { - Settings::getInstance()->setBool("ShowPoweroffSystem", show_poweroff_system->getState()); - s->setNeedsSaving(); + // macOS requires root privileges to reboot and power off so it doesn't make much + // sense to show the quit menu for this operating system. + #if !defined(__APPLE__) + // Whether to show the quit menu with the options to reboot and shutdown the computer. + auto show_quit_menu = std::make_shared(mWindow); + show_quit_menu->setState(Settings::getInstance()->getBool("ShowQuitMenu")); + s->addWithLabel("SHOW QUIT MENU (REBOOT AND POWER OFF ENTRIES)", show_quit_menu); + s->addSaveFunc([this, show_quit_menu, s] { + if (show_quit_menu->getState() != + Settings::getInstance()->getBool("ShowQuitMenu")) { + Settings::getInstance()->setBool("ShowQuitMenu", show_quit_menu->getState()); + s->setNeedsSaving(); + GuiMenu::close(false); } }); #endif @@ -851,31 +862,40 @@ void GuiMenu::openConfigInput() void GuiMenu::openQuitMenu() { - auto s = new GuiSettings(mWindow, "QUIT"); - - Window* window = mWindow; - HelpStyle style = getHelpStyle(); - - ComponentListRow row; - if (UIModeController::getInstance()->isUIModeFull()) { - if (Settings::getInstance()->getBool("ShowExit")) { - row.makeAcceptInputHandler([window, this] { - window->pushGui(new GuiMsgBox(window, this->getHelpStyle(), - "REALLY QUIT?", "YES", [] { - Scripting::fireEvent("quit"); - quitES(); - }, "NO", nullptr)); - }); - row.addElement(std::make_shared(window, "QUIT EMULATIONSTATION", - Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); - s->addRow(row); - } + if (!Settings::getInstance()->getBool("ShowQuitMenu")) { + mWindow->pushGui(new GuiMsgBox(mWindow, this->getHelpStyle(), + "REALLY QUIT?", "YES", [this] { + Scripting::fireEvent("quit"); + close(true); + quitES(); + }, "NO", nullptr)); } + else { + auto s = new GuiSettings(mWindow, "QUIT"); + + Window* window = mWindow; + HelpStyle style = getHelpStyle(); + + // This transparent bracket is only neeeded to generate the correct help prompts. + auto bracket = std::make_shared(mWindow); + bracket->setImage(":/graphics/arrow.svg"); + bracket->setOpacity(0); + + ComponentListRow row; + + row.makeAcceptInputHandler([window, this] { + window->pushGui(new GuiMsgBox(window, this->getHelpStyle(), + "REALLY QUIT?", "YES", [this] { + Scripting::fireEvent("quit"); + close(true); + quitES(); + }, "NO", nullptr)); + }); + row.addElement(std::make_shared(window, "QUIT EMULATIONSTATION", + Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); + row.addElement(bracket, false); + s->addRow(row); - // macOS requires root privileges to reboot and power off so it doesn't make much - // sense to enable these settings and menu entries for this operating system. - #if !defined(__APPLE__) - if (Settings::getInstance()->getBool("ShowRebootSystem")) { row.elements.clear(); row.makeAcceptInputHandler([window, this] { window->pushGui(new GuiMsgBox(window, this->getHelpStyle(), @@ -889,10 +909,9 @@ void GuiMenu::openQuitMenu() }); row.addElement(std::make_shared(window, "REBOOT SYSTEM", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); + row.addElement(bracket, false); s->addRow(row); - } - if (Settings::getInstance()->getBool("ShowPoweroffSystem")) { row.elements.clear(); row.makeAcceptInputHandler([window, this] { window->pushGui(new GuiMsgBox(window, this->getHelpStyle(), @@ -906,11 +925,11 @@ void GuiMenu::openQuitMenu() }); row.addElement(std::make_shared(window, "POWER OFF SYSTEM", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); + row.addElement(bracket, false); s->addRow(row); - } - #endif - mWindow->pushGui(s); + mWindow->pushGui(s); + } } void GuiMenu::addVersionInfo() diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index aefcdf3c0..eecdcad08 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -243,9 +243,6 @@ bool parseArgs(int argc, char* argv[]) else if (strcmp(argv[i], "--show-hidden-games") == 0) { Settings::getInstance()->setBool("ShowHiddenGames", true); } - else if (strcmp(argv[i], "--no-exit") == 0) { - Settings::getInstance()->setBool("ShowExit", false); - } else if (strcmp(argv[i], "--no-splash") == 0) { Settings::getInstance()->setBool("SplashScreen", false); } @@ -277,6 +274,7 @@ bool parseArgs(int argc, char* argv[]) } else if (strcmp(argv[i], "--force-full") == 0) { Settings::getInstance()->setString("UIMode", "full"); + Settings::getInstance()->setBool("ForceFull", true); } else if (strcmp(argv[i], "--force-kiosk") == 0) { Settings::getInstance()->setBool("ForceKiosk", true); @@ -302,7 +300,6 @@ bool parseArgs(int argc, char* argv[]) " --ignore-gamelist Ignore the gamelist files (useful for troubleshooting)\n" " --show-hidden-files Show hidden files and folders\n" " --show-hidden-games Show hidden games\n" -" --no-exit Don't show the exit option in the menu\n" " --no-splash Don't show the splash screen\n" " --debug Print debug information\n" #if defined(__unix__) diff --git a/es-app/src/views/UIModeController.cpp b/es-app/src/views/UIModeController.cpp index 822c15ca5..251a0c99e 100644 --- a/es-app/src/views/UIModeController.cpp +++ b/es-app/src/views/UIModeController.cpp @@ -81,7 +81,9 @@ void UIModeController::unlockUIMode() bool UIModeController::isUIModeFull() { - return ((mCurrentUIMode == "full") && !Settings::getInstance()->getBool("ForceKiosk")); + return ((mCurrentUIMode == "full" || (isUIModeKid() && + Settings::getInstance()->getBool("EnableMenuKidMode"))) + && !Settings::getInstance()->getBool("ForceKiosk")); } bool UIModeController::isUIModeKid() diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index 0db0f24ac..f20eda3e2 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -630,7 +630,7 @@ bool ViewController::input(InputConfig* config, Input input) // Open the main menu. if (!(UIModeController::getInstance()->isUIModeKid() && - !Settings::getInstance()->getBool("ShowKidStartMenu")) && + !Settings::getInstance()->getBool("EnableMenuKidMode")) && config->isMappedTo("start", input) && input.value != 0) { // If we don't stop the scrolling here, it will continue to // run after closing the menu. @@ -833,7 +833,7 @@ std::vector ViewController::getHelpPrompts() prompts = mCurrentView->getHelpPrompts(); if (!(UIModeController::getInstance()->isUIModeKid() && - !Settings::getInstance()->getBool("ShowKidStartMenu"))) + !Settings::getInstance()->getBool("EnableMenuKidMode"))) prompts.push_back(HelpPrompt("start", "menu")); return prompts; } diff --git a/es-core/src/Settings.cpp b/es-core/src/Settings.cpp index 0ad6a14aa..32ea9c287 100644 --- a/es-core/src/Settings.cpp +++ b/es-core/src/Settings.cpp @@ -28,10 +28,10 @@ Settings* Settings::sInstance = nullptr; std::vector settings_dont_save { // These options can be set using command-line arguments: "Debug", // --debug + "ForceFull", // --force-full "ForceKid", // --force-kid "ForceKiosk", // --force-kiosk "IgnoreGamelist", // --ignore-gamelist - "ShowExit", // --no-exit "SplashScreen", // --no-splash "VSync", // --vsync [1/on or 0/off] #if !defined(_WIN64) @@ -124,7 +124,7 @@ void Settings::setDefaults() mBoolMap["QuickSystemSelect"] = { true, true }; mBoolMap["ShowHelpPrompts"] = { true, true }; mBoolMap["PlayVideosImmediately"] = { false, false }; - mBoolMap["ShowKidStartMenu"] = { false, false }; + mBoolMap["EnableMenuKidMode"] = { false, false }; // UI settings -> screensaver settings. mIntMap["ScreensaverTimer"] = { 5*60*1000, 5*60*1000 }; // 5 minutes @@ -226,9 +226,10 @@ void Settings::setDefaults() mBoolMap["DisplayGPUStatistics"] = { false, false }; // macOS requires root privileges to reboot and power off so it doesn't make much // sense to enable these settings and menu entries for this operating system. - #if !defined(__APPLE__) - mBoolMap["ShowRebootSystem"] = { true, true }; - mBoolMap["ShowPoweroffSystem"] = { true, true }; + #if defined(__APPLE__) + mBoolMap["ShowQuitMenu"] = { false, false }; + #else + mBoolMap["ShowQuitMenu"] = { true, true }; #endif // @@ -237,10 +238,10 @@ void Settings::setDefaults() // Options listed using --help mBoolMap["Debug"] = { false, false }; + mBoolMap["ForceFull"] = { false, false }; mBoolMap["ForceKid"] = { false, false }; mBoolMap["ForceKiosk"] = { false, false }; mBoolMap["IgnoreGamelist"] = { false, false }; - mBoolMap["ShowExit"] = { true, true }; mBoolMap["SplashScreen"] = { true, true }; mBoolMap["VSync"] = { true, true }; #if !defined(_WIN64)