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: 452c164d50
Author: gixxpunk <thomas.harfmann@gmail.com>
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
This commit is contained in:
gixxpunk
2011-11-17 16:58:39 +00:00
parent dd9656cd6d
commit 355e5d769e
4 changed files with 219 additions and 22 deletions

View File

@@ -48,6 +48,9 @@
#include <gui/widget/buttons.h> #include <gui/widget/buttons.h>
#include <gui/widget/icons.h> #include <gui/widget/icons.h>
#include <zapit/getservices.h>
#include <zapit/frontend_c.h>
#include <zapit/client/zapitclient.h> #include <zapit/client/zapitclient.h>
extern CBouquetManager *g_bouquetManager; extern CBouquetManager *g_bouquetManager;
@@ -56,11 +59,11 @@ CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bou
int icol_w, icol_h; int icol_w, icol_h;
frameBuffer = CFrameBuffer::getInstance(); frameBuffer = CFrameBuffer::getInstance();
selected = 0; selected = 0;
ButtonHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8;
iconoffset = 0; iconoffset = 0;
theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->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); frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_YELLOW, &icol_w, &icol_h);
iheight = std::max(fheight, icol_h+2); iheight = std::max(fheight, icol_h+2);
@@ -84,6 +87,15 @@ void CBEChannelWidget::paintItem(int pos)
if(current == selected) { if(current == selected) {
color = COL_MENUCONTENTSELECTED; color = COL_MENUCONTENTSELECTED;
bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; 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, COL_MENUCONTENT_PLUS_0);
frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, RADIUS_LARGE); frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, RADIUS_LARGE);
} else { } else {
@@ -155,12 +167,100 @@ const struct button_label CBEChannelWidgetButtons[4] =
void CBEChannelWidget::paintFoot() 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() 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*/) int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*/)
@@ -174,13 +274,14 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
parent->hide(); parent->hide();
int fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth(); int fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth();
int fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); width = w_max ((frameBuffer->getScreenWidth() / 20 * (fw+6)), 100);
width = w_max (64 * fw, 20); height = h_max ((frameBuffer->getScreenHeight() / 20 * 17), (frameBuffer->getScreenHeight() / 20 * 2));
height = h_max (20 * fh, 50); listmaxshow = (height-theight-footerHeight-0)/iheight;
listmaxshow = (height-theight-0)/iheight; height = theight+footerHeight+listmaxshow*iheight; // recalc height
height = theight+0+listmaxshow*iheight; // recalc height info_height = 2*iheight + 10;
x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; 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); Channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels);
paintHead(); paintHead();

View File

@@ -66,6 +66,8 @@ class CBEChannelWidget : public CMenuWidget
int theight; int theight;
int iconoffset; int iconoffset;
int iheight; // item height int iheight; // item height
int footerHeight;
int info_height;
int ButtonHeight; int ButtonHeight;
std::string caption; std::string caption;
@@ -81,6 +83,9 @@ class CBEChannelWidget : public CMenuWidget
int y; int y;
void paintItem(int pos); void paintItem(int pos);
void paintDetails(int index);
void paintItem2DetailsLine (int pos, int ch_index);
void clearItem2DetailsLine ();
void paint(); void paint();
void paintHead(); void paintHead();
void paintFoot(); void paintFoot();

View File

@@ -52,25 +52,24 @@ extern CBouquetManager *g_bouquetManager;
CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, unsigned int Bouquet, CZapitClient::channelsMode Mode) CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, unsigned int Bouquet, CZapitClient::channelsMode Mode)
:CListBox(Caption.c_str()) :CListBox(Caption.c_str())
{ {
int icol_w, icol_h, fh; int icol_w, icol_h;
bouquet = Bouquet; bouquet = Bouquet;
mode = Mode; mode = Mode;
ButtonHeight = 25;
iconoffset = 0; iconoffset = 0;
theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->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); frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_GREEN, &icol_w, &icol_h);
iheight = std::max(fheight, icol_h+2); iheight = std::max(fheight, icol_h+2);
iconoffset = std::max(iconoffset, icol_w); 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); 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); 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; liststart = 0;
} }
@@ -105,6 +104,13 @@ void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselec
{ {
color = COL_MENUCONTENTSELECTED; color = COL_MENUCONTENTSELECTED;
bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; 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, COL_MENUCONTENT_PLUS_0);
frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, RADIUS_LARGE); 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 CBEChannelSelectWidget::exec(CMenuTarget* parent, const std::string & actionKey)
{ {
int fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth(); int fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth();
int fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); width = w_max ((frameBuffer->getScreenWidth() / 20 * (fw+6)), 100);
width = w_max (64 * fw, 20); height = h_max ((frameBuffer->getScreenHeight() / 20 * 17), (frameBuffer->getScreenHeight() / 20 * 2));
height = h_max (20 * fh, 50); 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; 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); 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() void CBEChannelSelectWidget::paintFoot()
{ {
int _ButtonHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8; ::paintButtons(x, y + (height-footerHeight), width, 2, CBEChannelSelectButtons, footerHeight);
::paintButtons(x, y+height, width, 2, CBEChannelSelectButtons, _ButtonHeight);
#if 0 #if 0
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_OKAY, x+width- 3* ButtonWidth+ 8, y+height+1); 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 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 #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);
}
}

View File

@@ -51,9 +51,14 @@ class CBEChannelSelectWidget : public CListBox
uint getItemCount(); uint getItemCount();
void paintItem(uint32_t itemNr, int paintNr, bool selected); void paintItem(uint32_t itemNr, int paintNr, bool selected);
void paintDetails(int index);
void paintItem2DetailsLine (int pos, int ch_index);
void paintFoot(); void paintFoot();
void onOkKeyPressed(); void onOkKeyPressed();
int footerHeight;
int info_height;
public: public:
//CZapitClient::BouquetChannelList Channels; // list of all channels //CZapitClient::BouquetChannelList Channels; // list of all channels
//CZapitClient::BouquetChannelList bouquetChannels; // list of chans that are currently selected //CZapitClient::BouquetChannelList bouquetChannels; // list of chans that are currently selected