From 5107116c6050eae649deafe7978bee1a63e74eb7 Mon Sep 17 00:00:00 2001 From: Christian Schuett Date: Mon, 30 Dec 2013 23:27:04 +0100 Subject: [PATCH] Neutrino: show remaining sleep time in main menu if sleeptimer exists based on idea by martii in Neutrino-MP Git Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/9f10fc9821e1492a5f5187f8c8a17727f3700ffa Author: Christian Schuett Date: 2013-12-30 (Mon, 30 Dec 2013) ------------------ This commit was generated by Migit --- src/gui/sleeptimer.cpp | 16 +++++++++++++++- src/gui/sleeptimer.h | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/gui/sleeptimer.cpp b/src/gui/sleeptimer.cpp index 8779552cd..eeb5dd079 100644 --- a/src/gui/sleeptimer.cpp +++ b/src/gui/sleeptimer.cpp @@ -28,6 +28,7 @@ #include +#include #include #include @@ -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; +} diff --git a/src/gui/sleeptimer.h b/src/gui/sleeptimer.h index dd02a34a8..f52f9bebc 100644 --- a/src/gui/sleeptimer.h +++ b/src/gui/sleeptimer.h @@ -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(); };