2014-09-27 09:25:14 +02:00
|
|
|
#define __STL_CONFIG_H
|
|
|
|
#include <vdr/menu.h>
|
|
|
|
#include "../services/scraper2vdr.h"
|
|
|
|
#include "displaychannelview.h"
|
2015-03-28 11:57:51 +01:00
|
|
|
#include "displayviewelements.h"
|
2014-09-27 09:25:14 +02:00
|
|
|
#include "../libcore/timers.h"
|
|
|
|
#include "../libcore/helpers.h"
|
|
|
|
|
|
|
|
cDisplayChannelView::cDisplayChannelView(cTemplateView *tmplView) : cView(tmplView) {
|
|
|
|
lastScreenWidth = 0;
|
|
|
|
lastScreenHeight = 0;
|
2014-10-17 17:44:02 +02:00
|
|
|
lastNumAudioTracks = 0;
|
|
|
|
lastAudioChannel = -1;
|
|
|
|
lastTracDesc = "";
|
|
|
|
lastTrackLang = "";
|
2014-10-25 20:10:00 +02:00
|
|
|
InitDevices();
|
2014-09-27 09:25:14 +02:00
|
|
|
DeleteOsdOnExit();
|
|
|
|
SetFadeTime(tmplView->GetNumericParameter(ptFadeTime));
|
|
|
|
}
|
|
|
|
|
|
|
|
cDisplayChannelView::~cDisplayChannelView() {
|
|
|
|
CancelSave();
|
|
|
|
FadeOut();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cDisplayChannelView::createOsd(void) {
|
|
|
|
cRect osdSize = tmplView->GetOsdSize();
|
|
|
|
bool ok = CreateOsd(cOsd::OsdLeft() + osdSize.X(),
|
|
|
|
cOsd::OsdTop() + osdSize.Y(),
|
|
|
|
osdSize.Width(),
|
|
|
|
osdSize.Height());
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::DrawBackground(void) {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
DrawViewElement(veBackground, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::DrawChannel(cString &number, cString &name, cString &id, bool switching) {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
|
|
|
stringTokens.insert(pair<string,string>("channelname", *name));
|
|
|
|
stringTokens.insert(pair<string,string>("channelnumber", *number));
|
|
|
|
stringTokens.insert(pair<string,string>("channelid", *id));
|
|
|
|
|
|
|
|
intTokens.insert(pair<string, int>("switching", switching));
|
|
|
|
bool logoExisis = imgCache->LogoExists(*id);
|
|
|
|
intTokens.insert(pair<string, int>("channellogoexists", logoExisis));
|
|
|
|
|
|
|
|
DrawViewElement(veChannelInfo, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::ClearChannel(void) {
|
|
|
|
ClearViewElement(veChannelInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::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
|
|
|
|
2015-03-28 11:57:51 +01:00
|
|
|
if (DetachViewElement(veDateTime)) {
|
|
|
|
cViewElement *viewElement = GetViewElement(veDateTime);
|
|
|
|
if (!viewElement) {
|
|
|
|
viewElement = new cViewElementDate(tmplView->GetViewElement(veDateTime));
|
|
|
|
AddViewElement(veDateTime, viewElement);
|
|
|
|
viewElement->Start();
|
|
|
|
} else {
|
|
|
|
if (!viewElement->Starting())
|
|
|
|
viewElement->Render();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
2015-04-07 17:46:39 +02:00
|
|
|
if (!SetDate(false, stringTokens, intTokens)) {
|
2015-03-28 11:57:51 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 06:07:48 +01:00
|
|
|
|
2015-03-28 11:57:51 +01:00
|
|
|
ClearViewElement(veDateTime);
|
|
|
|
DrawViewElement(veDateTime, &stringTokens, &intTokens);
|
|
|
|
}
|
2015-01-06 06:07:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::DrawTime(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veTime)) {
|
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
|
|
|
|
2015-03-28 11:57:51 +01:00
|
|
|
if (DetachViewElement(veTime)) {
|
|
|
|
cViewElement *viewElement = GetViewElement(veTime);
|
|
|
|
if (!viewElement) {
|
|
|
|
viewElement = new cViewElementTime(tmplView->GetViewElement(veTime));
|
|
|
|
AddViewElement(veTime, viewElement);
|
|
|
|
viewElement->Start();
|
|
|
|
} else {
|
|
|
|
if (!viewElement->Starting())
|
|
|
|
viewElement->Render();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
2015-01-06 06:07:48 +01:00
|
|
|
|
2015-04-07 17:46:39 +02:00
|
|
|
if (!SetTime(false, stringTokens, intTokens)) {
|
2015-03-28 11:57:51 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ClearViewElement(veTime);
|
|
|
|
DrawViewElement(veTime, &stringTokens, &intTokens);
|
|
|
|
}
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::DrawProgressBar(cString &start, cString &stop, int Current, int Total) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veProgressBar)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
|
|
|
stringTokens.insert(pair<string, string>("start", *start));
|
|
|
|
stringTokens.insert(pair<string, string>("stop", *stop));
|
|
|
|
|
|
|
|
intTokens.insert(pair<string, int>("duration", Total));
|
|
|
|
intTokens.insert(pair<string, int>("elapsed", Current));
|
|
|
|
intTokens.insert(pair<string, int>("remaining", Total - Current));
|
2014-10-25 20:10:00 +02:00
|
|
|
|
|
|
|
ClearProgressBar();
|
2014-09-27 09:25:14 +02:00
|
|
|
DrawViewElement(veProgressBar, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::ClearProgressBar(void) {
|
|
|
|
ClearViewElement(veProgressBar);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::DrawProgressBarBack(void) {
|
|
|
|
DrawViewElement(veProgressBarBack);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::ClearProgressBarBack(void) {
|
|
|
|
ClearViewElement(veProgressBarBack);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::DrawEPGInfo(const cEvent *present, const cEvent *next, bool presentRecording, bool nextRecording) {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
|
|
|
if (present) {
|
|
|
|
stringTokens.insert(pair<string,string>("currenttitle", (present->Title())?present->Title():""));
|
|
|
|
stringTokens.insert(pair<string,string>("currentsubtitle", (present->ShortText())?present->ShortText():""));
|
|
|
|
stringTokens.insert(pair<string,string>("currentstart", *present->GetTimeString()));
|
|
|
|
stringTokens.insert(pair<string,string>("currentstop", *present->GetEndTimeString()));
|
|
|
|
|
|
|
|
intTokens.insert(pair<string,int>("currentduration", present->Duration() / 60));
|
2014-10-05 17:03:38 +02:00
|
|
|
intTokens.insert(pair<string,int>("currentdurationhours", present->Duration() / 3600));
|
|
|
|
stringTokens.insert(pair<string,string>("currentdurationminutes", *cString::sprintf("%.2d", (present->Duration() / 60)%60)));
|
2014-09-27 09:25:14 +02:00
|
|
|
intTokens.insert(pair<string,int>("currentelapsed", (int)round((time(NULL) - present->StartTime())/60)));
|
|
|
|
intTokens.insert(pair<string,int>("currentremaining", (int)round((present->EndTime() - time(NULL))/60)));
|
|
|
|
intTokens.insert(pair<string,int>("currentrecording", presentRecording ? 1 : 0));
|
2014-10-05 17:03:38 +02:00
|
|
|
intTokens.insert(pair<string,int>("hasVPS", (bool)present->Vps()));
|
2014-09-27 09:25:14 +02:00
|
|
|
} else {
|
|
|
|
stringTokens.insert(pair<string,string>("currenttitle", ""));
|
|
|
|
stringTokens.insert(pair<string,string>("currentsubtitle", ""));
|
|
|
|
stringTokens.insert(pair<string,string>("currentstart", ""));
|
|
|
|
stringTokens.insert(pair<string,string>("currentstop", ""));
|
|
|
|
|
|
|
|
intTokens.insert(pair<string,int>("currentduration", 0));
|
2014-10-05 17:03:38 +02:00
|
|
|
intTokens.insert(pair<string,int>("currentdurationhours", 0));
|
|
|
|
stringTokens.insert(pair<string,string>("currentdurationminutes", ""));
|
2014-09-27 09:25:14 +02:00
|
|
|
intTokens.insert(pair<string,int>("currentelapsed", 0));
|
|
|
|
intTokens.insert(pair<string,int>("currentremaining", 0));
|
|
|
|
intTokens.insert(pair<string,int>("currentrecording", 0));
|
2014-10-03 07:30:20 +02:00
|
|
|
intTokens.insert(pair<string,int>("hasVPS", 0));
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (next) {
|
|
|
|
stringTokens.insert(pair<string,string>("nexttitle", (next->Title())?next->Title():""));
|
|
|
|
stringTokens.insert(pair<string,string>("nextsubtitle", (next->ShortText())?next->ShortText():""));
|
|
|
|
stringTokens.insert(pair<string,string>("nextstart", *next->GetTimeString()));
|
|
|
|
stringTokens.insert(pair<string,string>("nextstop", *next->GetEndTimeString()));
|
|
|
|
|
|
|
|
intTokens.insert(pair<string,int>("nextduration", next->Duration() / 60));
|
2014-10-05 17:03:38 +02:00
|
|
|
intTokens.insert(pair<string,int>("nextdurationhours", next->Duration() / 3600));
|
|
|
|
stringTokens.insert(pair<string,string>("nextdurationminutes", *cString::sprintf("%.2d", (next->Duration() / 60)%60)));
|
2014-09-27 09:25:14 +02:00
|
|
|
intTokens.insert(pair<string,int>("nextrecording", nextRecording ? 1 : 0));
|
|
|
|
} else {
|
|
|
|
stringTokens.insert(pair<string,string>("nexttitle", ""));
|
|
|
|
stringTokens.insert(pair<string,string>("nextsubtitle", ""));
|
|
|
|
stringTokens.insert(pair<string,string>("nextstart", ""));
|
|
|
|
stringTokens.insert(pair<string,string>("nextstop", ""));
|
|
|
|
|
|
|
|
intTokens.insert(pair<string,int>("nextduration", 0));
|
2014-10-05 17:03:38 +02:00
|
|
|
intTokens.insert(pair<string,int>("nextdurationhours", 0));
|
|
|
|
stringTokens.insert(pair<string,string>("nextdurationminutes", ""));
|
2014-09-27 09:25:14 +02:00
|
|
|
intTokens.insert(pair<string,int>("nextrecording", 0));
|
|
|
|
}
|
|
|
|
DrawViewElement(veEpgInfo, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::ClearEPGInfo(void) {
|
|
|
|
ClearViewElement(veEpgInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::DrawStatusIcons(const cChannel *Channel) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veStatusInfo)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-10-03 07:17:16 +02:00
|
|
|
map < string, int > intTokens;
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
bool isRadio = !Channel->Vpid() && Channel->Apid(0);
|
|
|
|
bool hasVT = Channel->Vpid() && Channel->Tpid();
|
|
|
|
bool isStereo = Channel->Apid(0);
|
|
|
|
bool isDolby = Channel->Dpid(0);
|
|
|
|
bool isEncrypted = Channel->Ca();
|
|
|
|
bool isRecording = cRecordControls::Active();
|
|
|
|
cGlobalSortedTimers SortedTimers;// local and remote timers
|
|
|
|
for (int i = 0; i < SortedTimers.Size() && !isRecording; i++)
|
|
|
|
if (const cTimer *Timer = SortedTimers[i])
|
|
|
|
if (Timer->Recording())
|
|
|
|
isRecording = true;
|
|
|
|
|
2014-10-17 17:44:02 +02:00
|
|
|
intTokens.insert(pair<string,int>("isRadio", isRadio));
|
|
|
|
intTokens.insert(pair<string,int>("hasVT", hasVT));
|
|
|
|
intTokens.insert(pair<string,int>("isStereo", isStereo));
|
|
|
|
intTokens.insert(pair<string,int>("isDolby", isDolby));
|
|
|
|
intTokens.insert(pair<string,int>("isEncrypted", isEncrypted));
|
|
|
|
intTokens.insert(pair<string,int>("isRecording", isRecording));
|
2014-11-15 16:24:07 +01:00
|
|
|
intTokens.insert(pair<string,int>("newmails", CheckNewMails()));
|
2014-10-17 17:44:02 +02:00
|
|
|
|
|
|
|
DrawViewElement(veStatusInfo, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::ClearStatusIcons(void) {
|
|
|
|
ClearViewElement(veStatusInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::DrawAudioInfo(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veAudioInfo)) {
|
2014-10-17 17:44:02 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-10-03 07:17:16 +02:00
|
|
|
int numAudioTracks = 0;
|
|
|
|
int audioChannel = -1;
|
|
|
|
string trackDescription = "";
|
|
|
|
string trackLanguage = "";
|
|
|
|
|
|
|
|
cDevice *device = cDevice::PrimaryDevice();
|
|
|
|
if (device) {
|
|
|
|
numAudioTracks = device->NumAudioTracks();
|
|
|
|
audioChannel = device->GetAudioChannel();
|
|
|
|
if (numAudioTracks > 0) {
|
|
|
|
const tTrackId *track = device->GetTrack(device->GetCurrentAudioTrack());
|
|
|
|
if (track) {
|
|
|
|
trackDescription = track->description ? track->description : "";
|
|
|
|
trackLanguage = track->language ? track->language : "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-10-17 17:44:02 +02:00
|
|
|
if (lastNumAudioTracks != numAudioTracks || lastAudioChannel != audioChannel || lastTracDesc.compare(trackDescription) || lastTrackLang.compare(trackLanguage)) {
|
|
|
|
lastNumAudioTracks = numAudioTracks;
|
|
|
|
lastAudioChannel = audioChannel;
|
|
|
|
lastTracDesc = trackDescription;
|
|
|
|
lastTrackLang = trackLanguage;
|
2014-10-03 07:17:16 +02:00
|
|
|
|
2014-10-17 17:44:02 +02:00
|
|
|
map < string, int > intTokens;
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
intTokens.insert(pair<string,int>("numaudiotracks", numAudioTracks));
|
|
|
|
intTokens.insert(pair<string,int>("audiochannel", audioChannel));
|
|
|
|
stringTokens.insert(pair<string,string>("trackdesc", trackDescription));
|
|
|
|
stringTokens.insert(pair<string,string>("tracklang", trackLanguage));
|
|
|
|
|
|
|
|
ClearAudioInfo();
|
|
|
|
DrawViewElement(veAudioInfo, &stringTokens, &intTokens);
|
|
|
|
}
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
2014-10-17 17:44:02 +02:00
|
|
|
void cDisplayChannelView::ClearAudioInfo(void) {
|
|
|
|
ClearViewElement(veAudioInfo);
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::DrawScreenResolution(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veScreenResolution)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int screenWidth = 0;
|
|
|
|
int screenHeight = 0;
|
|
|
|
double aspect = 0;
|
|
|
|
|
|
|
|
cDevice::PrimaryDevice()->GetVideoSize(screenWidth, screenHeight, aspect);
|
|
|
|
|
|
|
|
if ((lastScreenWidth == screenWidth) && (lastScreenHeight == screenHeight))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ((screenWidth == 0) && (screenHeight == 0))
|
|
|
|
return;
|
|
|
|
|
|
|
|
lastScreenWidth = screenWidth;
|
|
|
|
lastScreenHeight = screenHeight;
|
|
|
|
|
|
|
|
bool isHD = false;
|
|
|
|
string resName = GetScreenResolutionString(screenWidth, screenHeight, &isHD);
|
|
|
|
|
|
|
|
bool isWideScreen = false;
|
|
|
|
string aspectName = GetScreenAspectString(aspect, &isWideScreen);
|
|
|
|
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
|
|
|
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(veScreenResolution);
|
|
|
|
DrawViewElement(veScreenResolution, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::ClearScreenResolution(void) {
|
|
|
|
ClearViewElement(veScreenResolution);
|
|
|
|
lastScreenWidth = 0;
|
|
|
|
lastScreenHeight = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::DrawScraperContent(const cEvent *event) {
|
2015-01-20 09:29:16 +01:00
|
|
|
if (!event) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return;
|
2015-01-20 09:29:16 +01:00
|
|
|
}
|
2014-09-27 09:25:14 +02:00
|
|
|
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veScraperContent)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-03-28 11:57:51 +01:00
|
|
|
if (DetachViewElement(veScraperContent)) {
|
|
|
|
cViewElement *viewElement = GetViewElement(veScraperContent);
|
|
|
|
if (!viewElement) {
|
|
|
|
viewElement = new cViewElementScraperContent(event, ctPosterBanner, tmplView->GetViewElement(veScraperContent));
|
|
|
|
AddViewElement(veScraperContent, viewElement);
|
|
|
|
viewElement->Start();
|
|
|
|
} else {
|
|
|
|
if (!viewElement->Starting())
|
|
|
|
viewElement->Render();
|
|
|
|
}
|
|
|
|
} else {
|
2014-09-27 09:25:14 +02:00
|
|
|
map < string, string > stringTokens;
|
2015-03-28 11:57:51 +01:00
|
|
|
map < string, int > intTokens;
|
|
|
|
|
|
|
|
SetPosterBanner(event, stringTokens, intTokens);
|
|
|
|
ClearScraperContent();
|
2014-09-27 09:25:14 +02:00
|
|
|
DrawViewElement(veScraperContent, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::ClearScraperContent(void) {
|
|
|
|
ClearViewElement(veScraperContent);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::DrawSignal(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veSignalQuality)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return;
|
|
|
|
}
|
2015-03-22 08:29:52 +01:00
|
|
|
|
2015-03-28 11:57:51 +01:00
|
|
|
if (DetachViewElement(veSignalQuality)) {
|
|
|
|
cViewElement *viewElement = GetViewElement(veSignalQuality);
|
|
|
|
if (!viewElement) {
|
|
|
|
viewElement = new cViewElementSignal(tmplView->GetViewElement(veSignalQuality));
|
|
|
|
AddViewElement(veSignalQuality, viewElement);
|
|
|
|
viewElement->Start();
|
|
|
|
} else {
|
|
|
|
if (!viewElement->Starting())
|
|
|
|
viewElement->Render();
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
2015-03-28 11:57:51 +01:00
|
|
|
} else {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
|
|
|
bool changed = SetSignal(intTokens);
|
|
|
|
if (!changed)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ClearSignal();
|
|
|
|
DrawViewElement(veSignalQuality, &stringTokens, &intTokens);
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::DrawSignalBackground(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veSignalQualityBack)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
DrawViewElement(veSignalQualityBack);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void cDisplayChannelView::ClearSignal(void) {
|
|
|
|
ClearViewElement(veSignalQuality);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::ClearSignalBackground(void) {
|
|
|
|
ClearViewElement(veSignalQualityBack);
|
|
|
|
}
|
|
|
|
|
2014-10-25 20:10:00 +02:00
|
|
|
void cDisplayChannelView::DrawDevices(bool initial) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veDevices)) {
|
2014-10-25 20:10:00 +02:00
|
|
|
return;
|
|
|
|
}
|
2015-04-01 13:26:36 +02:00
|
|
|
string mode = tmplView->GetViewElementMode(veDevices);
|
|
|
|
bool light = false;
|
|
|
|
if (!mode.compare("light")) {
|
|
|
|
light = true;
|
|
|
|
}
|
2015-03-22 08:29:52 +01:00
|
|
|
if (DetachViewElement(veDevices)) {
|
2015-03-22 12:52:10 +01:00
|
|
|
cViewElement *viewElement = GetViewElement(veDevices);
|
|
|
|
if (!viewElement) {
|
2015-04-01 13:26:36 +02:00
|
|
|
viewElement = new cViewElementDevices(light, tmplView->GetViewElement(veDevices));
|
2015-03-22 12:52:10 +01:00
|
|
|
AddViewElement(veDevices, viewElement);
|
|
|
|
viewElement->Start();
|
|
|
|
} else {
|
2015-03-28 11:57:51 +01:00
|
|
|
if (!viewElement->Starting())
|
|
|
|
viewElement->Render();
|
2015-03-22 12:52:10 +01:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
map < string, vector< map< string, string > > > deviceLoopTokens;
|
|
|
|
vector< map< string, string > > devices;
|
2015-03-22 08:29:52 +01:00
|
|
|
|
2015-04-01 13:26:36 +02:00
|
|
|
bool changed = SetDevices(initial, light, &intTokens, &devices);
|
2015-03-22 12:52:10 +01:00
|
|
|
if (!changed)
|
|
|
|
return;
|
2014-10-25 20:10:00 +02:00
|
|
|
|
2015-03-22 12:52:10 +01:00
|
|
|
deviceLoopTokens.insert(pair< string, vector< map< string, string > > >("devices", devices));
|
|
|
|
|
2015-03-28 11:57:51 +01:00
|
|
|
ClearDevices();
|
2015-03-22 12:52:10 +01:00
|
|
|
DrawViewElement(veDevices, &stringTokens, &intTokens, &deviceLoopTokens);
|
|
|
|
}
|
2014-10-25 20:10:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::ClearDevices(void) {
|
|
|
|
ClearViewElement(veDevices);
|
|
|
|
}
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
void cDisplayChannelView::DrawChannelGroups(const cChannel *Channel, cString ChannelName) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veChannelGroup)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool separatorExists = imgCache->SeparatorLogoExists(*ChannelName);
|
|
|
|
string separatorPath = separatorExists ? *ChannelName : "";
|
|
|
|
|
2015-03-28 11:57:51 +01:00
|
|
|
string prevChannelSep = GetChannelSep(Channel, true);
|
|
|
|
string nextChannelSep = GetChannelSep(Channel, false);
|
2014-09-27 09:25:14 +02:00
|
|
|
bool prevAvailable = (prevChannelSep.size() > 0)?true:false;
|
|
|
|
bool nextAvailable = (nextChannelSep.size() > 0)?true:false;
|
|
|
|
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
|
|
|
intTokens.insert(pair<string,int>("sepexists", separatorExists));
|
|
|
|
intTokens.insert(pair<string,int>("prevAvailable", prevAvailable));
|
|
|
|
intTokens.insert(pair<string,int>("nextAvailable", nextAvailable));
|
|
|
|
stringTokens.insert(pair<string,string>("group", *ChannelName));
|
|
|
|
stringTokens.insert(pair<string,string>("nextgroup", nextChannelSep));
|
|
|
|
stringTokens.insert(pair<string,string>("prevgroup", prevChannelSep));
|
|
|
|
stringTokens.insert(pair<string,string>("seppath", separatorPath));
|
|
|
|
|
|
|
|
ClearViewElement(veChannelGroup);
|
|
|
|
DrawViewElement(veChannelGroup, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::ClearChannelGroups(void) {
|
|
|
|
ClearViewElement(veChannelGroup);
|
|
|
|
}
|
|
|
|
|
|
|
|
string cDisplayChannelView::GetChannelSep(const cChannel *channel, bool prev) {
|
2015-03-28 11:57:51 +01:00
|
|
|
string sepName = "";
|
2014-09-27 09:25:14 +02:00
|
|
|
const cChannel *sep = prev ? Channels.Prev(channel) :
|
|
|
|
Channels.Next(channel);
|
|
|
|
for (; sep; (prev)?(sep = Channels.Prev(sep)):(sep = Channels.Next(sep))) {
|
|
|
|
if (sep->GroupSep()) {
|
|
|
|
sepName = sep->Name();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return sepName;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayChannelView::DisplayMessage(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);
|
|
|
|
}
|
|
|
|
|
2014-10-11 16:31:39 +02:00
|
|
|
void cDisplayChannelView::DrawCustomTokens(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veCustomTokens)) {
|
2014-10-11 16:31:39 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!tmplView)
|
|
|
|
return;
|
2015-03-28 11:57:51 +01:00
|
|
|
|
|
|
|
if (DetachViewElement(veCustomTokens)) {
|
|
|
|
cViewElement *viewElement = GetViewElement(veCustomTokens);
|
|
|
|
if (!viewElement) {
|
|
|
|
viewElement = new cViewElementCustomTokens(tmplView->GetViewElement(veCustomTokens), tmplView);
|
|
|
|
AddViewElement(veCustomTokens, viewElement);
|
|
|
|
viewElement->Start();
|
|
|
|
} else {
|
|
|
|
if (!viewElement->Starting())
|
|
|
|
viewElement->Render();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
map < string, string > stringTokens = tmplView->GetCustomStringTokens();
|
|
|
|
map < string, int > intTokens = tmplView->GetCustomIntTokens();
|
|
|
|
DrawViewElement(veCustomTokens, &stringTokens, &intTokens);
|
|
|
|
}
|
2014-10-11 16:31:39 +02:00
|
|
|
}
|
|
|
|
|
2015-01-13 09:01:11 +01:00
|
|
|
void cDisplayChannelView::DrawCurrentWeather(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veCurrentWeather)) {
|
2015-01-13 09:01:11 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-03-28 11:57:51 +01:00
|
|
|
|
|
|
|
if (DetachViewElement(veCurrentWeather)) {
|
|
|
|
cViewElement *viewElement = GetViewElement(veCurrentWeather);
|
|
|
|
if (!viewElement) {
|
|
|
|
viewElement = new cViewElementWeather(tmplView->GetViewElement(veCurrentWeather));
|
|
|
|
AddViewElement(veCurrentWeather, viewElement);
|
|
|
|
viewElement->Start();
|
|
|
|
} else {
|
|
|
|
if (!viewElement->Starting())
|
|
|
|
viewElement->Render();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
if (!SetCurrentWeatherTokens(stringTokens, intTokens)){
|
|
|
|
ClearViewElement(veCurrentWeather);
|
|
|
|
return;
|
|
|
|
}
|
2015-01-14 14:20:22 +01:00
|
|
|
ClearViewElement(veCurrentWeather);
|
2015-03-28 11:57:51 +01:00
|
|
|
DrawViewElement(veCurrentWeather, &stringTokens, &intTokens);
|
2015-01-14 14:20:22 +01:00
|
|
|
}
|
2015-01-13 09:01:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
void cDisplayChannelView::Action(void) {
|
|
|
|
SetInitFinished();
|
|
|
|
FadeIn();
|
|
|
|
DoFlush();
|
|
|
|
cView::Action();
|
|
|
|
}
|