Merge branch 'master' into pu/mp

This commit is contained in:
svenhoefer
2017-04-10 10:28:08 +02:00
2 changed files with 60 additions and 16 deletions

View File

@@ -81,16 +81,22 @@ static int current_bouquet;
Font *EpgPlus::Header::font = NULL; Font *EpgPlus::Header::font = NULL;
EpgPlus::Header::Header(CFrameBuffer * pframeBuffer, int px, int py, int pwidth) EpgPlus::Header::Header(CFrameBuffer * pframeBuffer __attribute__((unused)), int px, int py, int pwidth)
{ {
this->frameBuffer = pframeBuffer; //this->frameBuffer = pframeBuffer;
this->x = px; this->x = px;
this->y = py; this->y = py;
this->width = pwidth; this->width = pwidth;
this->header = NULL;
} }
EpgPlus::Header::~Header() EpgPlus::Header::~Header()
{ {
if (this->header)
{
delete this->header;
this->header = NULL;
}
} }
void EpgPlus::Header::init() void EpgPlus::Header::init()
@@ -100,10 +106,19 @@ void EpgPlus::Header::init()
void EpgPlus::Header::paint(const char * Name) void EpgPlus::Header::paint(const char * Name)
{ {
std::string head = Name ? Name : g_Locale->getText(LOCALE_EPGPLUS_HEAD); std::string headerCaption = Name ? Name : g_Locale->getText(LOCALE_EPGPLUS_HEAD);
CComponentsHeader _header(this->x, this->y, this->width, this->font->getHeight(), head); if (this->header == NULL)
_header.paint(CC_SAVE_SCREEN_NO); this->header = new CComponentsHeader();
if (this->header)
{
this->header->setDimensionsAll(this->x, this->y, this->width, this->font->getHeight());
this->header->setCaption(headerCaption, CTextBox::NO_AUTO_LINEBREAK);
this->header->setContextButton(CComponentsHeader::CC_BTN_HELP);
this->header->enableClock(true, "%H:%M", "%H %M", true);
this->header->paint(CC_SAVE_SCREEN_NO);
}
} }
int EpgPlus::Header::getUsedHeight() int EpgPlus::Header::getUsedHeight()
@@ -198,8 +213,20 @@ void EpgPlus::TimeLine::paintMark(time_t _startTime, int pduration, int px, int
this->clearMark(); this->clearMark();
// paint new mark // paint new mark
this->frameBuffer->paintBoxRel(px, this->y + this->font->getHeight(), CProgressBar pbbar = CProgressBar(px, this->y + this->font->getHeight(), pwidth, this->font->getHeight());
pwidth, this->font->getHeight() , COL_MENUCONTENTSELECTED_PLUS_0); pbbar.setActiveColor(COL_MENUCONTENTSELECTED_PLUS_0);
time_t currentTime;
time(&currentTime);
if ((currentTime > _startTime) && (currentTime < _startTime + pduration))
{
pbbar.setValues((currentTime - _startTime), pduration);
}
else
{
pbbar.setValues(0, pduration);
}
pbbar.paint();
// display start time before mark // display start time before mark
std::string timeStr = EpgPlus::getTimeString(_startTime, "%H:%M"); std::string timeStr = EpgPlus::getTimeString(_startTime, "%H:%M");
@@ -208,21 +235,25 @@ void EpgPlus::TimeLine::paintMark(time_t _startTime, int pduration, int px, int
this->font->RenderString(px - textWidth - OFFSET_INNER_MIN, this->y + this->font->getHeight() + this->font->getHeight(), this->font->RenderString(px - textWidth - OFFSET_INNER_MIN, this->y + this->font->getHeight() + this->font->getHeight(),
textWidth, timeStr, COL_MENUCONTENT_TEXT); textWidth, timeStr, COL_MENUCONTENT_TEXT);
// display end time after mark // display end time
timeStr = EpgPlus::getTimeString(_startTime + pduration, "%H:%M"); timeStr = EpgPlus::getTimeString(_startTime + pduration, "%H:%M");
textWidth = font->getRenderWidth(timeStr); textWidth = font->getRenderWidth(timeStr);
int textX = 0;
if (px + pwidth + textWidth < this->x + this->width) if (px + pwidth + textWidth + OFFSET_INNER_MIN < this->x + this->width)
{ {
this->font->RenderString(px + pwidth + OFFSET_INNER_MIN, this->y + this->font->getHeight() + this->font->getHeight(), // display end time after mark
textWidth, timeStr, COL_MENUCONTENT_TEXT); textX = px + pwidth + OFFSET_INNER_MIN;
} }
else if (textWidth < pwidth - OFFSET_INNER_MID) else if (textWidth < pwidth - 2*OFFSET_INNER_MIN)
{ {
this->font->RenderString(px + pwidth - textWidth - OFFSET_INNER_MIN, this->y + this->font->getHeight() + this->font->getHeight(), // display end time before mark
textWidth, timeStr, COL_MENUCONTENTSELECTED_TEXT); textX = px + pwidth - textWidth - OFFSET_INNER_MIN;
} }
if (textX)
this->font->RenderString(textX, this->y + this->font->getHeight() + this->font->getHeight(), textWidth, timeStr, COL_MENUCONTENT_TEXT);
// paint the separation line // paint the separation line
if (separationLineThickness > 0) if (separationLineThickness > 0)
{ {
@@ -329,7 +360,10 @@ EpgPlus::ChannelEntry::ChannelEntry(const CZapitChannel * pchannel, int pindex,
{ {
std::stringstream pdisplayName; std::stringstream pdisplayName;
//pdisplayName << pindex + 1 << " " << pchannel->getName(); //pdisplayName << pindex + 1 << " " << pchannel->getName();
pdisplayName << pchannel->number << " " << pchannel->getName(); if (g_settings.channellist_show_numbers)
pdisplayName << pchannel->number << " " << pchannel->getName();
else
pdisplayName << pchannel->getName();
this->displayName = pdisplayName.str(); this->displayName = pdisplayName.str();
} }
@@ -365,6 +399,7 @@ EpgPlus::ChannelEntry::~ChannelEntry()
if (this->detailsLine) if (this->detailsLine)
{ {
this->detailsLine->kill();
delete this->detailsLine; delete this->detailsLine;
this->detailsLine = NULL; this->detailsLine = NULL;
} }
@@ -425,6 +460,14 @@ void EpgPlus::ChannelEntry::paint(bool isSelected, time_t _selectedTime)
toggleColor = !toggleColor; toggleColor = !toggleColor;
} }
// kill detailsline
if (detailsLine)
{
detailsLine->kill();
delete detailsLine;
detailsLine = NULL;
}
// paint detailsline // paint detailsline
if (isSelected) if (isSelected)
{ {
@@ -571,7 +614,7 @@ void EpgPlus::createChannelEntries(int selectedChannelEntryIndex)
CZapitChannel * channel = (*this->channelList)[i]; CZapitChannel * channel = (*this->channelList)[i];
ChannelEntry *channelEntry = new ChannelEntry(channel, i, this->frameBuffer, this->footer, this->bouquetList, this->channelsTableX + 2, yPosChannelEntry, this->channelsTableWidth); ChannelEntry *channelEntry = new ChannelEntry(channel, i, this->frameBuffer, this->footer, this->bouquetList, this->channelsTableX, yPosChannelEntry, this->channelsTableWidth);
//printf("Going to get getEventsServiceKey for %llx\n", (channel->getChannelID() & 0xFFFFFFFFFFFFULL)); //printf("Going to get getEventsServiceKey for %llx\n", (channel->getChannelID() & 0xFFFFFFFFFFFFULL));
CChannelEventList channelEventList; CChannelEventList channelEventList;
CEitManager::getInstance()->getEventsServiceKey(channel->getEpgID(), channelEventList); CEitManager::getInstance()->getEventsServiceKey(channel->getEpgID(), channelEventList);

View File

@@ -95,6 +95,7 @@ class EpgPlus
int width; int width;
static Font* font; static Font* font;
CComponentsHeader *header;
}; };