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

based on idea by martii <m4rtii@gmx.de> in Neutrino-MP Git


Origin commit data
------------------
Branch: ni/coolstream
Commit: 9f10fc9821
Author: Christian Schuett <Gaucho316@hotmail.com>
Date: 2013-12-30 (Mon, 30 Dec 2013)



------------------
This commit was generated by Migit
This commit is contained in:
Christian Schuett
2013-12-30 23:27:04 +01:00
committed by vanhofen
parent 30fb5e2f60
commit 5107116c60
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();
};