Fixed updating current time

This commit is contained in:
kamel5 2019-10-13 12:16:34 +02:00
parent 3386c05e91
commit 9173d14b10
3 changed files with 27 additions and 19 deletions

View File

@ -3,6 +3,7 @@
cTimeLine::cTimeLine(cTimeManager *timeManager) { cTimeLine::cTimeLine(cTimeManager *timeManager) {
this->timeManager = timeManager; this->timeManager = timeManager;
lastClock = "";
if (config.displayMode == eVertical) { if (config.displayMode == eVertical) {
dateViewer = new cStyledPixmap(osdManager.requestPixmap(1, cRect(0, dateViewer = new cStyledPixmap(osdManager.requestPixmap(1, cRect(0,
geoManager.statusHeaderHeight + geoManager.clockHeight, geoManager.statusHeaderHeight + geoManager.clockHeight,
@ -263,20 +264,25 @@ void cTimeLine::setTimeline() {
drawCurrentTimeBase(); drawCurrentTimeBase();
} }
void cTimeLine::drawClock() { bool cTimeLine::drawClock() {
if (config.displayMode == eVertical)
clock->Fill(clrTransparent);
cString currentTime = timeManager->GetCurrentTime(); cString currentTime = timeManager->GetCurrentTime();
const cFont *font = (config.displayMode == eVertical)?fontManager.FontTimeLineTime:fontManager.FontTimeLineTimeHorizontal; if (strcmp(currentTime, lastClock)) {
int textHeight = font->Height(); if (config.displayMode == eVertical)
int clockTextWidth = font->Width(*currentTime); clock->Fill(clrTransparent);
tColor colorFontBack = (config.style == eStyleFlat)?theme.Color(clrHeader):clrTransparent; const cFont *font = (config.displayMode == eVertical) ? fontManager.FontTimeLineTime : fontManager.FontTimeLineTimeHorizontal;
if (config.style == eStyleGraphical) { int textHeight = font->Height();
clock->drawBackgroundGraphical(bgClock); int clockTextWidth = font->Width(*currentTime);
} else { tColor colorFontBack = (config.style == eStyleFlat) ? theme.Color(clrHeader) : clrTransparent;
clock->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending)); if (config.style == eStyleGraphical) {
clock->drawBackground(); clock->drawBackgroundGraphical(bgClock);
clock->drawBorder(); } else {
clock->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
clock->drawBackground();
clock->drawBorder();
}
clock->DrawText(cPoint((geoManager.clockWidth - clockTextWidth) / 2, (geoManager.clockHeight - textHeight) / 2), *currentTime, theme.Color(clrFont), colorFontBack, font);
lastClock = currentTime;
return true;
} }
clock->DrawText(cPoint((geoManager.clockWidth-clockTextWidth)/2, (geoManager.clockHeight-textHeight)/2), *currentTime, theme.Color(clrFont), colorFontBack, font); return false;
} }

View File

@ -13,6 +13,7 @@ private:
cPixmap *timeline; cPixmap *timeline;
cStyledPixmap *clock; cStyledPixmap *clock;
cPixmap *timeBase; cPixmap *timeBase;
cString lastClock;
void decorateTile(int posX, int posY, int tileWidth, int tileHeight); void decorateTile(int posX, int posY, int tileWidth, int tileHeight);
void drawRoundedCorners(int posX, int posY, int width, int height, int radius); void drawRoundedCorners(int posX, int posY, int width, int height, int radius);
cImage *createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend); cImage *createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend);
@ -23,7 +24,7 @@ public:
void setTimeline(); void setTimeline();
void drawDateViewer(); void drawDateViewer();
void drawTimeline(); void drawTimeline();
void drawClock(); bool drawClock();
}; };
#endif //__TVGUIDE_TIMELINE_H #endif //__TVGUIDE_TIMELINE_H

View File

@ -352,7 +352,7 @@ void cTvGuideOsd::channelBack() {
void cTvGuideOsd::timeForward() { void cTvGuideOsd::timeForward() {
bool actionDone = false; bool actionDone = false;
if ( (timeManager->GetEnd() - activeGrid->EndTime())/60 < 30 ) { if ((timeManager->GetEnd() - activeGrid->EndTime())/60 < 30 ) {
ScrollForward(); ScrollForward();
actionDone = true; actionDone = true;
} }
@ -373,7 +373,6 @@ void cTvGuideOsd::timeForward() {
void cTvGuideOsd::ScrollForward() { void cTvGuideOsd::ScrollForward() {
timeManager->AddStep(config.stepMinutes); timeManager->AddStep(config.stepMinutes);
timeLine->drawDateViewer(); timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline(); timeLine->setTimeline();
for (cChannelEpg *column = columns.First(); column; column = columns.Next(column)) { for (cChannelEpg *column = columns.First(); column; column = columns.Next(column)) {
column->AddNewGridsAtEnd(); column->AddNewGridsAtEnd();
@ -384,7 +383,7 @@ void cTvGuideOsd::ScrollForward() {
void cTvGuideOsd::timeBack() { void cTvGuideOsd::timeBack() {
bool actionDone = false; bool actionDone = false;
if ( (activeGrid->StartTime() - timeManager->GetStart())/60 < 30 ) { if ((activeGrid->StartTime() - timeManager->GetStart())/60 < 30 ) {
ScrollBack(); ScrollBack();
actionDone = true; actionDone = true;
} }
@ -408,7 +407,6 @@ void cTvGuideOsd::ScrollBack() {
if (tooFarInPast) if (tooFarInPast)
return; return;
timeLine->drawDateViewer(); timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline(); timeLine->setTimeline();
for (cChannelEpg *column = columns.First(); column; column = columns.Next(column)) { for (cChannelEpg *column = columns.First(); column; column = columns.Next(column)) {
column->AddNewGridsAtStart(); column->AddNewGridsAtStart();
@ -776,6 +774,9 @@ eOSState cTvGuideOsd::ProcessKey(eKeys Key) {
case kNone: if (channelJumper) CheckTimeout(); break; case kNone: if (channelJumper) CheckTimeout(); break;
default: break; default: break;
} }
if (timeLine->drawClock()) {
osdManager.flush();
}
} }
if (!alreadyUnlocked) { if (!alreadyUnlocked) {
cPixmap::Unlock(); cPixmap::Unlock();