Merge remote-tracking branch 'tuxbox/master'

Origin commit data
------------------
Branch: ni/coolstream
Commit: d1f5ea76a0
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2017-08-26 (Sat, 26 Aug 2017)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2017-08-26 12:58:44 +02:00
178 changed files with 5770 additions and 3336 deletions

View File

@@ -121,17 +121,19 @@ 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;
pb = NULL;
font_title = NULL;
}
CEpgData::~CEpgData()
{
delete header;
header = NULL;
ResetModules();
}
void CEpgData::start()
@@ -139,7 +141,8 @@ 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();
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;
buttonheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getHeight() + 6;
@@ -196,7 +199,7 @@ void CEpgData::processTextToArray(std::string text, int screening, bool has_cove
// check the wordwidth - add to this line if size ok
int aktWordWidth = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getRenderWidth(aktWord);
if ((aktWordWidth+aktWidth)<(ox - 2*OFFSET_INNER_MID - 15 - (has_cover ? ((ox/4)+OFFSET_INNER_MID) : 0)))
if ((aktWordWidth+aktWidth)<(ox - 2*OFFSET_INNER_MID - SCROLLBAR_WIDTH - (has_cover ? ((ox/4)+OFFSET_INNER_MID) : 0)))
{//space ok, add
aktWidth += aktWordWidth;
aktLine += aktWord;
@@ -267,12 +270,12 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear)
max_wday_w = std::max(max_wday_w, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getRenderWidth(std::string(g_Locale->getText(CLocaleManager::getWeekday(i))) + " "));
}
int offs = fullClear ? 0 : cover_offset;
frameBuffer->paintBoxRel(sx+offs, y, ox-15-offs, sb, COL_MENUCONTENT_PLUS_0); // background of the text box
frameBuffer->paintBoxRel(sx+offs, y, ox-SCROLLBAR_WIDTH-offs, sb, COL_MENUCONTENT_PLUS_0); // background of the text box
if (has_cover) {
if (!g_PicViewer->DisplayImage(cover ,sx+OFFSET_INNER_MID ,y+OFFSET_INNER_MID+((sb-cover_height)/2), cover_width, cover_height, CFrameBuffer::TM_NONE)) {
cover_offset = 0;
frameBuffer->paintBoxRel(sx, y, ox-15, sb, COL_MENUCONTENT_PLUS_0); // background of the text box
frameBuffer->paintBoxRel(sx, y, ox-SCROLLBAR_WIDTH, sb, COL_MENUCONTENT_PLUS_0); // background of the text box
}
}
int logo_offset = 0;
@@ -309,7 +312,7 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear)
offset += digi;
break;
}
g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->RenderString(sx+OFFSET_INNER_MID+offset, y+medlineheight, ox- 15- 15, epgText[i].first.substr(pos1, pos2 - pos1), (epgText[i].second==2)? COL_MENUCONTENTINACTIVE_TEXT: COL_MENUCONTENT_TEXT);
g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->RenderString(sx+OFFSET_INNER_MID+offset, y+medlineheight, ox - SCROLLBAR_WIDTH - 2*OFFSET_INNER_MID - offset, epgText[i].first.substr(pos1, pos2 - pos1), (epgText[i].second==2)? COL_MENUCONTENTINACTIVE_TEXT: COL_MENUCONTENT_TEXT);
count++;
pos1 = epgText[i].first.find_first_not_of(tok, pos2);
pos2 = epgText[i].first.find_first_of(tok, pos1);
@@ -318,17 +321,14 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear)
count = 0;
}
else{
g_Font[( i< info1_lines ) ?SNeutrinoSettings::FONT_TYPE_EPG_INFO1:SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->RenderString(sx+OFFSET_INNER_MID+cover_offset, y+medlineheight, ox-15-15-cover_offset, epgText[i].first, COL_MENUCONTENT_TEXT);
g_Font[( i< info1_lines ) ?SNeutrinoSettings::FONT_TYPE_EPG_INFO1:SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->RenderString(sx+OFFSET_INNER_MID+cover_offset, y+medlineheight, ox - SCROLLBAR_WIDTH - 2*OFFSET_INNER_MID - cover_offset, epgText[i].first, COL_MENUCONTENT_TEXT);
}
}
int sbc = ((textSize - 1)/ medlinecount) + 1;
int sbs= (startPos+ 1)/ medlinecount;
if (sbc < 1)
sbc = 1;
frameBuffer->paintBoxRel(sx+ ox- 15, ypos, 15, sb, COL_SCROLLBAR_PASSIVE_PLUS_0); // scrollbar bg
frameBuffer->paintBoxRel(sx+ ox- 13, ypos+ 2+ sbs*(sb-4)/sbc , 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0); // scrollbar
int total_pages;
int current_page;
getScrollBarData(&total_pages, &current_page, textSize, medlinecount, startPos + 1);
paintScrollBar(sx + ox - SCROLLBAR_WIDTH, ypos, SCROLLBAR_WIDTH, sb, total_pages, current_page);
}
#define GENRE_MOVIE_COUNT 9
@@ -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
@@ -878,62 +848,48 @@ 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 = new CComponentsHeader();
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->setDimensionsAll(sx, sy, ox, header_h);
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->setDimensionsAll(sx, sy, ox, toph);
header->setCaptionFont(font_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);
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);
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;
// small bottom box with left/right navigation
if (!Bottombox)
Bottombox = new CNaviBar(sx, sy+oy-botboxheight, ox, botboxheight);
if (!mp_info){
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);
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);
}
Bottombox->enableArrows(prev_id && !call_fromfollowlist, next_id && !call_fromfollowlist);
Bottombox->setText(fromto, epg_date);
}
//paint bottombox contents
Bottombox->paint(false);
showProgressBar();
// show Timer Event Buttons
@@ -1246,6 +1202,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();
@@ -1309,8 +1266,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;
}
@@ -1323,6 +1278,8 @@ void CEpgData::hide()
g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->setSize((int)(g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getSize() / BIGFONT_FACTOR));
}
ResetModules();
frameBuffer->paintBackgroundBoxRel(sx, sy, ox, oy);
showTimerEventBar (false);
}
@@ -1465,18 +1422,21 @@ int CEpgData::FollowScreenings (const t_channel_id /*channel_id*/, const std::st
void CEpgData::showProgressBar()
{
int w = ox/10;
int x = sx + (ox - w)/2;
int h = botboxheight - 2*OFFSET_INNER_SMALL;
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();
}
}
@@ -1551,6 +1511,19 @@ 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;
}
if (pb){
delete pb; pb = NULL;
}
}
// -- EPG Data Viewer Menu Handler Class
// -- to be used for calls from Menue
// -- (2004-03-06 rasc)