mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-24 07:05:39 +00:00
83 lines
4 KiB
C++
83 lines
4 KiB
C++
|
#include "guis/GuiVideoScreensaverOptions.h"
|
||
|
#include "Window.h"
|
||
|
#include "Settings.h"
|
||
|
#include "views/ViewController.h"
|
||
|
|
||
|
#include "components/SwitchComponent.h"
|
||
|
#include "components/SliderComponent.h"
|
||
|
#include "components/OptionListComponent.h"
|
||
|
#include "components/MenuComponent.h"
|
||
|
#include "guis/GuiMsgBox.h"
|
||
|
#include "PowerSaver.h"
|
||
|
|
||
|
GuiVideoScreensaverOptions::GuiVideoScreensaverOptions(Window* window, const char* title) : GuiScreensaverOptions(window, title)
|
||
|
{
|
||
|
// timeout to swap videos
|
||
|
auto swap = std::make_shared<SliderComponent>(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<SwitchComponent>(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<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;
|
||
|
info_type.push_back("always");
|
||
|
info_type.push_back("start & end");
|
||
|
info_type.push_back("never");
|
||
|
for(auto it = info_type.begin(); it != info_type.end(); 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<SwitchComponent>(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<SwitchComponent>(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
|
||
|
}
|