mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
Added flag for GUI components to indicate activate background processing.
ES won't enter sleep mode if any component has the processing flag set. (In sleep mode no more calls to update() on any components are invoked)
This commit is contained in:
parent
5b74b877ef
commit
b1daeafe24
|
@ -21,6 +21,8 @@ GuiScraperMulti::GuiScraperMulti(Window* window, const std::queue<ScraperSearchP
|
|||
addChild(&mBackground);
|
||||
addChild(&mGrid);
|
||||
|
||||
mIsProcessing = true;
|
||||
|
||||
mTotalGames = mSearchQueue.size();
|
||||
mCurrentGame = 0;
|
||||
mTotalSuccessful = 0;
|
||||
|
@ -143,6 +145,8 @@ void GuiScraperMulti::finish()
|
|||
|
||||
mWindow->pushGui(new GuiMsgBox(mWindow, ss.str(),
|
||||
"OK", [&] { delete this; }));
|
||||
|
||||
mIsProcessing = false;
|
||||
}
|
||||
|
||||
std::vector<HelpPrompt> GuiScraperMulti::getHelpPrompts()
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
#include "ThemeData.h"
|
||||
|
||||
GuiComponent::GuiComponent(Window* window) : mWindow(window), mParent(NULL), mOpacity(255),
|
||||
mPosition(Eigen::Vector3f::Zero()), mSize(Eigen::Vector2f::Zero()), mTransform(Eigen::Affine3f::Identity())
|
||||
mPosition(Eigen::Vector3f::Zero()), mSize(Eigen::Vector2f::Zero()), mTransform(Eigen::Affine3f::Identity()),
|
||||
mIsProcessing(false)
|
||||
{
|
||||
for(unsigned char i = 0; i < MAX_ANIMATIONS; i++)
|
||||
mAnimationMap[i] = NULL;
|
||||
|
@ -339,3 +340,8 @@ HelpStyle GuiComponent::getHelpStyle()
|
|||
{
|
||||
return HelpStyle();
|
||||
}
|
||||
|
||||
bool GuiComponent::isProcessing() const
|
||||
{
|
||||
return mIsProcessing;
|
||||
}
|
||||
|
|
|
@ -90,6 +90,9 @@ public:
|
|||
|
||||
virtual HelpStyle getHelpStyle();
|
||||
|
||||
// Returns true if the component is busy doing background processing (e.g. HTTP downloads)
|
||||
bool isProcessing() const;
|
||||
|
||||
protected:
|
||||
void renderChildren(const Eigen::Affine3f& transform) const;
|
||||
void updateSelf(int deltaTime); // updates animations
|
||||
|
@ -104,6 +107,8 @@ protected:
|
|||
Eigen::Vector3f mPosition;
|
||||
Eigen::Vector2f mSize;
|
||||
|
||||
bool mIsProcessing;
|
||||
|
||||
public:
|
||||
const static unsigned char MAX_ANIMATIONS = 4;
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "AudioManager.h"
|
||||
#include "Log.h"
|
||||
#include "Settings.h"
|
||||
#include <algorithm>
|
||||
#include <iomanip>
|
||||
#include "components/HelpComponent.h"
|
||||
#include "components/ImageComponent.h"
|
||||
|
@ -202,7 +203,7 @@ void Window::render()
|
|||
}
|
||||
|
||||
unsigned int screensaverTime = (unsigned int)Settings::getInstance()->getInt("ScreenSaverTime");
|
||||
if(mTimeSinceLastInput >= screensaverTime && screensaverTime != 0 && mAllowSleep)
|
||||
if(mTimeSinceLastInput >= screensaverTime && screensaverTime != 0 && !isProcessing() && mAllowSleep)
|
||||
{
|
||||
// go to sleep
|
||||
mSleeping = true;
|
||||
|
@ -335,3 +336,8 @@ void Window::onWake()
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
bool Window::isProcessing()
|
||||
{
|
||||
return count_if(mGuiStack.begin(), mGuiStack.end(), [](GuiComponent* c) { return c->isProcessing(); }) > 0;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,9 @@ private:
|
|||
void onSleep();
|
||||
void onWake();
|
||||
|
||||
// Returns true if at least one component on the stack is processing
|
||||
bool isProcessing();
|
||||
|
||||
HelpComponent* mHelp;
|
||||
ImageComponent* mBackgroundOverlay;
|
||||
|
||||
|
|
Loading…
Reference in a new issue