mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 07:51:19 +02:00
CInfoViewer: show time with CComponentsFrmClock object
This replaces old code that displayed time in infobar.
This commit is contained in:
@@ -56,7 +56,6 @@
|
||||
#include <gui/pictureviewer.h>
|
||||
#include <gui/movieplayer.h>
|
||||
#include <gui/infoclock.h>
|
||||
#include <gui/components/cc.h>
|
||||
|
||||
#include <system/helpers.h>
|
||||
|
||||
@@ -94,6 +93,7 @@ CInfoViewer::CInfoViewer ()
|
||||
sigscale = NULL;
|
||||
snrscale = NULL;
|
||||
timescale = NULL;
|
||||
clock = NULL;
|
||||
frameBuffer = CFrameBuffer::getInstance();
|
||||
infoViewerBB = CInfoViewerBB::getInstance();
|
||||
InfoHeightY = 0;
|
||||
@@ -128,6 +128,7 @@ CInfoViewer::~CInfoViewer()
|
||||
delete timescale;
|
||||
delete infoViewerBB;
|
||||
delete infobar_txt;
|
||||
delete clock;
|
||||
}
|
||||
|
||||
void CInfoViewer::Init()
|
||||
@@ -243,35 +244,26 @@ void CInfoViewer::changePB()
|
||||
timescale->setRgb(0, 100, 70);
|
||||
}
|
||||
|
||||
void CInfoViewer::paintTime (bool show_dot, bool firstPaint)
|
||||
void CInfoViewer::paintTime (bool show_dot)
|
||||
{
|
||||
if (! gotTime)
|
||||
return;
|
||||
|
||||
char timestr[10];
|
||||
time_t rawtime = time(NULL);
|
||||
strftime ((char *) ×tr, sizeof(timestr), "%H:%M", localtime(&rawtime));
|
||||
int clock_x = BoxEndX - time_width - LEFT_OFFSET;
|
||||
int clock_y = ChanNameY;
|
||||
int clock_w = time_width + LEFT_OFFSET;
|
||||
int clock_h = time_height;
|
||||
|
||||
if ((!firstPaint) && (strcmp (timestr, old_timestr) == 0)) {
|
||||
if (show_dot)
|
||||
frameBuffer->paintBoxRel (BoxEndX - time_width + time_left_width - LEFT_OFFSET, ChanNameY, time_dot_width, time_height / 2 + 2, COL_INFOBAR_PLUS_0);
|
||||
else
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString (BoxEndX - time_width + time_left_width - LEFT_OFFSET, ChanNameY + time_height, time_dot_width, ":", COL_INFOBAR_TEXT);
|
||||
strcpy (old_timestr, timestr);
|
||||
} else {
|
||||
strcpy (old_timestr, timestr);
|
||||
|
||||
if (!firstPaint) {
|
||||
frameBuffer->paintBoxRel(BoxEndX - time_width - LEFT_OFFSET, ChanNameY, time_width + LEFT_OFFSET, time_height, COL_INFOBAR_PLUS_0, RADIUS_SMALL, CORNER_TOP);
|
||||
}
|
||||
|
||||
timestr[2] = 0;
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString (BoxEndX - time_width - LEFT_OFFSET, ChanNameY + time_height, time_left_width, timestr, COL_INFOBAR_TEXT);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString (BoxEndX - time_left_width - LEFT_OFFSET, ChanNameY + time_height, time_left_width, ×tr[3], COL_INFOBAR_TEXT);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString (BoxEndX - time_width + time_left_width - LEFT_OFFSET, ChanNameY + time_height, time_dot_width, ":", COL_INFOBAR_TEXT);
|
||||
if (show_dot)
|
||||
frameBuffer->paintBoxRel (BoxEndX - time_left_width - time_dot_width - LEFT_OFFSET, ChanNameY, time_dot_width, time_height / 2 + 2, COL_INFOBAR_PLUS_0);
|
||||
if (clock == NULL){
|
||||
clock = new CComponentsFrmClock();
|
||||
clock->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT);
|
||||
clock->doPaintBg(false);
|
||||
}
|
||||
clock->setDimensionsAll(clock_x, clock_y, clock_w, clock_h);
|
||||
clock->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]);
|
||||
clock->setClockFormat(show_dot ? "%H:%M" : "%H.%M");
|
||||
|
||||
clock->paint(CC_SAVE_SCREEN_NO);
|
||||
}
|
||||
|
||||
void CInfoViewer::showRecordIcon (const bool show)
|
||||
@@ -516,7 +508,7 @@ void CInfoViewer::showMovieTitle(const int playState, const t_channel_id &Channe
|
||||
paintBackground(COL_INFOBAR_PLUS_0);
|
||||
|
||||
bool show_dot = true;
|
||||
paintTime (show_dot, true);
|
||||
paintTime (show_dot);
|
||||
showRecordIcon (show_dot);
|
||||
show_dot = !show_dot;
|
||||
|
||||
@@ -686,7 +678,7 @@ void CInfoViewer::showTitle (const int ChanNum, const std::string & Channel, con
|
||||
paintBackground(col_NumBox);
|
||||
|
||||
bool show_dot = true;
|
||||
paintTime (show_dot, true);
|
||||
paintTime (show_dot);
|
||||
showRecordIcon (show_dot);
|
||||
show_dot = !show_dot;
|
||||
|
||||
@@ -878,7 +870,7 @@ void CInfoViewer::loop(bool show_dot)
|
||||
res = messages_return::cancel_info;
|
||||
} else if ((msg == NeutrinoMessages::EVT_TIMER) && (data == sec_timer_id)) {
|
||||
showSNR ();
|
||||
paintTime (show_dot, false);
|
||||
paintTime (show_dot);
|
||||
showRecordIcon (show_dot);
|
||||
show_dot = !show_dot;
|
||||
showInfoFile();
|
||||
|
Reference in New Issue
Block a user