-add movieplayer icons to infoviewer

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@820 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
satbaby
2010-10-05 17:15:22 +00:00
parent 3d66446def
commit 34084de56f
4 changed files with 534 additions and 534 deletions

View File

@@ -54,7 +54,6 @@
#include <gui/customcolor.h>
#include <gui/pictureviewer.h>
#include <sys/timeb.h>
#include <time.h>
#include <sys/param.h>
@@ -76,22 +75,10 @@ extern t_channel_id live_channel_id; //zapit
#define COL_INFOBAR_BUTTONS_BACKGROUND (COL_INFOBAR_SHADOW_PLUS_1)
#define LEFT_OFFSET 5
#define ASIZE 100
#define LCD_UPDATE_TIME_TV_MODE (60 * 1000 * 1000)
int time_left_width;
int time_dot_width;
int time_width;
int time_height;
int info_time_width;
bool newfreq = true;
char old_timestr[10];
static event_id_t last_curr_id = 0, last_next_id = 0;
int bottom_bar_offset;
extern CZapitClient::SatelliteList satList;
static bool sortByDateTime (const CChannelEvent& a, const CChannelEvent& b)
@@ -100,26 +87,11 @@ static bool sortByDateTime (const CChannelEvent& a, const CChannelEvent& b)
}
extern int timeshift;
extern unsigned char file_prozent;
extern std::string g_file_epg;
extern std::string g_file_epg1;
extern bool autoshift;
extern uint32_t shift_timer;
#define RED_BAR 40
#define YELLOW_BAR 70
#define GREEN_BAR 100
#define BAR_BORDER 1
#define BAR_WIDTH 72 //(68+BAR_BORDER*2)
#define BAR_HEIGHT 12 //(13 + BAR_BORDER*2)
#define TIME_BAR_HEIGHT 12
// InfoViewer: H 63 W 27
#define NUMBER_H 63
#define NUMBER_W 27
extern char act_emu_str[20];
extern std::string ext_channel_name;
int m_CA_Status;
extern bool timeset;
extern unsigned char file_prozent;
CInfoViewer::CInfoViewer ()
{
@@ -141,8 +113,8 @@ void CInfoViewer::Init()
showButtonBar = false;
//gotTime = g_Sectionsd->getIsTimeSet ();
gotTime = timeset;
CA_Status = false;
virtual_zap_mode = false;
newfreq = true;
chanready = 1;
fileplay = 0;
@@ -239,38 +211,45 @@ void CInfoViewer::start ()
BBarY = BoxEndY + bottom_bar_offset;
BBarFontY = BBarY + InfoHeightY_Info - (InfoHeightY_Info - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()) / 2; /* center in buttonbar */
/* ChanNameX gets modified in showChannelLogo(), so we initialize it in showTitle()
ChanNameX = BoxStartX + ChanWidth + SHADOW_OFFSET;
*/
ChanNameY = BoxStartY + (ChanHeight / 2) + SHADOW_OFFSET; //oberkante schatten?
ChanInfoX = BoxStartX + (ChanWidth / 3);
/* assuming all color icons must have same size */
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h);
asize = (BoxEndX - (2*icon_large_width + 2*icon_small_width + 4*2) - 102) - ChanInfoX;
asize = asize - (icol_w+6)*4;
asize = asize / 4;
time_height = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getHeight()+5;
time_left_width = 2 * g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getWidth(); /* still a kludge */
time_dot_width = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth(":");
time_width = time_left_width* 2+ time_dot_width;
const int lcd_update_time_tv_mode = (60 * 1000 * 1000);
if (lcdUpdateTimer == 0)
lcdUpdateTimer = g_RCInput->addTimer (LCD_UPDATE_TIME_TV_MODE, false, true);
lcdUpdateTimer = g_RCInput->addTimer (lcd_update_time_tv_mode, false, true);
}
void CInfoViewer::changePB()
{
const short red_bar = 40;
const short yellow_bar = 70;
const short green_bar = 100;
if (sigscale != NULL)
delete sigscale;
sigscale = new CProgressBar(true, BAR_WIDTH, 10, RED_BAR, GREEN_BAR, YELLOW_BAR);
sigscale = new CProgressBar(true, bar_width, 10, red_bar, green_bar, yellow_bar);
if (snrscale != NULL)
delete snrscale;
snrscale = new CProgressBar(true, BAR_WIDTH, 10, RED_BAR, GREEN_BAR, YELLOW_BAR);
snrscale = new CProgressBar(true, bar_width, 10, red_bar, green_bar, yellow_bar);
if (hddscale != NULL)
delete hddscale;
hddscale = new CProgressBar(true, 100, 6, 50, GREEN_BAR, 75, true);
hddscale = new CProgressBar(true, 100, 6, 50, green_bar, 75, true);
if (varscale != NULL)
delete varscale;
varscale = new CProgressBar(true, 100, 6, 50, GREEN_BAR, 75, true);
varscale = new CProgressBar(true, 100, 6, 50, green_bar, 75, true);
if (timescale != NULL)
delete timescale;
timescale = new CProgressBar(true, -1, -1, 30, GREEN_BAR, 70, true);
timescale = new CProgressBar(true, -1, -1, 30, green_bar, yellow_bar, true);
}
void CInfoViewer::paintTime (bool show_dot, bool firstPaint)
@@ -278,13 +257,9 @@ void CInfoViewer::paintTime (bool show_dot, bool firstPaint)
if (! gotTime)
return;
// int ChanNameY = BoxStartY + (ChanHeight >> 1) + 5; //oberkante schatten?
char timestr[10];
struct timeb tm;
ftime (&tm);
strftime ((char *) &timestr, 20, "%H:%M", localtime (&tm.time));
time_t rawtime = time(NULL);
strftime ((char *) &timestr, sizeof(timestr), "%H:%M", localtime(&rawtime));
if ((!firstPaint) && (strcmp (timestr, old_timestr) == 0)) {
if (show_dot)
@@ -395,199 +370,13 @@ void CInfoViewer::paintCA_bar(int left, int right)
}
}
}
void CInfoViewer::showTitle (const int ChanNum, const std::string & Channel, const t_satellite_position satellitePosition, const t_channel_id new_channel_id, const bool calledFromNumZap, int epgpos)
void CInfoViewer::paintshowButtonBar()
{
last_curr_id = last_next_id = 0;
showButtonBar = !calledFromNumZap;
ChannelName = Channel;
bool show_dot = true;
bool fadeOut = false;
int fadeValue;
bool new_chan = false;
//printf("CInfoViewer::showTitle ************************* chan num %d name %s\n", ChanNum, Channel.c_str());
//aspectRatio = videoDecoder->getAspectRatio() > 2 ? 1 : 0;
aspectRatio = 0;
bool fadeIn = g_settings.widget_fade && (!is_visible) && showButtonBar;
if (casysChange != g_settings.casystem_display || channellogoChange != g_settings.infobar_show_channellogo){
casysChange = g_settings.casystem_display;
channellogoChange = g_settings.infobar_show_channellogo;
if (g_settings.casystem_display < 2)
bottom_bar_offset = 22;
else
bottom_bar_offset = 0;
start();
}
ChanNameY = BoxStartY + (ChanHeight / 2) + SHADOW_OFFSET; //oberkante schatten?
ChanInfoX = BoxStartX + (ChanWidth / 3);
is_visible = true;
if (!calledFromNumZap && fadeIn)
fadeTimer = g_RCInput->addTimer (FADE_TIME, false);
fileplay = (ChanNum == 0);
newfreq = true;
sigscale->reset();
snrscale->reset();
timescale->reset();
hddscale->reset();
varscale->reset();
lastsig = lastsnr = lasthdd = lastvar = -1;
#if 0
InfoHeightY = NUMBER_H * 9 / 8 + 2 * g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getHeight () + 25;
InfoHeightY_Info = 40;
time_height = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getHeight () + 5;
time_left_width = 2 * g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth (widest_number);
time_dot_width = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth (":");
time_width = time_left_width * 2 + time_dot_width;
BoxStartX = g_settings.screen_StartX + 10;
BoxEndX = g_settings.screen_EndX - 10;
BoxEndY = g_settings.screen_EndY - 10;
int BoxEndInfoY = showButtonBar ? (BoxEndY - InfoHeightY_Info) : (BoxEndY);
BoxStartY = BoxEndInfoY - InfoHeightY;
#endif
if (!gotTime)
gotTime = timeset;
if (fadeIn) {
fadeValue = 100;
frameBuffer->setBlendLevel(fadeValue, fadeValue);
} else
fadeValue = g_settings.infobar_alpha;
#if 0
// kill linke seite
frameBuffer->paintBackgroundBox (BoxStartX, BoxStartY + ChanHeight, BoxStartX + (ChanWidth / 3), BoxStartY + ChanHeight + InfoHeightY_Info + 10);
// kill progressbar
frameBuffer->paintBackgroundBox (BoxEndX - 120, BoxStartY, BoxEndX, BoxStartY + ChanHeight);
#endif
int col_NumBoxText;
int col_NumBox;
if (virtual_zap_mode) {
col_NumBoxText = COL_MENUHEAD;
col_NumBox = COL_MENUHEAD_PLUS_0;
if ((channel_id != new_channel_id) || (evtlist.empty())) {
evtlist.clear();
//evtlist = g_Sectionsd->getEventsServiceKey(new_channel_id & 0xFFFFFFFFFFFFULL);
sectionsd_getEventsServiceKey(new_channel_id & 0xFFFFFFFFFFFFULL, evtlist);
if (!evtlist.empty())
sort(evtlist.begin(),evtlist.end(), sortByDateTime);
new_chan = true;
}
} else {
col_NumBoxText = COL_INFOBAR;
col_NumBox = COL_INFOBAR_PLUS_0;
}
if (! calledFromNumZap && !(g_RemoteControl->subChannels.empty()) && (g_RemoteControl->selected_subchannel > 0))
{
channel_id = g_RemoteControl->subChannels[g_RemoteControl->selected_subchannel].getChannelID();
ChannelName = g_RemoteControl->subChannels[g_RemoteControl->selected_subchannel].subservice_name;
} else {
channel_id = new_channel_id;
}
/* showChannelLogo() changes this, so better reset it every time... */
ChanNameX = BoxStartX + ChanWidth + SHADOW_OFFSET;
/* assuming all color icons must have same size */
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h);
asize = (BoxEndX - (2*icon_large_width + 2*icon_small_width + 4*2) - 102) - ChanInfoX;
asize = asize - (icol_w+6)*4;
asize = asize / 4;
#if 0
//Shadow
frameBuffer->paintBox(BoxEndX-20, ChanNameY + SHADOW_OFFSET, BoxEndX + SHADOW_OFFSET, BoxEndY, COL_INFOBAR_SHADOW_PLUS_0, RADIUS_SMALL, CORNER_TOP);
frameBuffer->paintBox(ChanInfoX + SHADOW_OFFSET, BoxEndY -20, BoxEndX + SHADOW_OFFSET, BoxEndY + SHADOW_OFFSET, COL_INFOBAR_SHADOW_PLUS_0, RADIUS_SMALL, CORNER_BOTTOM); //round
//infobox
frameBuffer->paintBoxRel(ChanNameX-10, ChanNameY, BoxEndX-ChanNameX+10, BoxEndInfoY-ChanNameY, COL_INFOBAR_PLUS_0, RADIUS_SMALL, CORNER_TOP); // round
//number box
frameBuffer->paintBoxRel (BoxStartX + SHADOW_OFFSET, BoxStartY + SHADOW_OFFSET, ChanWidth, ChanHeight + 4, COL_INFOBAR_SHADOW_PLUS_0, RADIUS_SMALL); // round
frameBuffer->paintBoxRel (BoxStartX, BoxStartY, ChanWidth, ChanHeight + 4, COL_INFOBAR_PLUS_0, RADIUS_SMALL); // round
#endif
paintBackground(col_NumBox);
int ChanNumYPos = BoxStartY + ChanHeight;
if (g_settings.infobar_sat_display && satellitePosition != 0 && !satellitePositions.empty()) {
sat_iterator_t sit = satellitePositions.find(satellitePosition);
if (sit != satellitePositions.end()) {
int satNameWidth = g_SignalFont->getRenderWidth (sit->second.name);
if (satNameWidth > (ChanWidth - 4))
satNameWidth = ChanWidth - 4;
int chanH = g_SignalFont->getHeight ();
g_SignalFont->RenderString (3 + BoxStartX + ((ChanWidth - satNameWidth) / 2), BoxStartY + chanH, satNameWidth, sit->second.name, COL_INFOBAR);
}
ChanNumYPos += 10;
}
int ChannelLogoMode = showChannelLogo(channel_id); // get logo mode, paint channel logo if adjusted
bool logo_ok = ( g_settings.infobar_show_channellogo != 0 && ChannelLogoMode != 0);
fprintf(stderr, "after showchannellogo, mode = %d ret = %d logo_ok = %d\n",g_settings.infobar_show_channellogo, ChannelLogoMode, logo_ok);
paintTime (show_dot, true);
showRecordIcon (show_dot);
show_dot = !show_dot;
char strChanNum[10];
sprintf (strChanNum, "%d", ChanNum);
int ChanNumWidth = 0;
if (ChanNum) /* !fileplay */
{
/* TODO: the logic will get much easier once we decouple channellogo and signal bars */
if ((!logo_ok && g_settings.infobar_show_channellogo < 2) || g_settings.infobar_show_channellogo == 2) // no logo in numberbox
{
// show number in numberbox
int tmpwidth = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]->getRenderWidth(strChanNum);
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]->RenderString(
BoxStartX + (ChanWidth - tmpwidth) / 2, ChanNumYPos,
ChanWidth, strChanNum, col_NumBoxText);
}
if (ChannelLogoMode == 1 || ( g_settings.infobar_show_channellogo == 3 && !logo_ok)) /* channel number besides channel name */
{
ChanNumWidth = 5 + g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth (strChanNum);
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString(
ChanNameX + 5, ChanNameY + time_height,
ChanNumWidth, strChanNum, col_NumBoxText);
}
}
if (ChannelLogoMode != 2)
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString(
ChanNameX + 10 + ChanNumWidth, ChanNameY + time_height,
BoxEndX - (ChanNameX + 20) - time_width - LEFT_OFFSET - 5 - ChanNumWidth,
ChannelName, COL_INFOBAR, 0, true); // UTF-8
showInfoFile();
// int ChanInfoY = BoxStartY + ChanHeight + 10;
int icons_offset = (2*(icon_large_width + 2)) + icon_small_width +2 +2;
ButtonWidth = (BoxEndX - ChanInfoX - icons_offset) >> 2;
// frameBuffer->paintBox (ChanInfoX, ChanInfoY, ChanNameX, BoxEndInfoY, COL_INFOBAR_PLUS_0);
if (showButtonBar) {
sec_timer_id = g_RCInput->addTimer (1*1000*1000, false);
if (g_settings.casystem_display < 2)
{ // FIXME
#ifndef SKIP_CA_STATUS
if (g_settings.casystem_display < 2) {
paintCA_bar(0,0);
#endif
}
frameBuffer->paintBoxRel(ChanInfoX, BBarY, BoxEndX - ChanInfoX, InfoHeightY_Info, COL_INFOBAR_BUTTONS_BACKGROUND, RADIUS_SMALL, CORNER_BOTTOM); //round
@@ -600,7 +389,8 @@ fprintf(stderr, "after showchannellogo, mode = %d ret = %d logo_ok = %d\n",g_set
if (txt.empty())
txt = g_Locale->getText(LOCALE_INFOVIEWER_STREAMINFO);
//g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(ChanInfoX + 16*4 + asize * 3 + 2*8, BBarFontY, ButtonWidth - (2 + icol_w + 4 + 2), txt, COL_INFOBAR_BUTTONS, 0, true); // UTF-8
int icons_offset = (2*(icon_large_width + 2)) + icon_small_width +2 +2;
ButtonWidth = (BoxEndX - ChanInfoX - icons_offset) >> 2;
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(ChanInfoX + 10 + (icol_w + 4 + asize + 2) * 3 + icol_w + 4,
BBarFontY, ButtonWidth - (2 + icol_w + 4 + 2), txt, COL_INFOBAR_BUTTONS, 0, true); // UTF-8
@@ -611,11 +401,11 @@ fprintf(stderr, "after showchannellogo, mode = %d ret = %d logo_ok = %d\n",g_set
showIcon_VTXT ();
showIcon_SubT();
showIcon_Resolution();
}
if (fileplay) {
show_Data ();
} else {
void CInfoViewer::show_current_next(bool new_chan, int epgpos)
{
//info_CurrentNext = getEPG (channel_id);
sectionsd_getCurrentNextServiceKey(channel_id & 0xFFFFFFFFFFFFULL, info_CurrentNext);
if (!evtlist.empty()) {
@@ -681,39 +471,277 @@ fprintf(stderr, "after showchannellogo, mode = %d ret = %d logo_ok = %d\n",g_set
show_Data ();
}
}
void CInfoViewer::showMovieTitle( const int playState, const std::string Channel, const std::string g_file_epg, const std::string g_file_epg1)
{
chack_channellogo_ca_SettingsChange();
aspectRatio = 0;
last_curr_id = last_next_id = 0;
showButtonBar = true;
bool fadeIn = g_settings.widget_fade && (!is_visible) ;
is_visible = true;
if (fadeIn)
fadeTimer = g_RCInput->addTimer (FADE_TIME, false);
fileplay = true;
reset_allScala();
if (!gotTime)
gotTime = timeset;
int fadeValue;
if (fadeIn) {
fadeValue = 100;
frameBuffer->setBlendLevel(fadeValue, fadeValue);
} else
fadeValue = g_settings.infobar_alpha;
ChannelName = Channel;
channel_id = 0;
/* showChannelLogo() changes this, so better reset it every time... */
ChanNameX = BoxStartX + ChanWidth + SHADOW_OFFSET;
paintBackground(COL_INFOBAR_PLUS_0);
bool show_dot = true;
paintTime (show_dot, true);
showRecordIcon (show_dot);
show_dot = !show_dot;
showInfoFile();
paintshowButtonBar();
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString(ChanNameX + 10 , ChanNameY + time_height,BoxEndX - (ChanNameX + 20) - time_width - LEFT_OFFSET - 5 ,ChannelName, COL_INFOBAR, 0, true); // UTF-8
// show_Data
char runningPercent = file_prozent;
if (runningPercent > 100)
runningPercent = 100;
display_Info(g_file_epg.c_str(), g_file_epg1.c_str(), true, false, runningPercent);
const char *playicon = NULL;
switch (playState) {
case 3: //PLAY
playicon = NEUTRINO_ICON_PLAY;
break;
case 4: //PAUSE
playicon = NEUTRINO_ICON_PAUSE;
break;
case 6: //REW
playicon = NEUTRINO_ICON_REW;
break;
case 5: //FF
playicon = NEUTRINO_ICON_FF;
break;
default:
break;
}
int icon_w = 0,icon_h = 0;
frameBuffer->getIconSize(playicon, &icon_w, &icon_h);
int icon_x = BoxStartX + ChanWidth / 2 - icon_w / 2;
int icon_y = BoxStartY + ChanHeight / 2 - icon_h / 2;
frameBuffer->paintIcon(playicon, icon_x, icon_y);
showLcdPercentOver ();
loop(fadeValue, show_dot , fadeIn);
aspectRatio = 0;
fileplay = 0;
}
void CInfoViewer::reset_allScala()
{
sigscale->reset();
snrscale->reset();
timescale->reset();
hddscale->reset();
varscale->reset();
lastsig = lastsnr = lasthdd = lastvar = -1;
}
void CInfoViewer::chack_channellogo_ca_SettingsChange()
{
if (casysChange != g_settings.casystem_display || channellogoChange != g_settings.infobar_show_channellogo) {
casysChange = g_settings.casystem_display;
channellogoChange = g_settings.infobar_show_channellogo;
if (g_settings.casystem_display < 2)
bottom_bar_offset = 22;
else
bottom_bar_offset = 0;
start();
}
}
void CInfoViewer::showTitle (const int ChanNum, const std::string & Channel, const t_satellite_position satellitePosition, const t_channel_id new_channel_id, const bool calledFromNumZap, int epgpos)
{
chack_channellogo_ca_SettingsChange();
aspectRatio = 0;
last_curr_id = last_next_id = 0;
showButtonBar = !calledFromNumZap;
bool fadeIn = g_settings.widget_fade && (!is_visible) && showButtonBar;
is_visible = true;
if (!calledFromNumZap && fadeIn)
fadeTimer = g_RCInput->addTimer (FADE_TIME, false);
fileplay = (ChanNum == 0);
newfreq = true;
reset_allScala();
if (!gotTime)
gotTime = timeset;
int fadeValue;
if (fadeIn) {
fadeValue = 100;
frameBuffer->setBlendLevel(fadeValue, fadeValue);
} else
fadeValue = g_settings.infobar_alpha;
int col_NumBoxText;
int col_NumBox;
ChannelName = Channel;
bool new_chan = false;
if (virtual_zap_mode) {
col_NumBoxText = COL_MENUHEAD;
col_NumBox = COL_MENUHEAD_PLUS_0;
if ((channel_id != new_channel_id) || (evtlist.empty())) {
evtlist.clear();
//evtlist = g_Sectionsd->getEventsServiceKey(new_channel_id & 0xFFFFFFFFFFFFULL);
sectionsd_getEventsServiceKey(new_channel_id & 0xFFFFFFFFFFFFULL, evtlist);
if (!evtlist.empty())
sort(evtlist.begin(),evtlist.end(), sortByDateTime);
new_chan = true;
}
} else {
col_NumBoxText = COL_INFOBAR;
col_NumBox = COL_INFOBAR_PLUS_0;
}
if (! calledFromNumZap && !(g_RemoteControl->subChannels.empty()) && (g_RemoteControl->selected_subchannel > 0))
{
channel_id = g_RemoteControl->subChannels[g_RemoteControl->selected_subchannel].getChannelID();
ChannelName = g_RemoteControl->subChannels[g_RemoteControl->selected_subchannel].subservice_name;
} else {
channel_id = new_channel_id;
}
/* showChannelLogo() changes this, so better reset it every time... */
ChanNameX = BoxStartX + ChanWidth + SHADOW_OFFSET;
paintBackground(col_NumBox);
bool show_dot = true;
paintTime (show_dot, true);
showRecordIcon (show_dot);
show_dot = !show_dot;
showInfoFile();
if (showButtonBar) {
paintshowButtonBar();
}
int ChanNumWidth = 0;
int ChannelLogoMode = 0;
if (ChanNum) /* !fileplay */
{
ChannelLogoMode = showChannelLogo(channel_id); // get logo mode, paint channel logo if adjusted
bool logo_ok = ( g_settings.infobar_show_channellogo != 0 && ChannelLogoMode != 0);
fprintf(stderr, "after showchannellogo, mode = %d ret = %d logo_ok = %d\n",g_settings.infobar_show_channellogo, ChannelLogoMode, logo_ok);
int ChanNumYPos = BoxStartY + ChanHeight;
if (g_settings.infobar_sat_display && satellitePosition != 0 && !satellitePositions.empty()) {
sat_iterator_t sit = satellitePositions.find(satellitePosition);
if (sit != satellitePositions.end()) {
int satNameWidth = g_SignalFont->getRenderWidth (sit->second.name);
std::string satname_tmp = sit->second.name;
if (satNameWidth > (ChanWidth - 4)) {
satNameWidth = ChanWidth - 4;
size_t pos1 = sit->second.name.find("(") ;
size_t pos2 = sit->second.name.find_last_of(")");
size_t pos0 = sit->second.name.find(" ") ;
if ((pos1 != std::string::npos) && (pos2 != std::string::npos) && (pos0 != std::string::npos)) {
pos1++;
satname_tmp = sit->second.name.substr(0, pos0 );
if(satname_tmp == "Hot")
satname_tmp = "Hotbird";
satname_tmp +=" ";
satname_tmp += sit->second.name.substr( pos1,pos2-pos1 );
satNameWidth = g_SignalFont->getRenderWidth (satname_tmp);
if (satNameWidth > (ChanWidth - 4))
satNameWidth = ChanWidth - 4;
}
}
int chanH = g_SignalFont->getHeight ();
g_SignalFont->RenderString (3 + BoxStartX + ((ChanWidth - satNameWidth) / 2) , BoxStartY + chanH, satNameWidth, satname_tmp, COL_INFOBAR);
}
ChanNumYPos += 10;
}
char strChanNum[10];
snprintf (strChanNum, sizeof(strChanNum), "%d", ChanNum);
/* TODO: the logic will get much easier once we decouple channellogo and signal bars */
if ((!logo_ok && g_settings.infobar_show_channellogo < 2) || g_settings.infobar_show_channellogo == 2) // no logo in numberbox
{
// show number in numberbox
int tmpwidth = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]->getRenderWidth(strChanNum);
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]->RenderString(
BoxStartX + (ChanWidth - tmpwidth) / 2, ChanNumYPos,
ChanWidth, strChanNum, col_NumBoxText);
}
if (ChannelLogoMode == 1 || ( g_settings.infobar_show_channellogo == 3 && !logo_ok)) /* channel number besides channel name */
{
ChanNumWidth = 5 + g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth (strChanNum);
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString(
ChanNameX + 5, ChanNameY + time_height,
ChanNumWidth, strChanNum, col_NumBoxText);
}
}
if (ChannelLogoMode != 2)
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString(
ChanNameX + 10 + ChanNumWidth, ChanNameY + time_height,
BoxEndX - (ChanNameX + 20) - time_width - LEFT_OFFSET - 5 - ChanNumWidth,
ChannelName, COL_INFOBAR, 0, true); // UTF-8
if (fileplay) {
show_Data ();
} else {
show_current_next(new_chan,epgpos);
}
showLcdPercentOver ();
if ((g_RemoteControl->current_channel_id == channel_id) && !(((info_CurrentNext.flags & CSectionsdClient::epgflags::has_next) && (info_CurrentNext.flags & (CSectionsdClient::epgflags::has_current | CSectionsdClient::epgflags::has_no_current))) || (info_CurrentNext.flags & CSectionsdClient::epgflags::not_broadcast))) {
g_Sectionsd->setServiceChanged (channel_id & 0xFFFFFFFFFFFFULL, true);
}
neutrino_msg_t msg;
neutrino_msg_data_t data;
CNeutrinoApp *neutrino = CNeutrinoApp::getInstance ();
if (!calledFromNumZap) {
loop(fadeValue, show_dot , fadeIn);
}
aspectRatio = 0;
fileplay = 0;
}
void CInfoViewer::loop(int fadeValue, bool show_dot ,bool fadeIn)
{
bool hideIt = true;
virtual_zap_mode = false;
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd (g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR]);
bool fadeOut = false;
int res = messages_return::none;
// time_t ta, tb;
neutrino_msg_t msg;
neutrino_msg_data_t data;
while (!(res & (messages_return::cancel_info | messages_return::cancel_all))) {
g_RCInput->getMsgAbsoluteTimeout (&msg, &data, &timeoutEnd);
#if 0
if (!(info_CurrentNext.flags & (CSectionsdClient::epgflags::has_current))) {
if (difftime (time (&tb), ta) > 1.1) {
time (&ta);
info_CurrentNext = getEPG (channel_id);
if ((info_CurrentNext.flags & (CSectionsdClient::epgflags::has_current))) {
show_Data ();
showLcdPercentOver ();
}
}
}
#endif
if (msg == CRCInput::RC_sat || msg == CRCInput::RC_favorites) {
g_RCInput->postMsg (msg, 0);
res = messages_return::cancel_info;
@@ -773,6 +801,7 @@ fprintf(stderr, "after showchannellogo, mode = %d ret = %d logo_ok = %d\n",g_set
res = messages_return::cancel_all;
hideIt = true;
} else if (!fileplay && !timeshift) {
CNeutrinoApp *neutrino = CNeutrinoApp::getInstance ();
if ((msg == (neutrino_msg_t) g_settings.key_quickzap_up) || (msg == (neutrino_msg_t) g_settings.key_quickzap_down) || (msg == CRCInput::RC_0) || (msg == NeutrinoMessages::SHOW_INFOBAR)) {
hideIt = false;
//hideIt = (g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR] == 0) ? true : false;
@@ -816,10 +845,6 @@ fprintf(stderr, "after showchannellogo, mode = %d ret = %d logo_ok = %d\n",g_set
else
CNeutrinoApp::getInstance()->channelList->virtual_zap_mode(msg == CRCInput::RC_right);
}
}
aspectRatio = 0;
fileplay = 0;
}
void CInfoViewer::showSubchan ()
@@ -847,7 +872,7 @@ void CInfoViewer::showSubchan ()
g_RCInput->postMsg( NeutrinoMessages::SHOW_INFOBAR , 0 );
} else {
char text[100];
sprintf (text, "%d - %s", subchannel, subChannelName.c_str ());
snprintf (text, sizeof(text), "%d - %s", subchannel, subChannelName.c_str ());
int dx = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getRenderWidth (text) + 20;
int dy = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getHeight(); // 25;
@@ -1028,13 +1053,13 @@ void CInfoViewer::showMotorMoving (int duration)
char text[256];
#if 0
char buffer[10];
sprintf (buffer, "%d", duration);
snprintf (buffer, sizeof(buffer), "%d", duration);
strcpy (text, g_Locale->getText (LOCALE_INFOVIEWER_MOTOR_MOVING));
strcat (text, " (");
strcat (text, buffer);
strcat (text, " s)");
#endif
sprintf(text, "%s (%ds)", g_Locale->getText (LOCALE_INFOVIEWER_MOTOR_MOVING), duration);
snprintf(text, sizeof(text), "%s (%ds)", g_Locale->getText (LOCALE_INFOVIEWER_MOTOR_MOVING), duration);
ShowHintUTF (LOCALE_MESSAGEBOX_INFO, text, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth (text, true) + 10, duration); // UTF-8
}
@@ -1203,14 +1228,10 @@ CSectionsdClient::CurrentNextInfo CInfoViewer::getEPG (const t_channel_id for_ch
void CInfoViewer::showSNR ()
{
char percent[10];
uint16_t ssig, ssnr;
int sw, snr, sig, posx, posy;
int height, ChanNumYPos;
int barwidth = BAR_WIDTH;
if (! is_visible)
return;
char percent[10];
uint16_t ssig, ssnr;
/* right now, infobar_show_channellogo == 3 is the trigger for signal bars etc.
TODO: decouple this */
@@ -1220,7 +1241,7 @@ void CInfoViewer::showSNR ()
newfreq = false;
CZapitClient::CCurrentServiceInfo si = g_Zapit->getCurrentServiceInfo ();
sprintf (freq, "%d.%d MHz %c", si.tsfrequency / 1000, si.tsfrequency % 1000, si.polarisation ? 'V' : 'H');
snprintf (freq, sizeof(freq), "%d.%d MHz %c", si.tsfrequency / 1000, si.tsfrequency % 1000, si.polarisation ? 'V' : 'H');
#if 0
//FIXME this sets default params for scan menu
sprintf (get_set.TP_freq, "%d", si.tsfrequency);
@@ -1233,6 +1254,8 @@ void CInfoViewer::showSNR ()
int satNameWidth = g_SignalFont->getRenderWidth (freq);
g_SignalFont->RenderString (3 + BoxStartX + ((ChanWidth - satNameWidth) / 2), BoxStartY + 2 * chanH - 3, satNameWidth, freq, COL_INFOBAR);
}
int sw, snr, sig, posx, posy;
int height, ChanNumYPos;
ssig = frontend->getSignalStrength();
ssnr = frontend->getSignalNoiseRatio();
@@ -1245,10 +1268,10 @@ void CInfoViewer::showSNR ()
lastsig = sig;
posx = BoxStartX + 4;
posy = ChanNumYPos + 3;
sigscale->paintProgressBar(posx, posy+4, BAR_WIDTH, 10, sig, 100);
sigscale->paintProgressBar(posx, posy+4, bar_width, 10, sig, 100);
sprintf (percent, "%d%%S", sig);
posx = posx + barwidth + 2;
snprintf (percent, sizeof(percent), "%d%%S", sig);
posx = posx + bar_width + 2;
sw = BoxStartX + ChanWidth - posx;
frameBuffer->paintBoxRel (posx, posy, sw, height, COL_INFOBAR_PLUS_0);
g_SignalFont->RenderString (posx, posy + height, sw, percent, COL_INFOBAR);
@@ -1258,10 +1281,10 @@ void CInfoViewer::showSNR ()
posx = BoxStartX + 4;
posy = ChanNumYPos + 3 + height - 2;
snrscale->paintProgressBar(posx, posy+4, BAR_WIDTH, 10, snr, 100);
snrscale->paintProgressBar(posx, posy+4, bar_width, 10, snr, 100);
sprintf (percent, "%d%%Q", snr);
posx = posx + barwidth + 2;
snprintf (percent, sizeof(percent), "%d%%Q", snr);
posx = posx + bar_width + 2;
sw = BoxStartX + ChanWidth - posx -4;
frameBuffer->paintBoxRel (posx, posy, sw, height-2, COL_INFOBAR_PLUS_0);
g_SignalFont->RenderString (posx, posy + height, sw, percent, COL_INFOBAR);
@@ -1385,48 +1408,20 @@ void CInfoViewer::display_Info(const char *current, const char *next,
void CInfoViewer::show_Data (bool calledFromEvent)
{
if (! is_visible)
return;
char runningStart[10];
char runningRest[20];
char runningPercent = 0;
// static char oldrunningPercent = 255;
char nextStart[10];
char nextDuration[10];
int is_nvod = false;
if (fileplay) {
runningPercent = file_prozent;
if (runningPercent > 100)
runningPercent = 100;
#if 0
int posy = BoxStartY + 12;
int b114 = BoxEndX - 114 + 7;
int b112 = BoxEndX - 112 + 7;
if (!calledFromEvent || (oldrunningPercent != runningPercent)) {
frameBuffer->paintBoxRel (b114+4, posy, 102, 18, COL_INFOBAR_SHADOW_PLUS_0);
frameBuffer->paintBoxRel (b112+4, posy + 2, 98, 14, COL_INFOBAR_PLUS_0);
oldrunningPercent = file_prozent;
}
timescale->paintProgressBar2(b112+4, posy + 2, runningPercent);
int xStart = BoxStartX + ChanWidth;
int ChanInfoY = BoxStartY + ChanHeight + 15; //+10
int height = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getHeight ();
int duration1TextPos = BoxEndX - 30;
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->RenderString (xStart, ChanInfoY + height, duration1TextPos - xStart - 5, g_file_epg, COL_INFOBAR, 0, true);
ChanInfoY += height;
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->RenderString (xStart, ChanInfoY + height, duration1TextPos - xStart - 5, g_file_epg1, COL_INFOBAR, 0, true);
#else
display_Info(g_file_epg.c_str(), g_file_epg1.c_str(), true, false, runningPercent);
#endif
return;
}
if (! is_visible)
return;
if ((g_RemoteControl->current_channel_id == channel_id) && (!g_RemoteControl->subChannels.empty()) && (!g_RemoteControl->are_subchannels)) {
is_nvod = true;
info_CurrentNext.current_zeit.startzeit = g_RemoteControl->subChannels[g_RemoteControl->selected_subchannel].startzeit;
@@ -1446,27 +1441,27 @@ void CInfoViewer::show_Data (bool calledFromEvent)
int rest = (info_CurrentNext.current_zeit.dauer / 60) - seit;
if (seit < 0) {
runningPercent = 0;
sprintf (runningRest, "in %d min", -seit);
snprintf (runningRest, sizeof(runningRest), "in %d min", -seit);
} else {
runningPercent = (jetzt - info_CurrentNext.current_zeit.startzeit) * 100 / info_CurrentNext.current_zeit.dauer;
if (runningPercent > 100)
runningPercent = 100;
if (rest >= 0)
sprintf(runningRest, "%d / %d min", seit, rest);
snprintf(runningRest, sizeof(runningRest), "%d / %d min", seit, rest);
else
sprintf(runningRest, "%d +%d min", info_CurrentNext.current_zeit.dauer / 60, -rest);
snprintf(runningRest, sizeof(runningRest), "%d +%d min", info_CurrentNext.current_zeit.dauer / 60, -rest);
}
struct tm *pStartZeit = localtime (&info_CurrentNext.current_zeit.startzeit);
sprintf (runningStart, "%02d:%02d", pStartZeit->tm_hour, pStartZeit->tm_min);
snprintf (runningStart, sizeof(runningStart), "%02d:%02d", pStartZeit->tm_hour, pStartZeit->tm_min);
} else
last_curr_id = 0;
if (info_CurrentNext.flags & CSectionsdClient::epgflags::has_next) {
unsigned dauer = info_CurrentNext.next_zeit.dauer / 60;
sprintf (nextDuration, "%d min", dauer);
snprintf (nextDuration, sizeof(nextDuration), "%d min", dauer);
struct tm *pStartZeit = localtime (&info_CurrentNext.next_zeit.startzeit);
sprintf (nextStart, "%02d:%02d", pStartZeit->tm_hour, pStartZeit->tm_min);
snprintf (nextStart, sizeof(nextStart), "%02d:%02d", pStartZeit->tm_hour, pStartZeit->tm_min);
} else
last_next_id = 0;
@@ -1705,10 +1700,8 @@ void CInfoViewer::killTitle()
showButtonBar = false;
}
void CInfoViewer::Set_CA_Status (int Status)
void CInfoViewer::Set_CA_Status (int /*Status*/)
{
CA_Status = Status;
m_CA_Status = Status;
if (is_visible && showButtonBar)
showIcon_CA_Status (1);
}
@@ -1738,8 +1731,6 @@ static void resize_logo(int *w, int *h, const int width, const int height)
//fprintf(stderr, "resize_logo(%d, %d, %d, %d) aspect: %f\n", *w, *h, width, height, aspect);
}
#define LOGO_DIR1 "/share/tuxbox/neutrino/icons/logo"
#define LOGO_DIR2 "/var/share/icons/logo"
/******************************************************************************
returns mode of painted channel logo,
0 = no logo painted
@@ -1754,7 +1745,7 @@ int CInfoViewer::showChannelLogo(const t_channel_id logo_channel_id)
std::string strAbsIconPath;
int x_mid, y_mid, logo_w, logo_h;
int logo_w, logo_h;
int logo_x = 0, logo_y = 0;
int res = 0;
int start_x = ChanNameX;
@@ -1774,12 +1765,13 @@ int CInfoViewer::showChannelLogo(const t_channel_id logo_channel_id)
" -> please check logo file!\n", strAbsIconPath.c_str(), ChannelName.c_str());
return 0;
}
int y_mid;
if (g_settings.infobar_show_channellogo == 1) // paint logo in numberbox
{
// calculate mid of numberbox
int satNameHeight = g_settings.infobar_sat_display ? g_SignalFont->getHeight() : 0;
x_mid = BoxStartX + ChanWidth / 2;
int x_mid = BoxStartX + ChanWidth / 2;
y_mid = BoxStartY + (satNameHeight + ChanHeight) / 2;
resize_logo(&logo_w, &logo_h, ChanWidth, ChanHeight - satNameHeight);

View File

@@ -90,6 +90,17 @@ class CInfoViewer
uint32_t sec_timer_id;
uint32_t fadeTimer;
bool virtual_zap_mode;
int time_left_width;
int time_dot_width;
int time_width;
int time_height;
int info_time_width;
int bottom_bar_offset;
bool newfreq ;
char old_timestr[10];
static const short bar_width = 72;
CChannelEventList evtlist;
CChannelEventList::iterator eli;
@@ -111,12 +122,12 @@ class CInfoViewer
void showButton_SubServices();
void showIcon_16_9();
#ifndef SKIP_CA_STATUS
void showIcon_CA_Status(int);
void paint_ca_icons(int, char*, int&);
void paintCA_bar(int,int);
void showOne_CAIcon(bool);
#endif
void showIcon_VTXT() const;
void showRecordIcon(const bool show);
void showIcon_SubT() const;
@@ -128,15 +139,19 @@ class CInfoViewer
int showChannelLogo(const t_channel_id logo_channel_id);
void showSNR();
void showInfoFile();
void loop(int fadeValue, bool show_dot ,bool fadeIn);
std::string eventname;
void paintshowButtonBar();
void show_current_next(bool new_chan, int epgpos);
void reset_allScala();
void chack_channellogo_ca_SettingsChange();
public:
bool chanready;
bool is_visible;
uint32_t lcdUpdateTimer;
CInfoViewer();
void showMovieTitle( const int playState, const std::string Channel, const std::string g_file_epg, const std::string g_file_epg1);
void start();
void showEpgInfo();
@@ -146,9 +161,7 @@ class CInfoViewer
CSectionsdClient::CurrentNextInfo getEPG(const t_channel_id for_channel_id, CSectionsdClient::CurrentNextInfo &info);
void showSubchan();
#ifndef SKIP_CA_STATUS
void Set_CA_Status(int Status);
#endif
int handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data);
void clearVirtualZapMode() {virtual_zap_mode = false;}

View File

@@ -1128,8 +1128,8 @@ void CMoviePlayerGui::PlayFile(void)
if (isMovieBrowser) {
g_file_epg = p_movie_info->epgTitle;
g_file_epg1 = p_movie_info->epgInfo1;
g_InfoViewer->showTitle(0, p_movie_info->epgChannel.c_str(), 0, 0); // UTF-8
//g_InfoViewer->showTitle(0, p_movie_info->epgChannel.c_str(), 0, 0); // UTF-8
g_InfoViewer->showMovieTitle(playstate, p_movie_info->epgChannel.c_str(), g_file_epg, g_file_epg1);
} else {
char temp_name[255];
const char *slash = strrchr(filename, '/');
@@ -1146,7 +1146,8 @@ void CMoviePlayerGui::PlayFile(void)
}
g_file_epg = "";
g_file_epg1 = "";
g_InfoViewer->showTitle(0, temp_name, 0, 0); // UTF-8
// g_InfoViewer->showTitle(0, temp_name, 0, 0); // UTF-8
g_InfoViewer->showMovieTitle(playstate, temp_name, g_file_epg, g_file_epg1); // UTF-8
}
CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8);
update_lcd = true;

View File

@@ -83,8 +83,10 @@
#define NEUTRINO_ICON_MP3 "mp3"
#define NEUTRINO_ICON_MULTIMEDIA "multimedia"
#define NEUTRINO_ICON_NOT_MOUNTED "not_mounted"
#define NEUTRINO_ICON_PAUSE "pause"
#define NEUTRINO_ICON_PLAY "play"
#define NEUTRINO_ICON_PAUSE "mp_pause"
#define NEUTRINO_ICON_PLAY "mp_play"
#define NEUTRINO_ICON_REW "mp_b-skip"
#define NEUTRINO_ICON_FF "mp_f-skip"
#define NEUTRINO_ICON_PROTECTING "protecting"
#define NEUTRINO_ICON_QUESTION "question"
#define NEUTRINO_ICON_RADIOMODE "radiomode"
@@ -135,20 +137,12 @@
#define NEUTRINO_ICON_RESOLUTION_352 "res_352"
#define NEUTRINO_ICON_RESOLUTION_288 "res_288"
#define NEUTRINO_ICON_RESOLUTION_000 "res_000"
#define DUMMY_ICON "dummy"
#define NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE "mute_zap_green"
#define NEUTRINO_ICON_BUTTON_MUTE_ZAP_INACTIVE "mute_zap_gray"
/* icon widths */
#define NEUTRINO_ICON_BUTTON_BLUE_WIDTH 16
#define NEUTRINO_ICON_BUTTON_GREEN_WIDTH 16
#define NEUTRINO_ICON_BUTTON_RED_WIDTH 16
#define NEUTRINO_ICON_BUTTON_YELLOW_WIDTH 16
/* misc */