- bouqueteditor: add satellite/transponder info for easier userhandling (patch by FlatTV)

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1860 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
striper
2011-11-17 16:58:39 +00:00
parent 09dcd12b93
commit 452c164d50
4 changed files with 219 additions and 22 deletions

View File

@@ -52,25 +52,24 @@ extern CBouquetManager *g_bouquetManager;
CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, unsigned int Bouquet, CZapitClient::channelsMode Mode)
:CListBox(Caption.c_str())
{
int icol_w, icol_h, fh;
int icol_w, icol_h;
bouquet = Bouquet;
mode = Mode;
ButtonHeight = 25;
iconoffset = 0;
theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight();
footerHeight= g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+6;
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_GREEN, &icol_w, &icol_h);
iheight = std::max(fheight, icol_h+2);
iconoffset = std::max(iconoffset, icol_w);
fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight();
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_OKAY, &icol_w, &icol_h);
ButtonHeight = std::max(fh, icol_h+4);
ButtonHeight = std::max(footerHeight, icol_h+4);
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_HOME, &icol_w, &icol_h);
ButtonHeight = std::max(ButtonHeight, icol_h+4);
ButtonHeight = std::max(footerHeight, icol_h+4);
liststart = 0;
}
@@ -105,6 +104,13 @@ void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselec
{
color = COL_MENUCONTENTSELECTED;
bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
frameBuffer->paintBoxRel(x+2, y + height + 2, width-4, info_height - 4, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE);
if(itemNr < getItemCount()) {
paintItem2DetailsLine (paintNr, itemNr);
paintDetails(itemNr);
}
frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0);
frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, RADIUS_LARGE);
}
@@ -150,14 +156,14 @@ void CBEChannelSelectWidget::onOkKeyPressed()
int CBEChannelSelectWidget::exec(CMenuTarget* parent, const std::string & actionKey)
{
int fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth();
int fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight();
width = w_max (64 * fw, 20);
height = h_max (20 * fh, 50);
width = w_max ((frameBuffer->getScreenWidth() / 20 * (fw+6)), 100);
height = h_max ((frameBuffer->getScreenHeight() / 20 * 17), (frameBuffer->getScreenHeight() / 20 * 2));
listmaxshow = (height-theight-footerHeight-0)/iheight;
height = theight+footerHeight+listmaxshow*iheight; // recalc height
info_height = 2*iheight + 10;
listmaxshow = (height-theight-0)/iheight;
height = theight+0+listmaxshow*iheight; // recalc height
x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2;
y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - height) / 2;
y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - (height + info_height)) / 2;
bouquetChannels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels);
@@ -180,8 +186,7 @@ const struct button_label CBEChannelSelectButtons[] =
void CBEChannelSelectWidget::paintFoot()
{
int _ButtonHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8;
::paintButtons(x, y+height, width, 2, CBEChannelSelectButtons, _ButtonHeight);
::paintButtons(x, y + (height-footerHeight), width, 2, CBEChannelSelectButtons, footerHeight);
#if 0
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_OKAY, x+width- 3* ButtonWidth+ 8, y+height+1);
@@ -191,3 +196,84 @@ void CBEChannelSelectWidget::paintFoot()
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(x+width - ButtonWidth+ 38, y+height+24 - 2, width, g_Locale->getText(LOCALE_BOUQUETEDITOR_RETURN), COL_INFOBAR, 0, true); // UTF-8
#endif
}
void CBEChannelSelectWidget::paintDetails(int index)
{
char buf[128] = {0};
int len = 0;
transponder_id_t ct = Channels[index]->getTransponderId();
transponder_list_t::iterator tpI = transponders.find(ct);
sat_iterator_t sit = satellitePositions.find(Channels[index]->getSatellitePosition());
len = snprintf(buf, sizeof(buf), "%d ", Channels[index]->getFreqId());
if(tpI != transponders.end()) {
char * f, *s, *m;
switch(CFrontend::getInstance()->getInfo()->type)
{
case FE_QPSK:
CFrontend::getInstance()->getDelSys(tpI->second.feparams.u.qpsk.fec_inner, dvbs_get_modulation(tpI->second.feparams.u.qpsk.fec_inner), f, s, m);
len += snprintf(&buf[len], sizeof(buf) - len, "%c %d %s %s %s ", tpI->second.polarization ? 'V' : 'H', tpI->second.feparams.u.qpsk.symbol_rate/1000, f, s, m);
break;
case FE_QAM:
CFrontend::getInstance()->getDelSys(tpI->second.feparams.u.qam.fec_inner, tpI->second.feparams.u.qam.modulation, f, s, m);
len += snprintf(&buf[len], sizeof(buf) - len, "%d %s %s %s ", tpI->second.feparams.u.qam.symbol_rate/1000, f, s, m);
break;
case FE_OFDM:
case FE_ATSC:
break;
}
}
if(Channels[index]->pname) {
snprintf(&buf[len], sizeof(buf) - len, "(%s)", Channels[index]->pname);
}
else {
if(sit != satellitePositions.end()) {
snprintf(&buf[len], sizeof(buf) - len, "(%s)", sit->second.name.c_str());
}
}
if(sit != satellitePositions.end()) {
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ fheight, width - 30, sit->second.name.c_str(), COL_MENUCONTENTDARK, 0, true);
}
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2*fheight, width - 30, buf, COL_MENUCONTENTDARK, 0, true);
}
void CBEChannelSelectWidget::paintItem2DetailsLine (int pos, int /*ch_index*/)
{
#define ConnectLineBox_Width 16
int xpos = x - ConnectLineBox_Width;
int ypos1 = y + theight+0 + pos*fheight;
int ypos2 = y + height;
int ypos1a = ypos1 + (fheight/2)-2;
int ypos2a = ypos2 + (info_height/2)-2;
fb_pixel_t col1 = COL_MENUCONTENT_PLUS_6;
fb_pixel_t col2 = COL_MENUCONTENT_PLUS_1;
// Clear
frameBuffer->paintBackgroundBoxRel(xpos,y, ConnectLineBox_Width, height+info_height);
// paint Line if detail info (and not valid list pos)
if (pos >= 0)
{
int fh = fheight > 10 ? fheight - 10: 5;
frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-4, ypos1+5, 4, fh, col1);
frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-4, ypos1+5, 1, fh, col2);
frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-4, ypos2+7, 4,info_height-14, col1);
frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-4, ypos2+7, 1,info_height-14, col2);
frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-16, ypos1a, 4,ypos2a-ypos1a, col1);
frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-16, ypos1a, 1,ypos2a-ypos1a+4, col2);
frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-16, ypos1a, 12,4, col1);
frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-16, ypos1a, 12,1, col2);
frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-16, ypos2a, 12,4, col1);
frameBuffer->paintBoxRel(xpos+ConnectLineBox_Width-12, ypos2a, 8,1, col2);
frameBuffer->paintBoxFrame(x, ypos2, width, info_height, 2, col1, RADIUS_LARGE);
}
}