added progressmodeonly viewelement in displayreplay

This commit is contained in:
louis 2015-07-25 14:19:32 +02:00
parent d9c5219f43
commit 6e0f56e56c
10 changed files with 68 additions and 2 deletions

View File

@ -397,3 +397,6 @@ Version 0.6.1
- added version check for skinrepositiries
Version 0.6.2
- added progressmodeonly viewelement in displayreplay

View File

@ -59,6 +59,7 @@ void cSDDisplayReplay::SetMode(bool Play, bool Forward, int Speed) {
} else {
replayView->ClearOnPause();
}
replayView->DrawControlIcons(Play, Forward, Speed, modeOnly);
initialModeSet = true;
}
@ -103,7 +104,16 @@ void cSDDisplayReplay::Flush(void) {
replayView->DrawDate();
replayView->DrawTime();
}
if (modeOnly) {
cControl *control = cControl::Control();
if (control) {
double fps = control->FramesPerSecond();
int current = 0;
int total = 0;
if (control->GetIndex(current, total))
replayView->DrawProgressModeOnly(fps, current, total);
}
}
if (initial && initialModeSet) {
replayView->DrawBackground(modeOnly);
replayView->DrawCustomTokens();

View File

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

View File

@ -213,6 +213,19 @@ void cStopWatch::Stop(const char* message) {
dsyslog("skindesigner: %s - needed %d ms", message, (int)(cTimeMs::Now() - start));
}
string GetTimeString(int seconds) {
time_t sec(seconds);
tm *p = gmtime(&sec);
int hours = p->tm_hour;
int mins = p->tm_min;
int secs = p->tm_sec;
if (hours > 0) {
return *cString::sprintf("%d:%02d:%02d", hours, mins, secs);
}
return *cString::sprintf("%02d:%02d", mins, secs);;
}
//View Helpers
string GetScreenResolutionString(int width, int height, bool *isHD) {
string name = "";

View File

@ -41,6 +41,8 @@ public:
void Stop(const char* message);
};
string GetTimeString(int seconds);
string GetScreenResolutionString(int width, int height, bool *isHD);
string GetScreenAspectString(double aspect, bool *isWideScreen);

View File

@ -1739,6 +1739,7 @@ void cTemplateViewReplay::SetViewElements(void) {
viewElementsAllowed.insert("cutmarks");
viewElementsAllowed.insert("controlicons");
viewElementsAllowed.insert("controliconsmodeonly");
viewElementsAllowed.insert("progressmodeonly");
viewElementsAllowed.insert("jump");
viewElementsAllowed.insert("message");
viewElementsAllowed.insert("onpause");
@ -1785,6 +1786,9 @@ string cTemplateViewReplay::GetViewElementName(eViewElement ve) {
case veControlIconsModeOnly:
name = "Control Icons Mode only";
break;
case veProgressModeOnly:
name = "Progress Mode only";
break;
case veBackgroundModeOnly:
name = "Background Mode only";
break;
@ -1839,6 +1843,8 @@ void cTemplateViewReplay::AddPixmap(string sViewElement, cTemplatePixmapNode *pi
ve = veControlIcons;
} else if (!sViewElement.compare("controliconsmodeonly")) {
ve = veControlIconsModeOnly;
} else if (!sViewElement.compare("progressmodeonly")) {
ve = veProgressModeOnly;
} else if (!sViewElement.compare("backgroundmodeonly")) {
ve = veBackgroundModeOnly;
} else if (!sViewElement.compare("jump")) {

View File

@ -68,6 +68,7 @@ enum eViewElement {
veCuttingMarks,
veControlIcons,
veControlIconsModeOnly,
veProgressModeOnly,
veBackgroundModeOnly,
veRecJump,
veOnPause,

View File

@ -122,11 +122,21 @@
<controliconsmodeonly>
</controliconsmodeonly>
<!-- Available Variables progressmodeonly:
{current} current frame of recording
{total} total frames of recording
{timecurrent} current time in hh:mm:ss or mm:ss if shorter that one hour
{timetotal} total time in hh:mm:ss or mm:ss if shorter that one hour
-->
<progressmodeonly>
</progressmodeonly>
<!-- Available Variables jump:
{jump} time to jump to in hh:mm
-->
<jump>
</jump>
<!-- Available Variables message:
{text} message text
{status} true if message is a status message

View File

@ -349,6 +349,20 @@ void cDisplayReplayView::DrawControlIcons(bool play, bool forward, int speed, bo
}
}
void cDisplayReplayView::DrawProgressModeOnly(double fps, int current, int total) {
string cur = GetTimeString((double)current / fps);
string tot = GetTimeString((double)total / fps);
map < string, string > stringTokens;
map < string, int > intTokens;
intTokens.insert(pair<string,int>("current", current));
intTokens.insert(pair<string,int>("total", total));
stringTokens.insert(pair<string,string>("timecurrent", cur));
stringTokens.insert(pair<string,string>("timetotal", tot));
ClearViewElement(veProgressModeOnly);
DrawViewElement(veProgressModeOnly, &stringTokens, &intTokens);
}
void cDisplayReplayView::DrawJump(const char *jump) {
if (!jump) {
ClearViewElement(veRecJump);

View File

@ -38,6 +38,7 @@ public:
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);
void DrawProgressModeOnly(double fps, int current, int total);
void DrawJump(const char *jump);
void DrawMessage(eMessageType type, const char *text);
void DrawOnPause(string recFileName, bool modeOnly);