From 2e289f88f9c6a7074b1bc9e34efef7f5b5b83018 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 21 Sep 2012 17:45:19 +0400 Subject: [PATCH] gui/dboxinfo.cpp: show free mem without cached/buffers; add 5 seconds timer to update window Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/bc74b0c3a61ffa49b2d355820cea51bc53814874 Author: [CST] Focus Date: 2012-09-21 (Fri, 21 Sep 2012) --- src/gui/dboxinfo.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gui/dboxinfo.cpp b/src/gui/dboxinfo.cpp index 1f66372f8..e00db49e7 100644 --- a/src/gui/dboxinfo.cpp +++ b/src/gui/dboxinfo.cpp @@ -52,6 +52,7 @@ #include #include +#include static const int FSHIFT = 16; /* nr of bits of precision */ #define FIXED_1 (1<addTimer(5*1000*1000, false); while (doLoop) { @@ -103,6 +105,9 @@ int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &) if(fader.Fade()) doLoop = false; } + else if((msg == NeutrinoMessages::EVT_TIMER) && (data == updateTimer)) { + paint(); + } else if ( ( msg == CRCInput::RC_timeout ) || ( msg == CRCInput::RC_home ) || ( msg == CRCInput::RC_ok ) ) { @@ -143,6 +148,7 @@ int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &) hide(); fader.Stop(); + g_RCInput->killTimer(updateTimer); return res; } @@ -371,8 +377,12 @@ void CDBoxInfoWidget::paint() uint64_t bytes_free; if (memory_flag) { - bytes_total = info.totalram; - bytes_free = info.freeram; + //bytes_total = info.totalram; + //bytes_free = info.freeram; + unsigned long t, f; + get_mem_usage(t, f); + bytes_total = t*1024; + bytes_free = f*1024; } else {