diff options
author | louis <louis.braun@gmx.de> | 2015-03-31 11:53:25 +0200 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2015-03-31 11:53:25 +0200 |
commit | 43422fac91d7c67d1cb69e2add4abce49e89ca90 (patch) | |
tree | 9cfc5ed0efb1f7c45c5ed21640171942e0f2c95d /views | |
parent | a0f86bdc0d4e61338ede7ebd53da56563f2998bf (diff) | |
download | vdr-plugin-skindesigner-43422fac91d7c67d1cb69e2add4abce49e89ca90.tar.gz vdr-plugin-skindesigner-43422fac91d7c67d1cb69e2add4abce49e89ca90.tar.bz2 |
added viewelement <endtime> in displayreplay to display the time the currently replayed recording ends
Diffstat (limited to 'views')
-rw-r--r-- | views/displayreplayview.c | 21 | ||||
-rw-r--r-- | views/displayreplayview.h | 4 |
2 files changed, 25 insertions, 0 deletions
diff --git a/views/displayreplayview.c b/views/displayreplayview.c index 90b49ba..690eb96 100644 --- a/views/displayreplayview.c +++ b/views/displayreplayview.c @@ -5,6 +5,8 @@ #include "../libcore/helpers.h" cDisplayReplayView::cDisplayReplayView(cTemplateView *tmplView) : cView(tmplView) { + length = 0; + endLast = ""; onPauseView = NULL; numMarksLast = 0; lastMarks = NULL; @@ -226,6 +228,25 @@ void cDisplayReplayView::DrawTotal(const char *total) { DrawViewElement(veRecTotal, &stringTokens, &intTokens); } +void cDisplayReplayView::DrawEndTime(int current, int total) { + if (!current) + return; + double rest = (double)(total - current) / (double)total; + time_t end = time(0) + rest*length; + string endTime = *TimeString(end); + if (!endTime.compare(endLast)) { + return; + } + endLast = endTime; + + map < string, string > stringTokens; + map < string, int > intTokens; + stringTokens.insert(pair<string,string>("recend", endTime)); + + ClearViewElement(veRecEnd); + DrawViewElement(veRecEnd, &stringTokens, &intTokens); +} + void cDisplayReplayView::DrawProgressBar(int current, int total) { map < string, string > stringTokens; map < string, int > intTokens; diff --git a/views/displayreplayview.h b/views/displayreplayview.h index 77c2eb4..3b7c3e9 100644 --- a/views/displayreplayview.h +++ b/views/displayreplayview.h @@ -7,6 +7,8 @@ class cDisplayReplayView : public cView, public cViewHelpers { private: + int length; + string endLast; cDisplayReplayOnPauseView *onPauseView; int numMarksLast; int *lastMarks; @@ -18,6 +20,7 @@ public: cDisplayReplayView(cTemplateView *tmplView); virtual ~cDisplayReplayView(); bool createOsd(void); + void SetRecordingLength(int length) { this->length = length; }; void DrawBackground(bool modeOnly); void DrawDate(void); void DrawTime(void); @@ -27,6 +30,7 @@ public: void DrawScraperContent(const cRecording *recording); void DrawCurrent(const char *current); void DrawTotal(const char *total); + void DrawEndTime(int current, int total); void DrawProgressBar(int current, int total); void DrawMarks(const cMarks *marks, int current, int total); void DrawControlIcons(bool play, bool forward, int speed, bool modeOnly); |