added viewelement <endtime> in displayreplay to display the time the currently replayed recording ends

This commit is contained in:
louis
2015-03-31 11:53:25 +02:00
parent a0f86bdc0d
commit 43422fac91
11 changed files with 62 additions and 2 deletions

View File

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

View File

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