CComponentsHeader: add possibility to show channellogo

Contains methode setChannelLogo() with parameters
for channel id, channel name and optional
alignment (primary between title and clock). Default
alignment is centered.
Optional parameter to set logo height is available too.

Hope it works on first try. To see how it works, take look
at channellist class.


Origin commit data
------------------
Branch: ni/coolstream
Commit: 68835056c3
Author: Thilo Graf <dbt@novatux.de>
Date: 2017-04-21 (Fri, 21 Apr 2017)



------------------
This commit was generated by Migit
This commit is contained in:
2017-04-21 22:47:23 +02:00
parent fee0463182
commit 7c03858f7c
3 changed files with 124 additions and 27 deletions

View File

@@ -1676,35 +1676,16 @@ void CChannelList::paintAdditionals(int index)
}
}
void CChannelList::showChannelLogo() //TODO: move into an own handler, eg. header, channel logo should be paint inside header object
void CChannelList::showChannelLogo()
{
if ((*chanlist).empty())
return;
if(g_settings.channellist_show_channellogo){
int logo_w_max = full_width / 4;
int logo_h_max = theight - 2*OFFSET_INNER_MIN;
if (CChannelLogo) {
if (headerNew)
CChannelLogo->clearSavedScreen();
else
CChannelLogo->hide();
delete CChannelLogo;
}
CChannelLogo = new CComponentsChannelLogoScalable(0, 0, (*chanlist)[selected]->getName(), (*chanlist)[selected]->getChannelID());
if (CChannelLogo->hasLogo()){
CChannelLogo->setWidth(min(CChannelLogo->getWidth(), logo_w_max), true);
if (CChannelLogo->getHeight() > logo_h_max)
CChannelLogo->setHeight(logo_h_max, true);
CChannelLogo->setXPos(x + full_width - logo_off - CChannelLogo->getWidth());
CChannelLogo->setYPos(y + (theight - CChannelLogo->getHeight()) / 2);
CChannelLogo->paint();
} else {
CChannelLogo->hide();
delete CChannelLogo;
CChannelLogo = NULL;
}
headerNew = false;
header->setChannelLogo((*chanlist)[selected]->getChannelID(), (*chanlist)[selected]->getName());
header->getLogoObject()->hide();
header->getLogoObject()->clearSavedScreen();
header->getLogoObject()->allowPaint(true);
header->getLogoObject()->paint();
}
}
@@ -2172,7 +2153,14 @@ void CChannelList::paintHead()
else
logo_off = OFFSET_INNER_MID;
if(g_settings.channellist_show_channellogo){
//ensure to have clean background
header->getLogoObject()->hide();
header->setChannelLogo((*chanlist)[selected]->getChannelID(), (*chanlist)[selected]->getName());
header->getLogoObject()->allowPaint(false);
}
header->paint(CC_SAVE_SCREEN_NO);
showChannelLogo();
}
CComponentsHeader* CChannelList::getHeaderObject()