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

@ -246,5 +246,7 @@ Version 0.3.3
- fixed bug also for loops
- added possibility to draw vertical text bottomum and topdown
- translate drawtextvertical
- added viewelement <endtime> in displayreplay to display the time
the currently replayed recording ends

View File

@ -112,7 +112,6 @@ cSkinDisplayPlugin *cSkinDesigner::DisplayPlugin(string pluginName, int viewID,
if (useBackupSkin)
return NULL;
Init();
cSkinDisplayPlugin *displayPlugin = NULL;
map< string, map <int, cTemplate*> >::iterator hit = pluginTemplates.find(pluginName);
if (hit == pluginTemplates.end())
return NULL;

View File

@ -27,6 +27,8 @@ cSDDisplayReplay::~cSDDisplayReplay() {
void cSDDisplayReplay::SetRecording(const cRecording *Recording) {
if (!doOutput || !Recording)
return;
if (initial)
replayView->SetRecordingLength(Recording->LengthInSeconds());
replayView->DrawTitle(Recording);
replayView->DrawRecordingInformation(Recording);
replayView->DrawScraperContent(Recording);
@ -62,6 +64,7 @@ void cSDDisplayReplay::SetProgress(int Current, int Total) {
replayView->DelayOnPause();
replayView->DrawProgressBar(Current, Total);
replayView->DrawMarks(marks, Current, Total);
replayView->DrawEndTime(Current, Total);
}
void cSDDisplayReplay::SetCurrent(const char *Current) {

View File

@ -4,7 +4,7 @@
<!ELEMENT displayreplay (background | backgroundmodeonly |datetime | time |
scrapercontent | rectitle | recinfo | currenttime |
totaltime | progressbar | cutmarks | controlicons |
totaltime | endtime | progressbar | cutmarks | controlicons |
controliconsmodeonly | jump | message | onpause |
onpausemodeonly | customtokens)*>
<!ATTLIST displayreplay
@ -71,6 +71,12 @@
condition CDATA #IMPLIED
>
<!ELEMENT endtime (area|areascroll)*>
<!ATTLIST endtime
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
<!ELEMENT progressbar (area|areascroll)*>
<!ATTLIST progressbar
debug CDATA #IMPLIED

View File

@ -1606,6 +1606,7 @@ void cTemplateViewReplay::SetViewElements(void) {
viewElementsAllowed.insert("scrapercontent");
viewElementsAllowed.insert("currenttime");
viewElementsAllowed.insert("totaltime");
viewElementsAllowed.insert("endtime");
viewElementsAllowed.insert("progressbar");
viewElementsAllowed.insert("cutmarks");
viewElementsAllowed.insert("controlicons");
@ -1641,6 +1642,9 @@ string cTemplateViewReplay::GetViewElementName(eViewElement ve) {
case veRecTotal:
name = "Recording total Time";
break;
case veRecEnd:
name = "Recording end Time";
break;
case veRecProgressBar:
name = "Rec Progress Bar";
break;
@ -1697,6 +1701,8 @@ void cTemplateViewReplay::AddPixmap(string sViewElement, cTemplatePixmap *pix, v
ve = veRecCurrent;
} else if (!sViewElement.compare("totaltime")) {
ve = veRecTotal;
} else if (!sViewElement.compare("endtime")) {
ve = veRecEnd;
} else if (!sViewElement.compare("progressbar")) {
ve = veRecProgressBar;
} else if (!sViewElement.compare("cutmarks")) {

View File

@ -60,6 +60,7 @@ enum eViewElement {
veRecInfo,
veRecCurrent,
veRecTotal,
veRecEnd,
veRecProgressBar,
veCuttingMarks,
veControlIcons,

View File

@ -258,6 +258,10 @@
<trans lang="en_EN">for</trans>
<trans lang="de_DE">für</trans>
</token>
<token name="tr(endsat)">
<trans lang="en_EN">ends at</trans>
<trans lang="de_DE">endet um</trans>
</token>
</translations>
<!--
The three Fonts FontOSD, FontFix and FontSml configured in VDR

View File

@ -119,6 +119,14 @@
</area>
</totaltime>
<!-- Available Variables endtime:
{recend} End Time in hh:mm
-->
<endtime>
<area x="63%" y="92%" width="20%" height="7%" layer="2">
<drawtext align="center" valign="bottom" font="{light}" fontsize="60%" color="{clrWhite}" text="{tr(endsat)}: {recend}" />
</area>
</endtime>
<!-- Available Variables progressbar:
{current} current frame of recording
{total} total frames of recording

View File

@ -74,6 +74,12 @@
<totaltime>
</totaltime>
<!-- Available Variables endtime:
{recend} End Time in hh:mm
-->
<endtime>
</endtime>
<!-- Available Variables progressbar:
{current} current frame of recording
{total} total frames of recording

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