mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 00:11:14 +02:00
CEpgData: optimize handling of header and bottom box
Working with existant instances and reduce flicker effects.
This commit is contained in:
@@ -121,17 +121,22 @@ void reformatExtendedEvents(std::string strItem, std::string strLabel, bool bUse
|
|||||||
|
|
||||||
CEpgData::CEpgData()
|
CEpgData::CEpgData()
|
||||||
{
|
{
|
||||||
bigFonts = false;
|
bigFonts = false;
|
||||||
frameBuffer = CFrameBuffer::getInstance();
|
frameBuffer = CFrameBuffer::getInstance();
|
||||||
tmdb_active = false;
|
tmdb_active = false;
|
||||||
mp_movie_info = NULL;
|
mp_movie_info = NULL;
|
||||||
header = NULL;
|
header = NULL;
|
||||||
|
Bottombox = NULL;
|
||||||
|
lpic = NULL;
|
||||||
|
rpic = NULL;
|
||||||
|
lText = NULL;
|
||||||
|
rText = NULL;
|
||||||
|
pb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CEpgData::~CEpgData()
|
CEpgData::~CEpgData()
|
||||||
{
|
{
|
||||||
delete header;
|
ResetModules();
|
||||||
header = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEpgData::start()
|
void CEpgData::start()
|
||||||
@@ -841,40 +846,39 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start
|
|||||||
|
|
||||||
// show the epg
|
// show the epg
|
||||||
// header + logo
|
// header + logo
|
||||||
if (header) {
|
if (!header){
|
||||||
header->kill();
|
header = new CComponentsHeader(sx, sy, ox, toph);
|
||||||
delete header;
|
header->setColorBody(COL_MENUHEAD_PLUS_0);
|
||||||
header = NULL;
|
header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0, g_settings.theme.menu_Head_gradient_direction);
|
||||||
}
|
header->enableClock(true, "%H:%M", "%H %M", true);
|
||||||
|
}else
|
||||||
header = new CComponentsHeader(sx, sy, ox, toph);
|
header->setDimensionsAll(sx, sy, ox, toph);
|
||||||
header->setCorner(RADIUS_LARGE, CORNER_TOP);
|
|
||||||
header->setDimensionsAll(sx, sy, ox, toph);
|
|
||||||
header->setColorBody(COL_MENUHEAD_PLUS_0);
|
|
||||||
header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0, g_settings.theme.menu_Head_gradient_direction);
|
|
||||||
|
|
||||||
header->enableClock(true, "%H:%M", "%H.%M", true);
|
|
||||||
header->getClockObject()->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT);
|
|
||||||
|
|
||||||
header->getChannelLogoObject()->hide();
|
|
||||||
header->setChannelLogo(channel_id, channel_name);
|
|
||||||
|
|
||||||
header->setCaption(epgData.title);
|
header->setCaption(epgData.title);
|
||||||
|
|
||||||
|
if (header->isPainted())
|
||||||
|
header->hideCCItems();
|
||||||
|
|
||||||
|
// set channel logo
|
||||||
|
header->setChannelLogo(channel_id, channel_name);
|
||||||
|
|
||||||
|
//paint head
|
||||||
header->paint(CC_SAVE_SCREEN_NO);
|
header->paint(CC_SAVE_SCREEN_NO);
|
||||||
|
|
||||||
int showPos = 0;
|
int showPos = 0;
|
||||||
textCount = epgText.size();
|
textCount = epgText.size();
|
||||||
showText(showPos, sy + toph);
|
showText(showPos, sy + toph);
|
||||||
|
|
||||||
// small bottom box
|
// small bottom box with left/right navigation
|
||||||
CComponentsFrmChain *Bottombox = new CComponentsFrmChain(sx, sy+oy-botboxheight, ox, botboxheight);
|
if (!Bottombox){
|
||||||
Bottombox->setColorBody(COL_MENUFOOT_PLUS_0);
|
Bottombox = new CComponentsFrmChain(sx, sy+oy-botboxheight, ox, botboxheight);
|
||||||
Bottombox->enableColBodyGradient(g_settings.theme.infobar_gradient_bottom,COL_MENUFOOT_PLUS_0,g_settings.theme.infobar_gradient_bottom_direction);
|
Bottombox->setColorBody(COL_MENUFOOT_PLUS_0);
|
||||||
Bottombox->set2ndColor(COL_MENUCONTENT_PLUS_0);
|
Bottombox->setCornerType(CORNER_NONE);
|
||||||
|
Bottombox->enableColBodyGradient(g_settings.theme.infobar_gradient_bottom,COL_MENUFOOT_PLUS_0,g_settings.theme.infobar_gradient_bottom_direction);
|
||||||
|
Bottombox->set2ndColor(COL_MENUCONTENT_PLUS_0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!mp_info)
|
if (!mp_info){
|
||||||
{
|
|
||||||
std::string fromto = epg_start + " - " + epg_end;
|
std::string fromto = epg_start + " - " + epg_end;
|
||||||
int x_off = OFFSET_INNER_MID;
|
int x_off = OFFSET_INNER_MID;
|
||||||
int mid_width = ox * 40 / 100; // 40%
|
int mid_width = ox * 40 / 100; // 40%
|
||||||
@@ -882,26 +886,52 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start
|
|||||||
|
|
||||||
GetPrevNextEPGData(epgData.eventID, &epgData.epg_times.startzeit);
|
GetPrevNextEPGData(epgData.eventID, &epgData.epg_times.startzeit);
|
||||||
|
|
||||||
CComponentsPictureScalable *lpic = new CComponentsPictureScalable(x_off,CC_CENTERED,NEUTRINO_ICON_BUTTON_LEFT);
|
// init left arrow
|
||||||
CComponentsText *lText = new CComponentsText(x_off + lpic->getWidth() + OFFSET_INNER_MID, CC_CENTERED, side_width, toph, fromto, CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT);
|
if (!lpic){
|
||||||
if ((prev_id) && (!call_fromfollowlist))
|
lpic = new CComponentsPictureScalable(x_off,CC_CENTERED,NEUTRINO_ICON_BUTTON_LEFT);
|
||||||
|
lpic->doPaintBg(false);
|
||||||
Bottombox->addCCItem(lpic);
|
Bottombox->addCCItem(lpic);
|
||||||
lpic->doPaintBg(false);
|
lpic->enableSaveBg();
|
||||||
lText->doPaintBg(false);
|
}
|
||||||
|
lpic->allowPaint(prev_id && !call_fromfollowlist);
|
||||||
|
|
||||||
CComponentsPictureScalable *rpic = new CComponentsPictureScalable(0,CC_CENTERED,NEUTRINO_ICON_BUTTON_RIGHT,Bottombox);
|
// init right arrow
|
||||||
int x_pos = ox - rpic->getWidth() - OFFSET_INNER_MID;
|
if (!rpic){
|
||||||
if ((next_id) && (!call_fromfollowlist))
|
rpic = new CComponentsPictureScalable(0,CC_CENTERED,NEUTRINO_ICON_BUTTON_RIGHT);
|
||||||
|
|
||||||
|
rpic->doPaintBg(false);
|
||||||
Bottombox->addCCItem(rpic);
|
Bottombox->addCCItem(rpic);
|
||||||
rpic->setXPos(x_pos);
|
rpic->enableSaveBg();
|
||||||
CComponentsText *rText = new CComponentsText(0, CC_CENTERED, side_width, toph, epg_date, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT);
|
int x_pos = ox - rpic->getWidth() - x_off;
|
||||||
rText->setXPos(x_pos - OFFSET_INNER_MID - rText->getWidth());
|
rpic->setXPos(x_pos);
|
||||||
rpic->doPaintBg(false);
|
}
|
||||||
rText->doPaintBg(false);
|
rpic->allowPaint(next_id && !call_fromfollowlist);
|
||||||
|
|
||||||
|
// init text left "from to"
|
||||||
|
if (!lText){
|
||||||
|
lText = new CComponentsText(x_off + lpic->getWidth() + x_off, CC_CENTERED, side_width, toph, "", CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE], CComponentsText::FONT_STYLE_REGULAR, NULL, CC_SHADOW_OFF, COL_MENUHEAD_TEXT);
|
||||||
|
lText->doPaintBg(false);
|
||||||
|
Bottombox->addCCItem(lText);
|
||||||
|
lText->enableSaveBg();
|
||||||
|
}
|
||||||
|
lText->setText(fromto, CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE], COL_MENUHEAD_TEXT, CComponentsText::FONT_STYLE_REGULAR);
|
||||||
|
|
||||||
|
// init text right "follow"
|
||||||
|
if (!rText){
|
||||||
|
rText = new CComponentsText(0, CC_CENTERED, side_width, toph, "", CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT);
|
||||||
|
rText->doPaintBg(false);
|
||||||
|
rText->enableSaveBg();
|
||||||
|
}
|
||||||
|
rText->setText(epg_date, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]);
|
||||||
|
rText->setXPos(rpic->getXPos() - x_off - rText->getWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
Bottombox->paint(false);
|
//ensure clean background
|
||||||
|
if(Bottombox->isPainted())
|
||||||
|
Bottombox->hideCCItems();
|
||||||
|
|
||||||
|
//paint bottombox contents
|
||||||
|
Bottombox->paint(false);
|
||||||
showProgressBar();
|
showProgressBar();
|
||||||
|
|
||||||
// show Timer Event Buttons
|
// show Timer Event Buttons
|
||||||
@@ -1214,6 +1244,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start
|
|||||||
}
|
}
|
||||||
case CRCInput::RC_help:
|
case CRCInput::RC_help:
|
||||||
bigFonts = bigFonts ? false : true;
|
bigFonts = bigFonts ? false : true;
|
||||||
|
ResetModules();
|
||||||
frameBuffer->paintBackgroundBoxRel(sx, sy, ox, oy);
|
frameBuffer->paintBackgroundBoxRel(sx, sy, ox, oy);
|
||||||
showTimerEventBar (false);
|
showTimerEventBar (false);
|
||||||
start();
|
start();
|
||||||
@@ -1289,11 +1320,7 @@ void CEpgData::hide()
|
|||||||
g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->setSize((int)(g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getSize() / BIGFONT_FACTOR));
|
g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->setSize((int)(g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getSize() / BIGFONT_FACTOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header) {
|
ResetModules();
|
||||||
header->kill();
|
|
||||||
delete header;
|
|
||||||
header = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
frameBuffer->paintBackgroundBoxRel(sx, sy, ox, oy);
|
frameBuffer->paintBackgroundBoxRel(sx, sy, ox, oy);
|
||||||
showTimerEventBar (false);
|
showTimerEventBar (false);
|
||||||
@@ -1437,18 +1464,21 @@ int CEpgData::FollowScreenings (const t_channel_id /*channel_id*/, const std::st
|
|||||||
|
|
||||||
void CEpgData::showProgressBar()
|
void CEpgData::showProgressBar()
|
||||||
{
|
{
|
||||||
|
int w = 104;
|
||||||
|
int x = sx + (ox - w)/2;
|
||||||
|
int h = botboxheight - 12;
|
||||||
|
int y = sy + oy - botboxheight + (botboxheight - h)/2;
|
||||||
|
if (!pb){
|
||||||
|
pb = new CProgressBar(x, y, w, h);
|
||||||
|
pb->setType(CProgressBar::PB_TIMESCALE);
|
||||||
|
}
|
||||||
//show progressbar
|
//show progressbar
|
||||||
if (epg_done != -1)
|
if (epg_done != -1)
|
||||||
{
|
{
|
||||||
int w = 104;
|
pb->setValues(epg_done, 100);
|
||||||
int x = sx + (ox - w)/2;
|
pb->paint(true);
|
||||||
int h = botboxheight - 12;
|
}else{
|
||||||
int y = sy + oy - botboxheight + (botboxheight - h)/2;
|
pb->hide();
|
||||||
|
|
||||||
CProgressBar pb(x, y, w, h);
|
|
||||||
pb.setType(CProgressBar::PB_TIMESCALE);
|
|
||||||
pb.setValues(epg_done, 100);
|
|
||||||
pb.paint(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1523,6 +1553,22 @@ void CEpgData::showTimerEventBar (bool pshow, bool adzap, bool mp_info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CEpgData::ResetModules()
|
||||||
|
{
|
||||||
|
if (header){
|
||||||
|
delete header; header = NULL;
|
||||||
|
}
|
||||||
|
if (Bottombox){
|
||||||
|
delete Bottombox; Bottombox = NULL;
|
||||||
|
// bottom box items are destroyed but explicit reset of bottom box items here required
|
||||||
|
lpic = rpic = NULL;
|
||||||
|
lText = rText = NULL;
|
||||||
|
}
|
||||||
|
if (pb){
|
||||||
|
delete pb; pb = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// -- EPG Data Viewer Menu Handler Class
|
// -- EPG Data Viewer Menu Handler Class
|
||||||
// -- to be used for calls from Menue
|
// -- to be used for calls from Menue
|
||||||
// -- (2004-03-06 rasc)
|
// -- (2004-03-06 rasc)
|
||||||
|
@@ -50,7 +50,11 @@ class CEpgData
|
|||||||
CChannelEventList evtlist;
|
CChannelEventList evtlist;
|
||||||
CChannelEventList followlist;
|
CChannelEventList followlist;
|
||||||
CEPGData epgData;
|
CEPGData epgData;
|
||||||
CComponentsHeader* header;
|
CComponentsHeader *header;
|
||||||
|
CComponentsFrmChain *Bottombox;
|
||||||
|
CComponentsPictureScalable *lpic, *rpic;
|
||||||
|
CComponentsText *lText, *rText;
|
||||||
|
CProgressBar *pb;
|
||||||
std::string epg_date;
|
std::string epg_date;
|
||||||
std::string epg_start;
|
std::string epg_start;
|
||||||
std::string epg_end;
|
std::string epg_end;
|
||||||
@@ -100,6 +104,7 @@ class CEpgData
|
|||||||
int show(const t_channel_id channel_id, uint64_t id = 0, time_t* startzeit = NULL, bool doLoop = true, bool callFromfollowlist = false, bool mp_info = false );
|
int show(const t_channel_id channel_id, uint64_t id = 0, time_t* startzeit = NULL, bool doLoop = true, bool callFromfollowlist = false, bool mp_info = false );
|
||||||
int show_mp(MI_MOVIE_INFO *mi, int mp_position = 0, int mp_duration = 0, bool doLoop = true);
|
int show_mp(MI_MOVIE_INFO *mi, int mp_position = 0, int mp_duration = 0, bool doLoop = true);
|
||||||
void hide();
|
void hide();
|
||||||
|
void ResetModules();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user