From b3ecc2b65c531946fba6009c096f97f5193095c1 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 01/15] eventlist,epgview: adjust style, implement new header class picked from: https://github.com/TangoCash/neutrino-mp-cst-next commit: 477db186ee4f306e191035ed2201ff4fc9d70b9d Signed-off-by: Thilo Graf review reqiured Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/3ac2f99a671b444426f515b0d25ead1708880bf8 Author: TangoCash Date: 2017-05-03 (Wed, 03 May 2017) Origin message was: ------------------ -eventlist,epgview: adjust style, implement new header class picked from: https://github.com/TangoCash/neutrino-mp-cst-next commit: 477db186ee4f306e191035ed2201ff4fc9d70b9d Signed-off-by: Thilo Graf review reqiured --- src/gui/epgview.cpp | 118 +++++++++++++++--------------------- src/gui/epgview.h | 2 +- src/gui/eventlist.cpp | 107 +++++++++++++++++++++----------- src/gui/eventlist.h | 5 +- src/gui/moviebrowser/mb.cpp | 1 + 5 files changed, 126 insertions(+), 107 deletions(-) diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index bf6658969..b619f3dd6 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -712,46 +712,16 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start const int pic_h = 39; toph = std::max(toph, pic_h); - // Calculate offset for the title when logo appears. - int pic_offx = 0; std::string lname; - int logo_w = 0; - int logo_h = 0; - int logo_w_max = ox / 4; - int logo_h_max = toph - 2*OFFSET_INNER_MIN; std::string channel_name; if (mp_info) channel_name = mp_movie_info->channelName; else channel_name = g_Zapit->getChannelName(channel_id); - if (g_settings.infobar_show_channellogo && g_PicViewer->GetLogoName(channel_id, channel_name, lname, &logo_w, &logo_h)) - { - if ((logo_h > logo_h_max) || (logo_w > logo_w_max)) - g_PicViewer->rescaleImageDimensions(&logo_w, &logo_h, logo_w_max, logo_h_max); - pic_offx = logo_w + OFFSET_INNER_MID; - } - - int pos; - std::string text1 = epgData.title; - std::string text2 = ""; - if (g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]->getRenderWidth(text1) > ox - pic_offx - 2*OFFSET_INNER_MID) - { - do - { - pos = text1.find_last_of("[ .]+"); - if (pos != -1) - text1 = text1.substr(0, pos); - } while ((pos != -1) && (g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]->getRenderWidth(text1) > ox - pic_offx - 2*OFFSET_INNER_MID)); - if (epgData.title.length() > text1.length()) // shold never be false in this place - text2 = epgData.title.substr(text1.length()+ 1, uint(-1) ); - } if (!topboxheight) start(); - if (!text2.empty()) - toph = 2 * topboxheight; - sb = oy - toph - botboxheight; // 21.07.2005 - rainerk @@ -869,61 +839,65 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start COSDFader fader(g_settings.theme.menu_Content_alpha); fader.StartFadeIn(); - //show the epg + // show the epg // header + logo - int header_h = std::max(toph, logo_h); - if (!header){ - header = new CComponentsShapeSquare(sx, sy, ox, header_h); - header->setCorner(RADIUS_LARGE, CORNER_TOP); + if (header) { + header->kill(); + delete header; + header = NULL; } - header->setDimensionsAll(sx, sy, ox, header_h); + + header = new CComponentsHeader(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); - CComponentsPicture* headerPic = NULL; //NOTE: class CComponentsChannelLogo is preferred for channel logos - if (pic_offx > 0) { - headerPic = new CComponentsPicture(sx + OFFSET_INNER_MID, sy + (header_h-logo_h)/2, logo_w, logo_h, lname); - headerPic->doPaintBg(false); - } - std::string textAll = (!text2.empty()) ? text1 + "\n" + text2 : text1; - CComponentsText headerText(sx + OFFSET_INNER_MID + pic_offx, sy, ox - 2*OFFSET_INNER_MID - pic_offx, header_h, textAll, CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]); - headerText.doPaintBg(false); - headerText.setTextColor(COL_MENUHEAD_TEXT); + 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->paint(CC_SAVE_SCREEN_NO); - headerText.paint(CC_SAVE_SCREEN_NO); - if (headerPic) - headerPic->paint(CC_SAVE_SCREEN_NO); int showPos = 0; textCount = epgText.size(); showText(showPos, sy + toph); // small bottom box - frameBuffer->paintBoxRel(sx, sy+oy-botboxheight, ox, botboxheight, COL_MENUHEAD_PLUS_0); + CComponentsFrmChain *Bottombox = new CComponentsFrmChain(sx, sy+oy-botboxheight, ox, botboxheight); + Bottombox->setColorBody(COL_MENUHEAD_PLUS_0); + if (!mp_info) { - static int iw = 0, ih = 0, io = 0; - if (!iw && !ih) - frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_LEFT, &iw, &ih); - if (!io && iw) - io = iw + OFFSET_INNER_MID; - std::string fromto = epg_start + " - " + epg_end; - - int widthl = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->getRenderWidth(fromto); - g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->RenderString(sx+OFFSET_INNER_MID+io, sy+oy-3, widthl, fromto, COL_MENUHEAD_TEXT); - int widthr = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->getRenderWidth(epg_date); - g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->RenderString(sx+ox-OFFSET_INNER_MID-io-widthr, sy+oy-3, widthr, epg_date, COL_MENUHEAD_TEXT); + int x_off = OFFSET_INNER_MID; + int mid_width = ox * 40 / 100; // 40% + int side_width = ((ox - mid_width) / 2) - (2 * x_off); GetPrevNextEPGData(epgData.eventID, &epgData.epg_times.startzeit); - if (!call_fromfollowlist) - { - int iy = sy + oy - botboxheight + (botboxheight - iw)/2; - if (prev_id) - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_LEFT, sx + OFFSET_INNER_MID, iy); - if (next_id) - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_RIGHT, sx + ox - iw - OFFSET_INNER_MID, iy); - } + + CComponentsPictureScalable *lpic = new CComponentsPictureScalable(x_off,CC_CENTERED,NEUTRINO_ICON_BUTTON_LEFT); + 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 ((prev_id) && (!call_fromfollowlist)) + Bottombox->addCCItem(lpic); + lpic->doPaintBg(false); + lText->doPaintBg(false); + + CComponentsPictureScalable *rpic = new CComponentsPictureScalable(0,CC_CENTERED,NEUTRINO_ICON_BUTTON_RIGHT,Bottombox); + int x_pos = ox - rpic->getWidth() - OFFSET_INNER_MID; + if ((next_id) && (!call_fromfollowlist)) + Bottombox->addCCItem(rpic); + rpic->setXPos(x_pos); + 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); + rText->setXPos(x_pos - OFFSET_INNER_MID - rText->getWidth()); + rpic->doPaintBg(false); + rText->doPaintBg(false); + + Bottombox->paint(false); } showProgressBar(); @@ -1300,8 +1274,6 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start if(epgTextSwitchClear) epgTextSwitch.clear(); } - if (headerPic) - delete headerPic; return res; } @@ -1314,6 +1286,12 @@ void CEpgData::hide() g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->setSize((int)(g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getSize() / BIGFONT_FACTOR)); } + if (header) { + header->kill(); + delete header; + header = NULL; + } + frameBuffer->paintBackgroundBoxRel(sx, sy, ox, oy); showTimerEventBar (false); } diff --git a/src/gui/epgview.h b/src/gui/epgview.h index c7ec15b80..e2dd8a573 100644 --- a/src/gui/epgview.h +++ b/src/gui/epgview.h @@ -50,7 +50,7 @@ class CEpgData CChannelEventList evtlist; CChannelEventList followlist; CEPGData epgData; - CComponentsShapeSquare* header; + CComponentsHeader* header; std::string epg_date; std::string epg_start; std::string epg_end; diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 2c1a859d7..d1150a017 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -291,8 +291,10 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna fwidth1 = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_DATETIME]->getRenderWidth("DDD, :, ") + 4 * g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_DATETIME]->getMaxDigitWidth(); //fwidth2 = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getRenderWidth("[ ] ") + 3 * g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getMaxDigitWidth() + g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getRenderWidth(unit_short_minute); - listmaxshow = (height-theight-iheight-0)/fheight; - height = theight+iheight+0+listmaxshow*fheight; // recalc height + botboxheight = fheight1+2*OFFSET_INNER_MIN; + + listmaxshow = (height-theight-iheight-botboxheight-0)/fheight; + height = theight+iheight+botboxheight+0+listmaxshow*fheight; // recalc height y = getScreenStartY(height); // calculate width of right info_zone @@ -804,6 +806,9 @@ void CEventList::paintItem(unsigned int pos, t_channel_id channel_idI) // paint 2nd line text g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE]->RenderString(x + iw + OFFSET_INNER_MID, ypos + fheight, width - iw - 2*OFFSET_INNER_MID, evtlist[currpos].description, color); + + if (i_radius) + showProgressBar(currpos); } } @@ -847,57 +852,90 @@ void CEventList::paintDescription(int index) void CEventList::paintHead(t_channel_id _channel_id, std::string _channelname, std::string _channelname_prev, std::string _channelname_next) { - int font_mid = SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE; - int font_lr = SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE; + if (header) { + header->kill(); + delete header; + header = NULL; + } - if (!header) - header = new CComponentsFrmChain(); + header = new CComponentsHeader(); header->setDimensionsAll(x, y, full_width, theight); header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0, g_settings.theme.menu_Head_gradient_direction); header->setCorner(RADIUS_LARGE, CORNER_TOP); - header->clear(); + header->enableClock(true, "%H:%M", "%H.%M", true); + header->getClockObject()->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); + + header->getChannelLogoObject()->hide(); + header->setChannelLogo(_channel_id,_channelname); + header->setCaption(_channelname,CTextBox::CENTER); + + header->paint(CC_SAVE_SCREEN_NO); + paintBottomBox(_channelname_prev, _channelname_next); +} + +void CEventList::paintBottomBox(std::string _channelname_prev, std::string _channelname_next) +{ + int by = y + height - iheight - botboxheight; + int font_lr = SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE; int x_off = OFFSET_INNER_MID; int mid_width = full_width * 40 / 100; // 40% - int max_height = theight - 2*OFFSET_INNER_MIN; int side_width = ((full_width - mid_width) / 2) - (2 * x_off); - //create an logo object - CComponentsChannelLogoScalable* midLogo = new CComponentsChannelLogoScalable(0, 0, _channelname, _channel_id, header); - if (midLogo->hasLogo()) - { - midLogo->setWidth(min(midLogo->getWidth(), mid_width), true); - if (midLogo->getHeight() > max_height) - midLogo->setHeight(max_height, true); - - midLogo->setPos(CC_CENTERED, CC_CENTERED); - - // recalc widths - side_width = ((full_width - midLogo->getWidth()) / 2) - (4 * x_off); - } - else { - header->removeCCItem(midLogo); //remove/destroy logo object, if it is not available - int w_midText = g_Font[font_mid]->getRenderWidth(_channelname); - CComponentsText *midText = new CComponentsText(0, CC_CENTERED, w_midText, theight, _channelname, CTextBox::CENTER, g_Font[font_mid], CComponentsText::FONT_STYLE_REGULAR, header, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); - midText->setXPos(full_width/2 - midText->getWidth()/2); - midText->doPaintBg(false); - } + CComponentsFrmChain *Bottombox = new CComponentsFrmChain(x, by, full_width, botboxheight); + Bottombox->setColorBody(COL_MENUHEAD_PLUS_0); if (!_channelname_prev.empty()) { - CComponentsText *lText = new CComponentsText(x_off, CC_CENTERED, side_width, theight, _channelname_prev, CTextBox::NO_AUTO_LINEBREAK, g_Font[font_lr], CComponentsText::FONT_STYLE_REGULAR, header, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); + CComponentsPictureScalable *lpic = new CComponentsPictureScalable(x_off,CC_CENTERED,NEUTRINO_ICON_BUTTON_LEFT,Bottombox); + CComponentsText *lText = new CComponentsText(x_off + lpic->getWidth() + OFFSET_INNER_MID, CC_CENTERED, side_width, theight, _channelname_prev, CTextBox::NO_AUTO_LINEBREAK, g_Font[font_lr], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); + lpic->doPaintBg(false); lText->doPaintBg(false); } if (!_channelname_next.empty()) { - int x_pos = full_width - side_width - x_off; - CComponentsText *rText = new CComponentsText(x_pos, CC_CENTERED, side_width, theight, _channelname_next, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, g_Font[font_lr], CComponentsText::FONT_STYLE_REGULAR, header, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); + CComponentsPictureScalable *rpic = new CComponentsPictureScalable(0,CC_CENTERED,NEUTRINO_ICON_BUTTON_RIGHT,Bottombox); + int x_pos = full_width - rpic->getWidth() - OFFSET_INNER_MID; + rpic->setXPos(x_pos); + CComponentsText *rText = new CComponentsText(0, CC_CENTERED, side_width, theight, _channelname_next, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, g_Font[font_lr], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); + rText->setXPos(x_pos - OFFSET_INNER_MID - rText->getWidth()); + rpic->doPaintBg(false); rText->doPaintBg(false); } - if (header->isPainted()) //clean up background of header for new captions - header->kill(header->getColorBody()); - header->paint(CC_SAVE_SCREEN_NO); + Bottombox->paint(false); +} + +void CEventList::showProgressBar(int pos) +{ + int epg_done= -1; + if ((( time(NULL)- evtlist[pos].startTime )>= 0 ) && (evtlist[pos].duration > 0)) + { + unsigned nProcentagePassed = ((time(NULL) - evtlist[pos].startTime) * 100 / evtlist[pos].duration); + if (nProcentagePassed<= 100) + epg_done= nProcentagePassed; + } + + int pbw = 104; + int pbx = x + (full_width - pbw)/2; + int pbh = botboxheight - 12; + int pby = y + height -iheight - botboxheight + (botboxheight - pbh)/2; + + //show progressbar + if (epg_done != -1) + { + CProgressBar pb(pbx, pby, pbw, pbh); + pb.setType(CProgressBar::PB_TIMESCALE); + pb.setValues(epg_done, 100); + pb.paint(false); + } + else + { + CComponentsShapeSquare pb(pbx, pby, pbw, pbh); + pb.setColorBody(COL_MENUHEAD_PLUS_0); + pb.paint(false); + } + } void CEventList::paint(t_channel_id channel_id) @@ -998,7 +1036,6 @@ void CEventList::showFunctionBar(t_channel_id channel_id) buttons[btn_cnt].locale = LOCALE_EPGMENU_EVENTINFO; btn_cnt++; } - ::paintButtons(bx, by, bw, btn_cnt, buttons, bw, bh); } diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 90542ba26..512a38cf2 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -95,6 +95,7 @@ class CEventList : public CListHelpers std::string search_head_name; int full_width, width, infozone_width; + int botboxheight; int height; int x; int y; @@ -102,13 +103,15 @@ class CEventList : public CListHelpers int sort_mode; event_id_t item_event_ID; CComponentsText *cc_infozone; - CComponentsFrmChain *header; + CComponentsHeader *header; const char * unit_short_minute; void paintItem(unsigned pos, t_channel_id channel_id = 0); void paintDescription(int index); void paint(t_channel_id channel_id = 0); void paintHead(t_channel_id _channel_id, std::string _channelname, std::string _channelname_prev = "", std::string _channelname_next = ""); + void paintBottomBox(std::string _channelname_prev, std::string _channelname_next); + void showProgressBar(int pos); void hide(); void showFunctionBar(t_channel_id channel_id); diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 2d670805a..df586ca19 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -2095,6 +2095,7 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg) { if (m_movieSelectionHandler != NULL) { + m_header->getClockObject()->kill(); framebuffer->paintBackground(); //clear whole screen g_EpgData->show_mp(m_movieSelectionHandler); refresh(); From e8a4516c6de53ab7c9d4d6d050b6d37757979688 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 02/15] eventlist: fix clock Signed-off-by: Thilo Graf review required Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/099f83e819dca892026d10afd826928091332cd4 Author: TangoCash Date: 2017-05-03 (Wed, 03 May 2017) Origin message was: ------------------ -eventlist: fix clock Signed-off-by: Thilo Graf review required --- src/gui/eventlist.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index d1150a017..01e703843 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -684,6 +684,8 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna void CEventList::hide() { + if (header) + header->getClockObject()->kill(); frameBuffer->paintBackgroundBoxRel(x,y, full_width,height); } From 9ff141a81aae6564ede2ddd7336df92514547464 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 03/15] epgview: fix movieinfo Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/5b0668cc23e5ea1fc7a70468604126481062e5b9 Author: TangoCash Date: 2017-05-03 (Wed, 03 May 2017) Origin message was: ------------------ -epgview: fix movieinfo --- src/gui/epgview.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index b619f3dd6..bd2120766 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -896,9 +896,10 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start rText->setXPos(x_pos - OFFSET_INNER_MID - rText->getWidth()); rpic->doPaintBg(false); rText->doPaintBg(false); - - Bottombox->paint(false); } + + Bottombox->paint(false); + showProgressBar(); // show Timer Event Buttons From e549dcca7aa705be2f283f9d701516aff36df28e Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 04/15] eventlist,epgview: add infoviewer bottom gradient style Signed-off-by: Thilo Graf review required Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/54ce85c59876bd524fae066cc300a2115f859631 Author: TangoCash Date: 2017-05-03 (Wed, 03 May 2017) Origin message was: ------------------ -eventlist,epgview: add infoviewer bottom gradient style Signed-off-by: Thilo Graf review required --- src/gui/epgview.cpp | 4 +++- src/gui/eventlist.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index bd2120766..424fda032 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -869,7 +869,9 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start // small bottom box CComponentsFrmChain *Bottombox = new CComponentsFrmChain(sx, sy+oy-botboxheight, ox, botboxheight); - Bottombox->setColorBody(COL_MENUHEAD_PLUS_0); + Bottombox->setColorBody(COL_MENUFOOT_PLUS_0); + 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) { diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 01e703843..975615f7c 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -886,7 +886,9 @@ void CEventList::paintBottomBox(std::string _channelname_prev, std::string _chan int side_width = ((full_width - mid_width) / 2) - (2 * x_off); CComponentsFrmChain *Bottombox = new CComponentsFrmChain(x, by, full_width, botboxheight); - Bottombox->setColorBody(COL_MENUHEAD_PLUS_0); + Bottombox->setColorBody(COL_MENUFOOT_PLUS_0); + 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 (!_channelname_prev.empty()) { CComponentsPictureScalable *lpic = new CComponentsPictureScalable(x_off,CC_CENTERED,NEUTRINO_ICON_BUTTON_LEFT,Bottombox); From 5d6a052efcc98db023f7e819e40a1072f5859804 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 05/15] eventlist: fix gradient background Signed-off-by: Thilo Graf review required Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/ae0810e339fbdd8c0eb3c66300fc4b76c25caf0f Author: TangoCash Date: 2017-05-03 (Wed, 03 May 2017) Origin message was: ------------------ -eventlist: fix gradient background Signed-off-by: Thilo Graf review required --- src/gui/eventlist.cpp | 19 +++++++++++-------- src/gui/eventlist.h | 1 + 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 975615f7c..f5e573d2e 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -920,24 +920,27 @@ void CEventList::showProgressBar(int pos) epg_done= nProcentagePassed; } + if (!pb) + { int pbw = 104; int pbx = x + (full_width - pbw)/2; int pbh = botboxheight - 12; int pby = y + height -iheight - botboxheight + (botboxheight - pbh)/2; + pb = new CProgressBar(pbx, pby, pbw, pbh); + pb->setType(CProgressBar::PB_TIMESCALE); + pb->doPaintBg(false); + } + //show progressbar - if (epg_done != -1) + if (epg_done > 0) { - CProgressBar pb(pbx, pby, pbw, pbh); - pb.setType(CProgressBar::PB_TIMESCALE); - pb.setValues(epg_done, 100); - pb.paint(false); + pb->setValues(epg_done, 100); + pb->paint(true); } else { - CComponentsShapeSquare pb(pbx, pby, pbw, pbh); - pb.setColorBody(COL_MENUHEAD_PLUS_0); - pb.paint(false); + pb->hide(); } } diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 512a38cf2..10d255f73 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -104,6 +104,7 @@ class CEventList : public CListHelpers event_id_t item_event_ID; CComponentsText *cc_infozone; CComponentsHeader *header; + CProgressBar *pb; const char * unit_short_minute; void paintItem(unsigned pos, t_channel_id channel_id = 0); From c092c7642d8516bd3b64f23473c5180f7e82561b Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 06/15] eventlist: fix segfault Signed-off-by: Thilo Graf review required Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/08c48016980b637bf5e277b2da2d8f85d4f513f2 Author: TangoCash Date: 2017-05-03 (Wed, 03 May 2017) Origin message was: ------------------ -eventlist: fix segfault Signed-off-by: Thilo Graf review required --- src/gui/eventlist.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index f5e573d2e..c08d78183 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -120,12 +120,15 @@ CEventList::CEventList() oldEventID = -1; bgRightBoxPaint = false; header = NULL; + pb = NULL; } CEventList::~CEventList() { delete header; header = NULL; + delete pb; + pb = NULL; } void CEventList::UpdateTimerList(void) From a0b1d9c43f5aa11a982de20d0e22e1dd798f1def Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 07/15] CEpgData: optimize handling of header and bottom box Working with existant instances and reduce flicker effects. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/fc805049d31a1402696e3111eec883f17f2eb838 Author: Thilo Graf Date: 2017-05-03 (Wed, 03 May 2017) --- src/gui/epgview.cpp | 164 ++++++++++++++++++++++++++++---------------- src/gui/epgview.h | 7 +- 2 files changed, 111 insertions(+), 60 deletions(-) diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 424fda032..cde35d13c 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -121,17 +121,22 @@ void reformatExtendedEvents(std::string strItem, std::string strLabel, bool bUse CEpgData::CEpgData() { - bigFonts = false; - frameBuffer = CFrameBuffer::getInstance(); - tmdb_active = false; - mp_movie_info = NULL; - header = NULL; + bigFonts = false; + frameBuffer = CFrameBuffer::getInstance(); + tmdb_active = false; + mp_movie_info = NULL; + header = NULL; + Bottombox = NULL; + lpic = NULL; + rpic = NULL; + lText = NULL; + rText = NULL; + pb = NULL; } CEpgData::~CEpgData() { - delete header; - header = NULL; + ResetModules(); } 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 // header + logo - if (header) { - header->kill(); - delete header; - header = NULL; - } - - header = new CComponentsHeader(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); + if (!header){ + header = new CComponentsHeader(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); + }else + header->setDimensionsAll(sx, sy, ox, toph); 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); int showPos = 0; textCount = epgText.size(); showText(showPos, sy + toph); - // small bottom box - CComponentsFrmChain *Bottombox = new CComponentsFrmChain(sx, sy+oy-botboxheight, ox, botboxheight); - Bottombox->setColorBody(COL_MENUFOOT_PLUS_0); - 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); + // small bottom box with left/right navigation + if (!Bottombox){ + Bottombox = new CComponentsFrmChain(sx, sy+oy-botboxheight, ox, botboxheight); + Bottombox->setColorBody(COL_MENUFOOT_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; int x_off = OFFSET_INNER_MID; 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); - CComponentsPictureScalable *lpic = new CComponentsPictureScalable(x_off,CC_CENTERED,NEUTRINO_ICON_BUTTON_LEFT); - 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 ((prev_id) && (!call_fromfollowlist)) + // init left arrow + if (!lpic){ + lpic = new CComponentsPictureScalable(x_off,CC_CENTERED,NEUTRINO_ICON_BUTTON_LEFT); + lpic->doPaintBg(false); Bottombox->addCCItem(lpic); - lpic->doPaintBg(false); - lText->doPaintBg(false); + lpic->enableSaveBg(); + } + lpic->allowPaint(prev_id && !call_fromfollowlist); - CComponentsPictureScalable *rpic = new CComponentsPictureScalable(0,CC_CENTERED,NEUTRINO_ICON_BUTTON_RIGHT,Bottombox); - int x_pos = ox - rpic->getWidth() - OFFSET_INNER_MID; - if ((next_id) && (!call_fromfollowlist)) + // init right arrow + if (!rpic){ + rpic = new CComponentsPictureScalable(0,CC_CENTERED,NEUTRINO_ICON_BUTTON_RIGHT); + + rpic->doPaintBg(false); Bottombox->addCCItem(rpic); - rpic->setXPos(x_pos); - 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); - rText->setXPos(x_pos - OFFSET_INNER_MID - rText->getWidth()); - rpic->doPaintBg(false); - rText->doPaintBg(false); + rpic->enableSaveBg(); + int x_pos = ox - rpic->getWidth() - x_off; + rpic->setXPos(x_pos); + } + 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(); // 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: bigFonts = bigFonts ? false : true; + ResetModules(); frameBuffer->paintBackgroundBoxRel(sx, sy, ox, oy); showTimerEventBar (false); 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)); } - if (header) { - header->kill(); - delete header; - header = NULL; - } + ResetModules(); frameBuffer->paintBackgroundBoxRel(sx, sy, ox, oy); showTimerEventBar (false); @@ -1437,18 +1464,21 @@ int CEpgData::FollowScreenings (const t_channel_id /*channel_id*/, const std::st 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 if (epg_done != -1) { - int w = 104; - int x = sx + (ox - w)/2; - int h = botboxheight - 12; - int y = sy + oy - botboxheight + (botboxheight - h)/2; - - CProgressBar pb(x, y, w, h); - pb.setType(CProgressBar::PB_TIMESCALE); - pb.setValues(epg_done, 100); - pb.paint(false); + pb->setValues(epg_done, 100); + pb->paint(true); + }else{ + pb->hide(); } } @@ -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 // -- to be used for calls from Menue // -- (2004-03-06 rasc) diff --git a/src/gui/epgview.h b/src/gui/epgview.h index e2dd8a573..5db5cfa12 100644 --- a/src/gui/epgview.h +++ b/src/gui/epgview.h @@ -50,7 +50,11 @@ class CEpgData CChannelEventList evtlist; CChannelEventList followlist; CEPGData epgData; - CComponentsHeader* header; + CComponentsHeader *header; + CComponentsFrmChain *Bottombox; + CComponentsPictureScalable *lpic, *rpic; + CComponentsText *lText, *rText; + CProgressBar *pb; std::string epg_date; std::string epg_start; 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_mp(MI_MOVIE_INFO *mi, int mp_position = 0, int mp_duration = 0, bool doLoop = true); void hide(); + void ResetModules(); }; From d9aa5d0496ed09a3a47c9b47e084e8fae5e71810 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 08/15] eventlist,epgview: reduce header flickering picked from: https://github.com/TangoCash/neutrino-mp-cst-next commit: df6862963a9b29a4d0955b01a22e1061c312b17f Signed-off-by: Thilo Graf review reqiured Conflicts: src/gui/epgview.cpp Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/e98564c8e977b9e7ceb3d8f1bc0e45933d17fc25 Author: TangoCash Date: 2017-05-03 (Wed, 03 May 2017) Origin message was: ------------------ -eventlist,epgview: reduce header flickering picked from: https://github.com/TangoCash/neutrino-mp-cst-next commit: df6862963a9b29a4d0955b01a22e1061c312b17f Signed-off-by: Thilo Graf review reqiured Conflicts: src/gui/epgview.cpp --- src/gui/eventlist.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index c08d78183..4a429799b 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -857,14 +857,11 @@ void CEventList::paintDescription(int index) void CEventList::paintHead(t_channel_id _channel_id, std::string _channelname, std::string _channelname_prev, std::string _channelname_next) { - if (header) { - header->kill(); - delete header; - header = NULL; + if (header == NULL){ + header = new CComponentsHeader(); + header->getTextObject()->enableTboxSaveScreen(g_settings.theme.menu_Head_gradient);//enable screen save for title text if color gradient is in use } - header = new CComponentsHeader(); - header->setDimensionsAll(x, y, full_width, theight); header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0, g_settings.theme.menu_Head_gradient_direction); header->setCorner(RADIUS_LARGE, CORNER_TOP); From 08f5820f7278ea91a9e45b64cd56e4fd5195f6dc Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 09/15] CEventList: optimize handling of header and bottom box Mainly to reduce flicker effects on right/left scroll. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/43fda8bc11e58dd78ea0e4c10cd25455dfff5fe0 Author: Thilo Graf Date: 2017-05-03 (Wed, 03 May 2017) --- src/gui/eventlist.cpp | 61 +++++++++++++++++++++++++++++-------------- src/gui/eventlist.h | 2 ++ 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 4a429799b..ebb8d5e8f 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -121,14 +121,25 @@ CEventList::CEventList() bgRightBoxPaint = false; header = NULL; pb = NULL; + Bottombox = NULL; } CEventList::~CEventList() { - delete header; - header = NULL; - delete pb; - pb = NULL; + ResetModules(); +} + +void CEventList::ResetModules() +{ + if (header){ + delete header; header = NULL; + } + if (Bottombox){ + delete Bottombox; Bottombox = NULL; + } + if (pb){ + delete pb; pb = NULL; + } } void CEventList::UpdateTimerList(void) @@ -687,8 +698,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna void CEventList::hide() { - if (header) - header->getClockObject()->kill(); + ResetModules(); frameBuffer->paintBackgroundBoxRel(x,y, full_width,height); } @@ -860,20 +870,19 @@ void CEventList::paintHead(t_channel_id _channel_id, std::string _channelname, s if (header == NULL){ header = new CComponentsHeader(); header->getTextObject()->enableTboxSaveScreen(g_settings.theme.menu_Head_gradient);//enable screen save for title text if color gradient is in use + header->enableClock(true, "%H:%M", "%H %M", true); + header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0, g_settings.theme.menu_Head_gradient_direction); + header->setDimensionsAll(x, y, full_width, theight); } + //header->getClockObject()->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); - header->setDimensionsAll(x, y, full_width, theight); - header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0, g_settings.theme.menu_Head_gradient_direction); - header->setCorner(RADIUS_LARGE, CORNER_TOP); - - header->enableClock(true, "%H:%M", "%H.%M", true); - header->getClockObject()->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); - - header->getChannelLogoObject()->hide(); + if (header->isPainted()) + header->getChannelLogoObject()->hide(); header->setChannelLogo(_channel_id,_channelname); header->setCaption(_channelname,CTextBox::CENTER); header->paint(CC_SAVE_SCREEN_NO); + paintBottomBox(_channelname_prev, _channelname_next); } @@ -885,26 +894,38 @@ void CEventList::paintBottomBox(std::string _channelname_prev, std::string _chan int mid_width = full_width * 40 / 100; // 40% int side_width = ((full_width - mid_width) / 2) - (2 * x_off); - CComponentsFrmChain *Bottombox = new CComponentsFrmChain(x, by, full_width, botboxheight); - Bottombox->setColorBody(COL_MENUFOOT_PLUS_0); - 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 (!Bottombox){ + Bottombox = new CComponentsFrmChain(x, by, full_width, botboxheight); + Bottombox->setColorBody(COL_MENUFOOT_PLUS_0); + 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); + }else{ + if (Bottombox->isPainted()) + Bottombox->hideCCItems(); + Bottombox->clear(); + } if (!_channelname_prev.empty()) { CComponentsPictureScalable *lpic = new CComponentsPictureScalable(x_off,CC_CENTERED,NEUTRINO_ICON_BUTTON_LEFT,Bottombox); - CComponentsText *lText = new CComponentsText(x_off + lpic->getWidth() + OFFSET_INNER_MID, CC_CENTERED, side_width, theight, _channelname_prev, CTextBox::NO_AUTO_LINEBREAK, g_Font[font_lr], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); lpic->doPaintBg(false); + lpic->enableSaveBg(); + + CComponentsText *lText = new CComponentsText(x_off + lpic->getWidth() + OFFSET_INNER_MID, CC_CENTERED, side_width, theight, _channelname_prev, CTextBox::NO_AUTO_LINEBREAK, g_Font[font_lr], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); lText->doPaintBg(false); + lText->enableSaveBg(); } if (!_channelname_next.empty()) { CComponentsPictureScalable *rpic = new CComponentsPictureScalable(0,CC_CENTERED,NEUTRINO_ICON_BUTTON_RIGHT,Bottombox); int x_pos = full_width - rpic->getWidth() - OFFSET_INNER_MID; + rpic->doPaintBg(false); rpic->setXPos(x_pos); + rpic->enableSaveBg(); + CComponentsText *rText = new CComponentsText(0, CC_CENTERED, side_width, theight, _channelname_next, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, g_Font[font_lr], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); rText->setXPos(x_pos - OFFSET_INNER_MID - rText->getWidth()); - rpic->doPaintBg(false); rText->doPaintBg(false); + rText->enableSaveBg(); } Bottombox->paint(false); diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 10d255f73..8b81aefb5 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -105,6 +105,7 @@ class CEventList : public CListHelpers CComponentsText *cc_infozone; CComponentsHeader *header; CProgressBar *pb; + CComponentsFrmChain *Bottombox; const char * unit_short_minute; void paintItem(unsigned pos, t_channel_id channel_id = 0); @@ -127,6 +128,7 @@ class CEventList : public CListHelpers CEventList(); ~CEventList(); int exec(const t_channel_id channel_id, const std::string& channelname, const std::string& prev = "", const std::string& next = "", const CChannelEventList &followlist = CChannelEventList ()); // UTF-8 + void ResetModules(); }; class CEventListHandler : public CMenuTarget From fd43f9e123867c3857203c3b34701906a1c284b9 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 10/15] Revert "-cc_form_header: add max caption width" This reverts commit 9bbc06f3aefde0e7cf4ecfa545bf2ccf09808952. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/cb02d6253d699d3105286aa2c4462aa43c24b958 Author: Thilo Graf Date: 2017-05-03 (Wed, 03 May 2017) --- src/gui/components/cc_frm_header.cpp | 3 --- src/gui/components/cc_frm_header.h | 4 ---- 2 files changed, 7 deletions(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index c633c74b9..fff49031a 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -144,8 +144,6 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const cch_cl_sec_format = cch_cl_format; cch_cl_enable_run = false; - cch_text_max_w = width; - addContextButton(buttons); initCCItems(); initParent(parent); @@ -564,7 +562,6 @@ void CComponentsHeader::initCaption() cch_cl_obj->allowPaint(cch_cl_enable); } - cc_text_w = min(cc_text_w,cch_text_max_w); //create cch_text_obj and add to collection if (cch_text_obj == NULL){ diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index 16fa2ddd1..9550d1134 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -106,8 +106,6 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen int cch_icon_w; ///property: internal width for clock object int cch_clock_w; - ///property: internal max width for text object - int cch_text_max_w; ///property: internal x-position for caption object int cch_text_x; ///property: internal offset of context button icons within context button object @@ -193,8 +191,6 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen virtual Font* getCaptionFont(){return cch_font;} ///set text color for caption virtual void setCaptionColor(fb_pixel_t text_color){cch_col_text = text_color;} - ///set max width for caption - virtual void setCaptionMaxWidth(int max_width){cch_text_max_w = max_width;} enum { From 639a56b84550bca541c0dcef31e601c24a60a2c9 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 11/15] CComponentsHeader: optimize logo size/position handling Prevent oversized paint with stupid screen and/or font size settings Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/18fb99688c62d7c35a527fa14d98ae9f2330ae06 Author: Thilo Graf Date: 2017-05-03 (Wed, 03 May 2017) --- src/gui/components/cc_frm_header.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index fff49031a..f6e20c5a0 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -277,10 +277,13 @@ void CComponentsHeader::initLogo() int h_logo = cch_logo.dy_max == -1 ? height - 2*OFFSET_INNER_MIN : cch_logo.dy_max; if(!cch_logo_obj) - cch_logo_obj = new CComponentsChannelLogoScalable(width/2, height/2 - h_logo/2, cch_logo.Name, cch_logo.Id, this); + cch_logo_obj = new CComponentsChannelLogoScalable(1, height/2 - h_logo/2, cch_logo.Name, cch_logo.Id, this); else cch_logo_obj->setChannel(cch_logo.Id, cch_logo.Name); + // use value 1 as initial value for logo width, ensures downscale with stupid available logo space + cch_logo_obj->setHeight(1, true); + //ensure logo is not larger than original size if in auto mode if (cch_logo.dy_max == -1){ int dx_orig = 0, dy_orig = 0 ; @@ -289,6 +292,7 @@ void CComponentsHeader::initLogo() h_logo = dy_orig; } + //cch_logo_obj->setWidth(1, true); if (cch_logo_obj->hasLogo()){ cch_logo_obj->setHeight(h_logo, true); @@ -533,7 +537,7 @@ void CComponentsHeader::initCaption() cch_btn_obj->setXPos(width - buttons_w); //set required width of caption object - cc_text_w -= (buttons_w + cch_offset); + cc_text_w -= buttons_w; } //clock @@ -548,7 +552,7 @@ void CComponentsHeader::initCaption() cch_cl_obj->setXPos(width - buttons_w - clock_w); //set required width of caption object - cc_text_w -= (clock_w + cch_offset); + cc_text_w -= clock_w; //stop clock if disabled or option run is disabled and clock is running if (cch_cl_enable){ From 2eefbfab7a0ef300bbbaf7137e614b577b44e48a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 3 May 2017 21:29:41 +0200 Subject: [PATCH 12/15] CChannelList: rework details line handling, fix hide() after setup Detailsline is handling hide() by itself. After channellist setup, eg. switching additional infos and channellist window has different size, artefacts were possible. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/81001410f3264115d24c19be61f05838d6d0aba6 Author: Thilo Graf Date: 2017-05-03 (Wed, 03 May 2017) --- src/gui/channellist.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index e03acf7e8..32d70dbd8 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -439,8 +439,9 @@ int CChannelList::doChannelMenu(void) previous_channellist_additional = g_settings.channellist_additional; COsdSetup osd_setup; osd_setup.showContextChanlistMenu(this); - //FIXME check font/options changed ? hide(); + ResetModules(); + //FIXME check font/options changed ? calcSize(); ret = -1; } @@ -955,7 +956,11 @@ void CChannelList::hide() header->kill(); frameBuffer->paintBackgroundBoxRel(x, y, full_width, height + OFFSET_INTER + info_height); - clearItem2DetailsLine(); + + //remove details line + if (dline) + dline->kill(); + CInfoClock::getInstance()->enableInfoClock(!CInfoClock::getInstance()->isBlocked()); } @@ -1637,12 +1642,6 @@ void CChannelList::clearItem2DetailsLine() void CChannelList::paintItem2DetailsLine (int pos) { - if (dline){ - dline->kill(); //kill details line - delete dline; - dline = NULL; - } - if (!g_settings.channellist_show_infobox) return; @@ -1652,9 +1651,15 @@ void CChannelList::paintItem2DetailsLine (int pos) // paint Line if detail info (and not valid list pos) if (pos >= 0) { - if (dline == NULL) + if (!dline){ dline = new CComponentsDetailsLine(xpos, ypos1, ypos2, fheight/2, info_height-RADIUS_LARGE*2); - dline->paint(false); + }else{ + dline->setPos(xpos, ypos1); + dline->setYPosDown(ypos2); + dline->setHMarkTop(fheight/2); + dline->setHMarkDown(info_height-RADIUS_LARGE*2); + } + dline->paint(); } } From 929a561c3d96d9394e8e7922ca07f63abe11346a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 4 May 2017 16:30:37 +0200 Subject: [PATCH 13/15] CMovieBrowser: prevent possible segfault Clock is disabled, will crash here. comes with: b3ecc2b65c531946fba6009c096f97f5193095c1 Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/329fad5545766d94138b16334a74a9872366f650 Author: Thilo Graf Date: 2017-05-04 (Thu, 04 May 2017) --- src/gui/moviebrowser/mb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index df586ca19..9fdc4f188 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -2095,7 +2095,7 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg) { if (m_movieSelectionHandler != NULL) { - m_header->getClockObject()->kill(); + m_header->kill(); framebuffer->paintBackground(); //clear whole screen g_EpgData->show_mp(m_movieSelectionHandler); refresh(); From 4d00d397317bd6276d7689cf283ba308738a2d0f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 4 May 2017 16:52:30 +0200 Subject: [PATCH 14/15] CEpgData: fix header size Header height was bound to font size in previous versions, but new header is using other font as default, so we have wrong height, therefore header items could paint outside of header. This should fix this. In future we should unify header size with other windows. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/23912ba583582224750a3a4c148cfe5a0b97b372 Author: Thilo Graf Date: 2017-05-04 (Thu, 04 May 2017) --- src/gui/epgview.cpp | 4 +++- src/gui/epgview.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index cde35d13c..4defc0a8a 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -132,6 +132,7 @@ CEpgData::CEpgData() lText = NULL; rText = NULL; pb = NULL; + font_title = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]; } CEpgData::~CEpgData() @@ -144,7 +145,7 @@ void CEpgData::start() ox = frameBuffer->getScreenWidthRel(bigFonts ? false /* big */ : true /* small */); oy = frameBuffer->getScreenHeightRel(bigFonts ? false /* big */ : true /* small */); - topheight = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]->getHeight(); + topheight = font_title->getHeight(); topboxheight = topheight + 6; botboxheight = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->getHeight() + 6; buttonheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getHeight() + 6; @@ -848,6 +849,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start // header + logo if (!header){ header = new CComponentsHeader(sx, sy, ox, toph); + header->setCaptionFont(font_title); 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); diff --git a/src/gui/epgview.h b/src/gui/epgview.h index 5db5cfa12..44de63c05 100644 --- a/src/gui/epgview.h +++ b/src/gui/epgview.h @@ -55,6 +55,7 @@ class CEpgData CComponentsPictureScalable *lpic, *rpic; CComponentsText *lText, *rText; CProgressBar *pb; + Font *font_title; std::string epg_date; std::string epg_start; std::string epg_end; From 242c20c467f907ea92646d61a9536672a87c4976 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 4 May 2017 19:45:11 +0200 Subject: [PATCH 15/15] CEpgData: supplement to 'fix header size' commit: 7583714e6703a7ae9591e112726759c4070d0c68 Permanent font init is required to avoid possible crash after changed font settings by user. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/17958da28fc32fc857066000456e0c6af90099e7 Author: Thilo Graf Date: 2017-05-04 (Thu, 04 May 2017) --- src/gui/epgview.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 4defc0a8a..980b6acec 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -132,7 +132,7 @@ CEpgData::CEpgData() lText = NULL; rText = NULL; pb = NULL; - font_title = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]; + font_title = NULL; } CEpgData::~CEpgData() @@ -145,6 +145,7 @@ void CEpgData::start() ox = frameBuffer->getScreenWidthRel(bigFonts ? false /* big */ : true /* small */); oy = frameBuffer->getScreenHeightRel(bigFonts ? false /* big */ : true /* small */); + font_title = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]; topheight = font_title->getHeight(); topboxheight = topheight + 6; botboxheight = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->getHeight() + 6; @@ -849,13 +850,13 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start // header + logo if (!header){ header = new CComponentsHeader(sx, sy, ox, toph); - header->setCaptionFont(font_title); 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); }else header->setDimensionsAll(sx, sy, ox, toph); + header->setCaptionFont(font_title); header->setCaption(epgData.title); if (header->isPainted())