gui/dboxinfo.cpp: show free mem without cached/buffers; add 5 seconds timer to update window

This commit is contained in:
[CST] Focus
2012-09-21 17:45:19 +04:00
parent 5dc2656b8e
commit bc74b0c3a6

View File

@@ -52,6 +52,7 @@
#include <sys/sysinfo.h> #include <sys/sysinfo.h>
#include <sys/vfs.h> #include <sys/vfs.h>
#include <system/helpers.h>
static const int FSHIFT = 16; /* nr of bits of precision */ static const int FSHIFT = 16; /* nr of bits of precision */
#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */ #define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */
@@ -94,6 +95,7 @@ int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &)
int timeout = g_settings.timing[SNeutrinoSettings::TIMING_MENU]; int timeout = g_settings.timing[SNeutrinoSettings::TIMING_MENU];
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd( timeout == 0 ? 0xFFFF : timeout); uint64_t timeoutEnd = CRCInput::calcTimeoutEnd( timeout == 0 ? 0xFFFF : timeout);
uint32_t updateTimer = g_RCInput->addTimer(5*1000*1000, false);
while (doLoop) while (doLoop)
{ {
@@ -103,6 +105,9 @@ int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &)
if(fader.Fade()) if(fader.Fade())
doLoop = false; doLoop = false;
} }
else if((msg == NeutrinoMessages::EVT_TIMER) && (data == updateTimer)) {
paint();
}
else if ( ( msg == CRCInput::RC_timeout ) || else if ( ( msg == CRCInput::RC_timeout ) ||
( msg == CRCInput::RC_home ) || ( msg == CRCInput::RC_home ) ||
( msg == CRCInput::RC_ok ) ) { ( msg == CRCInput::RC_ok ) ) {
@@ -143,6 +148,7 @@ int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &)
hide(); hide();
fader.Stop(); fader.Stop();
g_RCInput->killTimer(updateTimer);
return res; return res;
} }
@@ -371,8 +377,12 @@ void CDBoxInfoWidget::paint()
uint64_t bytes_free; uint64_t bytes_free;
if (memory_flag) if (memory_flag)
{ {
bytes_total = info.totalram; //bytes_total = info.totalram;
bytes_free = info.freeram; //bytes_free = info.freeram;
unsigned long t, f;
get_mem_usage(t, f);
bytes_total = t*1024;
bytes_free = f*1024;
} }
else else
{ {