dboxinfo: allow to show "neutrino uptime"

Origin commit data
------------------
Branch: ni/coolstream
Commit: a98f94621a
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2017-12-26 (Tue, 26 Dec 2017)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2017-12-26 22:58:37 +01:00
committed by vanhofen
parent 725a69916a
commit abfd7f3155
4 changed files with 14 additions and 1 deletions

View File

@@ -4,7 +4,7 @@
Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/
(C) 2009-2011, 2013-2014 Stefan Seyfried
(C) 2009-2011, 2013-2014, 2017 Stefan Seyfried
License: GPL
@@ -74,6 +74,7 @@ CDBoxInfoWidget::CDBoxInfoWidget()
percWidth = 3 * fm->getMaxDigitWidth()
+ fm->getRenderWidth("%"); //100%
nameWidth = fontWidth * 17;
upmode = false;
}
CDBoxInfoWidget::~CDBoxInfoWidget()
@@ -135,6 +136,10 @@ int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &)
res = menu_return::RETURN_EXIT_ALL;
doLoop = false;
}
else if (msg == CRCInput::RC_info) {
upmode = !upmode;
paint();
}
else
{
int mr = CNeutrinoApp::getInstance()->handleMsg( msg, data );
@@ -388,6 +393,8 @@ void CDBoxInfoWidget::paint()
std::string str_now(strftime(g_Locale->getText(LOCALE_EXTRA_DBOXINFO_TIMEFORMAT), now));
struct sysinfo info;
sysinfo(&info);
if (upmode)
info.uptime = time_monotonic() - CNeutrinoApp::getInstance()->getStartTime();
now -= info.uptime;
std::string str_boot(strftime(g_Locale->getText(LOCALE_EXTRA_DBOXINFO_TIMEFORMAT), now));

View File

@@ -53,6 +53,7 @@ class CDBoxInfoWidget : public CMenuTarget
int sizeWidth; // width of mem / disk sizes
int percWidth;
int nameWidth;
bool upmode; // system or neutrino uptime
void paint();
CComponentsHeader *header;

View File

@@ -2378,6 +2378,8 @@ bool is_wakeup()
int CNeutrinoApp::run(int argc, char **argv)
{
neutrino_start_time = time_monotonic();
puts("[neutrino] executing " NEUTRINO_APP_START_SCRIPT ".");
if (my_system(NEUTRINO_APP_START_SCRIPT) != 0)
perror(NEUTRINO_APP_START_SCRIPT " failed");

View File

@@ -91,6 +91,8 @@ private:
int lastChannelMode;
struct timeval standby_pressed_at;
time_t neutrino_start_time;
int current_muted;
bool skipShutdownTimer;
@@ -188,6 +190,7 @@ public:
void switchTvRadioMode(const int prev_mode = NeutrinoModes::mode_unknown);
void switchInfoIconsOnOff(); //NI
time_t getStartTime() { return neutrino_start_time; }
bool isMuted() {return current_muted; }
void setCurrentMuted(int m) { current_muted = m; }