Neutrino: show remaining sleep time in main menu if sleeptimer exists

based on idea by martii <m4rtii@gmx.de> in Neutrino-MP Git
This commit is contained in:
Christian Schuett
2013-12-30 23:27:04 +01:00
committed by svenhoefer
parent 7d04113307
commit 9f10fc9821
2 changed files with 18 additions and 1 deletions

View File

@@ -28,6 +28,7 @@
#include <gui/sleeptimer.h>
#include <system/helpers.h>
#include <gui/widget/stringinput.h>
#include <timerdclient/timerdclient.h>
@@ -52,7 +53,7 @@ int CSleepTimerWidget::exec(CMenuTarget* parent, const std::string &actionKey)
}
is_running = true;
int shutdown_min = 0;
shutdown_min = 0;
char value[16];
CStringInput *inbox;
bool permanent = (actionKey == "permanent");
@@ -123,3 +124,16 @@ int CSleepTimerWidget::exec(CMenuTarget* parent, const std::string &actionKey)
return res;
}
const char * CSleepTimerWidget::getTargetValue()
{
shutdown_min = g_Timerd->getSleepTimerRemaining();
if (shutdown_min > 0)
{
shutdown_min_string = to_string(shutdown_min);
shutdown_min_string += " ";
shutdown_min_string += g_Locale->getText(LOCALE_UNIT_SHORT_MINUTE);
return shutdown_min_string.c_str();
}
return NULL;
}

View File

@@ -29,9 +29,12 @@ class CSleepTimerWidget: public CMenuTarget
{
private:
static bool is_running;
int shutdown_min;
std::string shutdown_min_string;
public:
int exec(CMenuTarget* parent, const std::string & actionKey);
const char * getTargetValue();
};