|
|
@@ -4,6 +4,14 @@
|
|
|
|
Copyright (C) 2001 Steffen Hehn 'McClean'
|
|
|
|
Copyright (C) 2001 Steffen Hehn 'McClean'
|
|
|
|
Homepage: http://dbox.cyberphoria.org/
|
|
|
|
Homepage: http://dbox.cyberphoria.org/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Kommentar:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
|
|
|
|
|
|
|
|
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
|
|
|
|
|
|
|
|
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
|
|
|
|
|
|
|
|
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
License: GPL
|
|
|
|
License: GPL
|
|
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
@@ -43,6 +51,8 @@
|
|
|
|
#include <driver/fade.h>
|
|
|
|
#include <driver/fade.h>
|
|
|
|
#include <driver/record.h>
|
|
|
|
#include <driver/record.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <zapit/femanager.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include <sys/sysinfo.h>
|
|
|
|
#include <sys/sysinfo.h>
|
|
|
|
#include <sys/vfs.h>
|
|
|
|
#include <sys/vfs.h>
|
|
|
|
#include <system/sysload.h>
|
|
|
|
#include <system/sysload.h>
|
|
|
@@ -51,28 +61,25 @@
|
|
|
|
#include <iostream>
|
|
|
|
#include <iostream>
|
|
|
|
#include <fstream>
|
|
|
|
#include <fstream>
|
|
|
|
|
|
|
|
|
|
|
|
static const int FSHIFT = 16; /* nr of bits of precision */
|
|
|
|
|
|
|
|
#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */
|
|
|
|
|
|
|
|
#define LOAD_INT(x) ((x) >> FSHIFT)
|
|
|
|
|
|
|
|
#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CDBoxInfoWidget::CDBoxInfoWidget()
|
|
|
|
CDBoxInfoWidget::CDBoxInfoWidget()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
fm = g_Font[SNeutrinoSettings::FONT_TYPE_MENU];
|
|
|
|
|
|
|
|
ft = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE];
|
|
|
|
frameBuffer = CFrameBuffer::getInstance();
|
|
|
|
frameBuffer = CFrameBuffer::getInstance();
|
|
|
|
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
|
|
|
|
hheight = ft->getHeight();
|
|
|
|
mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
|
|
|
|
mheight = fm->getHeight();
|
|
|
|
mheight += mheight & 1;
|
|
|
|
mheight += mheight & 1;
|
|
|
|
width = 0;
|
|
|
|
width = 0;
|
|
|
|
height = 0;
|
|
|
|
height = 0;
|
|
|
|
x = 0;
|
|
|
|
x = 0;
|
|
|
|
y = 0;
|
|
|
|
y = 0;
|
|
|
|
|
|
|
|
|
|
|
|
fontWidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getWidth();
|
|
|
|
fontWidth = fm->getWidth();
|
|
|
|
sizeWidth = 6 * g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getMaxDigitWidth()
|
|
|
|
sizeWidth = 6 * fm->getMaxDigitWidth()
|
|
|
|
+ g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(std::string(" MiB") + g_Locale->getText(LOCALE_UNIT_DECIMAL)); ;//9999.99 MiB
|
|
|
|
+ fm->getRenderWidth(std::string(" MiB") + g_Locale->getText(LOCALE_UNIT_DECIMAL)); ;//9999.99 MiB
|
|
|
|
percWidth = 3 * g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getMaxDigitWidth()
|
|
|
|
percWidth = 3 * fm->getMaxDigitWidth()
|
|
|
|
+ g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("%"); //100%
|
|
|
|
+ fm->getRenderWidth("%"); //100%
|
|
|
|
nameWidth = fontWidth * 10;
|
|
|
|
nameWidth = fontWidth * 17;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &)
|
|
|
|
int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &)
|
|
|
@@ -199,17 +206,20 @@ static std::string bytes2string(uint64_t bytes, bool binary)
|
|
|
|
|
|
|
|
|
|
|
|
void CDBoxInfoWidget::paint()
|
|
|
|
void CDBoxInfoWidget::paint()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const int head_info_lines = 3;
|
|
|
|
|
|
|
|
const char *head_info[head_info_lines] = {"Uptime", "Load average", "Current load"};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
height = hheight;
|
|
|
|
height = hheight;
|
|
|
|
height += mheight/2; // space
|
|
|
|
height += mheight/2; // space
|
|
|
|
int cpuload_y0 = height;
|
|
|
|
int cpuload_y0 = height;
|
|
|
|
int head_info_ypos = height;
|
|
|
|
height += mheight; // boot time
|
|
|
|
height += mheight*head_info_lines; // head info lines
|
|
|
|
height += mheight; // time
|
|
|
|
|
|
|
|
height += mheight; // uptime
|
|
|
|
|
|
|
|
height += mheight; // load
|
|
|
|
int cpuload_y1 = height;
|
|
|
|
int cpuload_y1 = height;
|
|
|
|
height += mheight/2; // space
|
|
|
|
height += mheight/2; // space
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int frontend_count = CFEManager::getInstance()->getFrontendCount();
|
|
|
|
|
|
|
|
if (frontend_count > 2)
|
|
|
|
|
|
|
|
height += mheight * (frontend_count - 2);
|
|
|
|
|
|
|
|
|
|
|
|
int icon_w = 0, icon_h = 0;
|
|
|
|
int icon_w = 0, icon_h = 0;
|
|
|
|
frameBuffer->getIconSize(NEUTRINO_ICON_REC, &icon_w, &icon_h);
|
|
|
|
frameBuffer->getIconSize(NEUTRINO_ICON_REC, &icon_w, &icon_h);
|
|
|
|
|
|
|
|
|
|
|
@@ -221,14 +231,19 @@ void CDBoxInfoWidget::paint()
|
|
|
|
#define MEMINFO_RAM 0
|
|
|
|
#define MEMINFO_RAM 0
|
|
|
|
#define MEMINFO_SWAP 1
|
|
|
|
#define MEMINFO_SWAP 1
|
|
|
|
#define MEMINFO_ROWS 2
|
|
|
|
#define MEMINFO_ROWS 2
|
|
|
|
unsigned long memstat[MEMINFO_ROWS][MEMINFO_COLUMNS] = { { 0, 0, 0 }, { 0, 0, 0 } }; // total, used, free
|
|
|
|
unsigned long long memstat[MEMINFO_ROWS][MEMINFO_COLUMNS] = { { 0, 0, 0 }, { 0, 0, 0 } }; // total, used, free
|
|
|
|
const char *memtype[MEMINFO_ROWS] = { "RAM", "Swap" };
|
|
|
|
const char *memtype[MEMINFO_ROWS] = { g_Locale->getText(LOCALE_EXTRA_DBOXINFO_RAM), g_Locale->getText(LOCALE_EXTRA_DBOXINFO_SWAP) };
|
|
|
|
FILE *procmeminfo = fopen("/proc/meminfo", "r");
|
|
|
|
FILE *procmeminfo = fopen("/proc/meminfo", "r");
|
|
|
|
if (procmeminfo) {
|
|
|
|
if (procmeminfo) {
|
|
|
|
char buf[80], a[80];
|
|
|
|
char buf[80], a[80];
|
|
|
|
unsigned long v;
|
|
|
|
long long unsigned v;
|
|
|
|
while (fgets(buf, sizeof(buf), procmeminfo)) {
|
|
|
|
while (fgets(buf, sizeof(buf), procmeminfo)) {
|
|
|
|
if (2 == sscanf(buf, "%[^:]: %lu", a, &v)) {
|
|
|
|
char unit[10];
|
|
|
|
|
|
|
|
*unit = 0;
|
|
|
|
|
|
|
|
if ((3 == sscanf(buf, "%[^:]: %llu %s", a, &v, unit))
|
|
|
|
|
|
|
|
|| (2 == sscanf(buf, "%[^:]: %llu", a, &v))) {
|
|
|
|
|
|
|
|
if (*unit == 'k')
|
|
|
|
|
|
|
|
v <<= 10;
|
|
|
|
if (!strcasecmp(a, "MemTotal"))
|
|
|
|
if (!strcasecmp(a, "MemTotal"))
|
|
|
|
memstat[MEMINFO_RAM][MEMINFO_TOTAL] += v;
|
|
|
|
memstat[MEMINFO_RAM][MEMINFO_TOTAL] += v;
|
|
|
|
else if (!strcasecmp(a, "MemFree"))
|
|
|
|
else if (!strcasecmp(a, "MemFree"))
|
|
|
@@ -266,7 +281,7 @@ void CDBoxInfoWidget::paint()
|
|
|
|
while (getline(in, line)) {
|
|
|
|
while (getline(in, line)) {
|
|
|
|
size_t firstslash = line.find_first_of('/');
|
|
|
|
size_t firstslash = line.find_first_of('/');
|
|
|
|
size_t firstspace = line.find_first_of(' ');
|
|
|
|
size_t firstspace = line.find_first_of(' ');
|
|
|
|
if ( (firstspace != string::npos && firstslash != string::npos && firstslash < firstspace) || (line.find("rootfs") == 0) ) {
|
|
|
|
if (firstspace != string::npos && firstslash != string::npos && firstslash < firstspace) {
|
|
|
|
firstspace++;
|
|
|
|
firstspace++;
|
|
|
|
size_t nextspace = line.find_first_of(' ', firstspace);
|
|
|
|
size_t nextspace = line.find_first_of(' ', firstspace);
|
|
|
|
if (nextspace == string::npos || line.find("nodev", nextspace + 1) != string::npos)
|
|
|
|
if (nextspace == string::npos || line.find("nodev", nextspace + 1) != string::npos)
|
|
|
@@ -279,18 +294,27 @@ void CDBoxInfoWidget::paint()
|
|
|
|
bool is_rec = (st.st_dev == rec_st.st_dev);
|
|
|
|
bool is_rec = (st.st_dev == rec_st.st_dev);
|
|
|
|
mounts[mountpoint] = is_rec;
|
|
|
|
mounts[mountpoint] = is_rec;
|
|
|
|
int icon_space = is_rec ? 10 + icon_w : 0;
|
|
|
|
int icon_space = is_rec ? 10 + icon_w : 0;
|
|
|
|
const char *mnt = mountpoint.c_str();
|
|
|
|
nameWidth = std::max(nameWidth, fm->getRenderWidth(mountpoint, true) + icon_space + 10);
|
|
|
|
nameWidth = std::max(nameWidth, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(basename((char *)mnt)) + icon_space + 10);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
in.close();
|
|
|
|
in.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int satWidth = nameWidth;
|
|
|
|
|
|
|
|
for (int i = 0; i < frontend_count; i++) {
|
|
|
|
|
|
|
|
CFrontend *fe = CFEManager::getInstance()->getFE(i);
|
|
|
|
|
|
|
|
if (fe) {
|
|
|
|
|
|
|
|
std::string s = to_string(i) + ": " + fe->getName();
|
|
|
|
|
|
|
|
satWidth = std::max(satWidth, fm->getRenderWidth(s));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("nameWidth %d satWidth %d\n", nameWidth, satWidth);
|
|
|
|
|
|
|
|
|
|
|
|
height += mheight; // header
|
|
|
|
height += mheight; // header
|
|
|
|
height += mounts.size() * mheight; // file systems
|
|
|
|
height += mounts.size() * mheight; // file systems
|
|
|
|
height += mheight/2; // space
|
|
|
|
height += mheight/2; // space
|
|
|
|
|
|
|
|
|
|
|
|
int offsetw = nameWidth+ (sizeWidth+10)*3 +10+percWidth+10;
|
|
|
|
//int offsetw = satWidth+ (sizeWidth+10)*3 +10+percWidth+10;
|
|
|
|
|
|
|
|
int offsetw = satWidth+ (sizeWidth)*3 +percWidth;
|
|
|
|
width = offsetw + 10 + 120;
|
|
|
|
width = offsetw + 10 + 120;
|
|
|
|
|
|
|
|
|
|
|
|
int diff = frameBuffer->getScreenWidth() - width;
|
|
|
|
int diff = frameBuffer->getScreenWidth() - width;
|
|
|
@@ -339,33 +363,28 @@ void CDBoxInfoWidget::paint()
|
|
|
|
|
|
|
|
|
|
|
|
ypos += hheight + mheight/2;
|
|
|
|
ypos += hheight + mheight/2;
|
|
|
|
|
|
|
|
|
|
|
|
int head_info_rw = 0;
|
|
|
|
cSysLoad *sysload = cSysLoad::getInstance();
|
|
|
|
for (int line = 0; line < head_info_lines; line++) {
|
|
|
|
int data_last = sysload->data_last;
|
|
|
|
head_info_rw = std::max(head_info_rw, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(head_info[line]));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int dw = offsetw - 3*10 - head_info_rw;
|
|
|
|
std::string str_now_title(g_Locale->getText(LOCALE_EXTRA_DBOXINFO_TIME));
|
|
|
|
int buf_size=256;
|
|
|
|
str_now_title += ": ";
|
|
|
|
char ubuf[buf_size];
|
|
|
|
std::string str_boot_title(g_Locale->getText(LOCALE_EXTRA_DBOXINFO_BOOTTIME));
|
|
|
|
char sbuf[buf_size];
|
|
|
|
str_boot_title += ": ";
|
|
|
|
memset(sbuf, 0, 256);
|
|
|
|
std::string str_up_title(g_Locale->getText(LOCALE_EXTRA_DBOXINFO_UPTIME));
|
|
|
|
|
|
|
|
str_up_title += ": ";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int time_title_width = std::max(fm->getRenderWidth(str_now_title, true), fm->getRenderWidth(str_boot_title));
|
|
|
|
|
|
|
|
time_title_width = std::max(time_title_width, fm->getRenderWidth(str_up_title));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
time_t now = time(NULL);
|
|
|
|
|
|
|
|
std::string str_now(strftime(g_Locale->getText(LOCALE_EXTRA_DBOXINFO_TIMEFORMAT), now));
|
|
|
|
struct sysinfo info;
|
|
|
|
struct sysinfo info;
|
|
|
|
sysinfo(&info);
|
|
|
|
sysinfo(&info);
|
|
|
|
|
|
|
|
now -= info.uptime;
|
|
|
|
|
|
|
|
std::string str_boot(strftime(g_Locale->getText(LOCALE_EXTRA_DBOXINFO_TIMEFORMAT), now));
|
|
|
|
|
|
|
|
|
|
|
|
//get uptime
|
|
|
|
char ubuf[80];
|
|
|
|
#if 0
|
|
|
|
char sbuf[256];
|
|
|
|
struct tm *current_time;
|
|
|
|
|
|
|
|
time_t current_secs;
|
|
|
|
|
|
|
|
time(¤t_secs);
|
|
|
|
|
|
|
|
current_time = localtime(¤t_secs);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snprintf( ubuf,buf_size, "%02d:%02d%s up ",
|
|
|
|
|
|
|
|
current_time->tm_hour%12 ? current_time->tm_hour%12 : 12,
|
|
|
|
|
|
|
|
current_time->tm_min, current_time->tm_hour > 11 ? "pm" : "am");
|
|
|
|
|
|
|
|
strcat(sbuf, ubuf);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int updays, uphours, upminutes;
|
|
|
|
int updays, uphours, upminutes;
|
|
|
|
|
|
|
|
|
|
|
|
updays = (int) info.uptime / (60*60*24);
|
|
|
|
updays = (int) info.uptime / (60*60*24);
|
|
|
@@ -374,41 +393,46 @@ void CDBoxInfoWidget::paint()
|
|
|
|
upminutes %= 60;
|
|
|
|
upminutes %= 60;
|
|
|
|
|
|
|
|
|
|
|
|
if (updays) {
|
|
|
|
if (updays) {
|
|
|
|
snprintf(ubuf,buf_size, "%d day%s, ", updays, (updays != 1) ? "s" : "");
|
|
|
|
snprintf(ubuf, sizeof(sbuf), "%d day%s, ", updays, (updays != 1) ? "s" : "");
|
|
|
|
strcat(sbuf, ubuf);
|
|
|
|
strcat(sbuf, ubuf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (uphours) {
|
|
|
|
if (uphours) {
|
|
|
|
snprintf(ubuf,buf_size,"%d hour%s, ", uphours, (uphours != 1) ? "s" : "");
|
|
|
|
snprintf(ubuf, sizeof(sbuf), "%d hour%s, ", uphours, (uphours != 1) ? "s" : "");
|
|
|
|
strcat(sbuf, ubuf);
|
|
|
|
strcat(sbuf, ubuf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
snprintf(ubuf,buf_size,"%d minute%s", upminutes, (upminutes != 1) ? "s" : "");
|
|
|
|
snprintf(ubuf,sizeof(sbuf), "%d minute%s", upminutes, (upminutes != 1) ? "s" : "");
|
|
|
|
strcat(sbuf, ubuf);
|
|
|
|
strcat(sbuf, ubuf);
|
|
|
|
|
|
|
|
|
|
|
|
//paint uptime
|
|
|
|
snprintf(ubuf, sizeof(ubuf), "%s: ", g_Locale->getText(LOCALE_EXTRA_DBOXINFO_LOAD));
|
|
|
|
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + 2*10 + head_info_rw, ypos+ mheight, dw, sbuf, COL_MENUCONTENT_TEXT);
|
|
|
|
int time_width = fm->getRenderWidth(ubuf);
|
|
|
|
|
|
|
|
time_width = std::max(time_width, fm->getRenderWidth(str_now));
|
|
|
|
|
|
|
|
time_width = std::max(time_width, fm->getRenderWidth(str_boot));
|
|
|
|
|
|
|
|
time_width = std::max(time_width, fm->getRenderWidth(sbuf));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int time_width_total = time_title_width + time_width;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// boot time
|
|
|
|
|
|
|
|
fm->RenderString(x + offsetw - time_width_total - 10, ypos + mheight, time_title_width, str_boot_title, COL_MENUCONTENT_TEXT);
|
|
|
|
|
|
|
|
fm->RenderString(x + offsetw - time_width_total - 10 + time_title_width, ypos + mheight, time_width, str_boot, COL_MENUCONTENT_TEXT);
|
|
|
|
|
|
|
|
ypos += mheight;
|
|
|
|
|
|
|
|
// time now
|
|
|
|
|
|
|
|
fm->RenderString(x + offsetw - time_width_total - 10, ypos + mheight, time_title_width, str_now_title, COL_MENUCONTENT_TEXT);
|
|
|
|
|
|
|
|
fm->RenderString(x + offsetw - time_width_total - 10 + time_title_width, ypos + mheight, time_width, str_now, COL_MENUCONTENT_TEXT);
|
|
|
|
|
|
|
|
ypos += mheight;
|
|
|
|
|
|
|
|
// paint uptime
|
|
|
|
|
|
|
|
fm->RenderString(x + offsetw - time_width_total - 10, ypos + mheight, time_title_width, str_up_title, COL_MENUCONTENT_TEXT);
|
|
|
|
|
|
|
|
fm->RenderString(x + offsetw - time_width_total - 10 + time_title_width, ypos + mheight, time_width, sbuf, COL_MENUCONTENT_TEXT);
|
|
|
|
ypos += mheight;
|
|
|
|
ypos += mheight;
|
|
|
|
|
|
|
|
|
|
|
|
//get load avg
|
|
|
|
|
|
|
|
snprintf(ubuf,buf_size, "%ld.%02ld, %ld.%02ld, %ld.%02ld",
|
|
|
|
|
|
|
|
LOAD_INT(info.loads[0]), LOAD_FRAC(info.loads[0]),
|
|
|
|
|
|
|
|
LOAD_INT(info.loads[1]), LOAD_FRAC(info.loads[1]),
|
|
|
|
|
|
|
|
LOAD_INT(info.loads[2]), LOAD_FRAC(info.loads[2]));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//paint load avg
|
|
|
|
|
|
|
|
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + 2*10 + head_info_rw, ypos+ mheight, dw, ubuf, COL_MENUCONTENT_TEXT);
|
|
|
|
|
|
|
|
ypos += mheight;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//get current load
|
|
|
|
|
|
|
|
cSysLoad *sysload = cSysLoad::getInstance();
|
|
|
|
|
|
|
|
int data_last = sysload->data_last;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//paint current load
|
|
|
|
|
|
|
|
if (data_last > -1) {
|
|
|
|
if (data_last > -1) {
|
|
|
|
|
|
|
|
fm->RenderString(x + offsetw - time_width_total - 10, ypos + mheight, time_title_width, ubuf, COL_MENUCONTENT_TEXT);
|
|
|
|
snprintf(ubuf, sizeof(ubuf), "%d%s%d%%", data_last/10, g_Locale->getText(LOCALE_UNIT_DECIMAL), data_last%10);
|
|
|
|
snprintf(ubuf, sizeof(ubuf), "%d%s%d%%", data_last/10, g_Locale->getText(LOCALE_UNIT_DECIMAL), data_last%10);
|
|
|
|
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + 2*10 + head_info_rw, ypos+ mheight, dw, ubuf, COL_MENUCONTENT_TEXT);
|
|
|
|
fm->RenderString(x + offsetw - time_width_total - 10 + time_title_width, ypos + mheight, time_width, ubuf, COL_MENUCONTENT_TEXT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ypos += mheight;
|
|
|
|
ypos += mheight;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int ypos_mem = ypos;
|
|
|
|
|
|
|
|
|
|
|
|
int pbw = width - offsetw - 10;
|
|
|
|
int pbw = width - offsetw - 10;
|
|
|
|
if (pbw > 8) /* smaller progressbar is not useful ;) */
|
|
|
|
if (pbw > 8) /* smaller progressbar is not useful ;) */
|
|
|
|
{
|
|
|
|
{
|
|
|
@@ -424,6 +448,20 @@ void CDBoxInfoWidget::paint()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ypos = y + hheight + mheight/2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fm->RenderString(x + 10, ypos + mheight, width - 10, g_Locale->getText(LOCALE_EXTRA_DBOXINFO_FRONTEND), COL_MENUCONTENTINACTIVE_TEXT);
|
|
|
|
|
|
|
|
ypos += mheight;
|
|
|
|
|
|
|
|
for (int i = 0; i < frontend_count; i++) {
|
|
|
|
|
|
|
|
CFrontend *fe = CFEManager::getInstance()->getFE(i);
|
|
|
|
|
|
|
|
if (fe) {
|
|
|
|
|
|
|
|
std::string s = to_string(i) + ": " + fe->getName();
|
|
|
|
|
|
|
|
fm->RenderString(x+ 10, ypos+ mheight, width - 10, s, COL_MENUCONTENT_TEXT);
|
|
|
|
|
|
|
|
ypos += mheight;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ypos = std::max(ypos, ypos_mem);
|
|
|
|
ypos += mheight/2;
|
|
|
|
ypos += mheight/2;
|
|
|
|
|
|
|
|
|
|
|
|
int headOffset=0;
|
|
|
|
int headOffset=0;
|
|
|
@@ -453,13 +491,13 @@ void CDBoxInfoWidget::paint()
|
|
|
|
tmp = memtype[row];
|
|
|
|
tmp = memtype[row];
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
case 1:
|
|
|
|
tmp = bytes2string(memstat[row][MEMINFO_TOTAL] << 10);
|
|
|
|
tmp = bytes2string(memstat[row][MEMINFO_TOTAL]);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
case 2:
|
|
|
|
tmp = bytes2string(memstat[row][MEMINFO_USED] << 10);
|
|
|
|
tmp = bytes2string(memstat[row][MEMINFO_USED]);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
case 3:
|
|
|
|
tmp = bytes2string(memstat[row][MEMINFO_FREE] << 10);
|
|
|
|
tmp = bytes2string(memstat[row][MEMINFO_FREE]);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
case 4:
|
|
|
|
tmp = to_string(memstat[row][MEMINFO_TOTAL] ? (memstat[row][MEMINFO_USED] * 100) / memstat[row][MEMINFO_TOTAL] : 0) + "%";
|
|
|
|
tmp = to_string(memstat[row][MEMINFO_TOTAL] ? (memstat[row][MEMINFO_USED] * 100) / memstat[row][MEMINFO_TOTAL] : 0) + "%";
|
|
|
@@ -467,18 +505,16 @@ void CDBoxInfoWidget::paint()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mpOffset = offsets[column];
|
|
|
|
mpOffset = offsets[column];
|
|
|
|
int space = 0;
|
|
|
|
int space = 0;
|
|
|
|
int rw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp);
|
|
|
|
|
|
|
|
if (column > 0) {
|
|
|
|
if (column > 0) {
|
|
|
|
|
|
|
|
int rw = fm->getRenderWidth(tmp);
|
|
|
|
|
|
|
|
maxWidth[column] = std::max(maxWidth[column], rw);
|
|
|
|
space = widths[column] - rw;
|
|
|
|
space = widths[column] - rw;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
maxWidth[column] = std::max(maxWidth[column], rw)+6;
|
|
|
|
fm->RenderString(x + mpOffset + space, ypos+ mheight, width, tmp, COL_MENUCONTENT_TEXT);
|
|
|
|
if ((mpOffset + space + maxWidth[column]) > width)
|
|
|
|
|
|
|
|
maxWidth[column] = width - (mpOffset + space);
|
|
|
|
|
|
|
|
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + mpOffset + space, ypos+ mheight, maxWidth[column], tmp, COL_MENUCONTENT_TEXT);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pbw > 8) /* smaller progressbar is not useful ;) */
|
|
|
|
if (pbw > 8) /* smaller progressbar is not useful ;) */
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CProgressBar pb(x+offsetw, ypos+3, pbw, mheight-10);
|
|
|
|
CProgressBar pb(x+offsetw, ypos+mheight/4, pbw, mheight/2);
|
|
|
|
pb.setType(CProgressBar::PB_REDRIGHT);
|
|
|
|
pb.setType(CProgressBar::PB_REDRIGHT);
|
|
|
|
pb.setValues(memstat[row][MEMINFO_TOTAL] ? (memstat[row][MEMINFO_USED] * 100) / memstat[row][MEMINFO_TOTAL] : 0, 100);
|
|
|
|
pb.setValues(memstat[row][MEMINFO_TOTAL] ? (memstat[row][MEMINFO_USED] * 100) / memstat[row][MEMINFO_TOTAL] : 0, 100);
|
|
|
|
pb.paint(false);
|
|
|
|
pb.paint(false);
|
|
|
@@ -490,7 +526,7 @@ void CDBoxInfoWidget::paint()
|
|
|
|
int ypos_mnt_head = ypos;
|
|
|
|
int ypos_mnt_head = ypos;
|
|
|
|
ypos += mheight;
|
|
|
|
ypos += mheight;
|
|
|
|
|
|
|
|
|
|
|
|
int width_i = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("i");
|
|
|
|
int width_i = fm->getRenderWidth("i");
|
|
|
|
CRecordManager * crm = CRecordManager::getInstance();
|
|
|
|
CRecordManager * crm = CRecordManager::getInstance();
|
|
|
|
|
|
|
|
|
|
|
|
for (std::map<std::string, bool>::iterator it = mounts.begin(); it != mounts.end(); ++it) {
|
|
|
|
for (std::map<std::string, bool>::iterator it = mounts.begin(); it != mounts.end(); ++it) {
|
|
|
@@ -504,9 +540,9 @@ void CDBoxInfoWidget::paint()
|
|
|
|
//paint mountpoints
|
|
|
|
//paint mountpoints
|
|
|
|
for (int column = 0; column < headSize; column++) {
|
|
|
|
for (int column = 0; column < headSize; column++) {
|
|
|
|
std::string tmp;
|
|
|
|
std::string tmp;
|
|
|
|
const char *mnt;
|
|
|
|
|
|
|
|
mpOffset = offsets[column];
|
|
|
|
mpOffset = offsets[column];
|
|
|
|
int _w = maxWidth[column];
|
|
|
|
const char *mnt;
|
|
|
|
|
|
|
|
int _w = width;
|
|
|
|
switch (column) {
|
|
|
|
switch (column) {
|
|
|
|
case 0:
|
|
|
|
case 0:
|
|
|
|
tmp = (*it).first;
|
|
|
|
tmp = (*it).first;
|
|
|
@@ -534,20 +570,17 @@ void CDBoxInfoWidget::paint()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int space = 0;
|
|
|
|
int space = 0;
|
|
|
|
if (column > 0) {
|
|
|
|
if (column > 0) {
|
|
|
|
int rw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp);
|
|
|
|
int rw = fm->getRenderWidth(tmp);
|
|
|
|
maxWidth[column] = std::max(maxWidth[column], rw);
|
|
|
|
maxWidth[column] = std::max(maxWidth[column], rw);
|
|
|
|
space = widths[column] - rw;
|
|
|
|
space = widths[column] - rw;
|
|
|
|
_w = rw;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((mpOffset + space + _w) > width)
|
|
|
|
fm->RenderString(x + mpOffset + space, ypos+ mheight, _w, tmp, COL_MENUCONTENT_TEXT);
|
|
|
|
_w = width - (mpOffset + space);
|
|
|
|
|
|
|
|
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + mpOffset + space, ypos+ mheight, _w, tmp, COL_MENUCONTENT_TEXT);
|
|
|
|
|
|
|
|
if ((*it).second && icon_w>0 && icon_h>0)
|
|
|
|
if ((*it).second && icon_w>0 && icon_h>0)
|
|
|
|
frameBuffer->paintIcon(crm->RecordingStatus() ? NEUTRINO_ICON_REC:NEUTRINO_ICON_REC_GRAY, x + nameWidth - icon_w + width_i/2, ypos + (mheight/2 - icon_h/2));
|
|
|
|
frameBuffer->paintIcon(crm->RecordingStatus() ? NEUTRINO_ICON_REC:NEUTRINO_ICON_REC_GRAY, x + nameWidth - icon_w + width_i/2, ypos + (mheight/2 - icon_h/2));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pbw > 8) /* smaller progressbar is not useful ;) */
|
|
|
|
if (pbw > 8) /* smaller progressbar is not useful ;) */
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CProgressBar pb(x+offsetw, ypos+3, pbw, mheight-10);
|
|
|
|
CProgressBar pb(x+offsetw, ypos+mheight/4, pbw, mheight/2);
|
|
|
|
pb.setType(CProgressBar::PB_REDRIGHT);
|
|
|
|
pb.setType(CProgressBar::PB_REDRIGHT);
|
|
|
|
pb.setValues(percent_used, 100);
|
|
|
|
pb.setValues(percent_used, 100);
|
|
|
|
pb.paint(false);
|
|
|
|
pb.paint(false);
|
|
|
@@ -558,39 +591,50 @@ void CDBoxInfoWidget::paint()
|
|
|
|
if (ypos > y + height - mheight) /* the screen is not high enough */
|
|
|
|
if (ypos > y + height - mheight) /* the screen is not high enough */
|
|
|
|
break; /* todo: scrolling? */
|
|
|
|
break; /* todo: scrolling? */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// paint info heads
|
|
|
|
|
|
|
|
head_info_ypos += y;
|
|
|
|
|
|
|
|
for (int line = 0; line < head_info_lines; line++) {
|
|
|
|
|
|
|
|
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + 10, head_info_ypos + mheight*(line+1), head_info_rw, head_info[line], COL_MENUCONTENTINACTIVE_TEXT);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// paint mem head
|
|
|
|
// paint mem head
|
|
|
|
const char *head_mem[headSize] = {"Memory", "Size", "Used", "Available", "Use"};
|
|
|
|
const char *head_mem[headSize] = {
|
|
|
|
|
|
|
|
g_Locale->getText(LOCALE_EXTRA_DBOXINFO_MEMORY),
|
|
|
|
|
|
|
|
g_Locale->getText(LOCALE_EXTRA_DBOXINFO_SIZE),
|
|
|
|
|
|
|
|
g_Locale->getText(LOCALE_EXTRA_DBOXINFO_USED),
|
|
|
|
|
|
|
|
g_Locale->getText(LOCALE_EXTRA_DBOXINFO_AVAILABLE),
|
|
|
|
|
|
|
|
g_Locale->getText(LOCALE_EXTRA_DBOXINFO_USE)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
int len4 = fm->getRenderWidth(head_mem[4]);
|
|
|
|
|
|
|
|
if (pbw > 8 && maxWidth[4] < len4) {
|
|
|
|
|
|
|
|
maxWidth[4] += 10 + pbw;
|
|
|
|
|
|
|
|
maxWidth[4] = std::min(maxWidth[4], len4);
|
|
|
|
|
|
|
|
widths[4] = maxWidth[4];
|
|
|
|
|
|
|
|
}
|
|
|
|
for (int column = 0; column < headSize; column++) {
|
|
|
|
for (int column = 0; column < headSize; column++) {
|
|
|
|
headOffset = offsets[column];
|
|
|
|
headOffset = offsets[column];
|
|
|
|
int space = 0;
|
|
|
|
int space = 0;
|
|
|
|
int rw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(head_mem[column]);
|
|
|
|
|
|
|
|
int _w = rw;
|
|
|
|
|
|
|
|
if (column > 0) {
|
|
|
|
if (column > 0) {
|
|
|
|
|
|
|
|
int rw = fm->getRenderWidth(head_mem[column]);
|
|
|
|
if (rw > maxWidth[column])
|
|
|
|
if (rw > maxWidth[column])
|
|
|
|
space = widths[column] - rw;
|
|
|
|
space = widths[column] - rw;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
space = widths[column] - maxWidth[column] + (maxWidth[column] - rw)/2;
|
|
|
|
space = widths[column] - maxWidth[column] + (maxWidth[column] - rw)/2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ headOffset + space, ypos_mem_head + mheight, _w, head_mem[column], COL_MENUCONTENTINACTIVE_TEXT);
|
|
|
|
fm->RenderString(x + headOffset + space, ypos_mem_head + mheight, width, head_mem[column], COL_MENUCONTENTINACTIVE_TEXT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// paint mount head
|
|
|
|
// paint mount head
|
|
|
|
const char *head_mnt[headSize] = {"Filesystem", "Size", "Used", "Available", "Use"};
|
|
|
|
const char *head_mnt[headSize] = {
|
|
|
|
|
|
|
|
g_Locale->getText(LOCALE_EXTRA_DBOXINFO_FILESYSTEM),
|
|
|
|
|
|
|
|
g_Locale->getText(LOCALE_EXTRA_DBOXINFO_SIZE),
|
|
|
|
|
|
|
|
g_Locale->getText(LOCALE_EXTRA_DBOXINFO_USED),
|
|
|
|
|
|
|
|
g_Locale->getText(LOCALE_EXTRA_DBOXINFO_AVAILABLE),
|
|
|
|
|
|
|
|
g_Locale->getText(LOCALE_EXTRA_DBOXINFO_USE)
|
|
|
|
|
|
|
|
};
|
|
|
|
for (int column = 0; column < headSize; column++) {
|
|
|
|
for (int column = 0; column < headSize; column++) {
|
|
|
|
headOffset = offsets[column];
|
|
|
|
headOffset = offsets[column];
|
|
|
|
int space = 0;
|
|
|
|
int space = 0;
|
|
|
|
int rw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(head_mnt[column]);
|
|
|
|
|
|
|
|
int _w = rw;
|
|
|
|
|
|
|
|
if (column > 0) {
|
|
|
|
if (column > 0) {
|
|
|
|
|
|
|
|
int rw = fm->getRenderWidth(head_mnt[column]);
|
|
|
|
if (rw > maxWidth[column])
|
|
|
|
if (rw > maxWidth[column])
|
|
|
|
space = widths[column] - rw;
|
|
|
|
space = widths[column] - rw;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
space = widths[column] - maxWidth[column] + (maxWidth[column] - rw)/2;
|
|
|
|
space = widths[column] - maxWidth[column] + (maxWidth[column] - rw)/2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ headOffset + space, ypos_mnt_head + mheight, _w, head_mnt[column], COL_MENUCONTENTINACTIVE_TEXT);
|
|
|
|
fm->RenderString(x + headOffset + space, ypos_mnt_head + mheight, width, head_mnt[column], COL_MENUCONTENTINACTIVE_TEXT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|