Merge branch 'ni/tuxbox' into ni/mp/tuxbox

Origin commit data
------------------
Commit: d2c54a405b
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-09-28 (Thu, 28 Sep 2017)
This commit is contained in:
vanhofen
2017-09-28 23:43:36 +02:00
11 changed files with 177 additions and 185 deletions

View File

@@ -64,15 +64,15 @@ fb_pixel_t* CColorGradient::gradientColorToTransparent(fb_pixel_t col, fb_pixel_
{ {
if (bSize < 1) if (bSize < 1)
return gradientBuf; return gradientBuf;
unsigned long _bSize = (unsigned long) bSize;
if (gradientBuf == NULL) { if (gradientBuf == NULL) {
gradientBuf = (fb_pixel_t*) malloc(bSize * sizeof(fb_pixel_t)); gradientBuf = (fb_pixel_t*) malloc(_bSize * sizeof(fb_pixel_t));
if (gradientBuf == NULL) { if (gradientBuf == NULL) {
dprintf(DEBUG_NORMAL, "[%s:%d] malloc error\n", __func__, __LINE__); dprintf(DEBUG_NORMAL, "[%s:%d] malloc error\n", __func__, __LINE__);
return NULL; return NULL;
} }
} }
memset((void*)gradientBuf, '\0', bSize * sizeof(fb_pixel_t)); memset((void*)gradientBuf, '\0', _bSize * sizeof(fb_pixel_t));
int start_box = 0; int start_box = 0;
int end_box = bSize; int end_box = bSize;
@@ -87,7 +87,7 @@ fb_pixel_t* CColorGradient::gradientColorToTransparent(fb_pixel_t col, fb_pixel_
uint8_t g = (uint8_t)((col & 0x0000FF00) >> 8); uint8_t g = (uint8_t)((col & 0x0000FF00) >> 8);
uint8_t b = (uint8_t) (col & 0x000000FF); uint8_t b = (uint8_t) (col & 0x000000FF);
gradientBuf[i] = ((tr << 24) & 0xFF000000) | gradientBuf[i] = ((unsigned int)(tr << 24) & 0xFF000000) |
((r << 16) & 0x00FF0000) | ((r << 16) & 0x00FF0000) |
((g << 8) & 0x0000FF00) | ((g << 8) & 0x0000FF00) |
( b & 0x000000FF); ( b & 0x000000FF);
@@ -99,15 +99,15 @@ fb_pixel_t* CColorGradient::gradientOneColor(fb_pixel_t col, fb_pixel_t *gradien
{ {
if (bSize < 1) if (bSize < 1)
return gradientBuf; return gradientBuf;
unsigned long _bSize = (unsigned long) bSize;
if (gradientBuf == NULL) { if (gradientBuf == NULL) {
gradientBuf = (fb_pixel_t*) malloc(bSize * sizeof(fb_pixel_t)); gradientBuf = (fb_pixel_t*) malloc(_bSize * sizeof(fb_pixel_t));
if (gradientBuf == NULL) { if (gradientBuf == NULL) {
dprintf(DEBUG_NORMAL, "[%s:%d] malloc error\n", __func__, __LINE__); dprintf(DEBUG_NORMAL, "[%s:%d] malloc error\n", __func__, __LINE__);
return NULL; return NULL;
} }
} }
memset((void*)gradientBuf, '\0', bSize * sizeof(fb_pixel_t)); memset((void*)gradientBuf, '\0', _bSize * sizeof(fb_pixel_t));
HsvColor hsv; HsvColor hsv;
uint8_t min_v=0, max_v=0, col_s=0; uint8_t min_v=0, max_v=0, col_s=0;
@@ -180,26 +180,22 @@ fb_pixel_t* CColorGradient::gradientOneColor(fb_pixel_t col, fb_pixel_t *gradien
fb_pixel_t* CColorGradient::gradientColorToColor(fb_pixel_t start_col,fb_pixel_t end_col, fb_pixel_t *gradientBuf, int bSize, int mode, int /*intensity*/) fb_pixel_t* CColorGradient::gradientColorToColor(fb_pixel_t start_col,fb_pixel_t end_col, fb_pixel_t *gradientBuf, int bSize, int mode, int /*intensity*/)
{ {
unsigned long _bSize = (unsigned long) bSize;
if (gradientBuf == NULL) { if (gradientBuf == NULL) {
gradientBuf = (fb_pixel_t*) malloc(bSize * sizeof(fb_pixel_t)); gradientBuf = (fb_pixel_t*) malloc(_bSize * sizeof(fb_pixel_t));
if (gradientBuf == NULL) { if (gradientBuf == NULL) {
dprintf(DEBUG_NORMAL, "[%s:%d] malloc error\n", __func__, __LINE__); dprintf(DEBUG_NORMAL, "[%s:%d] malloc error\n", __func__, __LINE__);
return NULL; return NULL;
} }
} }
memset((void*)gradientBuf, '\0', bSize * sizeof(fb_pixel_t)); memset((void*)gradientBuf, '\0', _bSize * sizeof(fb_pixel_t));
int start_box = 0; int start_box = 0;
int end_box = bSize; int end_box = bSize;
fb_pixel_t temp_col = end_col; std::swap(start_col,end_col);
end_col = start_col;
start_col = temp_col;
if (mode == gradientDark2Light){ if (mode == gradientDark2Light){
temp_col = start_col; std::swap(start_col,end_col);
start_col = end_col;
end_col = temp_col;
} }
uint8_t start_tr = (uint8_t)((start_col & 0xFF000000) >> 24); uint8_t start_tr = (uint8_t)((start_col & 0xFF000000) >> 24);
@@ -226,7 +222,7 @@ fb_pixel_t* CColorGradient::gradientColorToColor(fb_pixel_t start_col,fb_pixel_t
uint8_t g = limitChar((int)((float)start_g + gStep*(float)i)); uint8_t g = limitChar((int)((float)start_g + gStep*(float)i));
uint8_t b = limitChar((int)((float)start_b + bStep*(float)i)); uint8_t b = limitChar((int)((float)start_b + bStep*(float)i));
gradientBuf[i] = ((tr << 24) & 0xFF000000) | gradientBuf[i] = ((unsigned int)(tr << 24) & 0xFF000000) |
((r << 16) & 0x00FF0000) | ((r << 16) & 0x00FF0000) |
((g << 8) & 0x0000FF00) | ((g << 8) & 0x0000FF00) |
( b & 0x000000FF); ( b & 0x000000FF);

View File

@@ -355,6 +355,7 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
CBEChannelWidget* channelWidget = new CBEChannelWidget(ChannelWidgetCaption, selected); CBEChannelWidget* channelWidget = new CBEChannelWidget(ChannelWidgetCaption, selected);
channelWidget->exec(this, ""); channelWidget->exec(this, "");
selected = channelWidget->getBouquet();
if (channelWidget->hasChanged()) if (channelWidget->hasChanged())
bouquetsChanged = true; bouquetsChanged = true;
delete channelWidget; delete channelWidget;

View File

@@ -70,6 +70,8 @@ CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bou
status_icon_width = std::max(status_icon_width, iw); status_icon_width = std::max(status_icon_width, iw);
frameBuffer->getIconSize(NEUTRINO_ICON_LOCK, &iw, &ih); frameBuffer->getIconSize(NEUTRINO_ICON_LOCK, &iw, &ih);
status_icon_width = std::max(status_icon_width, iw); status_icon_width = std::max(status_icon_width, iw);
header.addContextButton(CComponentsHeader::CC_BTN_LEFT | CComponentsHeader::CC_BTN_RIGHT);
} }
CBEChannelWidget::~CBEChannelWidget() CBEChannelWidget::~CBEChannelWidget()
@@ -93,7 +95,7 @@ void CBEChannelWidget::paintItem(int pos)
if (i_selected) if (i_selected)
{ {
if (current < Channels->size()) if (current < Channels->size() || Channels->empty())
paintDetails(pos, current); paintDetails(pos, current);
i_radius = RADIUS_LARGE; i_radius = RADIUS_LARGE;
@@ -238,6 +240,9 @@ std::string CBEChannelWidget::getInfoText(int index)
{ {
std::string res = ""; std::string res = "";
if (Channels->empty())
return res;
std::string satname = CServiceManager::getInstance()->GetSatelliteName((*Channels)[index]->getSatellitePosition()); std::string satname = CServiceManager::getInstance()->GetSatelliteName((*Channels)[index]->getSatellitePosition());
if (IS_WEBTV((*Channels)[index]->getChannelID())) if (IS_WEBTV((*Channels)[index]->getChannelID()))
satname = "WebTV"; satname = "WebTV";
@@ -416,6 +421,34 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
paintFoot(); paintFoot();
paintItems(); paintItems();
} }
else if (msg == CRCInput::RC_left || msg == CRCInput::RC_right)
{
unsigned int bouquet_size = g_bouquetManager->Bouquets.size();
if (msg == CRCInput::RC_left)
{
if (bouquet == 0)
bouquet = bouquet_size - 1;
else
bouquet--;
}
else
{
if (bouquet < bouquet_size - 1)
bouquet++;
else
bouquet = 0;
}
Channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels);
caption = g_bouquetManager->Bouquets[bouquet]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : g_bouquetManager->Bouquets[bouquet]->Name;
selected = 0;
paintHead();
paintBody();
paintFoot();
paintItems();
}
else if (msg == CRCInput::RC_ok) else if (msg == CRCInput::RC_ok)
{ {
if (state == beDefault) if (state == beDefault)

View File

@@ -89,6 +89,7 @@ class CBEChannelWidget : public CBEGlobals, public CMenuTarget, public CListHelp
ZapitChannelList * Channels; ZapitChannelList * Channels;
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget* parent, const std::string & actionKey);
bool hasChanged(); bool hasChanged();
unsigned int getBouquet() { return bouquet; };
}; };
#endif #endif

View File

@@ -83,7 +83,7 @@ void CBEChannelSelectWidget::paintItem(int pos)
if (i_selected) if (i_selected)
{ {
if (current < Channels.size()) if (current < Channels.size() || Channels.empty())
paintDetails(pos, current); paintDetails(pos, current);
i_radius = RADIUS_LARGE; i_radius = RADIUS_LARGE;
@@ -246,6 +246,9 @@ std::string CBEChannelSelectWidget::getInfoText(int index)
{ {
std::string res = ""; std::string res = "";
if (Channels.empty())
return res;
std::string satname = CServiceManager::getInstance()->GetSatelliteName(Channels[index]->getSatellitePosition()); std::string satname = CServiceManager::getInstance()->GetSatelliteName(Channels[index]->getSatellitePosition());
if (IS_WEBTV(Channels[index]->getChannelID())) if (IS_WEBTV(Channels[index]->getChannelID()))
satname = "WebTV"; satname = "WebTV";

View File

@@ -88,6 +88,7 @@ int CDaemonControlMenu::show()
daemonControlMenu->addIntroItems(); daemonControlMenu->addIntroItems();
CMenuOptionChooser *mc; CMenuOptionChooser *mc;
CFlagFileNotifier * flagFileNotifier[DAEMONS_COUNT];
for (unsigned int i = 0; i < DAEMONS_COUNT; i++) for (unsigned int i = 0; i < DAEMONS_COUNT; i++)
{ {
buf.str(""); buf.str("");
@@ -96,15 +97,18 @@ int CDaemonControlMenu::show()
daemons_data[i].flag_exist = file_exists(flagfile); daemons_data[i].flag_exist = file_exists(flagfile);
CFlagFileNotifier * flagFileNotifier = new CFlagFileNotifier(daemons_data[i].flag); flagFileNotifier[i] = new CFlagFileNotifier(daemons_data[i].flag);
mc = new CMenuOptionChooser(daemons_data[i].name, &daemons_data[i].flag_exist, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, flagFileNotifier, CRCInput::convertDigitToKey(daemon_shortcut++)); mc = new CMenuOptionChooser(daemons_data[i].name, &daemons_data[i].flag_exist, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, flagFileNotifier[i], CRCInput::convertDigitToKey(daemon_shortcut++));
mc->setHint(daemons_data[i].icon, daemons_data[i].desc); mc->setHint(daemons_data[i].icon, daemons_data[i].desc);
daemonControlMenu->addItem(mc); daemonControlMenu->addItem(mc);
} }
int res = daemonControlMenu->exec(NULL,""); int res = daemonControlMenu->exec(NULL,"");
daemonControlMenu->hide(); daemonControlMenu->hide();
for (unsigned int i = 0; i < DAEMONS_COUNT; i++)
delete flagFileNotifier[i];
delete daemonControlMenu;
return res; return res;
} }
@@ -172,6 +176,7 @@ int CCamdControlMenu::show()
camdControlMenu->addItem(GenericMenuSeparatorLine); camdControlMenu->addItem(GenericMenuSeparatorLine);
CMenuOptionChooser *mc; CMenuOptionChooser *mc;
CFlagFileNotifier * flagFileNotifier[CAMDS_COUNT];
for (unsigned int i = 0; i < CAMDS_COUNT; i++) for (unsigned int i = 0; i < CAMDS_COUNT; i++)
{ {
std::string vinfo = ""; std::string vinfo = "";
@@ -214,14 +219,17 @@ int CCamdControlMenu::show()
std::string hint(g_Locale->getText(camds_data[i].desc)); std::string hint(g_Locale->getText(camds_data[i].desc));
hint.append("\nvinfo: " + vinfo); hint.append("\nvinfo: " + vinfo);
CFlagFileNotifier * flagFileNotifier = new CFlagFileNotifier(camds_data[i].camd_file); flagFileNotifier[i] = new CFlagFileNotifier(camds_data[i].camd_file);
mc = new CMenuOptionChooser(camds_data[i].name, &camds_data[i].camd_runs, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, camds_data[i].camd_exist, flagFileNotifier, CRCInput::convertDigitToKey(camd_shortcut++)); mc = new CMenuOptionChooser(camds_data[i].name, &camds_data[i].camd_runs, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, camds_data[i].camd_exist, flagFileNotifier[i], CRCInput::convertDigitToKey(camd_shortcut++));
mc->setHint(NEUTRINO_ICON_HINT_IMAGELOGO, hint); mc->setHint(NEUTRINO_ICON_HINT_IMAGELOGO, hint);
camdControlMenu->addItem(mc); camdControlMenu->addItem(mc);
} }
int res = camdControlMenu->exec(NULL,""); int res = camdControlMenu->exec(NULL,"");
camdControlMenu->hide(); camdControlMenu->hide();
for (unsigned int i = 0; i < CAMDS_COUNT; i++)
delete flagFileNotifier[i];
delete camdControlMenu;
return res; return res;
} }

View File

@@ -220,34 +220,43 @@ CHDDInfoWidget::~CHDDInfoWidget()
} }
#define locale_itemsCount 9 typedef struct items_data_t
static const neutrino_locale_t locale_items[locale_itemsCount] =
{ {
LOCALE_HDD_INFO_MODEL_FAMILY , neutrino_locale_t locale;
LOCALE_HDD_INFO_MODEL , char value[128];
LOCALE_HDD_INFO_SERIAL , }
LOCALE_HDD_INFO_FIRMWARE , items_data_struct;
LOCALE_HDD_INFO_CAPACITY ,
LOCALE_HDD_INFO_SECTOR_SIZE , items_data_t items_data[] =
LOCALE_HDD_INFO_ROTATION_RATE , {
LOCALE_HDD_INFO_SATA_VERSION , { LOCALE_HDD_INFO_MODEL_FAMILY , "" }, // 0
LOCALE_HDD_INFO_TEMPERATURE { LOCALE_HDD_INFO_MODEL , "" }, // 1
{ LOCALE_HDD_INFO_SERIAL , "" }, // 2
{ LOCALE_HDD_INFO_FIRMWARE , "" }, // 3
{ LOCALE_HDD_INFO_CAPACITY , "" }, // 4
{ LOCALE_HDD_INFO_SECTOR_SIZE , "" }, // 5
{ LOCALE_HDD_INFO_ROTATION_RATE , "" }, // 6
{ LOCALE_HDD_INFO_SATA_VERSION , "" }, // 7
{ LOCALE_HDD_INFO_TEMPERATURE , "" } // 8
}; };
#define items_count (sizeof(items_data)/sizeof(struct items_data_t))
void CHDDInfoWidget::paint(const std::string &Key) void CHDDInfoWidget::paint(const std::string &Key)
{ {
frameBuffer = CFrameBuffer::getInstance(); frameBuffer = CFrameBuffer::getInstance();
int hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); CComponentsHeader header;
int mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); CComponentsFooter footer;
int sheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getHeight();
int offset = 20; Font *item_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU];
int bheight = offset + locale_itemsCount*mheight + offset; // body height
int fheight = sheight + offset/2; // footer height
width = frameBuffer->getScreenWidth() / 100 * 50; int header_height = header.getHeight();
height = hheight + bheight + fheight; int item_height = item_font->getHeight();
int body_height = items_count*item_height + 2*OFFSET_INNER_SMALL;
int footer_height = header.getHeight();
width = frameBuffer->getScreenWidth()/2;
height = header_height + body_height + footer_height;
x = getScreenStartX(width); x = getScreenStartX(width);
y = getScreenStartY(height); y = getScreenStartY(height);
@@ -261,42 +270,32 @@ void CHDDInfoWidget::paint(const std::string &Key)
unsigned long long mb; unsigned long long mb;
std::ostringstream buf; std::ostringstream buf;
char model_family[128] = "";
char model[128] = "";
char serial[128] = "";
char firmware[128] = "";
char capacity[128] = "";
char sector_size[128] = "";
char rotation_rate[128] = "";
char sata_version[128] = "";
char temperature[128] = "";
buf << "smartctl --all /dev/" << Key; buf << "smartctl --all /dev/" << Key;
buffer=NULL; buffer = NULL;
if((pipe_reader = popen(buf.str().c_str(), "r"))) if((pipe_reader = popen(buf.str().c_str(), "r")))
{ {
while ((read = getline(&buffer, &len, pipe_reader)) != -1) while ((read = getline(&buffer, &len, pipe_reader)) != -1)
{ {
if ((found = strstr(buffer, "Model Family:"))) if ((found = strstr(buffer, "Model Family:")))
sscanf(found+18, "%127[^\n]", (char *) &model_family); sscanf(found+18, "%127[^\n]", (char *) &items_data[0].value);
else if ((found = strstr(buffer, "Device Model:"))) else if ((found = strstr(buffer, "Device Model:")))
sscanf(found+18, "%127[^\n]", (char *) &model); sscanf(found+18, "%127[^\n]", (char *) &items_data[1].value);
else if ((found = strstr(buffer, "Serial Number:"))) else if ((found = strstr(buffer, "Serial Number:")))
sscanf(found+18, "%127[^\n]", (char *) &serial); sscanf(found+18, "%127[^\n]", (char *) &items_data[2].value);
else if ((found = strstr(buffer, "Firmware Version:"))) else if ((found = strstr(buffer, "Firmware Version:")))
sscanf(found+18, "%127[^\n]", (char *) &firmware); sscanf(found+18, "%127[^\n]", (char *) &items_data[3].value);
else if ((found = strstr(buffer, "User Capacity:"))) else if ((found = strstr(buffer, "User Capacity:")))
sscanf(found+18, "%127[^\n]", (char *) &capacity); sscanf(found+18, "%127[^\n]", (char *) &items_data[4].value);
else if ((found = strstr(buffer, "Sector Size:"))) else if ((found = strstr(buffer, "Sector Size:")))
sscanf(found+18, "%127[^\n]", (char *) &sector_size); sscanf(found+18, "%127[^\n]", (char *) &items_data[5].value);
else if ((found = strstr(buffer, "Rotation Rate:"))) else if ((found = strstr(buffer, "Rotation Rate:")))
sscanf(found+18, "%127[^\n]", (char *) &rotation_rate); sscanf(found+18, "%127[^\n]", (char *) &items_data[6].value);
else if ((found = strstr(buffer, "SATA Version is:"))) else if ((found = strstr(buffer, "SATA Version is:")))
sscanf(found+18, "%127[^\n]", (char *) &sata_version); sscanf(found+18, "%127[^\n]", (char *) &items_data[7].value);
else if ((found = strstr(buffer, "Temperature_Celsius"))) else if ((found = strstr(buffer, "Temperature_Celsius")))
sscanf(found+83, "%3[^\n]", (char *) &temperature); sscanf(found+83, "%3[^\n]", (char *) &items_data[8].value);
} }
pclose(pipe_reader); pclose(pipe_reader);
} }
@@ -307,7 +306,7 @@ void CHDDInfoWidget::paint(const std::string &Key)
free(buffer); free(buffer);
// manipulating capacity // manipulating capacity
str_capacity = capacity; str_capacity = items_data[4].value;
str_capacity.erase(std::remove(str_capacity.begin(), str_capacity.end(), ','), str_capacity.end()); str_capacity.erase(std::remove(str_capacity.begin(), str_capacity.end(), ','), str_capacity.end());
mb = strtoull(str_capacity.c_str(),NULL,0)/1000000; mb = strtoull(str_capacity.c_str(),NULL,0)/1000000;
buf.str(""); buf.str("");
@@ -318,147 +317,85 @@ void CHDDInfoWidget::paint(const std::string &Key)
else else
buf << mb/1000 << " GB"; buf << mb/1000 << " GB";
} }
snprintf(capacity, sizeof(capacity), "%s", buf.str().c_str()); snprintf(items_data[4].value, sizeof(items_data[4].value), "%s", buf.str().c_str());
// manipulating temperature // manipulating temperature
buf.str(""); buf.str("");
if (strcmp(temperature, "") != 0) if (strcmp(items_data[8].value, "") != 0)
{ {
buf << trim(temperature) << " Grad Celsius"; buf << trim(items_data[8].value) << " Grad Celsius";
snprintf(temperature, sizeof(temperature), "%s", buf.str().c_str()); snprintf(items_data[8].value, sizeof(items_data[8].value), "%s", buf.str().c_str());
} }
// calculate max width of used LOCALES // calculate max width of locales
int locwidth = 0; int w_loc = 0, w_tmp = 0;
for (int i = 0; i < locale_itemsCount; i++) { for (unsigned int i = 0; i < items_count; i++)
int w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(g_Locale->getText(locale_items[i])); {
locwidth = std::max(locwidth, w); w_tmp = item_font->getRenderWidth(g_Locale->getText(items_data[i].locale));
w_loc = std::max(w_loc, w_tmp);
} }
// calculate width of separator // calculate width of separator
std::string separator = " : "; std::string separator = ":";
int sepwidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(separator); int w_sep = item_font->getRenderWidth(separator);
// calculate max width of data // calculate max width of values
int datwidth = 0, w = 0; int w_val = 0;
w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(trim(model_family)); for (unsigned int i = 0; i < items_count; i++)
datwidth = std::max(datwidth, w); {
w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(trim(model)); if (strcmp(items_data[i].value, "") == 0)
datwidth = std::max(datwidth, w); snprintf(items_data[i].value, sizeof(items_data[i].value), "%s", g_Locale->getText(LOCALE_HDD_INFO_UNKNOWN));
w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(trim(serial)); w_tmp = item_font->getRenderWidth(trim(items_data[i].value));
datwidth = std::max(datwidth, w); w_val = std::max(w_val, w_tmp);
w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(trim(firmware)); }
datwidth = std::max(datwidth, w);
w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(trim(capacity));
datwidth = std::max(datwidth, w);
w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(trim(sector_size));
datwidth = std::max(datwidth, w);
w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(trim(rotation_rate));
datwidth = std::max(datwidth, w);
w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(trim(sata_version));
datwidth = std::max(datwidth, w);
w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(trim(temperature));
datwidth = std::max(datwidth, w);
// recalculate width and xpos // recalculate width and xpos
width = std::max(width, offset + locwidth + sepwidth + datwidth + offset); width = std::max(width, w_loc + w_sep + w_val + 4*OFFSET_INNER_MID);
if (width > (int) frameBuffer->getScreenWidth()) if (width > (int) frameBuffer->getScreenWidth())
{ {
// should only happen with very big fonts // should only happen with very big fonts
width = frameBuffer->getScreenWidth(); width = frameBuffer->getScreenWidth();
datwidth = width - offset - locwidth - sepwidth - offset; w_val = width - w_loc - w_sep - 4*OFFSET_INNER_MID;
} }
x = getScreenStartX(width); x = getScreenStartX(width);
fprintf(stderr, "CHDDInfoWidget::CHDDInfoWidget() x = %d, y = %d, width = %d, height = %d\n", x, y, width, height);
// paint backgrounds
frameBuffer->paintBoxRel(x, y, width, hheight, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP);
frameBuffer->paintBoxRel(x, y+ hheight, width, bheight, COL_MENUCONTENT_PLUS_0);
frameBuffer->paintBoxRel(x, y+ hheight+ bheight, width, fheight, COL_MENUFOOT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);
// header // header
int xpos = x + offset/2;
int ypos = y + hheight;
int icol_w = 0, icol_h = 0, icol_o = 0;
frameBuffer->getIconSize(NEUTRINO_ICON_SETTINGS, &icol_w, &icol_h);
if ( (icol_w) && (icol_h) )
{
frameBuffer->paintIcon(NEUTRINO_ICON_SETTINGS, xpos, y, hheight);
icol_o = icol_w + offset/2;
}
buf.str(""); buf.str("");
buf << g_Locale->getText(LOCALE_HDD_INFO_HEAD) << " (" << Key << ")"; buf << g_Locale->getText(LOCALE_HDD_INFO_HEAD) << " (" << Key << ")";
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(xpos + icol_o, ypos, width - offset - icol_o, buf.str(), COL_MENUHEAD_TEXT); header.setCaption(buf.str());
header.setIcon(NEUTRINO_ICON_SETTINGS);
header.setDimensionsAll(x, y, width, header_height);
header.addContextButton(CComponentsHeader::CC_BTN_EXIT);
header.enableShadow(CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT, -1, true);
header.paint(CC_SAVE_SCREEN_NO);
// locale // body
xpos = x + offset; PaintBoxRel(x, y + header_height, width, body_height, COL_MENUCONTENT_PLUS_0, RADIUS_NONE, CORNER_NONE, CC_SHADOW_ON);
ypos += offset;
for (int i = 0; i < locale_itemsCount; i++) { // footer
ypos += mheight; const struct button_label buttons[] =
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(xpos, ypos, locwidth, g_Locale->getText(locale_items[i]), COL_MENUCONTENTINACTIVE_TEXT); {
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(xpos + locwidth, ypos, sepwidth, separator, COL_MENUCONTENTINACTIVE_TEXT); { "", LOCALE_HDD_INFO_INFO }
};
footer.enableShadow(CC_SHADOW_ON, -1, true);
footer.paintButtons(x, y + header_height + body_height, width, footer_height, 1, buttons);
// paint items
int x_loc = x + OFFSET_INNER_MID;
int x_sep = x_loc + w_loc + OFFSET_INNER_MID;
int x_val = x_sep + w_sep + OFFSET_INNER_MID;
int y_item = y + header_height + OFFSET_INNER_SMALL;
for (unsigned int i = 0; i < items_count; i++)
{
y_item += item_height;
item_font->RenderString(x_loc, y_item, w_loc, g_Locale->getText(items_data[i].locale), COL_MENUCONTENTINACTIVE_TEXT);
item_font->RenderString(x_sep, y_item, w_sep, separator, COL_MENUCONTENTINACTIVE_TEXT);
item_font->RenderString(x_val, y_item, w_val, items_data[i].value, COL_MENUCONTENT_TEXT);
} }
// footer with centered content
int wtmp = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getRenderWidth(g_Locale->getText(LOCALE_HDD_INFO_INFO));
xpos = x + width/2 - wtmp/2;
ypos = y + hheight + bheight + offset/4 + sheight;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->RenderString(xpos, ypos, wtmp, g_Locale->getText(LOCALE_HDD_INFO_INFO), COL_MENUCONTENTINACTIVE_TEXT);
// finally paint data
xpos = x + offset + locwidth + sepwidth;
ypos = y + hheight + offset;
ypos += mheight;
buf.str("");
buf << model_family;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(xpos, ypos, datwidth, (!strcmp(model_family, "") ? g_Locale->getText(LOCALE_HDD_INFO_UNKNOWN) : buf.str().c_str()), COL_MENUCONTENT_TEXT);
ypos += mheight;
buf.str("");
buf << model;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(xpos, ypos, datwidth, (!strcmp(model, "") ? g_Locale->getText(LOCALE_HDD_INFO_UNKNOWN) : buf.str().c_str()), COL_MENUCONTENT_TEXT);
ypos += mheight;
buf.str("");
buf << serial;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(xpos, ypos, datwidth, (!strcmp(serial, "") ? g_Locale->getText(LOCALE_HDD_INFO_UNKNOWN) : buf.str().c_str()), COL_MENUCONTENT_TEXT);
ypos += mheight;
buf.str("");
buf << firmware;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(xpos, ypos, datwidth, (!strcmp(firmware, "") ? g_Locale->getText(LOCALE_HDD_INFO_UNKNOWN) : buf.str().c_str()), COL_MENUCONTENT_TEXT);
ypos += mheight;
buf.str("");
buf << capacity;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(xpos, ypos, datwidth, (!strcmp(capacity, "") ? g_Locale->getText(LOCALE_HDD_INFO_UNKNOWN) : buf.str().c_str()), COL_MENUCONTENT_TEXT);
ypos += mheight;
buf.str("");
buf << sector_size;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(xpos, ypos, datwidth, (!strcmp(sector_size, "") ? g_Locale->getText(LOCALE_HDD_INFO_UNKNOWN) : buf.str().c_str()), COL_MENUCONTENT_TEXT);
ypos += mheight;
buf.str("");
buf << rotation_rate;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(xpos, ypos, datwidth, (!strcmp(rotation_rate, "") ? g_Locale->getText(LOCALE_HDD_INFO_UNKNOWN) : buf.str().c_str()), COL_MENUCONTENT_TEXT);
ypos += mheight;
buf.str("");
buf << sata_version;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(xpos, ypos, datwidth, (!strcmp(sata_version, "") ? g_Locale->getText(LOCALE_HDD_INFO_UNKNOWN) : buf.str().c_str()), COL_MENUCONTENT_TEXT);
ypos += mheight;
buf.str("");
buf << temperature;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(xpos, ypos, datwidth, (!strcmp(temperature, "") ? g_Locale->getText(LOCALE_HDD_INFO_UNKNOWN) : buf.str().c_str()), COL_MENUCONTENT_TEXT);
} }
void CHDDInfoWidget::hide() void CHDDInfoWidget::hide()
{ {
frameBuffer->paintBackgroundBoxRel(x, y, width, height); frameBuffer->paintBackgroundBoxRel(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW);
} }

View File

@@ -795,12 +795,14 @@ _show_menu:
} }
//NI //NI
int fake_hddpower = 0;
CTouchFileNotifier * hddpowerNotifier = NULL;
hddmenu->addItem(new CMenuSeparator()); hddmenu->addItem(new CMenuSeparator());
if (cs_get_revision() < 8) { if (cs_get_revision() < 8) {
//NI HDD power (HD1/BSE only) //NI HDD power (HD1/BSE only)
const char *flag_hddpower = FLAGDIR "/.hddpower"; const char *flag_hddpower = FLAGDIR "/.hddpower";
int fake_hddpower = file_exists(flag_hddpower); fake_hddpower = file_exists(flag_hddpower);
CTouchFileNotifier * hddpowerNotifier = new CTouchFileNotifier(flag_hddpower); hddpowerNotifier = new CTouchFileNotifier(flag_hddpower);
mc = new CMenuOptionChooser(LOCALE_HDD_POWER, &fake_hddpower, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, hddpowerNotifier, CRCInput::RC_yellow); mc = new CMenuOptionChooser(LOCALE_HDD_POWER, &fake_hddpower, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, hddpowerNotifier, CRCInput::RC_yellow);
mc->setHint(NEUTRINO_ICON_HINT_IMAGELOGO, LOCALE_MENU_HINT_HDD_POWER); mc->setHint(NEUTRINO_ICON_HINT_IMAGELOGO, LOCALE_MENU_HINT_HDD_POWER);
hddmenu->addItem(mc); hddmenu->addItem(mc);
@@ -873,7 +875,8 @@ _show_menu:
} }
int ret = hddmenu->exec(NULL, ""); int ret = hddmenu->exec(NULL, "");
if (hddpowerNotifier)
delete hddpowerNotifier;
delete hddmenu; delete hddmenu;
hdd_list.clear(); hdd_list.clear();
devtitle.clear(); devtitle.clear();

View File

@@ -210,6 +210,8 @@ int CInfoIconsSetup::menu()
infoiconsMenu->hide(); infoiconsMenu->hide();
delete infoiconsMenu; delete infoiconsMenu;
delete delFlagMenu; delete delFlagMenu;
for (int i = 0 ; i < MODE_ICONS_NR_OF_ENTRIES; i++)
delete flagchooser[i];
delete flagMenu; delete flagMenu;
return res; return res;
} }

View File

@@ -166,6 +166,8 @@ int CLCD4lSetup::show()
int res = lcd4lSetup->exec(NULL, ""); int res = lcd4lSetup->exec(NULL, "");
lcd4lSetup->hide(); lcd4lSetup->hide();
delete lcd_clock_a;
delete lcd_weather;
delete lcd4lSetup; delete lcd4lSetup;
// the things to do on exit // the things to do on exit

View File

@@ -1335,7 +1335,10 @@ void CMenuWidget::setMenuPos(const int& menu_width)
int scr_y = frameBuffer->getScreenY(); int scr_y = frameBuffer->getScreenY();
int scr_w = frameBuffer->getScreenWidth(); int scr_w = frameBuffer->getScreenWidth();
int scr_h = frameBuffer->getScreenHeight(); int scr_h = frameBuffer->getScreenHeight();
int real_h = full_height + OFFSET_INTER + hint_height + OFFSET_SHADOW; // full_height includes footer_height : see calcSize int hint_h = 0;
if (hint_height)
hint_h = OFFSET_INTER + hint_height + OFFSET_SHADOW;
int real_h = full_height + hint_h; // full_height includes footer_height : see calcSize
int x_old = x; int x_old = x;
int y_old = y; int y_old = y;
//configured positions //configured positions
@@ -1455,20 +1458,23 @@ void CMenuWidget::saveScreen()
return; return;
delete[] background; delete[] background;
saveScreen_height = full_height + OFFSET_INTER + hint_height + OFFSET_SHADOW; // full_height includes footer_height : see calcSize int hint_h = 0;
if (hint_height)
hint_h = OFFSET_INTER + hint_height + OFFSET_SHADOW;
saveScreen_height = full_height + hint_h; // full_height includes footer_height : see calcSize
saveScreen_width = full_width; saveScreen_width = full_width;
saveScreen_y = y; saveScreen_y = y;
saveScreen_x = x; saveScreen_x = x;
background = new fb_pixel_t [saveScreen_height * saveScreen_width]; background = new fb_pixel_t [saveScreen_height * saveScreen_width];
if(background) if(background)
frameBuffer->SaveScreen(saveScreen_x /*-DETAILSLINE_WIDTH*/, saveScreen_y, saveScreen_width, saveScreen_height, background); frameBuffer->SaveScreen(saveScreen_x, saveScreen_y, saveScreen_width, saveScreen_height, background);
} }
void CMenuWidget::restoreScreen() void CMenuWidget::restoreScreen()
{ {
if(background) { if(background) {
if(savescreen) if(savescreen)
frameBuffer->RestoreScreen(saveScreen_x /*-DETAILSLINE_WIDTH*/, saveScreen_y, saveScreen_width, saveScreen_height, background); frameBuffer->RestoreScreen(saveScreen_x, saveScreen_y, saveScreen_width, saveScreen_height, background);
} }
} }