From 43422fac91d7c67d1cb69e2add4abce49e89ca90 Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 31 Mar 2015 11:53:25 +0200 Subject: added viewelement in displayreplay to display the time the currently replayed recording ends --- views/displayreplayview.c | 21 +++++++++++++++++++++ views/displayreplayview.h | 4 ++++ 2 files changed, 25 insertions(+) (limited to 'views') 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("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); -- cgit v1.2.3