mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 00:11:08 +02:00
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 <dbt@novatux.de>
review reqiured
Origin commit data
------------------
Branch: ni/coolstream
Commit: 3ac2f99a67
Author: TangoCash <eric@loxat.de>
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 <dbt@novatux.de>
review reqiured
------------------
This commit was generated by Migit
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user