mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 00:11:08 +02:00
src/gui/epgview.cpp: optimize text arrangement for tmdb/imdb
Origin commit data
------------------
Branch: ni/coolstream
Commit: ef03c4d739
Author: Thilo Graf <dbt@novatux.de>
Date: 2018-04-29 (Sun, 29 Apr 2018)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -241,10 +241,7 @@ void CEpgData::processTextToArray(std::string text, int screening, bool has_cove
|
|||||||
|
|
||||||
void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear)
|
void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear)
|
||||||
{
|
{
|
||||||
// recalculate
|
Font* font = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2];
|
||||||
medlineheight = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]->getHeight();
|
|
||||||
medlinecount = sb / medlineheight;
|
|
||||||
|
|
||||||
std::string cover = "/tmp/tmdb.jpg"; //todo: maybe add a getCover()-function to tmdb class
|
std::string cover = "/tmp/tmdb.jpg"; //todo: maybe add a getCover()-function to tmdb class
|
||||||
int cover_max_width = ox/4; //25%
|
int cover_max_width = ox/4; //25%
|
||||||
int cover_max_height = sb-(2*OFFSET_INNER_MID);
|
int cover_max_height = sb-(2*OFFSET_INNER_MID);
|
||||||
@@ -271,13 +268,13 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear)
|
|||||||
const char tok = ' ';
|
const char tok = ' ';
|
||||||
int offset = 0, count = 0;
|
int offset = 0, count = 0;
|
||||||
int max_mon_w = 0, max_wday_w = 0;
|
int max_mon_w = 0, max_wday_w = 0;
|
||||||
int digi = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getRenderWidth("29..");
|
int digi = font->getRenderWidth("29..");
|
||||||
|
|
||||||
for(int i = 0; i < 12;i++){
|
for(int i = 0; i < 12;i++){
|
||||||
max_mon_w = std::max(max_mon_w, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getRenderWidth(std::string(g_Locale->getText(CLocaleManager::getMonth(i))) + " "));
|
max_mon_w = std::max(max_mon_w, font->getRenderWidth(std::string(g_Locale->getText(CLocaleManager::getMonth(i))) + " "));
|
||||||
if(i > 6)
|
if(i > 6)
|
||||||
continue;
|
continue;
|
||||||
max_wday_w = std::max(max_wday_w, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getRenderWidth(std::string(g_Locale->getText(CLocaleManager::getWeekday(i))) + " "));
|
max_wday_w = std::max(max_wday_w, font->getRenderWidth(std::string(g_Locale->getText(CLocaleManager::getWeekday(i))) + " "));
|
||||||
}
|
}
|
||||||
int offs = fullClear ? 0 : cover_offset;
|
int offs = fullClear ? 0 : cover_offset;
|
||||||
frameBuffer->paintBoxRel(sx+offs, y, ox-SCROLLBAR_WIDTH-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
|
||||||
@@ -289,6 +286,9 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// recalculate
|
||||||
|
medlineheight = font->getHeight();
|
||||||
|
|
||||||
// show ranking
|
// show ranking
|
||||||
if ((stars > 0 || imdb_stars > 0) && (tmdb_active || imdb_active) && startPos == 0)
|
if ((stars > 0 || imdb_stars > 0) && (tmdb_active || imdb_active) && startPos == 0)
|
||||||
{
|
{
|
||||||
@@ -308,12 +308,15 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear)
|
|||||||
rate_bar.paint();
|
rate_bar.paint();
|
||||||
|
|
||||||
if (imdb_active) //TODO: unify imdb and tmdb
|
if (imdb_active) //TODO: unify imdb and tmdb
|
||||||
paintTextBoxRel(imdb_rating, sx + 2*OFFSET_INNER_MID + cover_offset + rate_bar.getWidth(), y + OFFSET_INNER_MID, rate_bar.getHeight());
|
paintTextBoxRel(imdb_rating, sx + 2*OFFSET_INNER_MID + cover_offset + rate_bar.getWidth(), y + OFFSET_INNER_MID + rate_bar.getHeight()/2 - font->getHeight()/2, 0, rate_bar.getHeight(), font );
|
||||||
|
|
||||||
|
medlinecount = (sb - rate_bar.getHeight() - 2*OFFSET_INNER_MID) / medlineheight;
|
||||||
|
y = rate_bar.getYPos() + rate_bar.getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
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){ // screening
|
||||||
std::string::size_type pos1 = epgText[i].first.find_first_not_of(tok, 0);
|
std::string::size_type pos1 = epgText[i].first.find_first_not_of(tok, 0);
|
||||||
std::string::size_type pos2 = epgText[i].first.find_first_of(tok, pos1);
|
std::string::size_type pos2 = epgText[i].first.find_first_of(tok, pos1);
|
||||||
while( pos2 != std::string::npos || pos1 != std::string::npos ){
|
while( pos2 != std::string::npos || pos1 != std::string::npos ){
|
||||||
@@ -328,7 +331,7 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear)
|
|||||||
offset += digi;
|
offset += digi;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
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);
|
font->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++;
|
count++;
|
||||||
pos1 = epgText[i].first.find_first_not_of(tok, pos2);
|
pos1 = epgText[i].first.find_first_not_of(tok, pos2);
|
||||||
pos2 = epgText[i].first.find_first_of(tok, pos1);
|
pos2 = epgText[i].first.find_first_of(tok, pos1);
|
||||||
@@ -336,7 +339,7 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear)
|
|||||||
offset = 0;
|
offset = 0;
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
else{
|
else{ // epgtext
|
||||||
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);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -275,7 +275,6 @@ bool cTmdb::GetMovieDetails(std::string lang)
|
|||||||
std::string cTmdb::CreateEPGText()
|
std::string cTmdb::CreateEPGText()
|
||||||
{
|
{
|
||||||
std::string epgtext;
|
std::string epgtext;
|
||||||
epgtext += "\n";
|
|
||||||
epgtext += "Vote: "+minfo.vote_average.substr(0,3)+"/10 Votecount: "+to_string(minfo.vote_count)+"\n";
|
epgtext += "Vote: "+minfo.vote_average.substr(0,3)+"/10 Votecount: "+to_string(minfo.vote_count)+"\n";
|
||||||
epgtext += "\n";
|
epgtext += "\n";
|
||||||
epgtext += minfo.overview+"\n";
|
epgtext += minfo.overview+"\n";
|
||||||
|
Reference in New Issue
Block a user