Channellist: Use CComponentsTitleBar for paint head

Origin commit data
------------------
Branch: ni/coolstream
Commit: cd4cb6645e
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2012-08-29 (Wed, 29 Aug 2012)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Michael Liebmann
2012-08-29 00:47:41 +02:00
committed by Thilo Graf
parent abc6fa47af
commit 0275686caa
2 changed files with 29 additions and 51 deletions

View File

@@ -117,6 +117,9 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl
eventFont = SNeutrinoSettings::FONT_TYPE_CHANNELLIST_EVENT; eventFont = SNeutrinoSettings::FONT_TYPE_CHANNELLIST_EVENT;
dline = NULL; dline = NULL;
ibox = new CComponentsInfoBox(x, y + height + 2, width, info_height); ibox = new CComponentsInfoBox(x, y + height + 2, width, info_height);
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);
} }
@@ -126,6 +129,7 @@ CChannelList::~CChannelList()
chanlist.clear(); chanlist.clear();
delete dline; delete dline;
delete ibox; delete ibox;
delete clHead;
} }
void CChannelList::ClearList(void) void CChannelList::ClearList(void)
@@ -1670,23 +1674,6 @@ void CChannelList::paintItem2DetailsLine (int pos)
} }
} }
void CChannelList::showChannelLogo()
{
if(g_settings.infobar_show_channellogo){
static int logo_w = 0;
static int logo_h = 0;
int logo_w_max = full_width / 4;
frameBuffer->paintBoxRel(x + full_width - logo_off - logo_w, y+(theight-logo_h)/2, logo_w, logo_h, COL_MENUHEAD_PLUS_0);
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);
}
}
}
#define NUM_LIST_BUTTONS 4 #define NUM_LIST_BUTTONS 4
struct button_label SChannelListButtons[NUM_LIST_BUTTONS] = struct button_label SChannelListButtons[NUM_LIST_BUTTONS] =
{ {
@@ -2004,46 +1991,35 @@ void CChannelList::paintItem(int pos)
void CChannelList::paintHead() void CChannelList::paintHead()
{ {
int timestr_len = 0; if (clHead == NULL) {
char timestr[10] = {0}; clHead = new CComponentsTitleBar();
time_t now = time(NULL); clHead->setDimensionsAll(x, y, width, theight);
struct tm *tm = localtime(&now);
bool gotTime = g_Sectionsd->getIsTimeSet(); clHead->addElement(CC_ALIGN_LEFT, CC_ITEMBOX_TEXT, name);
if(gotTime) { clHead->addElement(CC_ALIGN_RIGHT, CC_ITEMBOX_ICON, NEUTRINO_ICON_BUTTON_INFO);
strftime(timestr, 10, "%H:%M", tm); clHead->addElement(CC_ALIGN_RIGHT, CC_ITEMBOX_ICON, NEUTRINO_ICON_BUTTON_MENU);
timestr_len = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(timestr, true); // UTF-8 if (g_settings.channellist_new_zap_mode)
clHead->addElement(CC_ALIGN_RIGHT, CC_ITEMBOX_ICON, this->new_mode_active ?
NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE : NEUTRINO_ICON_BUTTON_MUTE_ZAP_INACTIVE);
clHead->addElement(CC_ALIGN_RIGHT, CC_ITEMBOX_CLOCK);
clHead->addElement(CC_ALIGN_RIGHT, CC_ITEMBOX_PICTURE, "", &indexLogo);
} }
int iw1, iw2, iw3, ih = 0; clHead->calculateElements();
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_INFO, &iw1, &ih); clHead->paint();
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_MENU, &iw2, &ih); }
if (new_zap_mode)
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE, &iw3, &ih);
// head void CChannelList::showChannelLogo()
frameBuffer->paintBoxRel(x,y, full_width,theight+0, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP);//round {
if(g_settings.infobar_show_channellogo){
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_INFO, x + full_width - iw1 - 10, y, theight); //y+ 5 ); std::string lname = "";
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_MENU, x + full_width - iw1 - iw2 - 14, y, theight);//y + 5); // icon for bouquet list button int dummy;
if (new_zap_mode) g_PicViewer->GetLogoName(chanlist[selected]->channel_id, chanlist[selected]->getName(), lname, &dummy, &dummy);
frameBuffer->paintIcon((new_zap_mode == 2 /* active */) ? clHead->refreshElement(indexLogo, lname);
NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE : NEUTRINO_ICON_BUTTON_MUTE_ZAP_INACTIVE, clHead->calculateElements();
x + full_width - iw1 - iw2 - iw3 - 18, y, theight); clHead->paintElement(indexLogo, true);
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

@@ -97,6 +97,8 @@ private:
int ChannelList_Rec; int ChannelList_Rec;
CComponentsDetailLine *dline; CComponentsDetailLine *dline;
CComponentsInfoBox *ibox; CComponentsInfoBox *ibox;
CComponentsTitleBar* clHead;
size_t indexLogo;
void paintDetails(int index); void paintDetails(int index);
void clearItem2DetailsLine (); void clearItem2DetailsLine ();