From 355e5d769e5536e8883b13e02201bcdb4216841a Mon Sep 17 00:00:00 2001 From: gixxpunk Date: Thu, 17 Nov 2011 16:58:39 +0000 Subject: [PATCH] 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 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/452c164d50c3197bcb264cfb993def5ff95b62be Author: gixxpunk Date: 2011-11-17 (Thu, 17 Nov 2011) Origin message was: ------------------ - 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 was generated by Migit --- src/gui/bedit/bouqueteditor_channels.cpp | 119 +++++++++++++++++++-- src/gui/bedit/bouqueteditor_channels.h | 5 + src/gui/bedit/bouqueteditor_chanselect.cpp | 112 ++++++++++++++++--- src/gui/bedit/bouqueteditor_chanselect.h | 5 + 4 files changed, 219 insertions(+), 22 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 0b1e10a9c..9c9452fdf 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -48,6 +48,9 @@ #include #include +#include +#include + #include extern CBouquetManager *g_bouquetManager; @@ -56,11 +59,11 @@ CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bou int icol_w, icol_h; frameBuffer = CFrameBuffer::getInstance(); selected = 0; - ButtonHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8; 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_YELLOW, &icol_w, &icol_h); iheight = std::max(fheight, icol_h+2); @@ -84,6 +87,15 @@ void CBEChannelWidget::paintItem(int pos) if(current == selected) { color = COL_MENUCONTENTSELECTED; bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; + + // clear details + frameBuffer->paintBoxRel(x+2, y + height + 2, width-4, info_height - 4, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE); + + if(current < Channels->size()) { + paintItem2DetailsLine (pos, current); + paintDetails(current); + } + frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, RADIUS_LARGE); } else { @@ -155,12 +167,100 @@ const struct button_label CBEChannelWidgetButtons[4] = void CBEChannelWidget::paintFoot() { - ::paintButtons(x, y+height, width, 4, CBEChannelWidgetButtons, ButtonHeight); + ::paintButtons(x, y + (height-footerHeight), width, 4, CBEChannelWidgetButtons, footerHeight); +} + +void CBEChannelWidget::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 CBEChannelWidget::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); + } +} + +void CBEChannelWidget::clearItem2DetailsLine () +{ + paintItem2DetailsLine (-1, 0); } void CBEChannelWidget::hide() { - frameBuffer->paintBackgroundBoxRel(x,y, width,height+ButtonHeight); + frameBuffer->paintBackgroundBoxRel(x,y, width,height+footerHeight+info_height); + clearItem2DetailsLine (); } int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*/) @@ -174,13 +274,14 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* parent->hide(); 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); - listmaxshow = (height-theight-0)/iheight; - height = theight+0+listmaxshow*iheight; // recalc height + 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; + x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; - y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - height) / 2; + y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - (height + info_height)) / 2; Channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels); paintHead(); diff --git a/src/gui/bedit/bouqueteditor_channels.h b/src/gui/bedit/bouqueteditor_channels.h index 93e577cc4..a826fb324 100644 --- a/src/gui/bedit/bouqueteditor_channels.h +++ b/src/gui/bedit/bouqueteditor_channels.h @@ -66,6 +66,8 @@ class CBEChannelWidget : public CMenuWidget int theight; int iconoffset; int iheight; // item height + int footerHeight; + int info_height; int ButtonHeight; std::string caption; @@ -81,6 +83,9 @@ class CBEChannelWidget : public CMenuWidget int y; void paintItem(int pos); + void paintDetails(int index); + void paintItem2DetailsLine (int pos, int ch_index); + void clearItem2DetailsLine (); void paint(); void paintHead(); void paintFoot(); diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 93cfa6120..7f0bad20f 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -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); + } +} diff --git a/src/gui/bedit/bouqueteditor_chanselect.h b/src/gui/bedit/bouqueteditor_chanselect.h index fa1f11098..299b89c1a 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.h +++ b/src/gui/bedit/bouqueteditor_chanselect.h @@ -51,9 +51,14 @@ class CBEChannelSelectWidget : public CListBox uint getItemCount(); void paintItem(uint32_t itemNr, int paintNr, bool selected); + void paintDetails(int index); + void paintItem2DetailsLine (int pos, int ch_index); void paintFoot(); void onOkKeyPressed(); + int footerHeight; + int info_height; + public: //CZapitClient::BouquetChannelList Channels; // list of all channels //CZapitClient::BouquetChannelList bouquetChannels; // list of chans that are currently selected