#include "guis/GuiVideoScreensaverOptions.h" #include "components/OptionListComponent.h" #include "components/SliderComponent.h" #include "components/SwitchComponent.h" #include "guis/GuiMsgBox.h" #include "Settings.h" GuiVideoScreensaverOptions::GuiVideoScreensaverOptions(Window* window, const char* title) : GuiScreensaverOptions(window, title) { // timeout to swap videos auto swap = std::make_shared(mWindow, 10.f, 1000.f, 1.f, "s"); swap->setValue((float)(Settings::getInstance()->getInt("ScreenSaverSwapVideoTimeout") / (1000))); addWithLabel("SWAP VIDEO AFTER (SECS)", swap); addSaveFunc([swap] { int playNextTimeout = (int)round(swap->getValue()) * (1000); Settings::getInstance()->setInt("ScreenSaverSwapVideoTimeout", playNextTimeout); PowerSaver::updateTimeouts(); }); #ifdef _RPI_ auto ss_omx = std::make_shared(mWindow); ss_omx->setState(Settings::getInstance()->getBool("ScreenSaverOmxPlayer")); addWithLabel("USE OMX PLAYER FOR SCREENSAVER", ss_omx); addSaveFunc([ss_omx, this] { Settings::getInstance()->setBool("ScreenSaverOmxPlayer", ss_omx->getState()); }); #endif // Allow ScreenSaver Controls - ScreenSaverControls auto ss_controls = std::make_shared(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 >(mWindow, "SHOW GAME INFO", false); std::vector info_type; info_type.push_back("always"); info_type.push_back("start & end"); info_type.push_back("never"); for(auto it = info_type.cbegin(); it != info_type.cend(); it++) ss_info->add(*it, *it, Settings::getInstance()->getString("ScreenSaverGameInfo") == *it); addWithLabel("SHOW GAME INFO ON SCREENSAVER", ss_info); addSaveFunc([ss_info, this] { Settings::getInstance()->setString("ScreenSaverGameInfo", ss_info->getSelected()); }); #ifndef _RPI_ auto captions_compatibility = std::make_shared(mWindow); captions_compatibility->setState(Settings::getInstance()->getBool("CaptionsCompatibility")); addWithLabel("USE COMPATIBLE LOW RESOLUTION FOR CAPTIONS", captions_compatibility); addSaveFunc([captions_compatibility] { Settings::getInstance()->setBool("CaptionsCompatibility", captions_compatibility->getState()); }); #endif auto stretch_screensaver = std::make_shared(mWindow); stretch_screensaver->setState(Settings::getInstance()->getBool("StretchVideoOnScreenSaver")); addWithLabel("STRETCH VIDEO ON SCREENSAVER", stretch_screensaver); addSaveFunc([stretch_screensaver] { Settings::getInstance()->setBool("StretchVideoOnScreenSaver", stretch_screensaver->getState()); }); } GuiVideoScreensaverOptions::~GuiVideoScreensaverOptions() { } void GuiVideoScreensaverOptions::save() { #ifdef _RPI_ bool startingStatusNotRisky = (Settings::getInstance()->getString("ScreenSaverGameInfo") == "never" || !Settings::getInstance()->getBool("ScreenSaverOmxPlayer")); #endif GuiScreensaverOptions::save(); #ifdef _RPI_ bool endStatusRisky = (Settings::getInstance()->getString("ScreenSaverGameInfo") != "never" && Settings::getInstance()->getBool("ScreenSaverOmxPlayer")); if (startingStatusNotRisky && endStatusRisky) { // if before it wasn't risky but now there's a risk of problems, show warning mWindow->pushGui(new GuiMsgBox(mWindow, "Using OMX Player and displaying Game Info may result in the video flickering in some TV modes. If that happens, consider:\n\n• Disabling the \"Show Game Info\" option;\n• Disabling \"Overscan\" on the Pi configuration menu might help:\nRetroPie > Raspi-Config > Advanced Options > Overscan > \"No\".\n• Disabling the use of OMX Player for the screensaver.", "GOT IT!", [] { return; })); } #endif }