Fixed multiple issues with the UI modes (full/kiosk/kid).

Also improved the quit menu.
This commit is contained in:
Leon Styhre 2020-12-17 23:45:29 +01:00
parent ade0160ffe
commit defb16b6da
9 changed files with 100 additions and 89 deletions

View file

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

View file

@ -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

Binary file not shown.

View file

@ -59,7 +59,6 @@ void GuiGamelistFilter::resetAllFilters()
std::shared_ptr<OptionListComponent<std::string>> optionList = it->second;
optionList->selectNone();
}
bool testbool = mFilterIndex->isFiltered();
mFilterIndex->setTextFilter("");
mTextFilterField->setValue("");

View file

@ -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<SwitchComponent>(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<SwitchComponent>(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<SwitchComponent>(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<SwitchComponent>(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<SwitchComponent>(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<TextComponent>(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<ImageComponent>(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<TextComponent>(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<TextComponent>(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<TextComponent>(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()

View file

@ -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__)

View file

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

View file

@ -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<HelpPrompt> 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;
}

View file

@ -28,10 +28,10 @@ Settings* Settings::sInstance = nullptr;
std::vector<std::string> 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)