OCD update renaming ScreenSaver to Screensaver.

This commit is contained in:
Leon Styhre 2020-11-10 22:33:57 +01:00
parent bbb2aa5217
commit 6368ae0cc1
12 changed files with 56 additions and 56 deletions

View file

@ -10,7 +10,7 @@ set(ES_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/src/VolumeControl.h ${CMAKE_CURRENT_SOURCE_DIR}/src/VolumeControl.h
${CMAKE_CURRENT_SOURCE_DIR}/src/Gamelist.h ${CMAKE_CURRENT_SOURCE_DIR}/src/Gamelist.h
${CMAKE_CURRENT_SOURCE_DIR}/src/FileFilterIndex.h ${CMAKE_CURRENT_SOURCE_DIR}/src/FileFilterIndex.h
${CMAKE_CURRENT_SOURCE_DIR}/src/SystemScreenSaver.h ${CMAKE_CURRENT_SOURCE_DIR}/src/SystemScreensaver.h
${CMAKE_CURRENT_SOURCE_DIR}/src/CollectionSystemManager.h ${CMAKE_CURRENT_SOURCE_DIR}/src/CollectionSystemManager.h
# Guis # Guis
@ -58,7 +58,7 @@ set(ES_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/VolumeControl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/VolumeControl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Gamelist.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Gamelist.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/FileFilterIndex.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/FileFilterIndex.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/SystemScreenSaver.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/SystemScreensaver.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/CollectionSystemManager.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/CollectionSystemManager.cpp
# Guis # Guis

View file

@ -1,13 +1,13 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// //
// EmulationStation Desktop Edition // EmulationStation Desktop Edition
// SystemScreenSaver.cpp // SystemScreensaver.cpp
// //
// Screensaver, supporting the following types: // Screensaver, supporting the following types:
// Dim, black, slideshow, video. // Dim, black, slideshow, video.
// //
#include "SystemScreenSaver.h" #include "SystemScreensaver.h"
#if defined(_RPI_) #if defined(_RPI_)
#include "components/VideoPlayerComponent.h" #include "components/VideoPlayerComponent.h"

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// //
// EmulationStation Desktop Edition // EmulationStation Desktop Edition
// SystemScreenSaver.h // SystemScreensaver.h
// //
// Screensaver, supporting the following types: // Screensaver, supporting the following types:
// Dim, black, slideshow, video. // Dim, black, slideshow, video.

View file

@ -33,7 +33,7 @@
#include "PowerSaver.h" #include "PowerSaver.h"
#include "Settings.h" #include "Settings.h"
#include "SystemData.h" #include "SystemData.h"
#include "SystemScreenSaver.h" #include "SystemScreensaver.h"
#include <SDL2/SDL_events.h> #include <SDL2/SDL_events.h>
#include <SDL2/SDL_main.h> #include <SDL2/SDL_main.h>

View file

@ -545,16 +545,16 @@ void GuiComponent::onUnpauseVideo()
getChild(i)->onUnpauseVideo(); getChild(i)->onUnpauseVideo();
} }
void GuiComponent::onScreenSaverActivate() void GuiComponent::onScreensaverActivate()
{ {
for (unsigned int i = 0; i < getChildCount(); i++) for (unsigned int i = 0; i < getChildCount(); i++)
getChild(i)->onScreenSaverActivate(); getChild(i)->onScreensaverActivate();
} }
void GuiComponent::onScreenSaverDeactivate() void GuiComponent::onScreensaverDeactivate()
{ {
for (unsigned int i = 0; i < getChildCount(); i++) for (unsigned int i = 0; i < getChildCount(); i++)
getChild(i)->onScreenSaverDeactivate(); getChild(i)->onScreensaverDeactivate();
} }
void GuiComponent::onGameLaunchedActivate() void GuiComponent::onGameLaunchedActivate()

View file

@ -177,8 +177,8 @@ public:
virtual void setRenderView(bool status) { mRenderView = status; } virtual void setRenderView(bool status) { mRenderView = status; }
virtual bool getRenderView() { return mRenderView; }; virtual bool getRenderView() { return mRenderView; };
virtual void onScreenSaverActivate(); virtual void onScreensaverActivate();
virtual void onScreenSaverDeactivate(); virtual void onScreensaverDeactivate();
virtual void onGameLaunchedActivate(); virtual void onGameLaunchedActivate();
virtual void onGameLaunchedDeactivate(); virtual void onGameLaunchedDeactivate();
virtual void topWindow(bool isTop); virtual void topWindow(bool isTop);

View file

@ -16,10 +16,10 @@
#endif #endif
bool PowerSaver::mState = false; bool PowerSaver::mState = false;
bool PowerSaver::mRunningScreenSaver = false; bool PowerSaver::mRunningScreensaver = false;
int PowerSaver::mWakeupTimeout = -1; int PowerSaver::mWakeupTimeout = -1;
int PowerSaver::mScreenSaverTimeout = -1; int PowerSaver::mScreensaverTimeout = -1;
PowerSaver::mode PowerSaver::mMode = PowerSaver::DISABLED; PowerSaver::mode PowerSaver::mMode = PowerSaver::DISABLED;
void PowerSaver::init() void PowerSaver::init()
@ -34,7 +34,7 @@ int PowerSaver::getTimeout()
AudioManager::getInstance()->deinit(); AudioManager::getInstance()->deinit();
// Used only for SDL_WaitEventTimeout. Use `getMode()` for modes. // Used only for SDL_WaitEventTimeout. Use `getMode()` for modes.
return mRunningScreenSaver ? mWakeupTimeout : mScreenSaverTimeout; return mRunningScreensaver ? mWakeupTimeout : mScreensaverTimeout;
} }
void PowerSaver::loadWakeupTime() void PowerSaver::loadWakeupTime()
@ -51,8 +51,8 @@ void PowerSaver::loadWakeupTime()
void PowerSaver::updateTimeouts() void PowerSaver::updateTimeouts()
{ {
mScreenSaverTimeout = (unsigned int) Settings::getInstance()->getInt("ScreensaverTimer"); mScreensaverTimeout = (unsigned int) Settings::getInstance()->getInt("ScreensaverTimer");
mScreenSaverTimeout = mScreenSaverTimeout > 0 ? mScreenSaverTimeout - getMode() : -1; mScreensaverTimeout = mScreensaverTimeout > 0 ? mScreensaverTimeout - getMode() : -1;
loadWakeupTime(); loadWakeupTime();
} }
@ -93,7 +93,7 @@ void PowerSaver::setState(bool state)
void PowerSaver::runningScreensaver(bool state) void PowerSaver::runningScreensaver(bool state)
{ {
mRunningScreenSaver = state; mRunningScreensaver = state;
if (mWakeupTimeout < mMode) { if (mWakeupTimeout < mMode) {
// Disable PS if wake up time is less than mode as PS will never trigger. // Disable PS if wake up time is less than mode as PS will never trigger.
setState(!state); setState(!state);
@ -102,5 +102,5 @@ void PowerSaver::runningScreensaver(bool state)
bool PowerSaver::isScreensaverActive() bool PowerSaver::isScreensaverActive()
{ {
return mRunningScreenSaver; return mRunningScreensaver;
} }

View file

@ -42,17 +42,17 @@ public:
static void pause() { setState(false); } static void pause() { setState(false); }
static void resume() { setState(true); } static void resume() { setState(true); }
// This is used by ScreenSaver to let PS know when to switch to SS timeouts. // This is used by Screensaver to let PS know when to switch to SS timeouts.
static void runningScreensaver(bool state); static void runningScreensaver(bool state);
static bool isScreensaverActive(); static bool isScreensaverActive();
private: private:
static bool mState; static bool mState;
static bool mRunningScreenSaver; static bool mRunningScreensaver;
static mode mMode; static mode mMode;
static int mWakeupTimeout; static int mWakeupTimeout;
static int mScreenSaverTimeout; static int mScreensaverTimeout;
static void loadWakeupTime(); static void loadWakeupTime();
}; };

View file

@ -20,7 +20,7 @@
#include <iomanip> #include <iomanip>
Window::Window() Window::Window()
: mScreenSaver(nullptr), : mScreensaver(nullptr),
mInfoPopup(nullptr), mInfoPopup(nullptr),
mNormalizeNextUpdate(false), mNormalizeNextUpdate(false),
mFrameTimeElapsed(0), mFrameTimeElapsed(0),
@ -29,7 +29,7 @@ Window::Window()
mAllowSleep(true), mAllowSleep(true),
mSleeping(false), mSleeping(false),
mTimeSinceLastInput(0), mTimeSinceLastInput(0),
mRenderScreenSaver(false), mRenderScreensaver(false),
mGameLaunchedState(false), mGameLaunchedState(false),
mAllowTextScrolling(true), mAllowTextScrolling(true),
mCachedBackground(false), mCachedBackground(false),
@ -144,8 +144,8 @@ void Window::input(InputConfig* config, Input input)
if (Settings::getInstance()->getBool("Debug")) if (Settings::getInstance()->getBool("Debug"))
logInput(config, input); logInput(config, input);
if (mScreenSaver) { if (mScreensaver) {
if (mScreenSaver->isScreensaverActive() && if (mScreensaver->isScreensaverActive() &&
Settings::getInstance()->getBool("ScreensaverControls") && Settings::getInstance()->getBool("ScreensaverControls") &&
((Settings::getInstance()->getString("ScreensaverType") == "video") || ((Settings::getInstance()->getString("ScreensaverType") == "video") ||
(Settings::getInstance()->getString("ScreensaverType") == "slideshow"))) { (Settings::getInstance()->getString("ScreensaverType") == "slideshow"))) {
@ -154,21 +154,21 @@ void Window::input(InputConfig* config, Input input)
Settings::getInstance()->getBool("ScreensaverSlideshowCustomImages")) Settings::getInstance()->getBool("ScreensaverSlideshowCustomImages"))
customImageSlideshow = true; customImageSlideshow = true;
if (customImageSlideshow || mScreenSaver->getCurrentGame() != nullptr && if (customImageSlideshow || mScreensaver->getCurrentGame() != nullptr &&
(config->isMappedTo("a", input) || (config->isMappedTo("a", input) ||
config->isMappedLike("left", input) || config->isMappedLike("right", input))) { config->isMappedLike("left", input) || config->isMappedLike("right", input))) {
// Left or right browses to the next video or image. // Left or right browses to the next video or image.
if (config->isMappedLike("left", input) || config->isMappedLike("right", input)) { if (config->isMappedLike("left", input) || config->isMappedLike("right", input)) {
if (input.value != 0) { if (input.value != 0) {
// Handle screensaver control. // Handle screensaver control.
mScreenSaver->nextGame(); mScreensaver->nextGame();
} }
return; return;
} }
else if (config->isMappedTo("a", input) && input.value != 0) { else if (config->isMappedTo("a", input) && input.value != 0) {
// Launch game. // Launch game.
cancelScreensaver(); cancelScreensaver();
mScreenSaver->launchGame(); mScreensaver->launchGame();
// To force handling the wake up process. // To force handling the wake up process.
mSleeping = true; mSleeping = true;
} }
@ -279,8 +279,8 @@ void Window::update(int deltaTime)
peekGui()->update(deltaTime); peekGui()->update(deltaTime);
// Update the screensaver. // Update the screensaver.
if (mScreenSaver) if (mScreensaver)
mScreenSaver->update(deltaTime); mScreensaver->update(deltaTime);
} }
void Window::render() void Window::render()
@ -294,7 +294,7 @@ void Window::render()
auto& bottom = mGuiStack.front(); auto& bottom = mGuiStack.front();
auto& top = mGuiStack.back(); auto& top = mGuiStack.back();
if (mRenderScreenSaver) { if (mRenderScreensaver) {
bottom->cancelAllAnimations(); bottom->cancelAllAnimations();
bottom->stopAllAnimations(); bottom->stopAllAnimations();
} }
@ -373,7 +373,7 @@ void Window::render()
// the screensaver in the background when running a game. // the screensaver in the background when running a game.
else if (mGameLaunchedState) else if (mGameLaunchedState)
mTimeSinceLastInput = 0; mTimeSinceLastInput = 0;
else if (!isProcessing() && !mScreenSaver->isScreensaverActive()) else if (!isProcessing() && !mScreensaver->isScreensaverActive())
startScreensaver(); startScreensaver();
} }
@ -381,11 +381,11 @@ void Window::render()
// or not because it may perform a fade on transition. // or not because it may perform a fade on transition.
renderScreensaver(); renderScreensaver();
if (!mRenderScreenSaver && mInfoPopup) if (!mRenderScreensaver && mInfoPopup)
mInfoPopup->render(transform); mInfoPopup->render(transform);
if (mTimeSinceLastInput >= screensaverTimer && screensaverTimer != 0) { if (mTimeSinceLastInput >= screensaverTimer && screensaverTimer != 0) {
if (!isProcessing() && mAllowSleep && (!mScreenSaver)) { if (!isProcessing() && mAllowSleep && (!mScreensaver)) {
// Go to sleep. // Go to sleep.
if (mSleeping == false) { if (mSleeping == false) {
mSleeping = true; mSleeping = true;
@ -396,9 +396,9 @@ void Window::render()
#if defined(USE_OPENGL_21) #if defined(USE_OPENGL_21)
// Shaders for the screensavers. // Shaders for the screensavers.
if (mScreenSaver->isScreensaverActive()) { if (mScreensaver->isScreensaverActive()) {
if (Settings::getInstance()->getString("ScreensaverType") == "video") { if (Settings::getInstance()->getString("ScreensaverType") == "video") {
if (mScreenSaver->getHasMediaFiles()) { if (mScreensaver->getHasMediaFiles()) {
if (Settings::getInstance()->getBool("ScreensaverVideoBlur")) if (Settings::getInstance()->getBool("ScreensaverVideoBlur"))
Renderer::shaderPostprocessing(Renderer::SHADER_BLUR_HORIZONTAL); Renderer::shaderPostprocessing(Renderer::SHADER_BLUR_HORIZONTAL);
if (Settings::getInstance()->getBool("ScreensaverVideoScanlines")) if (Settings::getInstance()->getBool("ScreensaverVideoScanlines"))
@ -414,7 +414,7 @@ void Window::render()
} }
} }
else if (Settings::getInstance()->getString("ScreensaverType") == "slideshow") { else if (Settings::getInstance()->getString("ScreensaverType") == "slideshow") {
if (mScreenSaver->getHasMediaFiles()) { if (mScreensaver->getHasMediaFiles()) {
if (Settings::getInstance()->getBool("ScreensaverImageScanlines")) if (Settings::getInstance()->getBool("ScreensaverImageScanlines"))
Renderer::shaderPostprocessing(Renderer::SHADER_SCANLINES); Renderer::shaderPostprocessing(Renderer::SHADER_SCANLINES);
} }
@ -607,26 +607,26 @@ void Window::unsetLaunchedGame()
void Window::startScreensaver() void Window::startScreensaver()
{ {
if (mScreenSaver && !mRenderScreenSaver) { if (mScreensaver && !mRenderScreensaver) {
// Tell the GUI components the screensaver is starting. // Tell the GUI components the screensaver is starting.
for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); it++) for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); it++)
(*it)->onScreenSaverActivate(); (*it)->onScreensaverActivate();
stopInfoPopup(); stopInfoPopup();
mScreenSaver->startScreensaver(true); mScreensaver->startScreensaver(true);
mRenderScreenSaver = true; mRenderScreensaver = true;
} }
} }
bool Window::cancelScreensaver() bool Window::cancelScreensaver()
{ {
if (mScreenSaver && mRenderScreenSaver) { if (mScreensaver && mRenderScreensaver) {
mScreenSaver->stopScreensaver(); mScreensaver->stopScreensaver();
mRenderScreenSaver = false; mRenderScreensaver = false;
// Tell the GUI components the screensaver has stopped. // Tell the GUI components the screensaver has stopped.
for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); it++) { for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); it++) {
(*it)->onScreenSaverDeactivate(); (*it)->onScreensaverDeactivate();
// If the menu is open, pause the video so it won't start playing beneath the menu. // If the menu is open, pause the video so it won't start playing beneath the menu.
if (mGuiStack.front() != mGuiStack.back()) if (mGuiStack.front() != mGuiStack.back())
(*it)->onPauseVideo(); (*it)->onPauseVideo();
@ -643,6 +643,6 @@ bool Window::cancelScreensaver()
void Window::renderScreensaver() void Window::renderScreensaver()
{ {
if (mScreenSaver) if (mScreensaver)
mScreenSaver->renderScreensaver(); mScreensaver->renderScreensaver();
} }

View file

@ -81,14 +81,14 @@ public:
void renderHelpPromptsEarly(); // Used to render HelpPrompts before a fade. void renderHelpPromptsEarly(); // Used to render HelpPrompts before a fade.
void setHelpPrompts(const std::vector<HelpPrompt>& prompts, const HelpStyle& style); void setHelpPrompts(const std::vector<HelpPrompt>& prompts, const HelpStyle& style);
void setScreensaver(Screensaver* screenSaver) { mScreenSaver = screenSaver; } void setScreensaver(Screensaver* screensaver) { mScreensaver = screensaver; }
void setInfoPopup(InfoPopup* infoPopup) { delete mInfoPopup; mInfoPopup = infoPopup; } void setInfoPopup(InfoPopup* infoPopup) { delete mInfoPopup; mInfoPopup = infoPopup; }
inline void stopInfoPopup() { if (mInfoPopup) mInfoPopup->stop(); }; inline void stopInfoPopup() { if (mInfoPopup) mInfoPopup->stop(); };
void startScreensaver(); void startScreensaver();
bool cancelScreensaver(); bool cancelScreensaver();
void renderScreensaver(); void renderScreensaver();
bool isScreensaverActive() { return mRenderScreenSaver; }; bool isScreensaverActive() { return mRenderScreensaver; };
void setLaunchedGame(); void setLaunchedGame();
void unsetLaunchedGame(); void unsetLaunchedGame();
@ -107,7 +107,7 @@ private:
HelpComponent* mHelp; HelpComponent* mHelp;
ImageComponent* mBackgroundOverlay; ImageComponent* mBackgroundOverlay;
Screensaver* mScreenSaver; Screensaver* mScreensaver;
InfoPopup* mInfoPopup; InfoPopup* mInfoPopup;
std::vector<GuiComponent*> mGuiStack; std::vector<GuiComponent*> mGuiStack;
std::vector<std::shared_ptr<Font>> mDefaultFonts; std::vector<std::shared_ptr<Font>> mDefaultFonts;
@ -121,7 +121,7 @@ private:
bool mSleeping; bool mSleeping;
unsigned int mTimeSinceLastInput; unsigned int mTimeSinceLastInput;
bool mRenderScreenSaver; bool mRenderScreensaver;
bool mGameLaunchedState; bool mGameLaunchedState;
bool mAllowTextScrolling; bool mAllowTextScrolling;
bool mCachedBackground; bool mCachedBackground;

View file

@ -328,7 +328,7 @@ void VideoComponent::onUnpauseVideo()
manageState(); manageState();
} }
void VideoComponent::onScreenSaverActivate() void VideoComponent::onScreensaverActivate()
{ {
mBlockPlayer = true; mBlockPlayer = true;
mPause = true; mPause = true;
@ -337,7 +337,7 @@ void VideoComponent::onScreenSaverActivate()
manageState(); manageState();
} }
void VideoComponent::onScreenSaverDeactivate() void VideoComponent::onScreensaverDeactivate()
{ {
mBlockPlayer = false; mBlockPlayer = false;
// Stop video when deactivating the screensaver to force a reload of the // Stop video when deactivating the screensaver to force a reload of the

View file

@ -46,8 +46,8 @@ public:
virtual void onPauseVideo() override; virtual void onPauseVideo() override;
virtual void onUnpauseVideo() override; virtual void onUnpauseVideo() override;
virtual bool isVideoPaused() override { return mPause; } virtual bool isVideoPaused() override { return mPause; }
virtual void onScreenSaverActivate() override; virtual void onScreensaverActivate() override;
virtual void onScreenSaverDeactivate() override; virtual void onScreensaverDeactivate() override;
virtual void onGameLaunchedActivate() override; virtual void onGameLaunchedActivate() override;
virtual void onGameLaunchedDeactivate() override; virtual void onGameLaunchedDeactivate() override;
virtual void topWindow(bool isTop) override; virtual void topWindow(bool isTop) override;