From bbe85b27075a68027e55f6e9f9ac4e2644f422b6 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Thu, 5 Nov 2020 18:25:05 +0100 Subject: [PATCH] Removed deprecated GuiScreensaverOptions, GuiSlideshowScreensaverOptions and GuiVideoScreensaverOptions. --- es-app/CMakeLists.txt | 6 - es-app/src/guis/GuiScreensaverOptions.cpp | 100 ------------- es-app/src/guis/GuiScreensaverOptions.h | 38 ----- .../guis/GuiSlideshowScreensaverOptions.cpp | 114 --------------- .../src/guis/GuiSlideshowScreensaverOptions.h | 26 ---- .../src/guis/GuiVideoScreensaverOptions.cpp | 136 ------------------ es-app/src/guis/GuiVideoScreensaverOptions.h | 24 ---- 7 files changed, 444 deletions(-) delete mode 100644 es-app/src/guis/GuiScreensaverOptions.cpp delete mode 100644 es-app/src/guis/GuiScreensaverOptions.h delete mode 100644 es-app/src/guis/GuiSlideshowScreensaverOptions.cpp delete mode 100644 es-app/src/guis/GuiSlideshowScreensaverOptions.h delete mode 100644 es-app/src/guis/GuiVideoScreensaverOptions.cpp delete mode 100644 es-app/src/guis/GuiVideoScreensaverOptions.h diff --git a/es-app/CMakeLists.txt b/es-app/CMakeLists.txt index 774a4032f..5026c617d 100644 --- a/es-app/CMakeLists.txt +++ b/es-app/CMakeLists.txt @@ -17,10 +17,7 @@ set(ES_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMetaDataEd.h ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGameScraper.h ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGamelistOptions.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScreensaverOptions.h ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGeneralScreensaverOptions.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiVideoScreensaverOptions.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiSlideshowScreensaverOptions.h ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMenu.h ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiSettings.h ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScraperMenu.h @@ -68,10 +65,7 @@ set(ES_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMetaDataEd.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGameScraper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGamelistOptions.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScreensaverOptions.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGeneralScreensaverOptions.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiVideoScreensaverOptions.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiSlideshowScreensaverOptions.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMenu.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiSettings.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScraperMenu.cpp diff --git a/es-app/src/guis/GuiScreensaverOptions.cpp b/es-app/src/guis/GuiScreensaverOptions.cpp deleted file mode 100644 index 88f9e01a6..000000000 --- a/es-app/src/guis/GuiScreensaverOptions.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// SPDX-License-Identifier: MIT -// -// EmulationStation Desktop Edition -// GuiScreensaverOptions.cpp -// -// User interface template for the screensaver option GUIs. -// - -#include "guis/GuiScreensaverOptions.h" - -#include "guis/GuiTextEditPopup.h" -#include "views/ViewController.h" -#include "Settings.h" -#include "SystemData.h" -#include "Window.h" - -GuiScreensaverOptions::GuiScreensaverOptions(Window* window, const char* title) - : GuiComponent(window), mMenu(window, title) -{ - addChild(&mMenu); - mMenu.addButton("BACK", "back", [this] { delete this; }); - - setSize((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight()); - mMenu.setPosition((mSize.x() - mMenu.getSize().x()) / 2, Renderer::getScreenHeight() * 0.15f); -} - -GuiScreensaverOptions::~GuiScreensaverOptions() -{ - save(); -} - -void GuiScreensaverOptions::save() -{ - if (!mSaveFuncs.size()) - return; - - for (auto it = mSaveFuncs.cbegin(); it != mSaveFuncs.cend(); it++) - (*it)(); - - Settings::getInstance()->saveFile(); -} - -bool GuiScreensaverOptions::input(InputConfig* config, Input input) -{ - if (GuiComponent::input(config, input)) - return true; - - if (config->isMappedTo("b", input) && - input.value != 0) { - delete this; - return true; - } - - return false; -} - -HelpStyle GuiScreensaverOptions::getHelpStyle() -{ - HelpStyle style = HelpStyle(); - style.applyTheme(ViewController::get()->getState().getSystem()->getTheme(), "system"); - return style; -} - -std::vector GuiScreensaverOptions::getHelpPrompts() -{ - std::vector prompts = mMenu.getHelpPrompts(); - prompts.push_back(HelpPrompt("b", "back")); - return prompts; -} - -void GuiScreensaverOptions::addEditableTextComponent(ComponentListRow row, - const std::string label, std::shared_ptr ed, std::string value) -{ - row.elements.clear(); - - auto lbl = std::make_shared(mWindow, Utils::String::toUpper(label), - Font::get(FONT_SIZE_MEDIUM), 0x777777FF); - row.addElement(lbl, true); // Label. - - row.addElement(ed, true); - - auto spacer = std::make_shared(mWindow); - spacer->setSize(Renderer::getScreenWidth() * 0.005f, 0); - row.addElement(spacer, false); - - auto bracket = std::make_shared(mWindow); - bracket->setImage(":/graphics/arrow.svg"); - bracket->setResize(Vector2f(0, lbl->getFont()->getLetterHeight())); - row.addElement(bracket, false); - - // OK callback (apply new value to ed). - auto updateVal = [ed](const std::string& newVal) { ed->setValue(newVal); }; - row.makeAcceptInputHandler([this, label, ed, updateVal] { - mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), label, - ed->getValue(), updateVal, false)); - }); - assert(ed); - addRow(row); - ed->setValue(value); -} diff --git a/es-app/src/guis/GuiScreensaverOptions.h b/es-app/src/guis/GuiScreensaverOptions.h deleted file mode 100644 index c3cb6bbe8..000000000 --- a/es-app/src/guis/GuiScreensaverOptions.h +++ /dev/null @@ -1,38 +0,0 @@ -// SPDX-License-Identifier: MIT -// -// EmulationStation Desktop Edition -// GuiScreensaverOptions.h -// -// User interface template for the screensaver option GUIs. -// - -#ifndef ES_APP_GUIS_GUI_SCREENSAVER_OPTIONS_H -#define ES_APP_GUIS_GUI_SCREENSAVER_OPTIONS_H - -#include "components/MenuComponent.h" - -// This is just a really simple template for a GUI that calls some save functions when closed. -class GuiScreensaverOptions : public GuiComponent -{ -public: - GuiScreensaverOptions(Window* window, const char* title); - virtual ~GuiScreensaverOptions(); // Just calls save() - - virtual void save(); - inline void addRow(const ComponentListRow& row) { mMenu.addRow(row); }; - inline void addWithLabel(const std::string& label, - const std::shared_ptr& comp) { mMenu.addWithLabel(label, comp); }; - inline void addSaveFunc(const std::function& func) { mSaveFuncs.push_back(func); }; - void addEditableTextComponent(ComponentListRow row, - const std::string label, std::shared_ptr ed, std::string value); - - bool input(InputConfig* config, Input input) override; - std::vector getHelpPrompts() override; - HelpStyle getHelpStyle() override; - -protected: - MenuComponent mMenu; - std::vector< std::function > mSaveFuncs; -}; - -#endif // ES_APP_GUIS_GUI_SCREENSAVER_OPTIONS_H diff --git a/es-app/src/guis/GuiSlideshowScreensaverOptions.cpp b/es-app/src/guis/GuiSlideshowScreensaverOptions.cpp deleted file mode 100644 index fa81c932f..000000000 --- a/es-app/src/guis/GuiSlideshowScreensaverOptions.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// SPDX-License-Identifier: MIT -// -// EmulationStation Desktop Edition -// GuiSlideshowScreensaverOptions.cpp -// -// User interface for the slideshow screensaver options. -// Submenu to GuiGeneralScreensaverOptions. -// - -#include "guis/GuiSlideshowScreensaverOptions.h" - -#include "components/SliderComponent.h" -#include "components/SwitchComponent.h" -#include "guis/GuiTextEditPopup.h" -#include "utils/StringUtil.h" -#include "Settings.h" -#include "Window.h" - -GuiSlideshowScreensaverOptions::GuiSlideshowScreensaverOptions(Window* window, const char* title) - : GuiScreensaverOptions(window, title) -{ - ComponentListRow row; - - // Image duration (in seconds). - auto sss_image_sec = std::make_shared(mWindow, 1.f, 60.f, 1.f, "s"); - sss_image_sec->setValue((float)(Settings::getInstance()-> - getInt("ScreenSaverSwapImageTimeout") / (1000))); - addWithLabel(row, "SWAP IMAGE AFTER (SECS)", sss_image_sec); - addSaveFunc([sss_image_sec] { - int playNextTimeout = (int)Math::round(sss_image_sec->getValue()) * (1000); - Settings::getInstance()->setInt("ScreenSaverSwapImageTimeout", playNextTimeout); - PowerSaver::updateTimeouts(); - }); - - // Stretch image. - auto sss_stretch = std::make_shared(mWindow); - sss_stretch->setState(Settings::getInstance()->getBool("ScreenSaverStretchImages")); - addWithLabel(row, "STRETCH IMAGES TO SCREEN RESOLUTION", sss_stretch); - addSaveFunc([sss_stretch] { - Settings::getInstance()->setBool("ScreenSaverStretchImages", sss_stretch->getState()); - }); - - #if defined(USE_OPENGL_21) - // Render scanlines using a shader. - auto render_scanlines = std::make_shared(mWindow); - render_scanlines->setState(Settings::getInstance()->getBool("ScreenSaverImageScanlines")); - addWithLabel(row, "RENDER SCANLINES", render_scanlines); - addSaveFunc([render_scanlines] { Settings::getInstance()-> - setBool("ScreenSaverImageScanlines", render_scanlines->getState()); }); - #endif - - // Background audio file. - auto sss_bg_audio_file = std::make_shared(mWindow, "", - Font::get(FONT_SIZE_SMALL), 0x777777FF); - addEditableTextComponent(row, "BACKGROUND AUDIO", sss_bg_audio_file, - Settings::getInstance()->getString("SlideshowScreenSaverBackgroundAudioFile")); - addSaveFunc([sss_bg_audio_file] { - Settings::getInstance()->setString("SlideshowScreenSaverBackgroundAudioFile", - sss_bg_audio_file->getValue()); - }); - - // Image source. - auto sss_custom_source = std::make_shared(mWindow); - sss_custom_source->setState(Settings::getInstance()-> - getBool("SlideshowScreenSaverCustomImageSource")); - addWithLabel(row, "USE CUSTOM IMAGES", sss_custom_source); - addSaveFunc([sss_custom_source] { Settings::getInstance()-> - setBool("SlideshowScreenSaverCustomImageSource", sss_custom_source->getState()); }); - - // Custom image directory. - auto sss_image_dir = std::make_shared(mWindow, "", - Font::get(FONT_SIZE_SMALL), 0x777777FF); - addEditableTextComponent(row, "CUSTOM IMAGE DIR", sss_image_dir, - Settings::getInstance()->getString("SlideshowScreenSaverImageDir")); - addSaveFunc([sss_image_dir] { - Settings::getInstance()->setString("SlideshowScreenSaverImageDir", - sss_image_dir->getValue()); - }); - - // Recurse custom image directory. - auto sss_recurse = std::make_shared(mWindow); - sss_recurse->setState(Settings::getInstance()->getBool("SlideshowScreenSaverRecurse")); - addWithLabel(row, "CUSTOM IMAGE DIR RECURSIVE", sss_recurse); - addSaveFunc([sss_recurse] { - Settings::getInstance()->setBool("SlideshowScreenSaverRecurse", sss_recurse->getState()); - }); - - // Custom image filter (file extensions). - auto sss_image_filter = std::make_shared(mWindow, "", - Font::get(FONT_SIZE_SMALL), 0x777777FF); - addEditableTextComponent(row, "CUSTOM IMAGE FILTER", sss_image_filter, - Settings::getInstance()->getString("SlideshowScreenSaverImageFilter")); - addSaveFunc([sss_image_filter] { - Settings::getInstance()->setString("SlideshowScreenSaverImageFilter", - sss_image_filter->getValue()); - }); -} - -GuiSlideshowScreensaverOptions::~GuiSlideshowScreensaverOptions() -{ -} - -void GuiSlideshowScreensaverOptions::addWithLabel(ComponentListRow row, - const std::string label, std::shared_ptr component) -{ - row.elements.clear(); - - auto lbl = std::make_shared(mWindow, Utils::String::toUpper(label), - Font::get(FONT_SIZE_MEDIUM), 0x777777FF); - - row.addElement(lbl, true); // Label. - row.addElement(component, false, true); - addRow(row); -} diff --git a/es-app/src/guis/GuiSlideshowScreensaverOptions.h b/es-app/src/guis/GuiSlideshowScreensaverOptions.h deleted file mode 100644 index b729b388e..000000000 --- a/es-app/src/guis/GuiSlideshowScreensaverOptions.h +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-License-Identifier: MIT -// -// EmulationStation Desktop Edition -// GuiSlideshowScreensaverOptions.h -// -// User interface for the slideshow screensaver options. -// Submenu to GuiGeneralScreensaverOptions. -// - -#ifndef ES_APP_GUIS_GUI_SLIDESHOW_SCREENSAVER_OPTIONS_H -#define ES_APP_GUIS_GUI_SLIDESHOW_SCREENSAVER_OPTIONS_H - -#include "GuiScreensaverOptions.h" - -class GuiSlideshowScreensaverOptions : public GuiScreensaverOptions -{ -public: - GuiSlideshowScreensaverOptions(Window* window, const char* title); - virtual ~GuiSlideshowScreensaverOptions(); - -private: - void addWithLabel(ComponentListRow row, const std::string label, - std::shared_ptr component); -}; - -#endif // ES_APP_GUIS_GUI_SLIDESHOW_SCREENSAVER_OPTIONS_H diff --git a/es-app/src/guis/GuiVideoScreensaverOptions.cpp b/es-app/src/guis/GuiVideoScreensaverOptions.cpp deleted file mode 100644 index 0f6d4fcad..000000000 --- a/es-app/src/guis/GuiVideoScreensaverOptions.cpp +++ /dev/null @@ -1,136 +0,0 @@ -// SPDX-License-Identifier: MIT -// -// EmulationStation Desktop Edition -// GuiVideoScreensaverOptions.cpp -// -// User interface for the video screensaver options. -// Submenu to GuiGeneralScreensaverOptions. -// - -#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) -{ - // Timer for swapping videos. - auto swap = std::make_shared(mWindow, 1.f, 120.f, 1.f, "s"); - swap->setValue((float)(Settings::getInstance()-> - getInt("ScreenSaverSwapVideoTimeout") / (1000))); - addWithLabel("SWAP VIDEO AFTER (SECS)", swap); - addSaveFunc([swap] { - int playNextTimeout = (int)Math::round(swap->getValue()) * (1000); - Settings::getInstance()->setInt("ScreenSaverSwapVideoTimeout", playNextTimeout); - PowerSaver::updateTimeouts(); - }); - - auto stretch_screensaver = std::make_shared(mWindow); - stretch_screensaver->setState(Settings::getInstance()->getBool("ScreenSaverStretchVideos")); - addWithLabel("STRETCH VIDEOS TO SCREEN RESOLUTION", stretch_screensaver); - addSaveFunc([stretch_screensaver] { Settings::getInstance()-> - setBool("ScreenSaverStretchVideos", stretch_screensaver->getState()); }); - - #if defined(_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()); }); - - // TEMPORARY - Disabled for now, need to find a proper way to make an overlay on top of - // the videos. The solution with rendering subtitles is not a good solution. - // And as well the VLC video player subtitles seem to be somehow broken. - // Render video game name as subtitles. -// auto ss_info = std::make_shared> -// (mWindow,getHelpStyle(), "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()); }); - -// ComponentListRow row; - - // Set subtitle position. -// auto ss_omx_subs_align = std::make_shared> -// (mWindow, getHelpStyle(), "GAME INFO ALIGNMENT", false); -// std::vector align_mode; -// align_mode.push_back("left"); -// align_mode.push_back("center"); -// for (auto it = align_mode.cbegin(); it != align_mode.cend(); it++) -// ss_omx_subs_align->add(*it, *it, Settings::getInstance()-> -// getString("SubtitleAlignment") == *it); -// addWithLabel("GAME INFO ALIGNMENT", ss_omx_subs_align); -// addSaveFunc([ss_omx_subs_align, this] { Settings::getInstance()-> -// setString("SubtitleAlignment", ss_omx_subs_align->getSelected()); }); - - // Set font size. -// auto ss_omx_font_size = std::make_shared(mWindow, 1.f, 64.f, 1.f, "h"); -// ss_omx_font_size->setValue((float)(Settings::getInstance()->getInt("SubtitleSize"))); -// addWithLabel("GAME INFO FONT SIZE", ss_omx_font_size); -// addSaveFunc([ss_omx_font_size] { -// int subSize = (int)Math::round(ss_omx_font_size->getValue()); -// Settings::getInstance()->setInt("SubtitleSize", subSize); -// }); - #endif - - auto ss_video_audio = std::make_shared(mWindow); - ss_video_audio->setState(Settings::getInstance()->getBool("ScreenSaverVideoAudio")); - addWithLabel("PLAY AUDIO FOR SCREENSAVER VIDEO FILES", ss_video_audio); - addSaveFunc([ss_video_audio] { Settings::getInstance()-> - setBool("ScreenSaverVideoAudio", ss_video_audio->getState()); }); - - #if defined(USE_OPENGL_21) - // Render scanlines using a shader. - auto render_scanlines = std::make_shared(mWindow); - render_scanlines->setState(Settings::getInstance()->getBool("ScreenSaverVideoScanlines")); - addWithLabel("RENDER SCANLINES", render_scanlines); - addSaveFunc([render_scanlines] { Settings::getInstance()-> - setBool("ScreenSaverVideoScanlines", render_scanlines->getState()); }); - - // Render blur using a shader. - auto render_blur = std::make_shared(mWindow); - render_blur->setState(Settings::getInstance()->getBool("ScreenSaverVideoBlur")); - addWithLabel("RENDER BLUR", render_blur); - addSaveFunc([render_blur] { Settings::getInstance()-> - setBool("ScreenSaverVideoBlur", render_blur->getState()); }); - #endif -} - -GuiVideoScreensaverOptions::~GuiVideoScreensaverOptions() -{ -} - -void GuiVideoScreensaverOptions::save() -{ - #if defined(_RPI_) - bool startingStatusNotRisky = (Settings::getInstance()-> - getString("ScreenSaverGameInfo") == "never" || - !Settings::getInstance()->getBool("ScreenSaverOmxPlayer")); - #endif - GuiScreensaverOptions::save(); - - #if defined(_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, getHelpStyle(), - "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 -} diff --git a/es-app/src/guis/GuiVideoScreensaverOptions.h b/es-app/src/guis/GuiVideoScreensaverOptions.h deleted file mode 100644 index 24cb92fd7..000000000 --- a/es-app/src/guis/GuiVideoScreensaverOptions.h +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: MIT -// -// EmulationStation Desktop Edition -// GuiVideoScreensaverOptions.h -// -// User interface for the video screensaver options. -// Submenu to GuiGeneralScreensaverOptions. -// - -#ifndef ES_APP_GUIS_GUI_VIDEO_SCREENSAVER_OPTIONS_H -#define ES_APP_GUIS_GUI_VIDEO_SCREENSAVER_OPTIONS_H - -#include "GuiScreensaverOptions.h" - -class GuiVideoScreensaverOptions : public GuiScreensaverOptions -{ -public: - GuiVideoScreensaverOptions(Window* window, const char* title); - virtual ~GuiVideoScreensaverOptions(); - - void save() override; -}; - -#endif // ES_APP_GUIS_GUI_VIDEO_SCREENSAVER_OPTIONS_H