gui/dboxinfo: localize (partially based on patch from Benny -- thanks!)

Conflicts:
	src/gui/dboxinfo.cpp


Origin commit data
------------------
Commit: 742760dbd3
Author: martii <m4rtii@gmx.de>
Date: 2014-05-24 (Sat, 24 May 2014)
This commit is contained in:
martii
2014-05-24 15:27:19 +02:00
committed by [CST] Focus
parent d763634287
commit bb0239bd4c
8 changed files with 232 additions and 122 deletions

View File

@@ -366,6 +366,20 @@ extra.cache_txt Teletext zwischenspeichern
extra.chadded Der aktuelle Kanal wird dem selektierten Bouquet hinzugefügt...\n
extra.chalreadyinbq Der aktuelle Kanal ist bereits im selektierten Bouquet...\n
extra.dboxinfo Box-Info
extra.dboxinfo_available Frei
extra.dboxinfo_boottime Boot
extra.dboxinfo_filesystem Dateisystem
extra.dboxinfo_frontend Frontends
extra.dboxinfo_load Last
extra.dboxinfo_memory Speicher
extra.dboxinfo_ram RAM
extra.dboxinfo_size Gesamt
extra.dboxinfo_swap Swap
extra.dboxinfo_time Zeit
extra.dboxinfo_timeformat %FT%H:%M:%S%z
extra.dboxinfo_uptime Uptime
extra.dboxinfo_use Nutzung
extra.dboxinfo_used Benutzt
extra.east Osten
extra.fec_1_2 1/2
extra.fec_2_3 2/3

View File

@@ -366,6 +366,20 @@ extra.cache_txt Cache teletext
extra.chadded The current channel has been added to selected bouquet....\n
extra.chalreadyinbq The current channel is already in selected bouquet....\n
extra.dboxinfo Box Info
extra.dboxinfo_available Free
extra.dboxinfo_boottime Boot
extra.dboxinfo_filesystem Filesystem
extra.dboxinfo_frontend Frontends
extra.dboxinfo_load Load
extra.dboxinfo_memory Memory
extra.dboxinfo_ram RAM
extra.dboxinfo_size Total
extra.dboxinfo_swap Swap
extra.dboxinfo_time Time
extra.dboxinfo_timeformat %FT%H:%M:%S%z
extra.dboxinfo_uptime Uptime
extra.dboxinfo_use Use
extra.dboxinfo_used Used
extra.east East
extra.fec_1_2 1/2
extra.fec_2_3 2/3

View File

@@ -4,6 +4,14 @@
Copyright (C) 2001 Steffen Hehn 'McClean'
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
This program is free software; you can redistribute it and/or modify
@@ -43,6 +51,8 @@
#include <driver/fade.h>
#include <driver/record.h>
#include <zapit/femanager.h>
#include <sys/sysinfo.h>
#include <sys/vfs.h>
#include <system/sysload.h>
@@ -51,28 +61,25 @@
#include <iostream>
#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()
{
fm = g_Font[SNeutrinoSettings::FONT_TYPE_MENU];
ft = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE];
frameBuffer = CFrameBuffer::getInstance();
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
hheight = ft->getHeight();
mheight = fm->getHeight();
mheight += mheight & 1;
width = 0;
height = 0;
x = 0;
y = 0;
fontWidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getWidth();
sizeWidth = 6 * g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getMaxDigitWidth()
+ g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(std::string(" MiB") + g_Locale->getText(LOCALE_UNIT_DECIMAL)); ;//9999.99 MiB
percWidth = 3 * g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getMaxDigitWidth()
+ g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("%"); //100%
nameWidth = fontWidth * 10;
fontWidth = fm->getWidth();
sizeWidth = 6 * fm->getMaxDigitWidth()
+ fm->getRenderWidth(std::string(" MiB") + g_Locale->getText(LOCALE_UNIT_DECIMAL)); ;//9999.99 MiB
percWidth = 3 * fm->getMaxDigitWidth()
+ fm->getRenderWidth("%"); //100%
nameWidth = fontWidth * 17;
}
int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &)
@@ -199,17 +206,20 @@ static std::string bytes2string(uint64_t bytes, bool binary)
void CDBoxInfoWidget::paint()
{
const int head_info_lines = 3;
const char *head_info[head_info_lines] = {"Uptime", "Load average", "Current load"};
height = hheight;
height += mheight/2; // space
int cpuload_y0 = height;
int head_info_ypos = height;
height += mheight*head_info_lines; // head info lines
height += mheight; // boot time
height += mheight; // time
height += mheight; // uptime
height += mheight; // load
int cpuload_y1 = height;
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;
frameBuffer->getIconSize(NEUTRINO_ICON_REC, &icon_w, &icon_h);
@@ -221,14 +231,19 @@ void CDBoxInfoWidget::paint()
#define MEMINFO_RAM 0
#define MEMINFO_SWAP 1
#define MEMINFO_ROWS 2
unsigned long memstat[MEMINFO_ROWS][MEMINFO_COLUMNS] = { { 0, 0, 0 }, { 0, 0, 0 } }; // total, used, free
const char *memtype[MEMINFO_ROWS] = { "RAM", "Swap" };
unsigned long long memstat[MEMINFO_ROWS][MEMINFO_COLUMNS] = { { 0, 0, 0 }, { 0, 0, 0 } }; // total, used, free
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");
if (procmeminfo) {
char buf[80], a[80];
unsigned long v;
long long unsigned v;
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"))
memstat[MEMINFO_RAM][MEMINFO_TOTAL] += v;
else if (!strcasecmp(a, "MemFree"))
@@ -266,7 +281,7 @@ void CDBoxInfoWidget::paint()
while (getline(in, line)) {
size_t firstslash = 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++;
size_t nextspace = line.find_first_of(' ', firstspace);
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);
mounts[mountpoint] = is_rec;
int icon_space = is_rec ? 10 + icon_w : 0;
const char *mnt = mountpoint.c_str();
nameWidth = std::max(nameWidth, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(basename((char *)mnt)) + icon_space + 10);
nameWidth = std::max(nameWidth, fm->getRenderWidth(mountpoint, true) + icon_space + 10);
}
}
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 += mounts.size() * mheight; // file systems
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;
int diff = frameBuffer->getScreenWidth() - width;
@@ -339,33 +363,28 @@ void CDBoxInfoWidget::paint()
ypos += hheight + mheight/2;
int head_info_rw = 0;
for (int line = 0; line < head_info_lines; line++) {
head_info_rw = std::max(head_info_rw, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(head_info[line]));
}
cSysLoad *sysload = cSysLoad::getInstance();
int data_last = sysload->data_last;
int dw = offsetw - 3*10 - head_info_rw;
int buf_size=256;
char ubuf[buf_size];
char sbuf[buf_size];
memset(sbuf, 0, 256);
std::string str_now_title(g_Locale->getText(LOCALE_EXTRA_DBOXINFO_TIME));
str_now_title += ": ";
std::string str_boot_title(g_Locale->getText(LOCALE_EXTRA_DBOXINFO_BOOTTIME));
str_boot_title += ": ";
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;
sysinfo(&info);
now -= info.uptime;
std::string str_boot(strftime(g_Locale->getText(LOCALE_EXTRA_DBOXINFO_TIMEFORMAT), now));
//get uptime
#if 0
struct tm *current_time;
time_t current_secs;
time(&current_secs);
current_time = localtime(&current_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
char ubuf[80];
char sbuf[256];
int updays, uphours, upminutes;
updays = (int) info.uptime / (60*60*24);
@@ -374,41 +393,46 @@ void CDBoxInfoWidget::paint()
upminutes %= 60;
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);
}
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);
}
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);
//paint uptime
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + 2*10 + head_info_rw, ypos+ mheight, dw, sbuf, COL_MENUCONTENT_TEXT);
snprintf(ubuf, sizeof(ubuf), "%s: ", g_Locale->getText(LOCALE_EXTRA_DBOXINFO_LOAD));
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;
//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) {
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);
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;
int ypos_mem = ypos;
int pbw = width - offsetw - 10;
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;
int headOffset=0;
@@ -453,13 +491,13 @@ void CDBoxInfoWidget::paint()
tmp = memtype[row];
break;
case 1:
tmp = bytes2string(memstat[row][MEMINFO_TOTAL] << 10);
tmp = bytes2string(memstat[row][MEMINFO_TOTAL]);
break;
case 2:
tmp = bytes2string(memstat[row][MEMINFO_USED] << 10);
tmp = bytes2string(memstat[row][MEMINFO_USED]);
break;
case 3:
tmp = bytes2string(memstat[row][MEMINFO_FREE] << 10);
tmp = bytes2string(memstat[row][MEMINFO_FREE]);
break;
case 4:
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];
int space = 0;
int rw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp);
if (column > 0) {
int rw = fm->getRenderWidth(tmp);
maxWidth[column] = std::max(maxWidth[column], rw);
space = widths[column] - rw;
}
maxWidth[column] = std::max(maxWidth[column], rw)+6;
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);
fm->RenderString(x + mpOffset + space, ypos+ mheight, width, tmp, COL_MENUCONTENT_TEXT);
}
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.setValues(memstat[row][MEMINFO_TOTAL] ? (memstat[row][MEMINFO_USED] * 100) / memstat[row][MEMINFO_TOTAL] : 0, 100);
pb.paint(false);
@@ -490,7 +526,7 @@ void CDBoxInfoWidget::paint()
int ypos_mnt_head = ypos;
ypos += mheight;
int width_i = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("i");
int width_i = fm->getRenderWidth("i");
CRecordManager * crm = CRecordManager::getInstance();
for (std::map<std::string, bool>::iterator it = mounts.begin(); it != mounts.end(); ++it) {
@@ -504,9 +540,9 @@ void CDBoxInfoWidget::paint()
//paint mountpoints
for (int column = 0; column < headSize; column++) {
std::string tmp;
const char *mnt;
mpOffset = offsets[column];
int _w = maxWidth[column];
const char *mnt;
int _w = width;
switch (column) {
case 0:
tmp = (*it).first;
@@ -534,20 +570,17 @@ void CDBoxInfoWidget::paint()
}
int space = 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);
space = widths[column] - rw;
_w = rw;
}
if ((mpOffset + space + _w) > width)
_w = width - (mpOffset + space);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + mpOffset + space, ypos+ mheight, _w, tmp, COL_MENUCONTENT_TEXT);
fm->RenderString(x + mpOffset + space, ypos+ mheight, _w, tmp, COL_MENUCONTENT_TEXT);
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));
}
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.setValues(percent_used, 100);
pb.paint(false);
@@ -558,39 +591,50 @@ void CDBoxInfoWidget::paint()
if (ypos > y + height - mheight) /* the screen is not high enough */
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
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++) {
headOffset = offsets[column];
int space = 0;
int rw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(head_mem[column]);
int _w = rw;
if (column > 0) {
int rw = fm->getRenderWidth(head_mem[column]);
if (rw > maxWidth[column])
space = widths[column] - rw;
else
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
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++) {
headOffset = offsets[column];
int space = 0;
int rw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(head_mnt[column]);
int _w = rw;
if (column > 0) {
int rw = fm->getRenderWidth(head_mnt[column]);
if (rw > maxWidth[column])
space = widths[column] - rw;
else
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);
}
}

View File

@@ -35,6 +35,7 @@
#include <gui/widget/menue.h>
#include <driver/framebuffer.h>
#include <driver/fontrenderer.h>
#include <string>
class CDBoxInfoWidget : public CMenuTarget
@@ -54,6 +55,8 @@ class CDBoxInfoWidget : public CMenuTarget
void paint();
Font *fm, *ft;
public:
CDBoxInfoWidget();

View File

@@ -398,6 +398,12 @@ std::string strftime(const char *format, const struct tm *tm)
return std::string(buf);
}
std::string strftime(const char *format, time_t when, bool gm)
{
struct tm *t = gm ? gmtime(&when) : localtime(&when);
return strftime(format, t);
}
time_t toEpoch(std::string &date)
{
struct tm t;

View File

@@ -61,6 +61,7 @@ std::string getFileExt(std::string &file);
std::string getNowTimeStr(const char* format);
std::string trim(std::string &str, const std::string &trimChars = " \n\r\t");
std::string strftime(const char *format, const struct tm *tm);
std::string strftime(const char *format, time_t when, bool gm = false);
time_t toEpoch(std::string &date);
std::string& str_replace(const std::string &search, const std::string &replace, std::string &text);
std::string& htmlEntityDecode(std::string& text);

View File

@@ -393,6 +393,20 @@ typedef enum
LOCALE_EXTRA_CHADDED,
LOCALE_EXTRA_CHALREADYINBQ,
LOCALE_EXTRA_DBOXINFO,
LOCALE_EXTRA_DBOXINFO_AVAILABLE,
LOCALE_EXTRA_DBOXINFO_BOOTTIME,
LOCALE_EXTRA_DBOXINFO_FILESYSTEM,
LOCALE_EXTRA_DBOXINFO_FRONTEND,
LOCALE_EXTRA_DBOXINFO_LOAD,
LOCALE_EXTRA_DBOXINFO_MEMORY,
LOCALE_EXTRA_DBOXINFO_RAM,
LOCALE_EXTRA_DBOXINFO_SIZE,
LOCALE_EXTRA_DBOXINFO_SWAP,
LOCALE_EXTRA_DBOXINFO_TIME,
LOCALE_EXTRA_DBOXINFO_TIMEFORMAT,
LOCALE_EXTRA_DBOXINFO_UPTIME,
LOCALE_EXTRA_DBOXINFO_USE,
LOCALE_EXTRA_DBOXINFO_USED,
LOCALE_EXTRA_EAST,
LOCALE_EXTRA_FEC_1_2,
LOCALE_EXTRA_FEC_2_3,

View File

@@ -393,6 +393,20 @@ const char * locale_real_names[] =
"extra.chadded",
"extra.chalreadyinbq",
"extra.dboxinfo",
"extra.dboxinfo_available",
"extra.dboxinfo_boottime",
"extra.dboxinfo_filesystem",
"extra.dboxinfo_frontend",
"extra.dboxinfo_load",
"extra.dboxinfo_memory",
"extra.dboxinfo_ram",
"extra.dboxinfo_size",
"extra.dboxinfo_swap",
"extra.dboxinfo_time",
"extra.dboxinfo_timeformat",
"extra.dboxinfo_uptime",
"extra.dboxinfo_use",
"extra.dboxinfo_used",
"extra.east",
"extra.fec_1_2",
"extra.fec_2_3",