mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user