Merge pull request #435 from raelgc/431-improve-kids-mode

Improving kids mode
This commit is contained in:
John Rassa 2018-06-04 14:17:25 -07:00 committed by GitHub
commit 401b184615
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 60 additions and 34 deletions

View file

@ -247,17 +247,19 @@ void FileFilterIndex::resetFilters()
void FileFilterIndex::setUIModeFilters()
{
if (!UIModeController::getInstance()->isUIModeFull())
{
filterByHidden = true;
std::vector<std::string> val = { "FALSE" };
setFilter(HIDDEN_FILTER, &val);
}
if (UIModeController::getInstance()->isUIModeKid())
{
filterByKidGame = true;
std::vector<std::string> val = { "TRUE" };
setFilter(KIDGAME_FILTER, &val);
if(!Settings::getInstance()->getBool("ForceDisableFilters")){
if (!UIModeController::getInstance()->isUIModeFull())
{
filterByHidden = true;
std::vector<std::string> val = { "FALSE" };
setFilter(HIDDEN_FILTER, &val);
}
if (UIModeController::getInstance()->isUIModeKid())
{
filterByKidGame = true;
std::vector<std::string> val = { "TRUE" };
setFilter(KIDGAME_FILTER, &val);
}
}
}

View file

@ -77,11 +77,14 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system) : Gui
mMenu.addWithLabel("SORT GAMES BY", mListSort);
}
// show filtered menu
row.elements.clear();
row.addElement(std::make_shared<TextComponent>(mWindow, "FILTER GAMELIST", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
row.addElement(makeArrow(mWindow), false);
row.makeAcceptInputHandler(std::bind(&GuiGamelistOptions::openGamelistFilter, this));
mMenu.addRow(row);
if(!Settings::getInstance()->getBool("ForceDisableFilters"))
{
row.elements.clear();
row.addElement(std::make_shared<TextComponent>(mWindow, "FILTER GAMELIST", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
row.addElement(makeArrow(mWindow), false);
row.makeAcceptInputHandler(std::bind(&GuiGamelistOptions::openGamelistFilter, this));
mMenu.addRow(row);
}
std::map<std::string, CollectionSystemData> customCollections = CollectionSystemManager::get()->getCustomCollectionSystems();

View file

@ -2,6 +2,7 @@
#include "components/OptionListComponent.h"
#include "components/SliderComponent.h"
#include "components/SwitchComponent.h"
#include "guis/GuiMsgBox.h"
#include "guis/GuiSlideshowScreensaverOptions.h"
#include "guis/GuiVideoScreensaverOptions.h"
@ -17,6 +18,12 @@ GuiGeneralScreensaverOptions::GuiGeneralScreensaverOptions(Window* window, const
Settings::getInstance()->setInt("ScreenSaverTime", (int)Math::round(screensaver_time->getValue()) * (1000 * 60));
PowerSaver::updateTimeouts();
});
// Allow ScreenSaver Controls - ScreenSaverControls
auto ss_controls = std::make_shared<SwitchComponent>(mWindow);
ss_controls->setState(Settings::getInstance()->getBool("ScreenSaverControls"));
addWithLabel("SCREENSAVER CONTROLS", ss_controls);
addSaveFunc([ss_controls] { Settings::getInstance()->setBool("ScreenSaverControls", ss_controls->getState()); });
// screensaver behavior
auto screensaver_behavior = std::make_shared< OptionListComponent<std::string> >(mWindow, "SCREENSAVER BEHAVIOR", false);

View file

@ -39,8 +39,7 @@ GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "MAIN MEN
if (isFullUI)
addEntry("CONFIGURE INPUT", 0x777777FF, true, [this] { openConfigInput(); });
if (!(UIModeController::getInstance()->isUIModeKid() && Settings::getInstance()->getBool("hideQuitMenuOnKidUI")))
addEntry("QUIT", 0x777777FF, true, [this] {openQuitMenu(); });
addEntry("QUIT", 0x777777FF, true, [this] {openQuitMenu(); });
addChild(&mMenu);
addVersionInfo();
@ -309,6 +308,16 @@ void GuiMenu::openUISettings()
s->addWithLabel("ON-SCREEN HELP", show_help);
s->addSaveFunc([show_help] { Settings::getInstance()->setBool("ShowHelpPrompts", show_help->getState()); });
// enable filters (ForceDisableFilters)
auto enable_filter = std::make_shared<SwitchComponent>(mWindow);
enable_filter->setState(!Settings::getInstance()->getBool("ForceDisableFilters"));
s->addWithLabel("ENABLE FILTERS", enable_filter);
s->addSaveFunc([enable_filter] {
bool filter_is_enabled = !Settings::getInstance()->getBool("ForceDisableFilters");
Settings::getInstance()->setBool("ForceDisableFilters", !enable_filter->getState());
if (enable_filter->getState() != filter_is_enabled) ViewController::get()->ReloadAndGoToStart();
});
mWindow->pushGui(s);
}

View file

@ -25,12 +25,6 @@ GuiVideoScreensaverOptions::GuiVideoScreensaverOptions(Window* window, const cha
addSaveFunc([ss_omx, this] { Settings::getInstance()->setBool("ScreenSaverOmxPlayer", ss_omx->getState()); });
#endif
// Allow ScreenSaver Controls - ScreenSaverControls
auto ss_controls = std::make_shared<SwitchComponent>(mWindow);
ss_controls->setState(Settings::getInstance()->getBool("ScreenSaverControls"));
addWithLabel("SCREENSAVER CONTROLS", ss_controls);
addSaveFunc([ss_controls] { Settings::getInstance()->setBool("ScreenSaverControls", ss_controls->getState()); });
// Render Video Game Name as subtitles
auto ss_info = std::make_shared< OptionListComponent<std::string> >(mWindow, "SHOW GAME INFO", false);
std::vector<std::string> info_type;

View file

@ -132,6 +132,10 @@ bool parseArgs(int argc, char* argv[])
{
Settings::getInstance()->setBool("ForceKid", true);
}
else if (strcmp(argv[i], "--force-disable-filters") == 0)
{
Settings::getInstance()->setBool("ForceDisableFilters", true);
}
else if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0)
{
#ifdef WIN32
@ -158,7 +162,9 @@ bool parseArgs(int argc, char* argv[])
"--windowed not fullscreen, should be used with --resolution\n"
"--vsync [1/on or 0/off] turn vsync on or off (default is on)\n"
"--max-vram [size] Max VRAM to use in Mb before swapping. 0 for unlimited\n"
"--force-kid Force the UI mode to be Kid\n"
"--force-kiosk Force the UI mode to be Kiosk\n"
"--force-disable-filters Force the UI to ignore applied filters in gamelist\n"
"--help, -h summon a sentient, angry tuba\n\n"
"More information available in README.md.\n";
return false; //exit after printing help

View file

@ -196,7 +196,7 @@ bool SystemView::input(InputConfig* config, Input input)
config->isMappedTo("up", input) ||
config->isMappedTo("down", input))
listInput(0);
if(config->isMappedTo("select", input) && Settings::getInstance()->getBool("ScreenSaverControls"))
if(!UIModeController::getInstance()->isUIModeKid() && config->isMappedTo("select", input) && Settings::getInstance()->getBool("ScreenSaverControls"))
{
mWindow->startScreenSaver();
mWindow->renderScreenSaver();
@ -382,7 +382,7 @@ std::vector<HelpPrompt> SystemView::getHelpPrompts()
prompts.push_back(HelpPrompt("a", "select"));
prompts.push_back(HelpPrompt("x", "random"));
if (Settings::getInstance()->getBool("ScreenSaverControls"))
if (!UIModeController::getInstance()->isUIModeKid() && Settings::getInstance()->getBool("ScreenSaverControls"))
prompts.push_back(HelpPrompt("select", "launch screensaver"));
return prompts;

View file

@ -357,7 +357,7 @@ bool ViewController::input(InputConfig* config, Input input)
return true;
// open menu
if(config->isMappedTo("start", input) && input.value != 0)
if(!UIModeController::getInstance()->isUIModeKid() && config->isMappedTo("start", input) && input.value != 0)
{
// open menu
mWindow->pushGui(new GuiMenu(mWindow));
@ -512,7 +512,8 @@ std::vector<HelpPrompt> ViewController::getHelpPrompts()
return prompts;
prompts = mCurrentView->getHelpPrompts();
prompts.push_back(HelpPrompt("start", "menu"));
if(!UIModeController::getInstance()->isUIModeKid())
prompts.push_back(HelpPrompt("start", "menu"));
return prompts;
}

View file

@ -150,10 +150,11 @@ std::vector<HelpPrompt> BasicGameListView::getHelpPrompts()
prompts.push_back(HelpPrompt("up/down", "choose"));
prompts.push_back(HelpPrompt("a", "launch"));
prompts.push_back(HelpPrompt("b", "back"));
prompts.push_back(HelpPrompt("select", "options"));
if(!UIModeController::getInstance()->isUIModeKid())
prompts.push_back(HelpPrompt("select", "options"));
if(mRoot->getSystem()->isGameSystem())
prompts.push_back(HelpPrompt("x", "random"));
if(mRoot->getSystem()->isGameSystem() && !UIModeController::getInstance()->isUIModeKid())
if(mRoot->getSystem()->isGameSystem() && UIModeController::getInstance()->isUIModeFull())
{
std::string prompt = CollectionSystemManager::get()->getEditingCollection();
prompts.push_back(HelpPrompt("y", prompt));

View file

@ -368,7 +368,8 @@ std::vector<HelpPrompt> GridGameListView::getHelpPrompts()
prompts.push_back(HelpPrompt("up/down/left/right", "choose"));
prompts.push_back(HelpPrompt("a", "launch"));
prompts.push_back(HelpPrompt("b", "back"));
prompts.push_back(HelpPrompt("select", "options"));
if(!UIModeController::getInstance()->isUIModeKid())
prompts.push_back(HelpPrompt("select", "options"));
if(mRoot->getSystem()->isGameSystem())
prompts.push_back(HelpPrompt("x", "random"));
if(mRoot->getSystem()->isGameSystem() && !UIModeController::getInstance()->isUIModeKid())

View file

@ -1,6 +1,7 @@
#include "views/gamelist/IGameListView.h"
#include "guis/GuiGamelistOptions.h"
#include "views/UIModeController.h"
#include "views/ViewController.h"
#include "Sound.h"
#include "Window.h"
@ -8,7 +9,7 @@
bool IGameListView::input(InputConfig* config, Input input)
{
// select to open GuiGamelistOptions
if(config->isMappedTo("select", input) && input.value)
if(!UIModeController::getInstance()->isUIModeKid() && config->isMappedTo("select", input) && input.value)
{
Sound::getFromTheme(mTheme, getName(), "menuOpen")->play();
mWindow->pushGui(new GuiGamelistOptions(mWindow, this->mRoot->getSystem()));

View file

@ -146,7 +146,7 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
}
return true;
}
}else if (config->isMappedTo("y", input) && !(UIModeController::getInstance()->isUIModeKid()))
}else if (config->isMappedTo("y", input) && UIModeController::getInstance()->isUIModeFull())
{
if(mRoot->getSystem()->isGameSystem())
{

View file

@ -18,6 +18,7 @@ std::vector<const char*> settings_dont_save {
{ "DebugImage" },
{ "ForceKid" },
{ "ForceKiosk" },
{ "ForceDisableFilters" },
{ "IgnoreGamelist" },
{ "HideConsole" },
{ "ShowExit" },
@ -138,7 +139,7 @@ void Settings::setDefaults()
mStringMap["UIMode_passkey"] = "uuddlrlrba";
mBoolMap["ForceKiosk"] = false;
mBoolMap["ForceKid"] = false;
mBoolMap["hideQuitMenuOnKidUI"] = false;
mBoolMap["ForceDisableFilters"] = false;
mIntMap["WindowWidth"] = 0;
mIntMap["WindowHeight"] = 0;