mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +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/pictureviewer.h>
|
||||||
#include <gui/movieplayer.h>
|
#include <gui/movieplayer.h>
|
||||||
#include <gui/infoclock.h>
|
#include <gui/infoclock.h>
|
||||||
#include <gui/components/cc.h>
|
|
||||||
|
|
||||||
#include <system/helpers.h>
|
#include <system/helpers.h>
|
||||||
|
|
||||||
@@ -94,6 +93,7 @@ CInfoViewer::CInfoViewer ()
|
|||||||
sigscale = NULL;
|
sigscale = NULL;
|
||||||
snrscale = NULL;
|
snrscale = NULL;
|
||||||
timescale = NULL;
|
timescale = NULL;
|
||||||
|
clock = NULL;
|
||||||
frameBuffer = CFrameBuffer::getInstance();
|
frameBuffer = CFrameBuffer::getInstance();
|
||||||
infoViewerBB = CInfoViewerBB::getInstance();
|
infoViewerBB = CInfoViewerBB::getInstance();
|
||||||
InfoHeightY = 0;
|
InfoHeightY = 0;
|
||||||
@@ -128,6 +128,7 @@ CInfoViewer::~CInfoViewer()
|
|||||||
delete timescale;
|
delete timescale;
|
||||||
delete infoViewerBB;
|
delete infoViewerBB;
|
||||||
delete infobar_txt;
|
delete infobar_txt;
|
||||||
|
delete clock;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInfoViewer::Init()
|
void CInfoViewer::Init()
|
||||||
@@ -243,35 +244,26 @@ void CInfoViewer::changePB()
|
|||||||
timescale->setRgb(0, 100, 70);
|
timescale->setRgb(0, 100, 70);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInfoViewer::paintTime (bool show_dot, bool firstPaint)
|
void CInfoViewer::paintTime (bool show_dot)
|
||||||
{
|
{
|
||||||
if (! gotTime)
|
if (! gotTime)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char timestr[10];
|
int clock_x = BoxEndX - time_width - LEFT_OFFSET;
|
||||||
time_t rawtime = time(NULL);
|
int clock_y = ChanNameY;
|
||||||
strftime ((char *) ×tr, sizeof(timestr), "%H:%M", localtime(&rawtime));
|
int clock_w = time_width + LEFT_OFFSET;
|
||||||
|
int clock_h = time_height;
|
||||||
|
|
||||||
if ((!firstPaint) && (strcmp (timestr, old_timestr) == 0)) {
|
if (clock == NULL){
|
||||||
if (show_dot)
|
clock = new CComponentsFrmClock();
|
||||||
frameBuffer->paintBoxRel (BoxEndX - time_width + time_left_width - LEFT_OFFSET, ChanNameY, time_dot_width, time_height / 2 + 2, COL_INFOBAR_PLUS_0);
|
clock->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT);
|
||||||
else
|
clock->doPaintBg(false);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
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)
|
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);
|
paintBackground(COL_INFOBAR_PLUS_0);
|
||||||
|
|
||||||
bool show_dot = true;
|
bool show_dot = true;
|
||||||
paintTime (show_dot, true);
|
paintTime (show_dot);
|
||||||
showRecordIcon (show_dot);
|
showRecordIcon (show_dot);
|
||||||
show_dot = !show_dot;
|
show_dot = !show_dot;
|
||||||
|
|
||||||
@@ -686,7 +678,7 @@ void CInfoViewer::showTitle (const int ChanNum, const std::string & Channel, con
|
|||||||
paintBackground(col_NumBox);
|
paintBackground(col_NumBox);
|
||||||
|
|
||||||
bool show_dot = true;
|
bool show_dot = true;
|
||||||
paintTime (show_dot, true);
|
paintTime (show_dot);
|
||||||
showRecordIcon (show_dot);
|
showRecordIcon (show_dot);
|
||||||
show_dot = !show_dot;
|
show_dot = !show_dot;
|
||||||
|
|
||||||
@@ -878,7 +870,7 @@ void CInfoViewer::loop(bool show_dot)
|
|||||||
res = messages_return::cancel_info;
|
res = messages_return::cancel_info;
|
||||||
} else if ((msg == NeutrinoMessages::EVT_TIMER) && (data == sec_timer_id)) {
|
} else if ((msg == NeutrinoMessages::EVT_TIMER) && (data == sec_timer_id)) {
|
||||||
showSNR ();
|
showSNR ();
|
||||||
paintTime (show_dot, false);
|
paintTime (show_dot);
|
||||||
showRecordIcon (show_dot);
|
showRecordIcon (show_dot);
|
||||||
show_dot = !show_dot;
|
show_dot = !show_dot;
|
||||||
showInfoFile();
|
showInfoFile();
|
||||||
|
@@ -44,6 +44,7 @@
|
|||||||
#include <gui/infoviewer_bb.h>
|
#include <gui/infoviewer_bb.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <zapit/channel.h>
|
#include <zapit/channel.h>
|
||||||
|
#include <gui/components/cc.h>
|
||||||
|
|
||||||
class CInfoViewer
|
class CInfoViewer
|
||||||
{
|
{
|
||||||
@@ -51,6 +52,7 @@ class CInfoViewer
|
|||||||
|
|
||||||
CFrameBuffer * frameBuffer;
|
CFrameBuffer * frameBuffer;
|
||||||
CInfoViewerBB* infoViewerBB;
|
CInfoViewerBB* infoViewerBB;
|
||||||
|
CComponentsFrmClock *clock;
|
||||||
|
|
||||||
bool gotTime;
|
bool gotTime;
|
||||||
bool recordModeActive;
|
bool recordModeActive;
|
||||||
@@ -116,7 +118,7 @@ class CInfoViewer
|
|||||||
const char *runningStart = NULL, const char *runningRest = NULL,
|
const char *runningStart = NULL, const char *runningRest = NULL,
|
||||||
const char *nextStart = NULL, const char *nextDuration = NULL,
|
const char *nextStart = NULL, const char *nextDuration = NULL,
|
||||||
bool update_current = true, bool update_next = true);
|
bool update_current = true, bool update_next = true);
|
||||||
void paintTime( bool show_dot, bool firstPaint );
|
void paintTime( bool show_dot );
|
||||||
|
|
||||||
void showRecordIcon(const bool show);
|
void showRecordIcon(const bool show);
|
||||||
void showIcon_Tuner() const;
|
void showIcon_Tuner() const;
|
||||||
|
Reference in New Issue
Block a user