gui/epgview.cpp: attribute with TMDB logo along with stars

Origin commit data
------------------
Branch: ni/coolstream
Commit: 7680cf156f
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2016-03-07 (Mon, 07 Mar 2016)


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

------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2016-03-07 14:34:29 +03:00
parent 69a694dc76
commit d147433da9
2 changed files with 33 additions and 33 deletions

View File

@@ -165,7 +165,7 @@ void CEpgData::addTextToArray(const std::string & text, int screening) // UTF-8
} }
} }
void CEpgData::processTextToArray(std::string text, int screening) // UTF-8 void CEpgData::processTextToArray(std::string text, int screening, bool has_cover) // UTF-8
{ {
std::string aktLine = ""; std::string aktLine = "";
std::string aktWord = ""; std::string aktWord = "";
@@ -185,7 +185,7 @@ void CEpgData::processTextToArray(std::string text, int screening) // UTF-8
// check the wordwidth - add to this line if size ok // check the wordwidth - add to this line if size ok
int aktWordWidth = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getRenderWidth(aktWord); int aktWordWidth = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getRenderWidth(aktWord);
if ((aktWordWidth+aktWidth)<(ox - 20 - 15 - (tmdbtoggle? (std::min((sb-10)*342/513,342)) :0))) if ((aktWordWidth+aktWidth)<(ox - 20 - 15 - (has_cover? (std::min((sb-10)*342/513,342)) :0)))
{//space ok, add {//space ok, add
aktWidth += aktWordWidth; aktWidth += aktWordWidth;
aktLine += aktWord; aktLine += aktWord;
@@ -220,7 +220,7 @@ void CEpgData::processTextToArray(std::string text, int screening) // UTF-8
addTextToArray( aktLine + aktWord, screening ); addTextToArray( aktLine + aktWord, screening );
} }
void CEpgData::showText( int startPos, int ypos, bool cover, bool fullClear) void CEpgData::showText(int startPos, int ypos, bool cover, bool fullClear)
{ {
// recalculate // recalculate
medlineheight = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]->getHeight(); medlineheight = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]->getHeight();
@@ -243,12 +243,28 @@ void CEpgData::showText( int startPos, int ypos, bool cover, bool fullClear)
} }
int offs = fullClear ? 0 : cover_offset; 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-15-offs, sb, COL_MENUCONTENT_PLUS_0); // background of the text box
if (cover) { if (cover) {
if (!g_PicViewer->DisplayImage("/tmp/tmdb.jpg",sx+3,y+3+((sb-cover_height)/2),cover_width,cover_height, 1)) { if (!g_PicViewer->DisplayImage("/tmp/tmdb.jpg",sx+3,y+3+((sb-cover_height)/2),cover_width,cover_height, CFrameBuffer::TM_NONE)) {
cover_offset = 0; cover_offset = 0;
frameBuffer->paintBoxRel(sx, y, ox-15, sb, COL_MENUCONTENT_PLUS_0); // background of the text box frameBuffer->paintBoxRel(sx, y, ox-15, sb, COL_MENUCONTENT_PLUS_0); // background of the text box
} }
} }
int logo_offset = 0;
if (tmdbtoggle && startPos == 0) {
int icon_w,icon_h;
frameBuffer->getIconSize(NEUTRINO_ICON_TMDB, &icon_w, &icon_h);
frameBuffer->paintIcon(NEUTRINO_ICON_TMDB, sx+10+cover_offset, ypos+5);
logo_offset = icon_w + 10;
}
if (stars > 0 && startPos == 0) {
int icon_w,icon_h;
frameBuffer->getIconSize(NEUTRINO_ICON_STAR_OFF, &icon_w, &icon_h);
for (int i = 0; i < 10; i++)
frameBuffer->paintIcon(NEUTRINO_ICON_STAR_OFF, sx+10+cover_offset+logo_offset + i*(icon_w+3), y+3);
for (int i = 0; i < stars; i++)
frameBuffer->paintIcon(NEUTRINO_ICON_STAR_ON, sx+10+cover_offset+logo_offset + i*(icon_w+3), y+3);
}
for (int i = startPos; i < textSize && i < startPos + medlinecount; i++, y += medlineheight) for (int i = startPos; i < textSize && i < startPos + medlinecount; i++, y += medlineheight)
{ {
if(epgText[i].second){ if(epgText[i].second){
@@ -279,14 +295,6 @@ void CEpgData::showText( int startPos, int ypos, bool cover, bool fullClear)
} }
} }
if (stars > 0 && startPos == 0){
int icon_w,icon_h;
frameBuffer->getIconSize(NEUTRINO_ICON_STAR_OFF, &icon_w, &icon_h);
for (int i = 0; i < 10; i++)
frameBuffer->paintIcon(NEUTRINO_ICON_STAR_OFF, sx+10+cover_offset + i*(icon_w+3), ypos+3);
for (int i = 0; i < stars; i++)
frameBuffer->paintIcon(NEUTRINO_ICON_STAR_ON, sx+10+cover_offset + i*(icon_w+3), ypos+3);
}
int sbc = ((textSize - 1)/ medlinecount) + 1; int sbc = ((textSize - 1)/ medlinecount) + 1;
int sbs= (startPos+ 1)/ medlinecount; int sbs= (startPos+ 1)/ medlinecount;
@@ -800,11 +808,12 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start
break; break;
case CRCInput::RC_up: case CRCInput::RC_up:
showPos -= scrollCount; if (showPos > 0) {
if (showPos<0) showPos -= scrollCount;
showPos=0; if (showPos < 0)
else showPos = 0;
showText(showPos, sy + toph, tmdbtoggle, false); showText(showPos, sy + toph, tmdbtoggle, false);
}
break; break;
case CRCInput::RC_page_up: case CRCInput::RC_page_up:
if(isCurrentEPG(channel_id)){ if(isCurrentEPG(channel_id)){
@@ -911,31 +920,22 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start
break; break;
case CRCInput::RC_info: case CRCInput::RC_info:
{ {
showPos = 0;
if (!tmdbtoggle) { if (!tmdbtoggle) {
cTmdb* tmdb = new cTmdb(epgData.title); cTmdb* tmdb = new cTmdb(epgData.title);
if ((tmdb->getResults() > 0) && (!tmdb->getDescription().empty())) { if ((tmdb->getResults() > 0) && (!tmdb->getDescription().empty())) {
epgText_saved = epgText; epgText_saved = epgText;
epgText.clear(); epgText.clear();
if (tmdb->hasCover()) { tmdbtoggle = !tmdbtoggle;
tmdbtoggle = !tmdbtoggle; processTextToArray(tmdb->CreateEPGText(), 0, tmdb->hasCover());
processTextToArray(tmdb->CreateEPGText()); textCount = epgText.size();
textCount = epgText.size(); stars = tmdb->getStars();
stars = tmdb->getStars(); showText(showPos, sy + toph, tmdbtoggle);
showText(showPos, sy + toph, tmdbtoggle);
} else {
processTextToArray(tmdb->CreateEPGText());
textCount = epgText.size();
stars = tmdb->getStars();
showText(showPos, sy + toph, tmdbtoggle);
tmdbtoggle = !tmdbtoggle;
}
} else { } else {
ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_EPGVIEWER_NODETAILED, CMessageBox::mbrOk , CMessageBox::mbrOk); ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_EPGVIEWER_NODETAILED, CMessageBox::mbrOk , CMessageBox::mbrOk);
} }
if (tmdb) delete tmdb;
delete tmdb;
} else { } else {
epgText.clear();
epgText = epgText_saved; epgText = epgText_saved;
textCount = epgText.size(); textCount = epgText.size();
stars=0; stars=0;

View File

@@ -86,7 +86,7 @@ class CEpgData
void GetEPGData(const t_channel_id channel_id, uint64_t id, time_t* startzeit, bool clear = true ); void GetEPGData(const t_channel_id channel_id, uint64_t id, time_t* startzeit, bool clear = true );
void GetPrevNextEPGData( uint64_t id, time_t* startzeit ); void GetPrevNextEPGData( uint64_t id, time_t* startzeit );
void addTextToArray( const std::string & text, int screening ); void addTextToArray( const std::string & text, int screening );
void processTextToArray(std::string text, int screening = 0); void processTextToArray(std::string text, int screening = 0, bool has_cover = false);
void showText( int startPos, int ypos, bool cover=false, bool fullClear=true ); void showText( int startPos, int ypos, bool cover=false, bool fullClear=true );
bool hasFollowScreenings(const t_channel_id channel_id, const std::string & title); bool hasFollowScreenings(const t_channel_id channel_id, const std::string & title);
int FollowScreenings(const t_channel_id channel_id, const std::string & title); int FollowScreenings(const t_channel_id channel_id, const std::string & title);