gui/dboxinfo: slightly re-arrange window

This commit is contained in:
martii
2014-01-03 08:50:34 +01:00
committed by svenhoefer
parent b95f7298e9
commit 9285f9cdbd

View File

@@ -210,10 +210,9 @@ void CDBoxInfoWidget::paint()
height += mheight/2; // space height += mheight/2; // space
int frontend_count = CFEManager::getInstance()->getFrontendCount(); int frontend_count = CFEManager::getInstance()->getFrontendCount();
if (frontend_count) { if (frontend_count > 2)
height += mheight * frontend_count; height += mheight * (frontend_count - 2);
height += mheight/2; height += mheight/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);
@@ -355,22 +354,28 @@ void CDBoxInfoWidget::paint()
char ubuf[80]; char ubuf[80];
time_t now = time(NULL); time_t now = time(NULL);
strftime(ubuf, sizeof(ubuf), "Time: %F %H:%M:%S%z", localtime(&now)); strftime(ubuf, sizeof(ubuf), "Time: %F %H:%M:%S%z", localtime(&now));
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ 10, ypos+ mheight, width - 10, ubuf, COL_MENUCONTENT_TEXT);
ypos += mheight;
char ubuf_boot[80];
struct sysinfo info; struct sysinfo info;
sysinfo(&info); sysinfo(&info);
now -= info.uptime; now -= info.uptime;
strftime(ubuf, sizeof(ubuf), "Boot: %F %H:%M:%S%z", localtime(&now)); strftime(ubuf_boot, sizeof(ubuf_boot), "Boot: %FT%H:%M:%S%z", localtime(&now));
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ 10, ypos+ mheight, width - 10, ubuf, COL_MENUCONTENT_TEXT);
int time_width = std::max(g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(ubuf), g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(ubuf_boot));
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + offsetw - time_width - 10, ypos+ mheight, time_width, ubuf, COL_MENUCONTENT_TEXT);
ypos += mheight;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + offsetw - time_width - 10, ypos+ mheight, time_width, ubuf_boot, COL_MENUCONTENT_TEXT);
ypos += mheight; ypos += mheight;
if (data_last > -1) { if (data_last > -1) {
snprintf(ubuf, sizeof(ubuf), "Load: %d%s%d%%", data_last/10, g_Locale->getText(LOCALE_UNIT_DECIMAL), data_last%10); snprintf(ubuf, sizeof(ubuf), "Load: %d%s%d%%", data_last/10, g_Locale->getText(LOCALE_UNIT_DECIMAL), data_last%10);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ 10, ypos+ mheight, width - 10, ubuf, COL_MENUCONTENT_TEXT); g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + offsetw - time_width - 10, 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 ;) */
{ {
@@ -386,21 +391,22 @@ void CDBoxInfoWidget::paint()
} }
} }
ypos += mheight/2; ypos = y + hheight + mheight/2;
if (frontend_count) { g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + 10, ypos + mheight, width - 10, "Frontends", COL_MENUCONTENTINACTIVE_TEXT);
for (int i = 0; i < frontend_count; i++) { ypos += mheight;
CFrontend *fe = CFEManager::getInstance()->getFE(i); for (int i = 0; i < frontend_count; i++) {
if (fe) { CFrontend *fe = CFEManager::getInstance()->getFE(i);
std::string s("Frontend "); if (fe) {
s += to_string(i) + ": " + fe->getInfo()->name; std::string s = to_string(i) + ": " + fe->getInfo()->name;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ 10, ypos+ mheight, width - 10, s, COL_MENUCONTENT_TEXT); g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ 10, ypos+ mheight, width - 10, s, COL_MENUCONTENT_TEXT);
ypos += mheight; ypos += mheight;
}
} }
ypos += mheight/2;
} }
ypos = std::max(ypos, ypos_mem);
ypos += mheight/2;
int headOffset=0; int headOffset=0;
int mpOffset=0; int mpOffset=0;
int offsets[] = { int offsets[] = {