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 is contained in:
2013-02-18 08:55:50 +01:00
parent 399eb696d6
commit ce2e95cc5a
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)
@@ -626,9 +620,9 @@ int CChannelList::show()
} else } else
loop=false; loop=false;
} }
else if( msg == CRCInput::RC_record) { //start direct recording from channellist else if( msg == CRCInput::RC_record) { //start direct recording from channellist
#if 0 #if 0
if(!CRecordManager::getInstance()->RecordingStatus(chanlist[selected]->channel_id)) if(!CRecordManager::getInstance()->RecordingStatus(chanlist[selected]->channel_id))
{ {
printf("[neutrino channellist] start direct recording...\n"); printf("[neutrino channellist] start direct recording...\n");
hide(); hide();
@@ -640,10 +634,10 @@ int CChannelList::show()
loop=false; loop=false;
} }
else else
DisplayInfoMessage(g_Locale->getText(LOCALE_CHANNELLIST_RECORDING_NOT_POSSIBLE)); // UTF-8 DisplayInfoMessage(g_Locale->getText(LOCALE_CHANNELLIST_RECORDING_NOT_POSSIBLE)); // UTF-8
} }
} }
#endif #endif
if(SameTP()) { if(SameTP()) {
printf("[neutrino channellist] start direct recording...\n"); printf("[neutrino channellist] start direct recording...\n");
@@ -653,7 +647,7 @@ int CChannelList::show()
paint(); paint();
} else } else
loop=false; loop=false;
} }
} }
else if( msg == CRCInput::RC_stop ) { //stopp recording else if( msg == CRCInput::RC_stop ) { //stopp recording
@@ -809,7 +803,7 @@ int CChannelList::show()
zapOnExit = true; zapOnExit = true;
loop = false; loop = false;
} }
else if(g_settings.sms_channel) { else if(g_settings.sms_channel) {
unsigned char smsKey = 0; unsigned char smsKey = 0;
SMSKeyInput smsInput; SMSKeyInput smsInput;
smsInput.setTimeout(CHANNEL_SMSKEY_TIMEOUT); smsInput.setTimeout(CHANNEL_SMSKEY_TIMEOUT);
@@ -1408,7 +1402,7 @@ CZapitChannel* CChannelList::getPrevNextChannel(int key, unsigned int &sl)
bactive--; bactive--;
bouquetList->activateBouquet(bactive, false); bouquetList->activateBouquet(bactive, false);
cactive = bouquetList->Bouquets[bactive]->channelList->getSize() - 1; cactive = bouquetList->Bouquets[bactive]->channelList->getSize() - 1;
} else } else
--cactive; --cactive;
} }
else if ((key == g_settings.key_quickzap_up) || (key == CRCInput::RC_right)) { else if ((key == g_settings.key_quickzap_up) || (key == CRCInput::RC_right)) {
@@ -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);
} }
} }
} }
@@ -1735,7 +1734,7 @@ void CChannelList::paintButtonBar(bool is_current)
Bindex++; Bindex++;
//manage record button //manage record button
bool do_record = CRecordManager::getInstance()->RecordingStatus(getActiveChannel_ChannelID()); bool do_record = CRecordManager::getInstance()->RecordingStatus(getActiveChannel_ChannelID());
if (g_settings.recording_type != RECORDING_OFF && !displayNext){ if (g_settings.recording_type != RECORDING_OFF && !displayNext){
if (is_current && !do_record){ if (is_current && !do_record){
Button[Bindex].locale = LOCALE_MAINMENU_RECORDING; Button[Bindex].locale = LOCALE_MAINMENU_RECORDING;
@@ -1862,34 +1861,34 @@ void CChannelList::paintItem(int pos)
//record check //record check
rec_mode = CRecordManager::getInstance()->GetRecordMode(chanlist[curr]->channel_id); rec_mode = CRecordManager::getInstance()->GetRecordMode(chanlist[curr]->channel_id);
//set recording icon //set recording icon
const char * rec_icon = ""; const char * rec_icon = "";
if (rec_mode & CRecordManager::RECMODE_REC) if (rec_mode & CRecordManager::RECMODE_REC)
rec_icon = NEUTRINO_ICON_REC; rec_icon = NEUTRINO_ICON_REC;
else if (rec_mode & CRecordManager::RECMODE_TSHIFT) else if (rec_mode & CRecordManager::RECMODE_TSHIFT)
rec_icon = NEUTRINO_ICON_AUTO_SHIFT; rec_icon = NEUTRINO_ICON_AUTO_SHIFT;
//calculating icons //calculating icons
int icon_x = (x+width-15-2) - RADIUS_LARGE/2; int icon_x = (x+width-15-2) - RADIUS_LARGE/2;
int r_icon_w=0; int s_icon_h=0; int s_icon_w=0; int r_icon_w=0; int s_icon_h=0; int s_icon_w=0;
frameBuffer->getIconSize(NEUTRINO_ICON_SCRAMBLED, &s_icon_w, &s_icon_h); frameBuffer->getIconSize(NEUTRINO_ICON_SCRAMBLED, &s_icon_w, &s_icon_h);
r_icon_w = ChannelList_Rec; r_icon_w = ChannelList_Rec;
int r_icon_x = icon_x; int r_icon_x = icon_x;
//paint scramble icon //paint scramble icon
if(chan->scrambled) if(chan->scrambled)
if (frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, icon_x - s_icon_w, ypos, fheight))//ypos + (fheight - 16)/2); if (frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, icon_x - s_icon_w, ypos, fheight))//ypos + (fheight - 16)/2);
r_icon_x = r_icon_x - s_icon_w; r_icon_x = r_icon_x - s_icon_w;
//paint recording icon //paint recording icon
if (rec_mode != CRecordManager::RECMODE_OFF) if (rec_mode != CRecordManager::RECMODE_OFF)
frameBuffer->paintIcon(rec_icon, r_icon_x - r_icon_w, ypos, fheight);//ypos + (fheight - 16)/2); frameBuffer->paintIcon(rec_icon, r_icon_x - r_icon_w, ypos, fheight);//ypos + (fheight - 16)/2);
//paint buttons //paint buttons
if (paintbuttons) if (paintbuttons)
paintButtonBar(iscurrent); paintButtonBar(iscurrent);
int icon_space = r_icon_w+s_icon_w; int icon_space = r_icon_w+s_icon_w;
//number //number
@@ -1913,7 +1912,7 @@ void CChannelList::paintItem(int pos)
int max_desc_len = width - numwidth - prg_offset - ch_name_len - 15 - 20; // 15 = scrollbar, 20 = spaces int max_desc_len = width - numwidth - prg_offset - ch_name_len - 15 - 20; // 15 = scrollbar, 20 = spaces
if (chan->scrambled || (g_settings.channellist_extended ||g_settings.channellist_epgtext_align_right)) if (chan->scrambled || (g_settings.channellist_extended ||g_settings.channellist_epgtext_align_right))
max_desc_len -= icon_space; /* do we need space for the lock/rec icon? */ max_desc_len -= icon_space; /* do we need space for the lock/rec icon? */
if (max_desc_len < 0) if (max_desc_len < 0)
max_desc_len = 0; max_desc_len = 0;
if ((int) ch_desc_len > max_desc_len) if ((int) ch_desc_len > max_desc_len)
@@ -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);
clHead->addIcon(NEUTRINO_ICON_BUTTON_INFO, CC_ALIGN_RIGHT);
clHead->addIcon(NEUTRINO_ICON_BUTTON_MENU, CC_ALIGN_RIGHT);
if (g_settings.channellist_new_zap_mode)
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() bool gotTime = g_Sectionsd->getIsTimeSet();
{
if(g_settings.infobar_show_channellogo){ if(gotTime) {
std::string lname = ""; strftime(timestr, 10, "%H:%M", tm);
int dummy; timestr_len = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(timestr, true); // UTF-8
g_PicViewer->GetLogoName(chanlist[selected]->channel_id, chanlist[selected]->getName(), lname, &dummy, &dummy);
clHead->refreshElement(indexLogo, lname);
clHead->paintElement(indexLogo, true);
} }
int iw1, iw2, iw3, ih = 0;
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_INFO, &iw1, &ih);
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_MENU, &iw2, &ih);
if (new_zap_mode)
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE, &iw3, &ih);
// head
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()
@@ -2172,7 +2186,7 @@ void CChannelList::paint_events(int index)
} }
while ( dif > 0 ); while ( dif > 0 );
} }
if (e == evtlist.end()) if (e == evtlist.end())
break; break;
//Display the remaining events //Display the remaining events

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,7 +75,8 @@ 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;
int height; int height;
@@ -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;