2014-09-27 09:25:14 +02:00
|
|
|
#define __STL_CONFIG_H
|
|
|
|
#include <vdr/menu.h>
|
|
|
|
#include "../services/scraper2vdr.h"
|
|
|
|
#include "displayreplayview.h"
|
|
|
|
#include "../libcore/helpers.h"
|
|
|
|
|
|
|
|
cDisplayReplayView::cDisplayReplayView(cTemplateView *tmplView) : cView(tmplView) {
|
2015-03-31 11:53:25 +02:00
|
|
|
length = 0;
|
2015-05-16 07:57:14 +02:00
|
|
|
timeShiftActive = false;
|
|
|
|
timeShiftFramesTotal = 0;
|
|
|
|
timeShiftLength = 1;
|
|
|
|
timeShiftDuration = "";
|
2015-03-31 11:53:25 +02:00
|
|
|
endLast = "";
|
2014-11-29 11:23:54 +01:00
|
|
|
onPauseView = NULL;
|
2014-10-28 18:09:10 +01:00
|
|
|
numMarksLast = 0;
|
|
|
|
lastMarks = NULL;
|
|
|
|
markActive = -1;
|
2014-09-27 09:25:14 +02:00
|
|
|
DeleteOsdOnExit();
|
|
|
|
}
|
|
|
|
|
|
|
|
cDisplayReplayView::~cDisplayReplayView() {
|
2014-10-28 18:09:10 +01:00
|
|
|
if (lastMarks) {
|
|
|
|
delete[] lastMarks;
|
|
|
|
}
|
2014-11-29 11:23:54 +01:00
|
|
|
if (onPauseView) {
|
|
|
|
delete onPauseView;
|
|
|
|
}
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool cDisplayReplayView::createOsd(void) {
|
|
|
|
cRect osdSize = tmplView->GetOsdSize();
|
|
|
|
bool ok = CreateOsd(cOsd::OsdLeft() + osdSize.X(),
|
|
|
|
cOsd::OsdTop() + osdSize.Y(),
|
|
|
|
osdSize.Width(),
|
|
|
|
osdSize.Height());
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
2015-05-16 07:57:14 +02:00
|
|
|
void cDisplayReplayView::SetTimeShift(int framesTotal, int timeShiftLength) {
|
|
|
|
timeShiftActive = true;
|
|
|
|
timeShiftFramesTotal = framesTotal;
|
|
|
|
this->timeShiftLength = timeShiftLength;
|
|
|
|
int mins = (timeShiftLength / 60) % 60;
|
|
|
|
int hours = (timeShiftLength / 3600) % 24;
|
|
|
|
timeShiftDuration = *cString::sprintf("%d:%02d", hours, mins);
|
|
|
|
}
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
void cDisplayReplayView::DrawBackground(bool modeOnly) {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
if (modeOnly)
|
|
|
|
DrawViewElement(veBackgroundModeOnly, &stringTokens, &intTokens);
|
|
|
|
else
|
|
|
|
DrawViewElement(veBackground, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
2015-01-06 06:07:48 +01:00
|
|
|
void cDisplayReplayView::DrawDate(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veDateTime)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 06:07:48 +01:00
|
|
|
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
2015-04-07 17:46:39 +02:00
|
|
|
if (!SetDate(false, stringTokens, intTokens)) {
|
2015-01-06 06:07:48 +01:00
|
|
|
return;
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
2015-01-06 06:07:48 +01:00
|
|
|
ClearViewElement(veDateTime);
|
|
|
|
DrawViewElement(veDateTime, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayReplayView::DrawTime(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veTime)) {
|
2015-01-06 06:07:48 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
2015-04-07 17:46:39 +02:00
|
|
|
if (!SetTime(false, stringTokens, intTokens)) {
|
2015-01-06 06:07:48 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ClearViewElement(veTime);
|
|
|
|
DrawViewElement(veTime, &stringTokens, &intTokens);
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayReplayView::DrawTitle(const cRecording *recording) {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
2015-04-03 16:04:08 +02:00
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
const char *recName = NULL;
|
|
|
|
const cRecordingInfo *recInfo = recording->Info();
|
|
|
|
if (recInfo) {
|
|
|
|
recName = recInfo->Title();
|
|
|
|
}
|
|
|
|
if (!recName)
|
|
|
|
recName = recording->Name();
|
|
|
|
string recShortText = recInfo->ShortText() ? recInfo->ShortText() : "";
|
|
|
|
string recDate = *ShortDateString(recording->Start());
|
|
|
|
string recTime = *TimeString(recording->Start());
|
|
|
|
|
|
|
|
stringTokens.insert(pair<string,string>("rectitle", recName ? recName : ""));
|
|
|
|
stringTokens.insert(pair<string,string>("recsubtitle", recShortText));
|
|
|
|
stringTokens.insert(pair<string,string>("recdate", recDate));
|
|
|
|
stringTokens.insert(pair<string,string>("rectime", recTime));
|
|
|
|
|
|
|
|
DrawViewElement(veRecTitle, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
2015-02-01 14:45:33 +01:00
|
|
|
void cDisplayReplayView::DrawTitle(const char *title) {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
|
|
|
stringTokens.insert(pair<string,string>("rectitle", title));
|
|
|
|
stringTokens.insert(pair<string,string>("recsubtitle", ""));
|
|
|
|
stringTokens.insert(pair<string,string>("recdate", ""));
|
|
|
|
stringTokens.insert(pair<string,string>("rectime", ""));
|
|
|
|
|
|
|
|
DrawViewElement(veRecTitle, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
void cDisplayReplayView::DrawRecordingInformation(const cRecording *recording) {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
|
|
|
int screenWidth = 0;
|
|
|
|
int screenHeight = 0;
|
|
|
|
double aspect = 0;
|
|
|
|
cDevice::PrimaryDevice()->GetVideoSize(screenWidth, screenHeight, aspect);
|
|
|
|
bool isHD = false;
|
|
|
|
string resName = GetScreenResolutionString(screenWidth, screenHeight, &isHD);
|
|
|
|
bool isWideScreen = false;
|
|
|
|
string aspectName = GetScreenAspectString(aspect, &isWideScreen);
|
|
|
|
|
|
|
|
intTokens.insert(pair<string,int>("screenwidth", screenWidth));
|
|
|
|
intTokens.insert(pair<string,int>("screenheight", screenHeight));
|
|
|
|
intTokens.insert(pair<string,int>("isHD", isHD));
|
|
|
|
intTokens.insert(pair<string,int>("isWideScreen", isWideScreen));
|
|
|
|
stringTokens.insert(pair<string,string>("resolution", resName));
|
|
|
|
stringTokens.insert(pair<string,string>("aspect", aspectName));
|
|
|
|
|
|
|
|
ClearViewElement(veRecInfo);
|
|
|
|
DrawViewElement(veRecInfo, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayReplayView::DrawScraperContent(const cRecording *recording) {
|
|
|
|
if (!recording)
|
|
|
|
return;
|
|
|
|
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veScraperContent)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-01-06 06:07:48 +01:00
|
|
|
int mediaWidth = 0;
|
|
|
|
int mediaHeight = 0;
|
|
|
|
string mediaPath = "";
|
|
|
|
bool isBanner = false;
|
|
|
|
int posterWidth = 0;
|
|
|
|
int posterHeight = 0;
|
|
|
|
string posterPath = "";
|
|
|
|
bool hasPoster = false;
|
|
|
|
int bannerWidth = 0;
|
|
|
|
int bannerHeight = 0;
|
|
|
|
string bannerPath = "";
|
|
|
|
bool hasBanner = false;
|
2014-09-27 09:25:14 +02:00
|
|
|
|
2015-01-06 06:07:48 +01:00
|
|
|
static cPlugin *pScraper = GetScraperPlugin();
|
|
|
|
if (pScraper) {
|
|
|
|
ScraperGetPosterBannerV2 call;
|
|
|
|
call.event = NULL;
|
|
|
|
call.recording = recording;
|
|
|
|
if (pScraper->Service("GetPosterBannerV2", &call)) {
|
|
|
|
if ((call.type == tSeries) && call.banner.path.size() > 0) {
|
|
|
|
mediaWidth = call.banner.width;
|
|
|
|
mediaHeight = call.banner.height;
|
|
|
|
mediaPath = call.banner.path;
|
|
|
|
isBanner = true;
|
|
|
|
bannerWidth = mediaWidth;
|
|
|
|
bannerHeight = mediaHeight;
|
|
|
|
bannerPath = mediaPath;
|
|
|
|
hasBanner = true;
|
|
|
|
|
|
|
|
ScraperGetPoster callPoster;
|
|
|
|
callPoster.event = NULL;
|
|
|
|
callPoster.recording = recording;
|
|
|
|
if (pScraper->Service("GetPoster", &callPoster)) {
|
|
|
|
posterWidth = callPoster.poster.width;
|
|
|
|
posterHeight = callPoster.poster.height;
|
|
|
|
posterPath = callPoster.poster.path;
|
|
|
|
hasPoster = true;
|
|
|
|
}
|
|
|
|
} else if (call.type == tMovie && call.poster.path.size() > 0 && call.poster.height > 0) {
|
|
|
|
mediaWidth = call.poster.width;
|
|
|
|
mediaHeight = call.poster.height;
|
|
|
|
mediaPath = call.poster.path;
|
|
|
|
posterWidth = call.poster.width;
|
|
|
|
posterHeight = call.poster.height;
|
|
|
|
posterPath = call.poster.path;
|
2014-11-05 17:39:16 +01:00
|
|
|
hasPoster = true;
|
|
|
|
}
|
2015-01-06 06:07:48 +01:00
|
|
|
}
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
2015-01-06 06:07:48 +01:00
|
|
|
map < string, int > intTokens;
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
intTokens.insert(pair<string,int>("mediawidth", mediaWidth));
|
|
|
|
intTokens.insert(pair<string,int>("mediaheight", mediaHeight));
|
|
|
|
intTokens.insert(pair<string,int>("isbanner", isBanner));
|
|
|
|
stringTokens.insert(pair<string,string>("mediapath", mediaPath));
|
|
|
|
intTokens.insert(pair<string,int>("posterwidth", posterWidth));
|
|
|
|
intTokens.insert(pair<string,int>("posterheight", posterHeight));
|
|
|
|
stringTokens.insert(pair<string,string>("posterpath", posterPath));
|
|
|
|
intTokens.insert(pair<string,int>("hasposter", hasPoster));
|
|
|
|
intTokens.insert(pair<string,int>("bannerwidth", bannerWidth));
|
|
|
|
intTokens.insert(pair<string,int>("bannerheight", bannerHeight));
|
|
|
|
stringTokens.insert(pair<string,string>("bannerpath", bannerPath));
|
|
|
|
intTokens.insert(pair<string,int>("hasbanner", hasBanner));
|
|
|
|
ClearViewElement(veScraperContent);
|
|
|
|
DrawViewElement(veScraperContent, &stringTokens, &intTokens);
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayReplayView::DrawCurrent(const char *current) {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
stringTokens.insert(pair<string,string>("reccurrent", current));
|
|
|
|
|
|
|
|
ClearViewElement(veRecCurrent);
|
|
|
|
DrawViewElement(veRecCurrent, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayReplayView::DrawTotal(const char *total) {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
2015-05-16 07:57:14 +02:00
|
|
|
intTokens.insert(pair<string,int>("timeshift", timeShiftActive));
|
2014-09-27 09:25:14 +02:00
|
|
|
stringTokens.insert(pair<string,string>("rectotal", total));
|
2015-05-16 07:57:14 +02:00
|
|
|
stringTokens.insert(pair<string,string>("timeshifttotal", timeShiftDuration));
|
2014-09-27 09:25:14 +02:00
|
|
|
|
|
|
|
ClearViewElement(veRecTotal);
|
|
|
|
DrawViewElement(veRecTotal, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
2015-03-31 11:53:25 +02:00
|
|
|
void cDisplayReplayView::DrawEndTime(int current, int total) {
|
|
|
|
if (!current)
|
|
|
|
return;
|
2015-05-16 07:57:14 +02:00
|
|
|
int totalLength = total;
|
|
|
|
int recordingLength = length;
|
|
|
|
if (timeShiftActive && timeShiftFramesTotal > 0) {
|
|
|
|
totalLength = timeShiftFramesTotal;
|
|
|
|
recordingLength = timeShiftLength;
|
|
|
|
}
|
|
|
|
double rest = (double)(totalLength - current) / (double)totalLength;
|
|
|
|
time_t end = time(0) + rest*recordingLength;
|
2015-03-31 11:53:25 +02:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
void cDisplayReplayView::DrawProgressBar(int current, int total) {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
2015-05-16 07:57:14 +02:00
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
intTokens.insert(pair<string,int>("current", current));
|
|
|
|
intTokens.insert(pair<string,int>("total", total));
|
2015-05-16 07:57:14 +02:00
|
|
|
intTokens.insert(pair<string,int>("timeshift", timeShiftActive));
|
|
|
|
if (timeShiftActive) {
|
|
|
|
intTokens.insert(pair<string,int>("timeshifttotal", timeShiftFramesTotal));
|
|
|
|
}
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
ClearViewElement(veRecProgressBar);
|
|
|
|
DrawViewElement(veRecProgressBar, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
2014-10-28 18:09:10 +01:00
|
|
|
void cDisplayReplayView::DrawMarks(const cMarks *marks, int current, int total) {
|
2014-09-27 09:25:14 +02:00
|
|
|
if (!marks)
|
|
|
|
return;
|
2014-10-28 18:09:10 +01:00
|
|
|
if (!MarksChanged(marks, current))
|
|
|
|
return;
|
2015-04-03 16:04:08 +02:00
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
2015-05-16 11:02:09 +02:00
|
|
|
intTokens.insert(pair<string,int>("timeshift", timeShiftActive));
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
map < string, vector< map< string, string > > > loopTokens;
|
|
|
|
vector< map< string, string > > markTokens;
|
|
|
|
stringstream tot;
|
2015-05-16 11:02:09 +02:00
|
|
|
tot << total;
|
|
|
|
stringstream timeshifttot;
|
|
|
|
timeshifttot << timeShiftFramesTotal;
|
2014-09-27 09:25:14 +02:00
|
|
|
|
|
|
|
bool isStartMark = true;
|
|
|
|
for (const cMark *m = marks->First(); m; m = marks->Next(m)) {
|
|
|
|
map< string, string > markVals;
|
|
|
|
stringstream pos;
|
|
|
|
pos << m->Position();
|
|
|
|
markVals.insert(pair< string, string >("marks[position]", pos.str()));
|
|
|
|
markVals.insert(pair< string, string >("marks[total]", tot.str()));
|
2015-05-16 11:02:09 +02:00
|
|
|
if (timeShiftActive) {
|
|
|
|
markVals.insert(pair< string, string >("marks[timeshifttotal]", timeshifttot.str()));
|
|
|
|
}
|
2014-09-27 09:25:14 +02:00
|
|
|
markVals.insert(pair< string, string >("marks[startmark]", isStartMark ? "1" : "0"));
|
2014-10-28 18:09:10 +01:00
|
|
|
markVals.insert(pair< string, string >("marks[active]", (m->Position() == current) ? "1" : "0"));
|
2014-09-27 09:25:14 +02:00
|
|
|
const cMark *m2 = marks->Next(m);
|
|
|
|
if (m2) {
|
|
|
|
stringstream posNext;
|
|
|
|
posNext << m2->Position();
|
|
|
|
markVals.insert(pair< string, string >("marks[endposition]", posNext.str()));
|
|
|
|
} else {
|
|
|
|
markVals.insert(pair< string, string >("marks[endposition]", tot.str()));
|
|
|
|
}
|
|
|
|
isStartMark = !isStartMark;
|
|
|
|
markTokens.push_back(markVals);
|
|
|
|
}
|
|
|
|
loopTokens.insert(pair< string, vector< map< string, string > > >("marks", markTokens));
|
|
|
|
|
|
|
|
ClearViewElement(veCuttingMarks);
|
|
|
|
DrawViewElement(veCuttingMarks, &stringTokens, &intTokens, &loopTokens);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayReplayView::DrawControlIcons(bool play, bool forward, int speed, bool modeOnly) {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
|
|
|
bool isPlay = false;
|
|
|
|
bool isPause = false;
|
|
|
|
bool isFF = false;
|
|
|
|
bool isFF1x = false;
|
|
|
|
bool isFF2x = false;
|
|
|
|
bool isFF3x = false;
|
|
|
|
bool isRew = false;
|
|
|
|
bool isRew1x = false;
|
|
|
|
bool isRew2x = false;
|
|
|
|
bool isRew3x = false;
|
|
|
|
|
|
|
|
if (speed == -1) {
|
|
|
|
if (play) {
|
|
|
|
isPlay = true;
|
|
|
|
} else {
|
|
|
|
isPause = true;
|
|
|
|
}
|
|
|
|
} else if (forward) {
|
|
|
|
if (!play) {
|
|
|
|
isPause = true;
|
|
|
|
}
|
|
|
|
if (speed == 1) {
|
|
|
|
isFF1x = true;
|
|
|
|
} else if (speed == 2) {
|
|
|
|
isFF2x = true;
|
|
|
|
} else if (speed == 3) {
|
|
|
|
isFF3x = true;
|
|
|
|
} else {
|
|
|
|
isFF = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (!play) {
|
|
|
|
isPause = true;
|
|
|
|
}
|
|
|
|
if (speed == 1) {
|
|
|
|
isRew1x = true;
|
|
|
|
} else if (speed == 2) {
|
|
|
|
isRew2x = true;
|
|
|
|
} else if (speed == 3) {
|
|
|
|
isRew3x = true;
|
|
|
|
} else {
|
|
|
|
isRew = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
intTokens.insert(pair<string,int>("play", isPlay));
|
|
|
|
intTokens.insert(pair<string,int>("pause", isPause));
|
|
|
|
intTokens.insert(pair<string,int>("forward", isFF));
|
|
|
|
intTokens.insert(pair<string,int>("forward1x", isFF1x));
|
|
|
|
intTokens.insert(pair<string,int>("forward2x", isFF2x));
|
|
|
|
intTokens.insert(pair<string,int>("forward3x", isFF3x));
|
|
|
|
intTokens.insert(pair<string,int>("rewind", isRew));
|
|
|
|
intTokens.insert(pair<string,int>("rewind1x", isRew1x));
|
|
|
|
intTokens.insert(pair<string,int>("rewind2x", isRew2x));
|
|
|
|
intTokens.insert(pair<string,int>("rewind3x", isRew3x));
|
|
|
|
|
|
|
|
if (modeOnly) {
|
|
|
|
ClearViewElement(veControlIconsModeOnly);
|
|
|
|
DrawViewElement(veControlIconsModeOnly, &stringTokens, &intTokens);
|
|
|
|
} else {
|
|
|
|
ClearViewElement(veControlIcons);
|
|
|
|
DrawViewElement(veControlIcons, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayReplayView::DrawJump(const char *jump) {
|
|
|
|
if (!jump) {
|
|
|
|
ClearViewElement(veRecJump);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
stringTokens.insert(pair<string,string>("jump", jump));
|
|
|
|
|
|
|
|
ClearViewElement(veRecJump);
|
|
|
|
DrawViewElement(veRecJump, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayReplayView::DrawMessage(eMessageType type, const char *text) {
|
|
|
|
if (!text) {
|
|
|
|
ClearViewElement(veMessage);
|
2014-11-15 09:50:39 +01:00
|
|
|
return;
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
|
|
|
stringTokens.insert(pair<string,string>("text", text));
|
|
|
|
|
|
|
|
intTokens.insert(pair<string,int>("status", (type == mtStatus) ? true : false));
|
|
|
|
intTokens.insert(pair<string,int>("info", (type == mtInfo) ? true : false));
|
|
|
|
intTokens.insert(pair<string,int>("warning", (type == mtWarning) ? true : false));
|
|
|
|
intTokens.insert(pair<string,int>("error", (type == mtError) ? true : false));
|
|
|
|
|
|
|
|
ClearViewElement(veMessage);
|
|
|
|
DrawViewElement(veMessage, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
2015-03-19 16:31:39 +01:00
|
|
|
void cDisplayReplayView::DrawOnPause(string recFileName, bool modeOnly) {
|
2014-11-29 11:23:54 +01:00
|
|
|
eViewElement veTmplOnPause = modeOnly ? veOnPauseModeOnly : veOnPause;
|
|
|
|
cTemplateViewElement *tmplOnPause = tmplView->GetViewElement(veTmplOnPause);
|
|
|
|
if (!tmplOnPause)
|
|
|
|
return;
|
2015-03-19 16:31:39 +01:00
|
|
|
onPauseView = new cDisplayReplayOnPauseView(recFileName, tmplOnPause);
|
2014-11-29 11:23:54 +01:00
|
|
|
onPauseView->Start();
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayReplayView::ClearOnPause(void) {
|
|
|
|
if (onPauseView) {
|
|
|
|
delete onPauseView;
|
|
|
|
onPauseView = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-22 18:08:12 +01:00
|
|
|
void cDisplayReplayView::DelayOnPause(void) {
|
|
|
|
if (onPauseView) {
|
|
|
|
onPauseView->ResetSleep();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-06 06:23:36 +01:00
|
|
|
void cDisplayReplayView::DrawCustomTokens(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veCustomTokens)) {
|
2015-01-06 06:23:36 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!tmplView)
|
|
|
|
return;
|
|
|
|
map < string, string > stringTokens = tmplView->GetCustomStringTokens();
|
|
|
|
map < string, int > intTokens = tmplView->GetCustomIntTokens();
|
2015-06-05 14:48:45 +02:00
|
|
|
ClearViewElement(veCustomTokens);
|
2015-01-06 06:23:36 +01:00
|
|
|
DrawViewElement(veCustomTokens, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
2015-06-05 14:48:45 +02:00
|
|
|
bool cDisplayReplayView::CustomTokenChange(void) {
|
|
|
|
if (!tmplView)
|
|
|
|
return false;
|
|
|
|
return tmplView->CustomTokenChange();
|
|
|
|
}
|
|
|
|
|
2014-10-28 18:09:10 +01:00
|
|
|
/****************************************************************************************
|
|
|
|
* Private Functions
|
|
|
|
*****************************************************************************************/
|
|
|
|
|
|
|
|
bool cDisplayReplayView::MarksChanged(const cMarks *marks, int current) {
|
|
|
|
if (!marks)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
bool redraw = false;
|
|
|
|
//if mark was active, we redraw always
|
|
|
|
if (markActive >= 0) {
|
|
|
|
markActive = -1;
|
|
|
|
redraw = true;
|
|
|
|
}
|
|
|
|
//check if current position in recording hits mark exactly
|
|
|
|
for (const cMark *m = marks->First(); m; m = marks->Next(m)) {
|
|
|
|
if (m->Position() == current) {
|
|
|
|
markActive = current;
|
|
|
|
redraw = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (redraw)
|
|
|
|
return true;
|
|
|
|
//if number of marks has changed, redraw
|
|
|
|
int numMarks = marks->Count();
|
|
|
|
if (numMarks != numMarksLast) {
|
|
|
|
RememberMarks(marks);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!lastMarks)
|
|
|
|
return false;
|
|
|
|
//if position has changed, redraw
|
|
|
|
int i=0;
|
|
|
|
for (const cMark *m = marks->First(); m; m = marks->Next(m)) {
|
|
|
|
if (m->Position() != lastMarks[i]) {
|
|
|
|
RememberMarks(marks);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayReplayView::RememberMarks(const cMarks *marks) {
|
|
|
|
if (!marks)
|
|
|
|
return;
|
|
|
|
numMarksLast = marks->Count();
|
|
|
|
if (numMarksLast < 1)
|
|
|
|
return;
|
|
|
|
if (lastMarks) {
|
|
|
|
delete[] lastMarks;
|
|
|
|
}
|
|
|
|
lastMarks = new int[numMarksLast];
|
|
|
|
int i=0;
|
|
|
|
for (const cMark *m = marks->First(); m; m = marks->Next(m)) {
|
|
|
|
lastMarks[i] = m->Position();
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|