mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-21 21:55:38 +00:00
Removed the deprecated PowerSaver.
This commit is contained in:
parent
05302052de
commit
29abe2dc8c
1
NEWS.md
1
NEWS.md
|
@ -29,6 +29,7 @@ Many bugs have been fixed, and numerous features that were only partially implem
|
|||
* Gamelist sorting is now working as expected and is persistent throughout the application session
|
||||
* Overhaul of the game collection functionality including many bug fixes and optimizations
|
||||
* Overhaul of the screensaver (the game info overlay now works correctly for instance)
|
||||
* Removed the PowerSaver
|
||||
* Added ability to delete custom collections from the GUI menu
|
||||
* Game counting is now done during sorting instead of every time a system is selected. This should make the UI more responsive in case of large game libraries
|
||||
* Added a system view counter for favorite games in addition to the total number of games
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "views/ViewController.h"
|
||||
#include "FileData.h"
|
||||
#include "Log.h"
|
||||
#include "PowerSaver.h"
|
||||
#include "SystemData.h"
|
||||
|
||||
#include <random>
|
||||
|
@ -145,7 +144,6 @@ void SystemScreensaver::startScreensaver(bool generateMediaList)
|
|||
mImageScreensaver->setMaxSize(static_cast<float>(Renderer::getScreenWidth()),
|
||||
static_cast<float>(Renderer::getScreenHeight()));
|
||||
}
|
||||
PowerSaver::runningScreensaver(true);
|
||||
mTimer = 0;
|
||||
return;
|
||||
}
|
||||
|
@ -195,7 +193,6 @@ void SystemScreensaver::startScreensaver(bool generateMediaList)
|
|||
mVideoScreensaver->setVideo(path);
|
||||
mVideoScreensaver->setScreensaverMode(true);
|
||||
mVideoScreensaver->onShow();
|
||||
PowerSaver::runningScreensaver(true);
|
||||
mTimer = 0;
|
||||
return;
|
||||
}
|
||||
|
@ -213,7 +210,6 @@ void SystemScreensaver::stopScreensaver()
|
|||
mImageScreensaver = nullptr;
|
||||
|
||||
mState = STATE_INACTIVE;
|
||||
PowerSaver::runningScreensaver(false);
|
||||
|
||||
mDimValue = 1.0;
|
||||
mRectangleFadeIn = 50;
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "components/TextComponent.h"
|
||||
#include "views/ViewController.h"
|
||||
#include "FileData.h"
|
||||
#include "PowerSaver.h"
|
||||
#include "SystemData.h"
|
||||
|
||||
GuiGameScraper::GuiGameScraper(
|
||||
|
@ -28,7 +27,6 @@ GuiGameScraper::GuiGameScraper(
|
|||
mSearchParams(params),
|
||||
mClose(false)
|
||||
{
|
||||
PowerSaver::pause();
|
||||
addChild(&mBox);
|
||||
addChild(&mGrid);
|
||||
|
||||
|
@ -120,7 +118,6 @@ void GuiGameScraper::onSizeChanged()
|
|||
bool GuiGameScraper::input(InputConfig* config, Input input)
|
||||
{
|
||||
if (config->isMappedTo("b", input) && input.value) {
|
||||
PowerSaver::resume();
|
||||
delete this;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "guis/GuiScraperSearch.h"
|
||||
#include "views/ViewController.h"
|
||||
#include "Gamelist.h"
|
||||
#include "PowerSaver.h"
|
||||
#include "SystemData.h"
|
||||
#include "Window.h"
|
||||
|
||||
|
@ -36,7 +35,6 @@ GuiScraperMulti::GuiScraperMulti(
|
|||
addChild(&mBackground);
|
||||
addChild(&mGrid);
|
||||
|
||||
PowerSaver::pause();
|
||||
mIsProcessing = true;
|
||||
|
||||
mTotalGames = static_cast<int>(mSearchQueue.size());
|
||||
|
@ -182,8 +180,6 @@ void GuiScraperMulti::finish()
|
|||
mIsProcessing = false;
|
||||
delete this;
|
||||
}));
|
||||
|
||||
PowerSaver::resume();
|
||||
}
|
||||
|
||||
std::vector<HelpPrompt> GuiScraperMulti::getHelpPrompts()
|
||||
|
|
|
@ -28,7 +28,6 @@ GuiScreensaverOptions::GuiScreensaverOptions(Window* window, const char* title)
|
|||
Settings::getInstance()->getInt("ScreensaverTimer")) {
|
||||
Settings::getInstance()->setInt("ScreensaverTimer",
|
||||
static_cast<int>(Math::round(screensaver_timer->getValue()) * (1000 * 60)));
|
||||
PowerSaver::updateTimeouts();
|
||||
setNeedsSaving();
|
||||
}
|
||||
});
|
||||
|
@ -59,7 +58,6 @@ GuiScreensaverOptions::GuiScreensaverOptions(Window* window, const char* title)
|
|||
Settings::getInstance()->setString("ScreensaverType",
|
||||
screensaver_type->getSelected());
|
||||
setNeedsSaving();
|
||||
PowerSaver::updateTimeouts();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -113,7 +111,6 @@ void GuiScreensaverOptions::openSlideshowScreensaverOptions()
|
|||
static_cast<int>(Math::round(screensaver_swap_image_timeout->getValue()) *
|
||||
(1000)));
|
||||
s->setNeedsSaving();
|
||||
PowerSaver::updateTimeouts();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -225,7 +222,6 @@ void GuiScreensaverOptions::openVideoScreensaverOptions()
|
|||
static_cast<int>(Math::round(screensaver_swap_video_timeout->getValue()) *
|
||||
(1000)));
|
||||
s->setNeedsSaving();
|
||||
PowerSaver::updateTimeouts();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "Log.h"
|
||||
#include "MameNames.h"
|
||||
#include "Platform.h"
|
||||
#include "PowerSaver.h"
|
||||
#include "Settings.h"
|
||||
#include "SystemData.h"
|
||||
#include "SystemScreensaver.h"
|
||||
|
@ -453,7 +452,6 @@ int main(int argc, char* argv[])
|
|||
|
||||
Window window;
|
||||
SystemScreensaver screensaver(&window);
|
||||
PowerSaver::init();
|
||||
ViewController::init(&window);
|
||||
CollectionSystemManager::init(&window);
|
||||
window.pushGui(ViewController::get());
|
||||
|
@ -603,11 +601,8 @@ int main(int argc, char* argv[])
|
|||
|
||||
while (running) {
|
||||
SDL_Event event;
|
||||
bool ps_standby = PowerSaver::getState() && static_cast<int>(SDL_GetTicks()) -
|
||||
ps_time > PowerSaver::getMode();
|
||||
|
||||
if (ps_standby ? SDL_WaitEventTimeout(&event, PowerSaver::getTimeout())
|
||||
: SDL_PollEvent(&event)) {
|
||||
if (SDL_PollEvent(&event)) {
|
||||
do {
|
||||
InputManager::getInstance()->parseEvent(event, &window);
|
||||
|
||||
|
@ -616,19 +611,9 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
while (SDL_PollEvent(&event));
|
||||
|
||||
// Triggered if exiting from SDL_WaitEvent due to event.
|
||||
if (ps_standby)
|
||||
// Show as if continuing from last event.
|
||||
lastTime = SDL_GetTicks();
|
||||
|
||||
// Reset counter.
|
||||
ps_time = SDL_GetTicks();
|
||||
}
|
||||
else if (ps_standby) {
|
||||
// If exiting SDL_WaitEventTimeout due to timeout.
|
||||
// Trail considering timeout as an event.
|
||||
ps_time = SDL_GetTicks();
|
||||
}
|
||||
|
||||
if (window.isSleeping()) {
|
||||
lastTime = SDL_GetTicks();
|
||||
|
|
|
@ -218,7 +218,6 @@ void ViewController::goToSystemView(SystemData* system, bool playTransition)
|
|||
systemList->goToSystem(system, false);
|
||||
mCurrentView = systemList;
|
||||
mCurrentView->onShow();
|
||||
PowerSaver::setState(true);
|
||||
|
||||
// Application startup animation.
|
||||
if (applicationStartup) {
|
||||
|
|
|
@ -13,7 +13,6 @@ set(CORE_HEADERS
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/src/Log.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/MameNames.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Platform.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/PowerSaver.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Settings.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Sound.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/ThemeData.h
|
||||
|
@ -95,7 +94,6 @@ set(CORE_SOURCES
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/src/Log.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/MameNames.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Platform.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/PowerSaver.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Scripting.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Settings.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Sound.cpp
|
||||
|
|
|
@ -1,109 +0,0 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// EmulationStation Desktop Edition
|
||||
// PowerSaver.cpp
|
||||
//
|
||||
// Power saving functions.
|
||||
//
|
||||
|
||||
#include "PowerSaver.h"
|
||||
|
||||
#include "AudioManager.h"
|
||||
#include "Settings.h"
|
||||
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
#include <sstream>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
bool PowerSaver::mState = false;
|
||||
bool PowerSaver::mRunningScreensaver = false;
|
||||
|
||||
int PowerSaver::mWakeupTimeout = -1;
|
||||
int PowerSaver::mScreensaverTimeout = -1;
|
||||
PowerSaver::mode PowerSaver::mMode = PowerSaver::DISABLED;
|
||||
|
||||
void PowerSaver::init()
|
||||
{
|
||||
setState(true);
|
||||
updateMode();
|
||||
}
|
||||
|
||||
int PowerSaver::getTimeout()
|
||||
{
|
||||
if (SDL_GetAudioStatus() == SDL_AUDIO_PAUSED)
|
||||
AudioManager::getInstance()->deinit();
|
||||
|
||||
// Used only for SDL_WaitEventTimeout. Use `getMode()` for modes.
|
||||
return mRunningScreensaver ? mWakeupTimeout : mScreensaverTimeout;
|
||||
}
|
||||
|
||||
void PowerSaver::loadWakeupTime()
|
||||
{
|
||||
// TODO : Move this to Screensaver Class.
|
||||
std::string behaviour = Settings::getInstance()->getString("ScreensaverType");
|
||||
if (behaviour == "video")
|
||||
mWakeupTimeout = Settings::getInstance()->getInt("ScreensaverSwapVideoTimeout") - getMode();
|
||||
else if (behaviour == "slideshow")
|
||||
mWakeupTimeout = Settings::getInstance()->getInt("ScreensaverSwapImageTimeout") - getMode();
|
||||
else // Dim and Blank.
|
||||
mWakeupTimeout = -1;
|
||||
}
|
||||
|
||||
void PowerSaver::updateTimeouts()
|
||||
{
|
||||
mScreensaverTimeout = static_cast<unsigned int>(Settings::getInstance()->
|
||||
getInt("ScreensaverTimer"));
|
||||
mScreensaverTimeout = mScreensaverTimeout > 0 ? mScreensaverTimeout - getMode() : -1;
|
||||
loadWakeupTime();
|
||||
}
|
||||
|
||||
PowerSaver::mode PowerSaver::getMode()
|
||||
{
|
||||
return mMode;
|
||||
}
|
||||
|
||||
void PowerSaver::updateMode()
|
||||
{
|
||||
std::string mode = Settings::getInstance()->getString("PowerSaverMode");
|
||||
|
||||
if (mode == "disabled") {
|
||||
mMode = DISABLED;
|
||||
}
|
||||
else if (mode == "instant") {
|
||||
mMode = INSTANT;
|
||||
}
|
||||
else if (mode == "enhanced") {
|
||||
mMode = ENHANCED;
|
||||
}
|
||||
else {
|
||||
mMode = DEFAULT;
|
||||
}
|
||||
updateTimeouts();
|
||||
}
|
||||
|
||||
bool PowerSaver::getState()
|
||||
{
|
||||
return mState;
|
||||
}
|
||||
|
||||
void PowerSaver::setState(bool state)
|
||||
{
|
||||
bool ps_enabled = Settings::getInstance()->getString("PowerSaverMode") != "disabled";
|
||||
mState = ps_enabled && state;
|
||||
}
|
||||
|
||||
void PowerSaver::runningScreensaver(bool state)
|
||||
{
|
||||
mRunningScreensaver = state;
|
||||
if (mWakeupTimeout < mMode) {
|
||||
// Disable PS if wake up time is less than mode as PS will never trigger.
|
||||
setState(!state);
|
||||
}
|
||||
}
|
||||
|
||||
bool PowerSaver::isScreensaverActive()
|
||||
{
|
||||
return mRunningScreensaver;
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// EmulationStation Desktop Edition
|
||||
// PowerSaver.h
|
||||
//
|
||||
// Power saving functions.
|
||||
//
|
||||
|
||||
#ifndef ES_CORE_POWER_SAVER_H
|
||||
#define ES_CORE_POWER_SAVER_H
|
||||
|
||||
class PowerSaver
|
||||
{
|
||||
public:
|
||||
enum mode : int {
|
||||
DISABLED = -1,
|
||||
INSTANT = 200,
|
||||
ENHANCED = 3000,
|
||||
DEFAULT = 10000
|
||||
};
|
||||
|
||||
// Call when you want PS to reload all states and settings.
|
||||
static void init();
|
||||
|
||||
// Get timeout to wake up from for the next event.
|
||||
static int getTimeout();
|
||||
// Update currently set timeouts after user changes timeout settings.
|
||||
static void updateTimeouts();
|
||||
|
||||
// Use this to check which mode you are in or get the mode timeout.
|
||||
static mode getMode();
|
||||
// Called when user changes mode from settings menu.
|
||||
static void updateMode();
|
||||
|
||||
// Get current state of PS. Not to be confused with mode.
|
||||
static bool getState();
|
||||
// State is used to temporarily pause and resume PS.
|
||||
static void setState(bool state);
|
||||
|
||||
// Paired calls when you want to pause PS briefly until you finish animating
|
||||
// or processing over cycles.
|
||||
static void pause() { setState(false); }
|
||||
static void resume() { setState(true); }
|
||||
|
||||
// This is used by Screensaver to let PS know when to switch to SS timeouts.
|
||||
static void runningScreensaver(bool state);
|
||||
static bool isScreensaverActive();
|
||||
|
||||
private:
|
||||
static bool mState;
|
||||
static bool mRunningScreensaver;
|
||||
|
||||
static mode mMode;
|
||||
static int mWakeupTimeout;
|
||||
static int mScreensaverTimeout;
|
||||
|
||||
static void loadWakeupTime();
|
||||
};
|
||||
|
||||
#endif // ES_CORE_POWER_SAVER_H
|
|
@ -189,7 +189,6 @@ void Settings::setDefaults()
|
|||
#if defined (__unix__)
|
||||
mStringMap["FullscreenMode"] = { "normal", "normal" };
|
||||
#endif
|
||||
mStringMap["PowerSaverMode"] = { "disabled", "disabled" };
|
||||
#if defined(_RPI_)
|
||||
mBoolMap["VideoOmxPlayer"] = { false, false };
|
||||
// We're defaulting to OMX Player for full screen video on the Pi.
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "components/ImageComponent.h"
|
||||
#include "resources/Font.h"
|
||||
#include "PowerSaver.h"
|
||||
#include "Window.h"
|
||||
|
||||
enum CursorState {
|
||||
|
@ -245,8 +244,6 @@ protected:
|
|||
|
||||
bool listInput(int velocity) // A velocity of 0 = stop scrolling.
|
||||
{
|
||||
PowerSaver::setState(velocity == 0);
|
||||
|
||||
mScrollVelocity = velocity;
|
||||
mScrollTier = 0;
|
||||
mScrollTierAccumulator = 0;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
#include "resources/ResourceManager.h"
|
||||
#include "utils/FileSystemUtil.h"
|
||||
#include "PowerSaver.h"
|
||||
#include "ThemeData.h"
|
||||
#include "Window.h"
|
||||
|
||||
|
@ -307,7 +306,7 @@ void VideoComponent::startVideoWithDelay()
|
|||
// Set the video that we are going to be playing so we don't attempt to restart it.
|
||||
mPlayingVideoPath = mVideoPath;
|
||||
|
||||
if (mConfig.startDelay == 0 || PowerSaver::getMode() == PowerSaver::INSTANT) {
|
||||
if (mConfig.startDelay == 0) {
|
||||
// No delay. Just start the video.
|
||||
mStartDelayed = false;
|
||||
startVideo();
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "renderers/Renderer.h"
|
||||
#include "resources/TextureResource.h"
|
||||
#include "utils/StringUtil.h"
|
||||
#include "PowerSaver.h"
|
||||
#include "Settings.h"
|
||||
#include "Window.h"
|
||||
|
||||
|
@ -352,7 +351,6 @@ void VideoVlcComponent::startVideo()
|
|||
|
||||
// Make sure we found a valid video track.
|
||||
if ((mVideoWidth > 0) && (mVideoHeight > 0)) {
|
||||
PowerSaver::pause();
|
||||
setupContext();
|
||||
|
||||
// Setup the media player.
|
||||
|
@ -395,7 +393,6 @@ void VideoVlcComponent::stopVideo()
|
|||
libvlc_media_release(mMedia);
|
||||
mMediaPlayer = nullptr;
|
||||
freeContext();
|
||||
PowerSaver::resume();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "utils/FileSystemUtil.h"
|
||||
#include "utils/StringUtil.h"
|
||||
#include "InputManager.h"
|
||||
#include "PowerSaver.h"
|
||||
#include "Window.h"
|
||||
|
||||
#define HOLD_TIME 1000
|
||||
|
@ -98,12 +97,9 @@ void GuiDetectDevice::onSizeChanged()
|
|||
|
||||
bool GuiDetectDevice::input(InputConfig* config, Input input)
|
||||
{
|
||||
PowerSaver::pause();
|
||||
|
||||
if (!mFirstRun && input.device == DEVICE_KEYBOARD && input.type == TYPE_KEY &&
|
||||
input.value && input.id == SDLK_ESCAPE) {
|
||||
// Cancel the configuration.
|
||||
PowerSaver::resume();
|
||||
delete this; // Delete GUI element.
|
||||
return true;
|
||||
}
|
||||
|
@ -113,7 +109,6 @@ bool GuiDetectDevice::input(InputConfig* config, Input input)
|
|||
input.value && input.id == SDLK_ESCAPE) {
|
||||
if (mDoneCallback)
|
||||
mDoneCallback();
|
||||
PowerSaver::resume();
|
||||
delete this; // Delete GUI element.
|
||||
return true;
|
||||
}
|
||||
|
@ -145,7 +140,6 @@ void GuiDetectDevice::update(int deltaTime)
|
|||
InputManager::getInstance()->getNumConfiguredDevices() > 0) {
|
||||
if (mDoneCallback)
|
||||
mDoneCallback();
|
||||
PowerSaver::resume();
|
||||
delete this; // Delete GUI element.
|
||||
}
|
||||
else {
|
||||
|
@ -156,7 +150,6 @@ void GuiDetectDevice::update(int deltaTime)
|
|||
if (mHoldTime <= 0) {
|
||||
// Picked one!
|
||||
mWindow->pushGui(new GuiInputConfig(mWindow, mHoldingConfig, true, mDoneCallback));
|
||||
PowerSaver::resume();
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue