2014-09-27 09:25:14 +02:00
|
|
|
#define __STL_CONFIG_H
|
|
|
|
#include <vdr/menu.h>
|
|
|
|
#include <vdr/videodir.h>
|
|
|
|
#include "displaymenuview.h"
|
2015-03-28 11:57:51 +01:00
|
|
|
#include "displayviewelements.h"
|
2014-09-27 09:25:14 +02:00
|
|
|
#include "../config.h"
|
|
|
|
#include "../libcore/helpers.h"
|
2014-12-12 17:52:16 +01:00
|
|
|
#include "../services/scraper2vdr.h"
|
2014-09-27 09:25:14 +02:00
|
|
|
|
|
|
|
cDisplayMenuView::cDisplayMenuView(cTemplateView *tmplView, bool menuInit) : cView(tmplView) {
|
|
|
|
if (menuInit)
|
|
|
|
SetFadeTime(tmplView->GetNumericParameter(ptFadeTime));
|
|
|
|
else
|
|
|
|
SetFadeTime(0);
|
|
|
|
cat = mcUndefined;
|
2015-03-31 16:08:42 +02:00
|
|
|
sortMode = msmUnknown;
|
|
|
|
sortModeLast = msmUnknown;
|
2014-10-25 17:29:41 +02:00
|
|
|
buttonTexts = NULL;
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cDisplayMenuView::~cDisplayMenuView() {
|
|
|
|
CancelSave();
|
|
|
|
FadeOut();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cDisplayMenuView::DrawBackground(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veBackground)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return false;
|
|
|
|
}
|
2015-01-06 06:07:48 +01:00
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
|
|
|
DrawViewElement(veBackground, &stringTokens, &intTokens);
|
2014-09-27 09:25:14 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cDisplayMenuView::DrawHeader(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veHeader)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
2015-03-28 11:57:51 +01:00
|
|
|
SetMenuHeader(cat, menuTitle, stringTokens, intTokens);
|
2014-09-27 09:25:14 +02:00
|
|
|
ClearViewElement(veHeader);
|
|
|
|
DrawViewElement(veHeader, &stringTokens, &intTokens);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cDisplayMenuView::DrawDateTime(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veDateTime)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
2015-01-06 06:07:48 +01:00
|
|
|
if (!SetDate(stringTokens, intTokens)) {
|
|
|
|
return false;
|
|
|
|
}
|
2014-09-27 09:25:14 +02:00
|
|
|
|
|
|
|
ClearViewElement(veDateTime);
|
|
|
|
DrawViewElement(veDateTime, &stringTokens, &intTokens);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-01-06 06:07:48 +01:00
|
|
|
bool cDisplayMenuView::DrawTime(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veTime)) {
|
2015-01-06 06:07:48 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
|
|
|
if (!SetTime(stringTokens, intTokens)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
ClearViewElement(veTime);
|
|
|
|
DrawViewElement(veTime, &stringTokens, &intTokens);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
bool cDisplayMenuView::DrawColorButtons(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veButtons)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
2014-10-25 17:29:41 +02:00
|
|
|
stringTokens.insert(pair<string,string>("red", buttonTexts ? buttonTexts[0] : ""));
|
|
|
|
stringTokens.insert(pair<string,string>("green", buttonTexts ? buttonTexts[1]: ""));
|
|
|
|
stringTokens.insert(pair<string,string>("yellow", buttonTexts ? buttonTexts[2]: ""));
|
|
|
|
stringTokens.insert(pair<string,string>("blue", buttonTexts ? buttonTexts[3] : ""));
|
2014-09-27 09:25:14 +02:00
|
|
|
|
|
|
|
int colorKeys[4] = { Setup.ColorKey0, Setup.ColorKey1, Setup.ColorKey2, Setup.ColorKey3 };
|
|
|
|
|
|
|
|
for (int button = 1; button < 5; button++) {
|
|
|
|
string red = *cString::sprintf("red%d", button);
|
|
|
|
string green = *cString::sprintf("green%d", button);
|
|
|
|
string yellow = *cString::sprintf("yellow%d", button);
|
|
|
|
string blue = *cString::sprintf("blue%d", button);
|
|
|
|
bool isRed = false;
|
|
|
|
bool isGreen = false;
|
|
|
|
bool isYellow = false;
|
|
|
|
bool isBlue = false;
|
|
|
|
switch (colorKeys[button-1]) {
|
|
|
|
case 0:
|
|
|
|
isRed = true;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
isGreen = true;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
isYellow = true;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
isBlue = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
intTokens.insert(pair<string, int>(red, isRed));
|
|
|
|
intTokens.insert(pair<string, int>(green, isGreen));
|
|
|
|
intTokens.insert(pair<string, int>(yellow, isYellow));
|
|
|
|
intTokens.insert(pair<string, int>(blue, isBlue));
|
|
|
|
}
|
|
|
|
|
|
|
|
ClearViewElement(veButtons);
|
|
|
|
DrawViewElement(veButtons, &stringTokens, &intTokens);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cDisplayMenuView::DrawMessage(eMessageType type, const char *text) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veMessage)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (!text) {
|
|
|
|
ClearViewElement(veMessage);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
|
|
|
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));
|
|
|
|
stringTokens.insert(pair<string,string>("text", text));
|
|
|
|
|
|
|
|
ClearViewElement(veMessage);
|
|
|
|
DrawViewElement(veMessage, &stringTokens, &intTokens);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayMenuView::DrawScrollbar(int numMax, int numDisplayed, int offset) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veScrollbar)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
if (numDisplayed < 1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
int barHeight = 0;
|
|
|
|
if (numDisplayed < numMax)
|
|
|
|
barHeight = 1000;
|
|
|
|
else
|
|
|
|
barHeight = (double)numMax * 1000 / (double)numDisplayed;
|
|
|
|
|
|
|
|
int barOffset = (double)offset * 1000 / (double)numDisplayed;
|
|
|
|
|
|
|
|
intTokens.insert(pair<string, int>("height", barHeight));
|
|
|
|
intTokens.insert(pair<string, int>("offset", barOffset));
|
|
|
|
|
|
|
|
ClearViewElement(veScrollbar);
|
|
|
|
DrawViewElement(veScrollbar, &stringTokens, &intTokens);
|
|
|
|
}
|
|
|
|
|
2015-03-31 16:08:42 +02:00
|
|
|
bool cDisplayMenuView::DrawSortMode(void) {
|
|
|
|
if (!ExecuteViewElement(veSortMode)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (sortMode == msmUnknown) {
|
|
|
|
if (sortModeLast != msmUnknown)
|
|
|
|
ClearViewElement(veSortMode);
|
|
|
|
sortModeLast = msmUnknown;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (sortMode == sortModeLast)
|
|
|
|
return true;
|
|
|
|
sortModeLast = sortMode;
|
|
|
|
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
|
|
|
bool sortNumber = (sortMode == msmNumber) ? true : false;
|
|
|
|
bool sortName = (sortMode == msmName) ? true : false;
|
|
|
|
bool sortTime = (sortMode == msmTime) ? true : false;
|
|
|
|
bool sortProvider = (sortMode == msmProvider) ? true : false;
|
|
|
|
|
|
|
|
intTokens.insert(pair<string, int>("sortnumber", sortNumber));
|
|
|
|
intTokens.insert(pair<string, int>("sortname", sortName));
|
|
|
|
intTokens.insert(pair<string, int>("sorttime", sortTime));
|
|
|
|
intTokens.insert(pair<string, int>("sortprovider", sortProvider));
|
|
|
|
|
|
|
|
ClearViewElement(veSortMode);
|
|
|
|
DrawViewElement(veSortMode, &stringTokens, &intTokens);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
bool cDisplayMenuView::BackgroundImplemented(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veBackground)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void cDisplayMenuView::Action(void) {
|
|
|
|
SetInitFinished();
|
|
|
|
FadeIn();
|
|
|
|
DoFlush();
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* cDisplayMenuMainView
|
|
|
|
************************************************************************/
|
|
|
|
|
2015-04-01 10:14:26 +02:00
|
|
|
cDisplayMenuMainView::cDisplayMenuMainView(cTemplateView *tmplView, bool menuInit, string currentRecording) : cDisplayMenuView(tmplView, menuInit) {
|
|
|
|
this->currentRecording = currentRecording;
|
2014-09-27 09:25:14 +02:00
|
|
|
initial = true;
|
|
|
|
InitDevices();
|
|
|
|
}
|
|
|
|
|
|
|
|
cDisplayMenuMainView::~cDisplayMenuMainView() {
|
|
|
|
CancelSave();
|
|
|
|
FadeOut();
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayMenuMainView::DrawStaticViewElements(void) {
|
|
|
|
DrawTimers();
|
2015-03-29 13:29:59 +02:00
|
|
|
DrawLastRecordings();
|
2014-09-27 09:25:14 +02:00
|
|
|
DrawDiscUsage();
|
2015-01-06 06:07:48 +01:00
|
|
|
DrawTemperatures();
|
2014-12-12 17:52:16 +01:00
|
|
|
DrawCurrentSchedule();
|
2015-01-14 14:20:22 +01:00
|
|
|
DrawCurrentWeather();
|
2014-12-19 15:39:21 +01:00
|
|
|
DrawCustomTokens();
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool cDisplayMenuMainView::DrawDynamicViewElements(void) {
|
|
|
|
bool loadChanged = DrawLoad();
|
2015-03-15 15:50:12 +01:00
|
|
|
bool memChanged = DrawMemory();
|
2014-09-27 09:25:14 +02:00
|
|
|
bool devicesChanged = DrawDevices();
|
|
|
|
initial = false;
|
2015-03-15 15:50:12 +01:00
|
|
|
return loadChanged || memChanged || devicesChanged;
|
2014-09-27 09:25:14 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDisplayMenuMainView::DrawTimers(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veTimers)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return;
|
|
|
|
}
|
2015-03-28 11:57:51 +01:00
|
|
|
if (DetachViewElement(veTimers)) {
|
|
|
|
cViewElement *viewElement = GetViewElement(veTimers);
|
|
|
|
if (!viewElement) {
|
|
|
|
viewElement = new cViewElementTimers(tmplView->GetViewElement(veTimers));
|
|
|
|
AddViewElement(veTimers, viewElement);
|
|
|
|
viewElement->Start();
|
2014-09-27 09:25:14 +02:00
|
|
|
} else {
|
2015-03-28 11:57:51 +01:00
|
|
|
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;
|
|
|
|
map < string, vector< map< string, string > > > timerLoopTokens;
|
|
|
|
vector< map< string, string > > timers;
|
2014-09-27 09:25:14 +02:00
|
|
|
|
2015-03-28 11:57:51 +01:00
|
|
|
SetTimers(&intTokens, &stringTokens, &timers);
|
2014-09-27 09:25:14 +02:00
|
|
|
|
2015-03-28 11:57:51 +01:00
|
|
|
timerLoopTokens.insert(pair< string, vector< map< string, string > > >("timers", timers));
|
2014-09-27 09:25:14 +02:00
|
|
|
|
2015-03-28 11:57:51 +01:00
|
|
|
ClearViewElement(veTimers);
|
|
|
|
DrawViewElement(veTimers, &stringTokens, &intTokens, &timerLoopTokens);
|
|
|
|
}
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
2015-03-29 13:29:59 +02:00
|
|
|
void cDisplayMenuMainView::DrawLastRecordings(void) {
|
|
|
|
if (!ExecuteViewElement(veLastRecordings)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (DetachViewElement(veLastRecordings)) {
|
|
|
|
cViewElement *viewElement = GetViewElement(veLastRecordings);
|
|
|
|
if (!viewElement) {
|
|
|
|
viewElement = new cViewElementLastRecordings(tmplView->GetViewElement(veLastRecordings));
|
|
|
|
AddViewElement(veLastRecordings, viewElement);
|
|
|
|
viewElement->Start();
|
|
|
|
} else {
|
|
|
|
if (!viewElement->Starting())
|
|
|
|
viewElement->Render();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
map < string, vector< map< string, string > > > recordingLoopTokens;
|
|
|
|
vector< map< string, string > > lastRecordings;
|
|
|
|
|
|
|
|
SetLastRecordings(&intTokens, &stringTokens, &lastRecordings);
|
|
|
|
recordingLoopTokens.insert(pair< string, vector< map< string, string > > >("recordings", lastRecordings));
|
|
|
|
|
|
|
|
ClearViewElement(veLastRecordings);
|
|
|
|
DrawViewElement(veLastRecordings, &stringTokens, &intTokens, &recordingLoopTokens);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
void cDisplayMenuMainView::DrawDiscUsage(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veDiscUsage)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return;
|
|
|
|
}
|
2015-03-28 11:57:51 +01:00
|
|
|
if (DetachViewElement(veDiscUsage)) {
|
|
|
|
cViewElement *viewElement = GetViewElement(veDiscUsage);
|
|
|
|
if (!viewElement) {
|
|
|
|
viewElement = new cViewElementDiscUsage(tmplView->GetViewElement(veDiscUsage));
|
|
|
|
AddViewElement(veDiscUsage, viewElement);
|
|
|
|
viewElement->Start();
|
|
|
|
} else {
|
|
|
|
if (!viewElement->Starting())
|
|
|
|
viewElement->Render();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
SetDiscUsage(stringTokens, intTokens);
|
|
|
|
ClearViewElement(veDiscUsage);
|
|
|
|
DrawViewElement(veDiscUsage, &stringTokens, &intTokens);
|
|
|
|
}
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool cDisplayMenuMainView::DrawLoad(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veSystemLoad)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return false;
|
|
|
|
}
|
2015-03-28 11:57:51 +01:00
|
|
|
bool changed = false;
|
|
|
|
if (DetachViewElement(veSystemLoad)) {
|
|
|
|
cViewElement *viewElement = GetViewElement(veSystemLoad);
|
|
|
|
if (!viewElement) {
|
|
|
|
viewElement = new cViewElementSystemLoad(tmplView->GetViewElement(veSystemLoad));
|
|
|
|
AddViewElement(veSystemLoad, viewElement);
|
|
|
|
viewElement->Start();
|
|
|
|
changed = true;
|
|
|
|
} else {
|
|
|
|
if (!viewElement->Starting())
|
|
|
|
changed = 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;
|
|
|
|
changed = SetSystemLoad(stringTokens, intTokens);
|
|
|
|
if (changed) {
|
|
|
|
ClearViewElement(veSystemLoad);
|
|
|
|
DrawViewElement(veSystemLoad, &stringTokens, &intTokens);
|
2015-01-06 06:07:48 +01:00
|
|
|
}
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
2015-03-28 11:57:51 +01:00
|
|
|
return changed;
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
2015-03-15 15:50:12 +01:00
|
|
|
bool cDisplayMenuMainView::DrawMemory(void) {
|
|
|
|
if (!ExecuteViewElement(veSystemMemory)) {
|
|
|
|
return false;
|
|
|
|
}
|
2015-03-28 11:57:51 +01:00
|
|
|
bool changed = false;
|
|
|
|
if (DetachViewElement(veSystemMemory)) {
|
|
|
|
cViewElement *viewElement = GetViewElement(veSystemMemory);
|
|
|
|
if (!viewElement) {
|
|
|
|
viewElement = new cViewElementSystemMemory(tmplView->GetViewElement(veSystemMemory));
|
|
|
|
AddViewElement(veSystemMemory, viewElement);
|
|
|
|
viewElement->Start();
|
|
|
|
changed = true;
|
|
|
|
} else {
|
|
|
|
if (!viewElement->Starting())
|
|
|
|
changed = viewElement->Render();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
changed = SetSystemMemory(stringTokens, intTokens);
|
|
|
|
if (changed) {
|
|
|
|
ClearViewElement(veSystemMemory);
|
|
|
|
DrawViewElement(veSystemMemory, &stringTokens, &intTokens);
|
|
|
|
}
|
2015-03-15 15:50:12 +01:00
|
|
|
}
|
2015-03-28 11:57:51 +01:00
|
|
|
return changed;
|
2015-03-15 15:50:12 +01:00
|
|
|
}
|
|
|
|
|
2015-01-06 06:07:48 +01:00
|
|
|
void cDisplayMenuMainView::DrawTemperatures(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veTemperatures)) {
|
2015-01-06 06:07:48 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-03-28 11:57:51 +01:00
|
|
|
if (DetachViewElement(veTemperatures)) {
|
|
|
|
cViewElement *viewElement = GetViewElement(veTemperatures);
|
|
|
|
if (!viewElement) {
|
|
|
|
viewElement = new cViewElementTemperature(tmplView->GetViewElement(veTemperatures));
|
|
|
|
AddViewElement(veTemperatures, viewElement);
|
|
|
|
viewElement->Start();
|
|
|
|
} else {
|
|
|
|
if (!viewElement->Starting())
|
|
|
|
viewElement->Render();
|
|
|
|
}
|
2015-01-06 06:07:48 +01:00
|
|
|
} else {
|
2015-03-28 11:57:51 +01:00
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
bool changed = SetSystemTemperatures(stringTokens, intTokens);
|
|
|
|
if (changed) {
|
|
|
|
ClearViewElement(veTemperatures);
|
|
|
|
DrawViewElement(veTemperatures, &stringTokens, &intTokens);
|
|
|
|
}
|
2015-01-06 06:07:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
bool cDisplayMenuMainView::DrawDevices(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veDevices)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return false;
|
|
|
|
}
|
2015-03-28 11:57:51 +01:00
|
|
|
bool changed = false;
|
|
|
|
if (DetachViewElement(veDevices)) {
|
|
|
|
cViewElement *viewElement = GetViewElement(veDevices);
|
|
|
|
if (!viewElement) {
|
|
|
|
viewElement = new cViewElementDevices(tmplView->GetViewElement(veDevices));
|
|
|
|
AddViewElement(veDevices, viewElement);
|
|
|
|
viewElement->Start();
|
|
|
|
changed = true;
|
|
|
|
} else {
|
|
|
|
if (!viewElement->Starting())
|
|
|
|
changed = viewElement->Render();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
map < string, vector< map< string, string > > > deviceLoopTokens;
|
|
|
|
vector< map< string, string > > devices;
|
2014-09-27 09:25:14 +02:00
|
|
|
|
2015-03-28 11:57:51 +01:00
|
|
|
changed = SetDevices(initial, &intTokens, &devices);
|
|
|
|
if (!changed)
|
|
|
|
return false;
|
2014-09-27 09:25:14 +02:00
|
|
|
|
2015-03-28 11:57:51 +01:00
|
|
|
deviceLoopTokens.insert(pair< string, vector< map< string, string > > >("devices", devices));
|
|
|
|
ClearViewElement(veDevices);
|
|
|
|
DrawViewElement(veDevices, &stringTokens, &intTokens, &deviceLoopTokens);
|
|
|
|
}
|
|
|
|
return changed;
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
2014-12-12 17:52:16 +01:00
|
|
|
|
|
|
|
void cDisplayMenuMainView::DrawCurrentSchedule(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veCurrentSchedule)) {
|
2014-12-12 17:52:16 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-03-28 11:57:51 +01:00
|
|
|
if (DetachViewElement(veCurrentSchedule)) {
|
|
|
|
cViewElement *viewElement = GetViewElement(veCurrentSchedule);
|
|
|
|
if (!viewElement) {
|
2015-04-01 10:14:26 +02:00
|
|
|
viewElement = new cViewElementCurrentSchedule(tmplView->GetViewElement(veCurrentSchedule), currentRecording);
|
2015-03-28 11:57:51 +01:00
|
|
|
AddViewElement(veCurrentSchedule, viewElement);
|
|
|
|
viewElement->Start();
|
|
|
|
} else {
|
|
|
|
if (!viewElement->Starting())
|
|
|
|
viewElement->Render();
|
2014-12-12 17:52:16 +01:00
|
|
|
}
|
2015-03-28 11:57:51 +01:00
|
|
|
} else {
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
2015-04-01 10:14:26 +02:00
|
|
|
SetCurrentSchedule(currentRecording, stringTokens, intTokens);
|
2015-03-28 11:57:51 +01:00
|
|
|
ClearViewElement(veCurrentSchedule);
|
|
|
|
DrawViewElement(veCurrentSchedule, &stringTokens, &intTokens);
|
2014-12-12 17:52:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-14 14:20:22 +01:00
|
|
|
void cDisplayMenuMainView::DrawCurrentWeather(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veCurrentWeather)) {
|
2015-01-14 14:20:22 +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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-19 15:39:21 +01:00
|
|
|
void cDisplayMenuMainView::DrawCustomTokens(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veCustomTokens)) {
|
2014-12-19 15:39:21 +01: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-12-19 15:39:21 +01:00
|
|
|
}
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
/************************************************************************
|
|
|
|
* cDisplayMenuSchedulesView
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
cDisplayMenuSchedulesView::cDisplayMenuSchedulesView(cTemplateView *tmplView, eMenuCategory menuCat, bool menuInit) : cDisplayMenuView(tmplView, menuInit) {
|
|
|
|
cat = menuCat;
|
|
|
|
channel = NULL;
|
2015-01-10 10:10:31 +01:00
|
|
|
isEpgSearchFavoritesMenu = false;
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cDisplayMenuSchedulesView::~cDisplayMenuSchedulesView() {
|
|
|
|
CancelSave();
|
|
|
|
FadeOut();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cDisplayMenuSchedulesView::DrawHeader(void) {
|
2015-03-13 18:00:39 +01:00
|
|
|
if (!ExecuteViewElement(veHeader)) {
|
2014-09-27 09:25:14 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
map < string, string > stringTokens;
|
|
|
|
map < string, int > intTokens;
|
|
|
|
|
2015-01-10 10:10:31 +01:00
|
|
|
intTokens.insert(pair<string,int>("whatson", (cat == mcSchedule)&&(!isEpgSearchFavoritesMenu) ? true: false));
|
2014-09-27 09:25:14 +02:00
|
|
|
intTokens.insert(pair<string,int>("whatsonnow", (cat == mcScheduleNow) ? true: false));
|
|
|
|
intTokens.insert(pair<string,int>("whatsonnext", (cat == mcScheduleNext) ? true: false));
|
2015-01-10 10:10:31 +01:00
|
|
|
intTokens.insert(pair<string,int>("whatsonfavorites", isEpgSearchFavoritesMenu ? true: false));
|
2014-09-27 09:25:14 +02:00
|
|
|
|
|
|
|
stringTokens.insert(pair<string,string>("title", menuTitle));
|
|
|
|
stringTokens.insert(pair<string,string>("vdrversion", VDRVERSION));
|
|
|
|
if (channel) {
|
|
|
|
stringTokens.insert(pair<string,string>("channelnumber", *cString::sprintf("%d", channel->Number())));
|
|
|
|
stringTokens.insert(pair<string,string>("channelname", channel->Name()));
|
2014-11-01 10:23:34 +01:00
|
|
|
string channelID = *(channel->GetChannelID().ToString());
|
|
|
|
stringTokens.insert(pair<string,string>("channelid", channelID));
|
|
|
|
intTokens.insert(pair<string, int>("channellogoexists", imgCache->LogoExists(channelID)));
|
2015-01-13 09:12:44 +01:00
|
|
|
} else {
|
|
|
|
stringTokens.insert(pair<string,string>("channelnumber", ""));
|
|
|
|
stringTokens.insert(pair<string,string>("channelname", ""));
|
|
|
|
stringTokens.insert(pair<string,string>("channelid", ""));
|
|
|
|
intTokens.insert(pair<string, int>("channellogoexists", 0));
|
2014-09-27 09:25:14 +02:00
|
|
|
}
|
2014-10-26 08:26:44 +01:00
|
|
|
bool hasIcon = false;
|
|
|
|
string icon = imgCache->GetIconName(menuTitle, cat);
|
|
|
|
if (icon.size() > 0)
|
|
|
|
hasIcon = true;
|
|
|
|
|
|
|
|
stringTokens.insert(pair<string,string>("icon", icon));
|
|
|
|
intTokens.insert(pair<string,int>("hasicon", hasIcon));
|
2014-09-27 09:25:14 +02:00
|
|
|
ClearViewElement(veHeader);
|
|
|
|
DrawViewElement(veHeader, &stringTokens, &intTokens);
|
|
|
|
return true;
|
|
|
|
}
|