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,10 +264,11 @@ void cTimeLine::setTimeline() {
drawCurrentTimeBase(); drawCurrentTimeBase();
} }
void cTimeLine::drawClock() { bool cTimeLine::drawClock() {
cString currentTime = timeManager->GetCurrentTime();
if (strcmp(currentTime, lastClock)) {
if (config.displayMode == eVertical) if (config.displayMode == eVertical)
clock->Fill(clrTransparent); clock->Fill(clrTransparent);
cString currentTime = timeManager->GetCurrentTime();
const cFont *font = (config.displayMode == eVertical) ? fontManager.FontTimeLineTime : fontManager.FontTimeLineTimeHorizontal; const cFont *font = (config.displayMode == eVertical) ? fontManager.FontTimeLineTime : fontManager.FontTimeLineTimeHorizontal;
int textHeight = font->Height(); int textHeight = font->Height();
int clockTextWidth = font->Width(*currentTime); int clockTextWidth = font->Width(*currentTime);
@ -279,4 +281,8 @@ void cTimeLine::drawClock() {
clock->drawBorder(); clock->drawBorder();
} }
clock->DrawText(cPoint((geoManager.clockWidth - clockTextWidth) / 2, (geoManager.clockHeight - textHeight) / 2), *currentTime, theme.Color(clrFont), colorFontBack, font); clock->DrawText(cPoint((geoManager.clockWidth - clockTextWidth) / 2, (geoManager.clockHeight - textHeight) / 2), *currentTime, theme.Color(clrFont), colorFontBack, font);
lastClock = currentTime;
return true;
}
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

@ -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();
@ -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();