CChannelList: revert of some implementations of CComponents classes

Current state of CChannelList is mostly not compatible with CC-classes and
implementations are to expensive at the moment, because more preparations are necessary.


Origin commit data
------------------
Branch: ni/coolstream
Commit: ce2e95cc5a
Author: Thilo Graf <dbt@novatux.de>
Date: 2013-02-18 (Mon, 18 Feb 2013)

Origin message was:
------------------
CChannelList: revert of some implementations of CComponents classes

Current state of CChannelList is mostly not compatible with CC-classes and
implementations are to expensive at the moment, because more preparations are necessary.


------------------
This commit was generated by Migit
This commit is contained in:
2013-02-18 08:55:50 +01:00
parent f9d8a289d5
commit 19ce4c4d7c
2 changed files with 99 additions and 88 deletions

View File

@@ -116,10 +116,6 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl
previous_channellist_additional = -1; previous_channellist_additional = -1;
eventFont = SNeutrinoSettings::FONT_TYPE_CHANNELLIST_EVENT; eventFont = SNeutrinoSettings::FONT_TYPE_CHANNELLIST_EVENT;
dline = NULL; dline = NULL;
ibox = NULL;
clHead = NULL;
indexLogo = 0;
//printf("************ NEW LIST %s : %x\n", name.c_str(), (int) this);fflush(stdout); //printf("************ NEW LIST %s : %x\n", name.c_str(), (int) this);fflush(stdout);
} }
@@ -128,8 +124,6 @@ CChannelList::~CChannelList()
//printf("************ DELETE LIST %s : %x\n", name.c_str(), this);fflush(stdout); //printf("************ DELETE LIST %s : %x\n", name.c_str(), this);fflush(stdout);
chanlist.clear(); chanlist.clear();
delete dline; delete dline;
delete ibox;
delete clHead;
} }
void CChannelList::ClearList(void) void CChannelList::ClearList(void)
@@ -1515,20 +1509,6 @@ void CChannelList::quickZap(int key, bool /* cycle */)
g_RCInput->clearRCMsg(); //FIXME test for n.103 g_RCInput->clearRCMsg(); //FIXME test for n.103
} }
std::string CChannelList::getInfoTextTransponder(int index)
{
transponder t;
CServiceManager::getInstance()->GetTransponder(chanlist[index]->getTransponderId(), t);
std::string desc = t.description();
if(chanlist[index]->pname)
desc = desc + " (" + std::string(chanlist[index]->pname) + ")";
else
desc = desc + " (" + CServiceManager::getInstance()->GetSatelliteName(chanlist[index]->getSatellitePosition()) + ")";
return desc;
}
void CChannelList::paintDetails(int index) void CChannelList::paintDetails(int index)
{ {
CChannelEvent *p_event = NULL; CChannelEvent *p_event = NULL;
@@ -1541,14 +1521,13 @@ void CChannelList::paintDetails(int index)
if (g_settings.colored_events_channellist == 2) if (g_settings.colored_events_channellist == 2)
colored_event_N = true; colored_event_N = true;
if (displayNext) if (displayNext) {
p_event = &chanlist[index]->nextEvent; p_event = &chanlist[index]->nextEvent;
else } else {
p_event = &chanlist[index]->currentEvent; p_event = &chanlist[index]->currentEvent;
}
//infobox frameBuffer->paintBoxRel(x+2, y + height + 2, full_width-4, info_height - 4, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE);//round
if (ibox)
ibox->paint(false);
if (!p_event->description.empty()) { if (!p_event->description.empty()) {
char cNoch[50] = {0}; // UTF-8 char cNoch[50] = {0}; // UTF-8
@@ -1615,8 +1594,16 @@ void CChannelList::paintDetails(int index)
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- noch_len, y+ height+ 5+ 2* fheight, noch_len, cNoch, colored_event_C ? COL_COLORED_EVENTS_CHANNELLIST : COL_MENUCONTENTDARK, 0, true); // UTF-8 g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- noch_len, y+ height+ 5+ 2* fheight, noch_len, cNoch, colored_event_C ? COL_COLORED_EVENTS_CHANNELLIST : COL_MENUCONTENTDARK, 0, true); // UTF-8
} }
if(g_settings.channellist_foot == 0) { if(g_settings.channellist_foot == 0) {
std::string transp_info = getInfoTextTransponder(index); transponder t;
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 3*fheight, width - 30, transp_info.c_str(), COL_MENUCONTENTDARK, 0, true); CServiceManager::getInstance()->GetTransponder(chanlist[index]->getTransponderId(), t);
std::string desc = t.description();
if(chanlist[index]->pname)
desc = desc + " (" + std::string(chanlist[index]->pname) + ")";
else
desc = desc + " (" + CServiceManager::getInstance()->GetSatelliteName(chanlist[index]->getSatellitePosition()) + ")";
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 3*fheight, full_width - 30, desc.c_str(), COL_MENUCONTENTDARK, 0, true);
} }
else if( !displayNext && g_settings.channellist_foot == 1) { // next Event else if( !displayNext && g_settings.channellist_foot == 1) { // next Event
char buf[128] = {0}; char buf[128] = {0};
@@ -1639,40 +1626,52 @@ void CChannelList::paintDetails(int index)
void CChannelList::clearItem2DetailsLine() void CChannelList::clearItem2DetailsLine()
{ {
if (dline) paintItem2DetailsLine (-1, 0);
dline->kill(); //kill details line
} }
void CChannelList::paintItem2DetailsLine (int pos) void CChannelList::paintItem2DetailsLine (int pos)
{ {
int xpos = x - ConnectLineBox_Width; int xpos = x - ConnectLineBox_Width;
int ypos1 = y + theight+0 + pos*fheight; int ypos1 = y + theight+0 + pos*fheight;
int ypos2 = y + height + INFO_BOX_Y_OFFSET; int ypos2 = y + height;
int ypos1a = ypos1 + (fheight/2)-2; int ypos1a = ypos1 + (fheight/2)-2;
int ypos2a = ypos2 + (info_height/2)-2; int ypos2a = ypos2 + (info_height/2)-2;
fb_pixel_t col1 = COL_MENUCONTENT_PLUS_6;
if (dline) if (dline)
dline->kill(); //kill details line dline->kill(); //kill details line
// // Clear
// frameBuffer->paintBackgroundBoxRel(xpos,y, ConnectLineBox_Width, height+info_height + 1);
// init Line if detail info (and not valid list pos) // paint Line if detail info (and not valid list pos)
if (pos >= 0) { //pos >= 0 && chanlist[ch_index]->currentEvent.description != "") { if (pos >= 0) { //pos >= 0 && chanlist[ch_index]->currentEvent.description != "") {
if(1) // FIXME why -> ? (!g_settings.channellist_extended) if(1) // FIXME why -> ? (!g_settings.channellist_extended)
{ {
//details line
if (dline == NULL) if (dline == NULL)
dline = new CComponentsDetailLine(xpos, ypos1a, ypos2a, fheight/2+1, info_height-RADIUS_LARGE*2); dline = new CComponentsDetailLine(xpos, ypos1a, ypos2a, fheight/2+1, info_height-RADIUS_LARGE*2);
dline->setYPos(ypos1a); dline->setYPos(ypos1a);
dline->setHMarkDown(info_height-RADIUS_LARGE*2); //required if user has changed osd-settings (corner mode)
dline->paint(); dline->paint();
//info box frame
frameBuffer->paintBoxFrame(x, ypos2, full_width, info_height, 2, col1, RADIUS_LARGE);
}
}
} }
//infobox void CChannelList::showChannelLogo()
if (ibox == NULL) {
ibox = new CComponentsInfoBox(x, y + height + 2, width, info_height); if(g_settings.infobar_show_channellogo){
if (ibox){ static int logo_w = 0;
ibox->setDimensionsAll(x, ypos2, full_width, info_height); static int logo_h = 0;
ibox->setFrameThickness(2); int logo_w_max = full_width / 4;
ibox->setCornerRadius(RADIUS_LARGE); frameBuffer->paintBoxRel(x + full_width - logo_off - logo_w, y+(theight-logo_h)/2, logo_w, logo_h, COL_MENUHEAD_PLUS_0);
ibox->setShadowOnOff(CC_SHADOW_OFF);
ibox->syncSysColors(); std::string lname;
if(g_PicViewer->GetLogoName(chanlist[selected]->channel_id, chanlist[selected]->getName(), lname, &logo_w, &logo_h)) {
if((logo_h > theight) || (logo_w > logo_w_max))
g_PicViewer->rescaleImageDimensions(&logo_w, &logo_h, logo_w_max, theight);
g_PicViewer->DisplayImage(lname, x + full_width - logo_off - logo_w, y+(theight-logo_h)/2, logo_w, logo_h);
} }
} }
} }
@@ -1994,31 +1993,46 @@ void CChannelList::paintItem(int pos)
void CChannelList::paintHead() void CChannelList::paintHead()
{ {
if (clHead == NULL) { int timestr_len = 0;
clHead = new CComponentsTitleBar(); char timestr[10] = {0};
clHead->setDimensionsAll(x, y, full_width, theight); time_t now = time(NULL);
struct tm *tm = localtime(&now);
clHead->addText(name); bool gotTime = g_Sectionsd->getIsTimeSet();
clHead->addIcon(NEUTRINO_ICON_BUTTON_INFO, CC_ALIGN_RIGHT); if(gotTime) {
clHead->addIcon(NEUTRINO_ICON_BUTTON_MENU, CC_ALIGN_RIGHT); strftime(timestr, 10, "%H:%M", tm);
if (g_settings.channellist_new_zap_mode) timestr_len = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(timestr, true); // UTF-8
clHead->addIcon(this->new_mode_active ? NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE : NEUTRINO_ICON_BUTTON_MUTE_ZAP_INACTIVE, CC_ALIGN_RIGHT);
clHead->addClock();
clHead->addPicture("", CC_ALIGN_RIGHT, &indexLogo);
}
clHead->paint();
} }
void CChannelList::showChannelLogo() int iw1, iw2, iw3, ih = 0;
{ frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_INFO, &iw1, &ih);
if(g_settings.infobar_show_channellogo){ frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_MENU, &iw2, &ih);
std::string lname = ""; if (new_zap_mode)
int dummy; frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE, &iw3, &ih);
g_PicViewer->GetLogoName(chanlist[selected]->channel_id, chanlist[selected]->getName(), lname, &dummy, &dummy);
clHead->refreshElement(indexLogo, lname); // head
clHead->paintElement(indexLogo, true); frameBuffer->paintBoxRel(x,y, full_width,theight+0, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP);//round
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_INFO, x + full_width - iw1 - 10, y, theight); //y+ 5 );
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_MENU, x + full_width - iw1 - iw2 - 14, y, theight);//y + 5); // icon for bouquet list button
if (new_zap_mode)
frameBuffer->paintIcon((new_zap_mode == 2 /* active */) ?
NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE : NEUTRINO_ICON_BUTTON_MUTE_ZAP_INACTIVE,
x + full_width - iw1 - iw2 - iw3 - 18, y, theight);
if (gotTime) {
int iw3x = (new_zap_mode) ? iw3 : -10;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(x + full_width - iw1 - iw2 - iw3x - 28 -timestr_len,
y+theight, timestr_len, timestr, COL_MENUHEAD, 0, true); // UTF-8
timestr_len += 4;
} }
timestr_len += iw1 + iw2 + 12;
if (new_zap_mode)
timestr_len += iw3 + 10;
logo_off = timestr_len + 10;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(x+10,y+theight+0, full_width - timestr_len, name, COL_MENUHEAD, 0, true); // UTF-8
} }
void CChannelList::paint() void CChannelList::paint()

View File

@@ -35,6 +35,7 @@
#include <driver/framebuffer.h> #include <driver/framebuffer.h>
#include <gui/widget/menue.h> #include <gui/widget/menue.h>
#include <gui/widget/components.h>
#include <system/lastchannel.h> #include <system/lastchannel.h>
#include <sectionsdclient/sectionsdclient.h> #include <sectionsdclient/sectionsdclient.h>
@@ -74,6 +75,7 @@ private:
std::string name; std::string name;
ZapitChannelList chanlist; ZapitChannelList chanlist;
CZapProtection* zapProtection; CZapProtection* zapProtection;
CComponentsDetailLine *dline;
int full_width; int full_width;
int width; int width;
@@ -95,10 +97,6 @@ private:
int info_height; int info_height;
int ChannelList_Rec; int ChannelList_Rec;
CComponentsDetailLine *dline;
CComponentsInfoBox *ibox;
CComponentsTitleBar* clHead;
size_t indexLogo;
void paintDetails(int index); void paintDetails(int index);
void clearItem2DetailsLine (); void clearItem2DetailsLine ();
@@ -112,7 +110,6 @@ private:
void showChannelLogo(); void showChannelLogo();
void calcSize(); void calcSize();
std::string MaxChanNr(); std::string MaxChanNr();
std::string getInfoTextTransponder(int index);
void paint_pig(int x, int y, int w, int h); void paint_pig(int x, int y, int w, int h);
void paint_events(int index); void paint_events(int index);
CChannelEventList evtlist; CChannelEventList evtlist;