added possibility to detach viewelements

This commit is contained in:
louis 2015-03-28 11:57:51 +01:00
parent fcf90375fa
commit 762e2c1507
30 changed files with 1188 additions and 681 deletions

View File

@ -229,4 +229,8 @@ Version 0.3.1
Version 0.3.2
- fixed crash if number of dvb devices changes
- added possibility to detach dedicated viewelements in displaychannel
and displaymenumain that they start in an own thread
- introduced background="true" attribute in viewelements. These areas
will only be drawn once.

View File

@ -91,8 +91,8 @@ OBJS = $(PLUGIN).o \
views/view.o \
views/viewgrid.o \
views/viewhelpers.o \
views/displayviewelements.o \
views/displaychannelview.o \
views/displaychannelviewelements.o \
views/displaymenurootview.o \
views/displaymenuview.o \
views/displaymenulistview.o \

View File

@ -22,13 +22,11 @@ cSDDisplayChannel::cSDDisplayChannel(cTemplate *channelTemplate, bool WithInfo)
doOutput = false;
return;
}
esyslog("skindesigner: displaychannel opened");
}
cSDDisplayChannel::~cSDDisplayChannel() {
if (channelView)
delete channelView;
esyslog("skindesigner: displaychannel closed");
}
void cSDDisplayChannel::SetChannel(const cChannel *Channel, int Number) {

View File

@ -95,24 +95,36 @@
<!ELEMENT currentweather (area|areascroll)*>
<!ATTLIST currentweather
detached CDATA #IMPLIED
delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
<!ELEMENT scrapercontent (area|areascroll)*>
<!ATTLIST scrapercontent
detached CDATA #IMPLIED
delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
<!ELEMENT datetime (area|areascroll)*>
<!ATTLIST datetime
detached CDATA #IMPLIED
delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
<!ELEMENT time (area|areascroll)*>
<!ATTLIST time
detached CDATA #IMPLIED
delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
@ -125,6 +137,9 @@
<!ELEMENT customtokens (area|areascroll)*>
<!ATTLIST customtokens
detached CDATA #IMPLIED
delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>

View File

@ -53,54 +53,81 @@
<!ELEMENT timers (area|areascroll)*>
<!ATTLIST timers
detached CDATA #IMPLIED
delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
<!ELEMENT discusage (area|areascroll)*>
<!ATTLIST discusage
detached CDATA #IMPLIED
delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
<!ELEMENT devices (area|areascroll)*>
<!ATTLIST devices
detached CDATA #IMPLIED
delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
<!ELEMENT systemload (area|areascroll)*>
<!ATTLIST systemload
detached CDATA #IMPLIED
delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
<!ELEMENT systemmemory (area|areascroll)*>
<!ATTLIST systemmemory
detached CDATA #IMPLIED
delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
<!ELEMENT temperatures (area|areascroll)*>
<!ATTLIST temperatures
detached CDATA #IMPLIED
delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
<!ELEMENT currentschedule (area|areascroll)*>
<!ATTLIST currentschedule
detached CDATA #IMPLIED
delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
<!ELEMENT currentweather (area|areascroll)*>
<!ATTLIST currentweather
detached CDATA #IMPLIED
delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
<!ELEMENT customtokens (area|areascroll)*>
<!ATTLIST customtokens
detached CDATA #IMPLIED
delay CDATA #IMPLIED
fadetime CDATA #IMPLIED
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>

View File

@ -7,6 +7,7 @@
layer CDATA #REQUIRED
transparency CDATA #IMPLIED
condition CDATA #IMPLIED
background (true|false) #IMPLIED
debug (true|false) #IMPLIED
>

View File

@ -83,6 +83,8 @@ void cTemplateFunction::SetParameters(vector<pair<string, string> > params) {
p.first = ptLayer;
} else if (!name.compare("transparency")) {
p.first = ptTransparency;
} else if (!name.compare("background")) {
p.first = ptBackground;
} else if (!name.compare("quadrant")) {
p.first = ptQuadrant;
} else if (!name.compare("type")) {
@ -271,6 +273,9 @@ bool cTemplateFunction::CalculateParameters(void) {
case ptDetached:
paramValid = SetDetached(value);
break;
case ptBackground:
paramValid = SetBackground(value);
break;
default:
paramValid = true;
break;
@ -413,6 +418,8 @@ int cTemplateFunction::GetNumericParameter(eParamType type) {
return 0;
else if (type == ptDetached)
return 0;
else if (type == ptBackground)
return 0;
return -1;
}
return hit->second;
@ -1077,6 +1084,14 @@ bool cTemplateFunction::SetDetached(string value) {
return true;
}
bool cTemplateFunction::SetBackground(string value) {
int back = 0;
if (!value.compare("true"))
back = 1;
numericParameters.insert(pair<eParamType, int>(ptBackground, back));
return true;
}
void cTemplateFunction::ParseStringParameters(void) {
//first replace stringtokens in Text (drawText)
stringstream text;

View File

@ -56,6 +56,7 @@ enum eParamType {
ptText,
ptLayer,
ptTransparency,
ptBackground,
ptQuadrant,
ptType,
ptAlign,
@ -154,6 +155,7 @@ protected:
bool SetOverflow(string value);
bool SetHideRoot(string value);
bool SetDetached(string value);
bool SetBackground(string value);
void ParseStringParameters(void);
void ParseNumericalParameters(void);
void CalculateAlign(int elementWidth, int elementHeight);

View File

@ -12,6 +12,7 @@ cTemplatePixmap::cTemplatePixmap(void) {
containerHeight = 0;
globals = NULL;
scrolling = false;
background = false;
}
cTemplatePixmap::~cTemplatePixmap() {
@ -171,6 +172,8 @@ bool cTemplatePixmap::CalculateParameters(void) {
}
}
background = parameters->GetNumericParameter(ptBackground);
return paramsValid;
}

View File

@ -21,6 +21,7 @@ using namespace std;
class cTemplatePixmap {
protected:
bool scrolling;
bool background;
cTemplateFunction *parameters;
vector<cTemplateFunction*> functions;
vector<cTemplateFunction*>::iterator funcIt;
@ -76,6 +77,7 @@ public:
bool DoExecute(void) { return parameters->DoExecute(); };
bool DoDebug(void) { return parameters->DoDebug(); };
bool Ready(void);
bool BackgroundArea(void) { return background; };
//Traverse Functions
void InitIterator(void);
cTemplateFunction *GetNextFunction(void);

View File

@ -638,6 +638,7 @@ void cTemplateView::SetFunctionDefinitions(void) {
attributes.insert("height");
attributes.insert("layer");
attributes.insert("transparency");
attributes.insert("background");
funcsAllowed.insert(pair< string, set<string> >(name, attributes));
name = "areascroll";

View File

@ -52,7 +52,7 @@
</area>
</scrollbar>
<currentweather>
<currentweather detached="true" delay="100" fadetime="0">
<area x="40%" y="0" width="15%" height="8%" layer="3">
<drawimage name="weathericon" imagetype="icon" path="{icon}" align="right" valign="center" width="{areaheight}*0.8" height="{areaheight}*0.8"/>
<drawtext name="temperature" x="{areawidth} - {width(weathericon)} - {width(temperature)} - 10" valign="center" font="{light}" fontsize="80%" color="{clrWhite}" text="{temperature}°C" />
@ -75,7 +75,7 @@
{timers[channelid]} ChannelID of channel
{timers[channellogoexists]} true if channel logo exists
-->
<timers>
<timers detached="true" delay="100" fadetime="0">
<area condition="not{numtimers}" x="55%" y="71%" width="44%" height="19%" layer="2">
<drawtext align="center" valign="center" font="{semibold}" fontsize="40%" color="{clrWhite}" text="{tr(noactivetimers)}" />
</area>
@ -97,7 +97,7 @@
{discalert} true if disc usage is > 95%
{vdrusagestring} localized VDR internal usage string
-->
<discusage>
<discusage detached="true" delay="100" fadetime="0">
<area x="55%" y="51%" width="44%" height="19%" layer="5">
<drawimage imagetype="skinpart" path="tachohands/perc_{usedpercent}" x="{areawidth}*0.025" y="5%" width="20%" height="{areawidth}*0.20"/>
</area>
@ -131,7 +131,7 @@
{load} current system load
{loadhand} system load for tacho hand (between 0 and 2.5 in 0.025 steps multiplied by 1000, >2.5 is always 2525)
-->
<systemload>
<systemload detached="true" delay="100" fadetime="0">
<area x="55%" y="51%" width="44%" height="19%" layer="5">
<drawimage imagetype="skinpart" path="tachohands/load_{loadhand}" x="{areawidth}*0.28" y="5%" width="20%" height="{areawidth}*0.20"/>
</area>
@ -144,7 +144,7 @@
{cputemp} current cpu temperature in °C
{gputemp} current gpu temperature in °C
-->
<temperatures>
<temperatures detached="true" delay="100" fadetime="0">
<area x="55%" y="51%" width="44%" height="19%" layer="5">
<drawimage condition="gt({cputemp}, 80)" imagetype="skinpart" path="tachohands/temp_81" x="{areawidth}*0.53" y="5%" width="20%" height="{areawidth}*0.2"/>
<drawimage condition="lt({cputemp}, 81)" imagetype="skinpart" path="tachohands/temp_{cputemp}" x="{areawidth}*0.53" y="5%" width="20%" height="{areawidth}*0.2"/>

View File

@ -7,16 +7,6 @@
<area x="0" y="80%" width="100%" height="20%" layer="1">
<fill color="{clrTransBlack}" />
</area>
<!-- background datetime -->
<area x="70%" y="0" width="30%" height="13%" layer="1">
<fill color="{clrTransBlack}" />
<drawrectangle x="0" y="0" width="45%" height="100%" color="{clrTransBlueLight}" />
</area>
<!-- background weather -->
<area x="70%" y="15%" width="30%" height="13%" layer="1">
<fill color="{clrTransBlack}" />
<drawrectangle x="0" y="0" width="45%" height="100%" color="{clrTransBlueLight}" />
</area>
<!-- background channellogo -->
<area x="0" y="80%" width="20%" height="20%" layer="2">
<fill color="{clrTransBlueLight}" />
@ -196,11 +186,11 @@
{devices[channelid]} ID of the currently tuned channel
{devices[source]} source of the currently tuned channel
-->
<devices detached="true" delay="500" fadetime="500">
<area condition="{showdevices}" x="70%" y="30%" width="30%" height="{areaheight}/12 * {numdevices}" layer="1">
<devices condition="{showdevices}" detached="true" delay="100" fadetime="{fadetime}">
<area x="70%" y="30%" width="30%" height="{areaheight}/12 * {numdevices}" layer="1" background="true">
<fill color="{clrTransBlack}"/>
</area>
<area condition="{showdevices}" x="70%" y="30%" width="30%" height="{areaheight}/12 * {numdevices}" layer="2">
<area x="70%" y="30%" width="30%" height="{areaheight}/12 * {numdevices}" layer="2">
<loop name="devices" x="0" y="0" orientation="vertical" columnwidth="{areawidth}" rowheight="{areaheight} / {numdevices}" overflow="cut">
<drawtext name="label" x="5" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrWhite}" text="{devices[num]}: {devices[type]}" />
<drawtext condition="{devices[hascam]}" x="{width(label)} + 15" y="0" font="{light}" fontsize="{rowheight}*0.35" color="{clrWhite}" text="(CAM {devices[cam]})" />
@ -235,6 +225,10 @@
{ozone} ozone value in DU
-->
<currentweather>
<area background="true" x="70%" y="15%" width="30%" height="13%" layer="1">
<fill color="{clrTransBlack}" />
<drawrectangle x="0" y="0" width="45%" height="100%" color="{clrTransBlueLight}" />
</area>
<area x="70%" y="15%" width="13%" height="13%" layer="2">
<drawimage imagetype="icon" path="{icon}" align="center" valign="center" width="{areaheight}*0.8" height="{areaheight}*0.8"/>
</area>
@ -284,6 +278,10 @@
{year} year in yyyy
-->
<datetime>
<area background="true" x="70%" y="0" width="30%" height="13%" layer="1">
<fill color="{clrTransBlack}" />
<drawrectangle x="0" y="0" width="45%" height="100%" color="{clrTransBlueLight}" />
</area>
<area x="70%" y="0" width="13%" height="13%" layer="2">
<drawtext align="right" y="0" font="{light}" fontsize="50%" color="{clrWhite}" text="{dayname}" />
<drawtext align="right" y="48%" font="{light}" fontsize="50%" color="{clrWhite}" text="{day}. {monthnameshort}" />

View File

@ -120,7 +120,7 @@
{timers[channelid]} ChannelID of channel
{timers[channellogoexists]} true if channel logo exists
-->
<timers>
<timers detached="true" delay="100" fadetime="0">
<area x="0" y="75%" width="{areawidth}/8 - 5" height="25%" layer="1">
<fill color="{clrTransBlack}" />
</area>
@ -174,8 +174,8 @@
{discalert} true if disc usage is > 95%
{vdrusagestring} localized VDR internal usage string
-->
<discusage>
<area x="75%" y="26%" width="25%" height="10%" layer="1">
<discusage detached="true" delay="100" fadetime="0">
<area background="true" x="75%" y="26%" width="25%" height="10%" layer="1">
<fill condition="not{discalert}" color="{clrTransBlack}"/>
<fill condition="{discalert}" color="{clrRed}"/>
</area>
@ -206,7 +206,7 @@
{pressure} pressure in HPo
{ozone} ozone value in DU
-->
<currentweather>
<currentweather detached="true" delay="100" fadetime="0">
<area x="75%" y="13%" width="25%" height="10%" layer="2">
<drawrectangle x="0" y="0" width="53%" height="100%" color="{clrTransBlueLight}" />
<drawrectangle x="53%" y="0" width="47%" height="100%" color="{clrTransBlack}" />
@ -240,8 +240,8 @@
{devices[channelid]} ID of the currently tuned channel
{devices[source]} source of the currently tuned channel
-->
<devices>
<area x="75%" y="48%" width="25%" height="{areaheight}/12 * {numdevices}" layer="1">
<devices detached="true" delay="100" fadetime="0">
<area background="true" x="75%" y="48%" width="25%" height="{areaheight}/12 * {numdevices}" layer="1">
<fill color="{clrTransBlack}"/>
</area>
<area x="75%" y="48%" width="25%" height="{areaheight}/12 * {numdevices}" layer="2">
@ -261,8 +261,8 @@
<!-- Available Variables systemload:
{load} current system load
-->
<systemload>
<area x="75%" y="40%" width="25%" height="5%" layer="1">
<systemload detached="true" delay="100" fadetime="0">
<area background="true" x="75%" y="40%" width="25%" height="5%" layer="1">
<fill color="{clrTransBlack}"/>
</area>
<area x="75%" y="40%" width="25%" height="5%" layer="2">

View File

@ -28,7 +28,7 @@
{timers[channelid]} ChannelID of channel
{timers[channellogoexists]} true if channel logo exists
-->
<timers>
<timers detached="true" delay="100" fadetime="0">
<area x="85%" y="28%" width="14%" height="60%" layer="1">
<drawrectangle condition="gt({numtimers}, 0)" x="0" y="0" width="{areawidth}" height="{areaheight} / 4 * 99 / 100" color="{clrTransBlack}" />
<drawrectangle condition="gt({numtimers}, 1)" x="0" y="{areaheight} / 4" width="{areawidth}" height="{areaheight} / 4 * 99 / 100" color="{clrTransBlack}" />
@ -61,8 +61,8 @@
{discalert} true if disc usage is > 95%
{vdrusagestring} localized VDR internal usage string
-->
<discusage>
<area x="89%" y="11%" width="10%" height="16%" layer="1">
<discusage detached="true" delay="100" fadetime="0">
<area background="true" x="89%" y="11%" width="10%" height="16%" layer="1">
<fill condition="lt({freepercent}, 6)" color="{clrTransRed}" />
<fill condition="gt({freepercent}, 5)" color="{clrBackground}" />
<drawimage imagetype="skinpart" path="discpercent" x="0" y="82%" width="{areawidth}" height="18%"/>
@ -75,8 +75,8 @@
</area>
</discusage>
<currentweather>
<area x="63%" y="11%" width="25%" height="16%" layer="1">
<currentweather detached="true" delay="100" fadetime="0">
<area background="true" x="63%" y="11%" width="25%" height="16%" layer="1">
<fill color="{clrBackground}"/>
</area>
<area x="63%" y="11%" width="25%" height="16%" layer="2">

View File

@ -2,16 +2,13 @@
#include <vdr/menu.h>
#include "../services/scraper2vdr.h"
#include "displaychannelview.h"
#include "displaychannelviewelements.h"
#include "displayviewelements.h"
#include "../libcore/timers.h"
#include "../libcore/helpers.h"
cDisplayChannelView::cDisplayChannelView(cTemplateView *tmplView) : cView(tmplView) {
lastScreenWidth = 0;
lastScreenHeight = 0;
lastSignalDisplay = 0;
lastSignalStrength = 0;
lastSignalQuality = 0;
lastNumAudioTracks = 0;
lastAudioChannel = -1;
lastTracDesc = "";
@ -65,15 +62,27 @@ void cDisplayChannelView::DrawDate(void) {
return;
}
map < string, string > stringTokens;
map < string, int > intTokens;
if (!SetDate(stringTokens, intTokens)) {
return;
}
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;
if (!SetDate(stringTokens, intTokens)) {
return;
}
ClearViewElement(veDateTime);
DrawViewElement(veDateTime, &stringTokens, &intTokens);
ClearViewElement(veDateTime);
DrawViewElement(veDateTime, &stringTokens, &intTokens);
}
}
void cDisplayChannelView::DrawTime(void) {
@ -81,14 +90,26 @@ void cDisplayChannelView::DrawTime(void) {
return;
}
map < string, string > stringTokens;
map < string, int > intTokens;
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;
if (!SetTime(stringTokens, intTokens)) {
return;
}
ClearViewElement(veTime);
DrawViewElement(veTime, &stringTokens, &intTokens);
if (!SetTime(stringTokens, intTokens)) {
return;
}
ClearViewElement(veTime);
DrawViewElement(veTime, &stringTokens, &intTokens);
}
}
void cDisplayChannelView::DrawProgressBar(cString &start, cString &stop, int Current, int Total) {
@ -316,72 +337,22 @@ void cDisplayChannelView::DrawScraperContent(const cEvent *event) {
return;
}
static cPlugin *pScraper = GetScraperPlugin();
if (!pScraper) {
return;
}
ScraperGetPosterBanner call;
call.event = event;
if (pScraper->Service("GetPosterBanner", &call)) {
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;
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 = event;
callPoster.recording = NULL;
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;
hasPoster = true;
} else
return;
map < string, int > intTokens;
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 {
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);
map < string, int > intTokens;
SetPosterBanner(event, stringTokens, intTokens);
ClearScraperContent();
DrawViewElement(veScraperContent, &stringTokens, &intTokens);
}
}
@ -395,25 +366,26 @@ void cDisplayChannelView::DrawSignal(void) {
return;
}
time_t Now = time(NULL);
if (Now != lastSignalDisplay) {
int SignalStrength = cDevice::ActualDevice()->SignalStrength();
int SignalQuality = cDevice::ActualDevice()->SignalQuality();
if (SignalStrength < 0) SignalStrength = 0;
if (SignalQuality < 0) SignalQuality = 0;
if ((SignalStrength == 0)&&(SignalQuality==0))
return;
if ((lastSignalStrength != SignalStrength) || (lastSignalQuality != SignalQuality)) {
map < string, int > intTokens;
map < string, string > stringTokens;
intTokens.insert(pair<string,int>("signalstrength", SignalStrength));
intTokens.insert(pair<string,int>("signalquality", SignalQuality));
ClearViewElement(veSignalQuality);
DrawViewElement(veSignalQuality, &stringTokens, &intTokens);
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();
}
lastSignalStrength = SignalStrength;
lastSignalQuality = SignalQuality;
lastSignalDisplay = Now;
} else {
map < string, string > stringTokens;
map < string, int > intTokens;
bool changed = SetSignal(intTokens);
if (!changed)
return;
ClearSignal();
DrawViewElement(veSignalQuality, &stringTokens, &intTokens);
}
}
@ -445,7 +417,8 @@ void cDisplayChannelView::DrawDevices(bool initial) {
AddViewElement(veDevices, viewElement);
viewElement->Start();
} else {
viewElement->Render();
if (!viewElement->Starting())
viewElement->Render();
}
} else {
map < string, string > stringTokens;
@ -459,10 +432,9 @@ void cDisplayChannelView::DrawDevices(bool initial) {
deviceLoopTokens.insert(pair< string, vector< map< string, string > > >("devices", devices));
ClearViewElement(veDevices);
ClearDevices();
DrawViewElement(veDevices, &stringTokens, &intTokens, &deviceLoopTokens);
}
}
void cDisplayChannelView::ClearDevices(void) {
@ -477,8 +449,8 @@ void cDisplayChannelView::DrawChannelGroups(const cChannel *Channel, cString Cha
bool separatorExists = imgCache->SeparatorLogoExists(*ChannelName);
string separatorPath = separatorExists ? *ChannelName : "";
std::string prevChannelSep = GetChannelSep(Channel, true);
std::string nextChannelSep = GetChannelSep(Channel, false);
string prevChannelSep = GetChannelSep(Channel, true);
string nextChannelSep = GetChannelSep(Channel, false);
bool prevAvailable = (prevChannelSep.size() > 0)?true:false;
bool nextAvailable = (nextChannelSep.size() > 0)?true:false;
@ -502,7 +474,7 @@ void cDisplayChannelView::ClearChannelGroups(void) {
}
string cDisplayChannelView::GetChannelSep(const cChannel *channel, bool prev) {
std::string sepName = "";
string sepName = "";
const cChannel *sep = prev ? Channels.Prev(channel) :
Channels.Next(channel);
for (; sep; (prev)?(sep = Channels.Prev(sep)):(sep = Channels.Next(sep))) {
@ -540,24 +512,49 @@ void cDisplayChannelView::DrawCustomTokens(void) {
}
if (!tmplView)
return;
map < string, string > stringTokens = tmplView->GetCustomStringTokens();
map < string, int > intTokens = tmplView->GetCustomIntTokens();
DrawViewElement(veCustomTokens, &stringTokens, &intTokens);
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);
}
}
void cDisplayChannelView::DrawCurrentWeather(void) {
if (!ExecuteViewElement(veCurrentWeather)) {
return;
}
map < string, string > stringTokens;
map < string, int > intTokens;
if (!SetCurrentWeatherTokens(stringTokens, intTokens)){
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;
}
ClearViewElement(veCurrentWeather);
return;
DrawViewElement(veCurrentWeather, &stringTokens, &intTokens);
}
ClearViewElement(veCurrentWeather);
DrawViewElement(veCurrentWeather, &stringTokens, &intTokens);
}

View File

@ -9,9 +9,6 @@ class cDisplayChannelView : public cView, public cViewHelpers {
private:
int lastScreenWidth;
int lastScreenHeight;
int lastSignalDisplay;
int lastSignalStrength;
int lastSignalQuality;
int lastNumAudioTracks;
int lastAudioChannel;
string lastTracDesc;

View File

@ -1,23 +0,0 @@
#include "displaychannelviewelements.h"
cViewElementDevices::cViewElementDevices(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) {
init = true;
}
void cViewElementDevices::Render(void) {
map < string, vector< map< string, string > > > deviceLoopTokens;
vector< map< string, string > > devices;
if (init)
InitDevices();
bool changed = SetDevices(init, &intTokens, &devices);
init = false;
if (!changed)
return;
deviceLoopTokens.insert(pair< string, vector< map< string, string > > >("devices", devices));
Clear();
Draw(&deviceLoopTokens);
}

View File

@ -1,17 +0,0 @@
#ifndef __DISPLAYCHANNELVIEWELEMENTS_H
#define __DISPLAYCHANNELVIEWELEMENTS_H
#include "../libtemplate/template.h"
#include "view.h"
#include "viewhelpers.h"
class cViewElementDevices : public cViewElement, public cViewHelpers {
private:
bool init;
public:
cViewElementDevices(cTemplateViewElement *tmplViewElement);
virtual ~cViewElementDevices() {};
void Render(void);
};
#endif //__DISPLAYCHANNELVIEWELEMENTS_H

View File

@ -62,12 +62,13 @@ cDisplayMenuItemCurrentMainView::cDisplayMenuItemCurrentMainView(cTemplateViewEl
this->icon = icon;
}
void cDisplayMenuItemCurrentMainView::Render(void) {
bool cDisplayMenuItemCurrentMainView::Render(void) {
stringTokens.insert(pair<string,string>("number", number));
stringTokens.insert(pair<string,string>("label", label));
stringTokens.insert(pair<string,string>("icon", icon));
SetTokensPosMenuItem();
DrawViewElement(veMenuCurrentItemDetail, &stringTokens, &intTokens);
return true;
}
/*************************************************************
@ -83,7 +84,7 @@ cDisplayMenuItemCurrentSchedulesView::cDisplayMenuItemCurrentSchedulesView(cTemp
this->isEpgSearchFav = isEpgSearchFav;
}
void cDisplayMenuItemCurrentSchedulesView::Render(void) {
bool cDisplayMenuItemCurrentSchedulesView::Render(void) {
intTokens.insert(pair<string,int>("whatson", (cat == mcSchedule)&&(!isEpgSearchFav) ? true: false));
intTokens.insert(pair<string,int>("whatsonnow", (cat == mcScheduleNow) ? true: false));
intTokens.insert(pair<string,int>("whatsonnext", (cat == mcScheduleNext) ? true: false));
@ -145,6 +146,7 @@ void cDisplayMenuItemCurrentSchedulesView::Render(void) {
loopTokens.insert(pair<string, vector< map< string, string > > >("schedule", schedulesTokens));
SetTokensPosMenuItem();
DrawViewElement(veMenuCurrentItemDetail, &stringTokens, &intTokens, &loopTokens);
return true;
}
void cDisplayMenuItemCurrentSchedulesView::ReadSchedules(vector< map<string,string> > *schedulesTokens) {
@ -179,9 +181,9 @@ cDisplayMenuItemCurrentChannelView::cDisplayMenuItemCurrentChannelView(cTemplate
this->channel = channel;
}
void cDisplayMenuItemCurrentChannelView::Render(void) {
bool cDisplayMenuItemCurrentChannelView::Render(void) {
if (!channel)
return;
return false;
//general channel information
intTokens.insert(pair<string,int>("number", channel->Number()));
intTokens.insert(pair<string,int>("transponder", channel->Transponder()));
@ -276,6 +278,7 @@ void cDisplayMenuItemCurrentChannelView::Render(void) {
loopTokens.insert(pair<string, vector< map< string, string > > >("schedule", schedulesTokens));
SetTokensPosMenuItem();
DrawViewElement(veMenuCurrentItemDetail, &stringTokens, &intTokens, &loopTokens);
return true;
}
void cDisplayMenuItemCurrentChannelView::ReadSchedules(vector< map<string,string> > *schedulesTokens) {
@ -314,9 +317,9 @@ cDisplayMenuItemCurrentTimerView::cDisplayMenuItemCurrentTimerView(cTemplateView
this->timer = timer;
}
void cDisplayMenuItemCurrentTimerView::Render(void) {
bool cDisplayMenuItemCurrentTimerView::Render(void) {
if (!timer)
return;
return false;
intTokens.insert(pair<string,int>("flagactive", timer->HasFlags(tfActive)));
intTokens.insert(pair<string,int>("flaginstant", timer->HasFlags(tfInstant)));
intTokens.insert(pair<string,int>("flagvps", timer->HasFlags(tfVps)));
@ -398,6 +401,7 @@ void cDisplayMenuItemCurrentTimerView::Render(void) {
}
SetTokensPosMenuItem();
DrawViewElement(veMenuCurrentItemDetail, &stringTokens, &intTokens);
return true;
}
/*************************************************************
@ -412,9 +416,9 @@ cDisplayMenuItemCurrentRecordingView::cDisplayMenuItemCurrentRecordingView(cTemp
this->newRecs = newRecs;
}
void cDisplayMenuItemCurrentRecordingView::Render(void) {
bool cDisplayMenuItemCurrentRecordingView::Render(void) {
if (!recording)
return;
return false;
map < string, vector< map< string, string > > > loopTokens;
bool isFolder = (total > 0) ? true : false;
@ -468,7 +472,7 @@ void cDisplayMenuItemCurrentRecordingView::Render(void) {
const cRecordingInfo *info = usedRecording->Info();
if (!info) return;
if (!info) return true;
bool extRecinfoAvailable = false;
if (info->Aux()) {
@ -509,7 +513,7 @@ void cDisplayMenuItemCurrentRecordingView::Render(void) {
stringTokens.insert(pair<string,string>("description", info->Description() ? info->Description() : ""));
const cEvent *event = info->GetEvent();
if (!event) return;
if (!event) return true;
string recDate = *(event->GetDateString());
string recTime = *(event->GetTimeString());
@ -538,6 +542,7 @@ void cDisplayMenuItemCurrentRecordingView::Render(void) {
stringTokens.insert(pair<string,string>("durationeventminutes", *cString::sprintf("%.2d", duration%60)));
SetTokensPosMenuItem();
DrawViewElement(veMenuCurrentItemDetail, &stringTokens, &intTokens, &loopTokens);
return true;
}
/*************************************************************
@ -553,7 +558,8 @@ cDisplayMenuItemCurrentPluginView::cDisplayMenuItemCurrentPluginView(cTemplateVi
loopTokens = pluginLoopTokens;
}
void cDisplayMenuItemCurrentPluginView::Render(void) {
bool cDisplayMenuItemCurrentPluginView::Render(void) {
SetTokensPosMenuItem();
DrawViewElement(veMenuCurrentItemDetail, &stringTokens, &intTokens, &loopTokens);
return true;
}

View File

@ -24,7 +24,7 @@ private:
public:
cDisplayMenuItemCurrentMainView(cTemplateViewElement *tmplCurrent, string number, string label, string icon);
virtual ~cDisplayMenuItemCurrentMainView() {};
void Render(void);
bool Render(void);
};
class cDisplayMenuItemCurrentSchedulesView: public cDisplayMenuItemCurrentView {
@ -38,7 +38,7 @@ private:
public:
cDisplayMenuItemCurrentSchedulesView(cTemplateViewElement *tmplCurrent, const cEvent *event, const cChannel *channel, eTimerMatch timerMatch, eMenuCategory cat, bool isEpgSearchFav);
virtual ~cDisplayMenuItemCurrentSchedulesView() {};
void Render(void);
bool Render(void);
};
class cDisplayMenuItemCurrentChannelView: public cDisplayMenuItemCurrentView {
@ -48,7 +48,7 @@ private:
public:
cDisplayMenuItemCurrentChannelView(cTemplateViewElement *tmplCurrent, const cChannel *channel);
virtual ~cDisplayMenuItemCurrentChannelView() {};
void Render(void);
bool Render(void);
};
class cDisplayMenuItemCurrentTimerView: public cDisplayMenuItemCurrentView {
@ -57,7 +57,7 @@ private:
public:
cDisplayMenuItemCurrentTimerView(cTemplateViewElement *tmplCurrent, const cTimer *timer);
virtual ~cDisplayMenuItemCurrentTimerView() {};
void Render(void);
bool Render(void);
};
class cDisplayMenuItemCurrentRecordingView: public cDisplayMenuItemCurrentView {
@ -69,7 +69,7 @@ private:
public:
cDisplayMenuItemCurrentRecordingView(cTemplateViewElement *tmplCurrent, const cRecording *recording, int level, int total, int newRecs);
virtual ~cDisplayMenuItemCurrentRecordingView() {};
void Render(void);
bool Render(void);
};
class cDisplayMenuItemCurrentPluginView: public cDisplayMenuItemCurrentView {
@ -78,7 +78,7 @@ private:
public:
cDisplayMenuItemCurrentPluginView(cTemplateViewElement *tmplCurrent, map <string,string> &plugStringTokens, map <string,int> &plugIntTokens, map<string,vector<map<string,string> > > &pluginLoopTokens);
virtual ~cDisplayMenuItemCurrentPluginView() {};
void Render(void);
bool Render(void);
};
#endif //__DISPLAYMENUITEMCURRENTVIEW_H

View File

@ -1,12 +1,13 @@
#define __STL_CONFIG_H
#include <vdr/menu.h>
#include <vdr/videodir.h>
#include "displaymenurootview.h"
#include "displayviewelements.h"
#include "../config.h"
#include "../libcore/helpers.h"
cDisplayMenuRootView::cDisplayMenuRootView(cTemplateView *rootView) : cView(rootView) {
cat = mcUndefined;
menuTitle = "";
viewType = svUndefined;
subView = NULL;
subViewAvailable = false;
@ -479,37 +480,9 @@ void cDisplayMenuRootView::DrawHeader(void) {
if (!ExecuteViewElement(veHeader)) {
return;
}
map < string, string > stringTokens;
map < string, int > intTokens;
stringTokens.insert(pair<string,string>("title", menuTitle));
stringTokens.insert(pair<string,string>("vdrversion", VDRVERSION));
//check for standard menu entries
bool hasIcon = false;
string icon = imgCache->GetIconName(menuTitle, cat);
if (imgCache->MenuIconExists(icon))
hasIcon = true;
stringTokens.insert(pair<string,string>("icon", icon));
intTokens.insert(pair<string,int>("hasicon", hasIcon));
//Disc Usage
string vdrUsageString = *cVideoDiskUsage::String();
int discUsage = cVideoDiskUsage::UsedPercent();
bool discAlert = (discUsage > 95) ? true : false;
string freeTime = *cString::sprintf("%02d:%02d", cVideoDiskUsage::FreeMinutes() / 60, cVideoDiskUsage::FreeMinutes() % 60);
int freeGB = cVideoDiskUsage::FreeMB() / 1024;
intTokens.insert(pair<string, int>("usedpercent", discUsage));
intTokens.insert(pair<string, int>("freepercent", 100-discUsage));
intTokens.insert(pair<string, int>("discalert", discAlert));
intTokens.insert(pair<string, int>("freegb", freeGB));
stringTokens.insert(pair<string,string>("freetime", freeTime));
stringTokens.insert(pair<string,string>("vdrusagestring", vdrUsageString));
SetMenuHeader(cat, menuTitle, stringTokens, intTokens);
ClearViewElement(veHeader);
DrawViewElement(veHeader, &stringTokens, &intTokens);
}

View File

@ -1,13 +1,10 @@
#define __STL_CONFIG_H
#include <fstream>
#include <iostream>
#include <sys/sysinfo.h>
#include <vdr/menu.h>
#include <vdr/videodir.h>
#include "displaymenuview.h"
#include "displayviewelements.h"
#include "../config.h"
#include "../libcore/helpers.h"
#include "../libcore/timers.h"
#include "../services/scraper2vdr.h"
cDisplayMenuView::cDisplayMenuView(cTemplateView *tmplView, bool menuInit) : cView(tmplView) {
@ -39,35 +36,9 @@ bool cDisplayMenuView::DrawHeader(void) {
if (!ExecuteViewElement(veHeader)) {
return false;
}
map < string, string > stringTokens;
map < string, int > intTokens;
stringTokens.insert(pair<string,string>("title", menuTitle));
stringTokens.insert(pair<string,string>("vdrversion", VDRVERSION));
//check for standard menu entries
bool hasIcon = false;
string icon = imgCache->GetIconName(menuTitle, cat);
if (imgCache->MenuIconExists(icon))
hasIcon = true;
stringTokens.insert(pair<string,string>("icon", icon));
intTokens.insert(pair<string,int>("hasicon", hasIcon));
//Disc Usage
string vdrUsageString = *cVideoDiskUsage::String();
int discUsage = cVideoDiskUsage::UsedPercent();
bool discAlert = (discUsage > 95) ? true : false;
string freeTime = *cString::sprintf("%02d:%02d", cVideoDiskUsage::FreeMinutes() / 60, cVideoDiskUsage::FreeMinutes() % 60);
int freeGB = cVideoDiskUsage::FreeMB() / 1024;
intTokens.insert(pair<string, int>("usedpercent", discUsage));
intTokens.insert(pair<string, int>("freepercent", 100-discUsage));
intTokens.insert(pair<string, int>("discalert", discAlert));
intTokens.insert(pair<string, int>("freegb", freeGB));
stringTokens.insert(pair<string,string>("freetime", freeTime));
stringTokens.insert(pair<string,string>("vdrusagestring", vdrUsageString));
SetMenuHeader(cat, menuTitle, stringTokens, intTokens);
ClearViewElement(veHeader);
DrawViewElement(veHeader, &stringTokens, &intTokens);
return true;
@ -224,8 +195,6 @@ void cDisplayMenuView::Action(void) {
cDisplayMenuMainView::cDisplayMenuMainView(cTemplateView *tmplView, bool menuInit) : cDisplayMenuView(tmplView, menuInit) {
initial = true;
lastSystemLoad = 0.0;
lastMemUsage = -1;
InitDevices();
}
@ -256,382 +225,215 @@ void cDisplayMenuMainView::DrawTimers(void) {
if (!ExecuteViewElement(veTimers)) {
return;
}
map < string, string > stringTokens;
map < string, int > intTokens;
map < string, vector< map< string, string > > > timerLoopTokens;
vector< map< string, string > > timers;
cGlobalSortedTimers SortedTimers;// local and remote timers
int numTimers = SortedTimers.Size();
intTokens.insert(pair<string, int>("numtimers", numTimers));
int numTimerConflicts = SortedTimers.NumTimerConfilicts();
intTokens.insert(pair<string, int>("numtimerconflicts", numTimerConflicts));
for (int i=0; i<15; i++) {
stringstream name;
name << "timer" << i+1 << "exists";
if (i < numTimers) {
intTokens.insert(pair<string, int>(name.str(), true));
if (DetachViewElement(veTimers)) {
cViewElement *viewElement = GetViewElement(veTimers);
if (!viewElement) {
viewElement = new cViewElementTimers(tmplView->GetViewElement(veTimers));
AddViewElement(veTimers, viewElement);
viewElement->Start();
} else {
intTokens.insert(pair<string, int>(name.str(), false));
if (!viewElement->Starting())
viewElement->Render();
}
}
} else {
map < string, string > stringTokens;
map < string, int > intTokens;
map < string, vector< map< string, string > > > timerLoopTokens;
vector< map< string, string > > timers;
for (int i = 0; i < numTimers; i++) {
if (i >=15)
break;
map< string, string > timerVals;
const cTimer *Timer = SortedTimers[i];
const cEvent *event = Timer->Event();
if (event) {
timerVals.insert(pair< string, string >("timers[title]", event->Title()));
} else {
const char *File = Setup.FoldersInTimerMenu ? NULL : strrchr(Timer->File(), FOLDERDELIMCHAR);
if (File && strcmp(File + 1, TIMERMACRO_TITLE) && strcmp(File + 1, TIMERMACRO_EPISODE))
File++;
else
File = Timer->File();
timerVals.insert(pair< string, string >("timers[title]", File));
}
const cChannel *channel = Timer->Channel();
if (channel) {
timerVals.insert(pair< string, string >("timers[channelname]", channel->Name()));
stringstream chanNum;
chanNum << channel->Number();
timerVals.insert(pair< string, string >("timers[channelnumber]", chanNum.str()));
string channelID = *(channel->GetChannelID().ToString());
timerVals.insert(pair< string, string >("timers[channelid]", channelID));
bool logoExists = imgCache->LogoExists(channelID);
timerVals.insert(pair< string, string >("timers[channellogoexists]", logoExists ? "1" : "0"));
} else {
timerVals.insert(pair< string, string >("timers[channelname]", ""));
timerVals.insert(pair< string, string >("timers[channelnumber]", "0"));
timerVals.insert(pair< string, string >("timers[channelid]", ""));
timerVals.insert(pair< string, string >("timers[channellogoexists]", "0"));
}
timerVals.insert(pair< string, string >("timers[recording]", Timer->Recording() ? "1" : "0"));
SetTimers(&intTokens, &stringTokens, &timers);
cString timerDate("");
if (Timer->Recording()) {
timerDate = cString::sprintf("-%s", *TimeString(Timer->StopTime()));
} else {
time_t Now = time(NULL);
cString Today = WeekDayName(Now);
cString Time = TimeString(Timer->StartTime());
cString Day = WeekDayName(Timer->StartTime());
if (Timer->StartTime() > Now + 6 * SECSINDAY) {
time_t ttm = Timer->StartTime();
struct tm * timerTime = localtime(&ttm);
timerDate = cString::sprintf("%02d.%02d %s", timerTime->tm_mday, timerTime->tm_mon + 1, *Time);
} else if (strcmp(Day, Today) != 0)
timerDate = cString::sprintf("%s %s", *Day, *Time);
else
timerDate = Time;
if (Timer->Flags() & tfVps)
timerDate = cString::sprintf("VPS %s", *timerDate);
}
timerVals.insert(pair< string, string >("timers[datetime]", *timerDate));
timerLoopTokens.insert(pair< string, vector< map< string, string > > >("timers", timers));
timers.push_back(timerVals);
}
timerLoopTokens.insert(pair< string, vector< map< string, string > > >("timers", timers));
ClearViewElement(veTimers);
DrawViewElement(veTimers, &stringTokens, &intTokens, &timerLoopTokens);
ClearViewElement(veTimers);
DrawViewElement(veTimers, &stringTokens, &intTokens, &timerLoopTokens);
}
}
void cDisplayMenuMainView::DrawDiscUsage(void) {
if (!ExecuteViewElement(veDiscUsage)) {
return;
}
map < string, string > stringTokens;
map < string, int > intTokens;
string vdrUsageString = *cVideoDiskUsage::String();
int discUsage = cVideoDiskUsage::UsedPercent();
bool discAlert = (discUsage > 95) ? true : false;
string freeTime = *cString::sprintf("%02d:%02d", cVideoDiskUsage::FreeMinutes() / 60, cVideoDiskUsage::FreeMinutes() % 60);
int freeGB = cVideoDiskUsage::FreeMB() / 1024;
intTokens.insert(pair<string, int>("usedpercent", discUsage));
intTokens.insert(pair<string, int>("freepercent", 100-discUsage));
intTokens.insert(pair<string, int>("discalert", discAlert));
intTokens.insert(pair<string, int>("freegb", freeGB));
stringTokens.insert(pair<string,string>("freetime", freeTime));
stringTokens.insert(pair<string,string>("vdrusagestring", vdrUsageString));
ClearViewElement(veDiscUsage);
DrawViewElement(veDiscUsage, &stringTokens, &intTokens);
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);
}
}
bool cDisplayMenuMainView::DrawLoad(void) {
if (!ExecuteViewElement(veSystemLoad)) {
return false;
}
map < string, string > stringTokens;
map < string, int > intTokens;
double systemLoad;
if (getloadavg(&systemLoad, 1) > 0) {
if (lastSystemLoad == systemLoad) {
return false;
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();
}
string load = *cString::sprintf("%.2f", systemLoad);
int loadHand = systemLoad * 1000;
int loadHandValue = 0;
if (loadHand > 2500)
loadHandValue = 2525;
else {
int loadHandDec = loadHand - (loadHand / 100) * 100;
if (loadHandDec <= 12)
loadHandDec = 0;
else if (loadHandDec <= 37)
loadHandDec = 25;
else if (loadHandDec <= 62)
loadHandDec = 50;
else if (loadHandDec <= 87)
loadHandDec = 75;
else
loadHandDec = 0;
loadHandValue = loadHand / 100 * 100 + loadHandDec;
} else {
map < string, string > stringTokens;
map < string, int > intTokens;
changed = SetSystemLoad(stringTokens, intTokens);
if (changed) {
ClearViewElement(veSystemLoad);
DrawViewElement(veSystemLoad, &stringTokens, &intTokens);
}
stringTokens.insert(pair<string,string>("load", load));
intTokens.insert(pair<string,int>("loadhand", loadHandValue));
lastSystemLoad = systemLoad;
}
ClearViewElement(veSystemLoad);
DrawViewElement(veSystemLoad, &stringTokens, &intTokens);
return true;
return changed;
}
bool cDisplayMenuMainView::DrawMemory(void) {
if (!ExecuteViewElement(veSystemMemory)) {
return false;
}
struct sysinfo memInfo;
sysinfo (&memInfo);
long long totalMem = memInfo.totalram;
totalMem += memInfo.totalswap;
totalMem *= memInfo.mem_unit;
int totalMemMB = totalMem / 1024 / 1024;
long long usedMem = memInfo.totalram - memInfo.freeram;
usedMem += memInfo.totalswap - memInfo.freeswap;
usedMem *= memInfo.mem_unit;
int usedMemMB = usedMem / 1024 / 1024;
if (lastMemUsage == usedMemMB) {
return false;
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);
}
}
lastMemUsage = usedMemMB;
map < string, string > stringTokens;
map < string, int > intTokens;
intTokens.insert(pair<string,int>("totalmem", totalMemMB));
intTokens.insert(pair<string,int>("usedmem", usedMemMB));
if (totalMemMB > 0)
intTokens.insert(pair<string,int>("usedmempercent", usedMemMB * 100 / totalMemMB));
ClearViewElement(veSystemMemory);
DrawViewElement(veSystemMemory, &stringTokens, &intTokens);
return true;
return changed;
}
void cDisplayMenuMainView::DrawTemperatures(void) {
if (!ExecuteViewElement(veTemperatures)) {
return;
}
cString execCommand = cString::sprintf("cd \"%s/\"; \"%s/temperatures\"", SCRIPTFOLDER, SCRIPTFOLDER);
system(*execCommand);
string tempCPU, tempGPU;
int cpu, gpu;
cString itemFilename = cString::sprintf("%s/cpu", SCRIPTOUTPUTPATH );
ifstream file(*itemFilename, ifstream::in);
if( file.is_open() ) {
std::getline(file, tempCPU);
if (tempCPU.size() > 2) {
cpu = atoi(tempCPU.substr(0,2).c_str());
} else
cpu = 0;
file.close();
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();
}
} else {
tempCPU = "0°C";
cpu = 0;
map < string, string > stringTokens;
map < string, int > intTokens;
bool changed = SetSystemTemperatures(stringTokens, intTokens);
if (changed) {
ClearViewElement(veTemperatures);
DrawViewElement(veTemperatures, &stringTokens, &intTokens);
}
}
itemFilename = cString::sprintf("%s/gpu", SCRIPTOUTPUTPATH );
ifstream file2(*itemFilename, ifstream::in);
if( file2.is_open() ) {
std::getline(file2, tempGPU);
if (tempGPU.size() > 2) {
gpu = atoi(tempGPU.substr(0,2).c_str());
} else
gpu = 0;
file2.close();
} else {
tempGPU = "0°C";
gpu = 0;
}
map < string, string > stringTokens;
map < string, int > intTokens;
intTokens.insert(pair<string,int>("cputemp", cpu));
intTokens.insert(pair<string,int>("gputemp", gpu));
ClearViewElement(veTemperatures);
DrawViewElement(veTemperatures, &stringTokens, &intTokens);
}
bool cDisplayMenuMainView::DrawDevices(void) {
if (!ExecuteViewElement(veDevices)) {
return false;
}
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;
map < string, string > stringTokens;
map < string, int > intTokens;
map < string, vector< map< string, string > > > deviceLoopTokens;
vector< map< string, string > > devices;
changed = SetDevices(initial, &intTokens, &devices);
if (!changed)
return false;
bool changed = SetDevices(initial, &intTokens, &devices);
if (!changed)
return false;
deviceLoopTokens.insert(pair< string, vector< map< string, string > > >("devices", devices));
ClearViewElement(veDevices);
DrawViewElement(veDevices, &stringTokens, &intTokens, &deviceLoopTokens);
return true;
deviceLoopTokens.insert(pair< string, vector< map< string, string > > >("devices", devices));
ClearViewElement(veDevices);
DrawViewElement(veDevices, &stringTokens, &intTokens, &deviceLoopTokens);
}
return changed;
}
void cDisplayMenuMainView::DrawCurrentSchedule(void) {
if (!ExecuteViewElement(veCurrentSchedule)) {
return;
}
cDevice *device = cDevice::PrimaryDevice();
const cChannel *channel = NULL;
if (!device->Replaying() || device->Transferring()) {
channel = Channels.GetByNumber(device->CurrentChannel());
}
if (!channel)
return;
const cEvent *event = NULL;
cSchedulesLock SchedulesLock;
if (const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock))
if (const cSchedule *Schedule = Schedules->GetSchedule(channel))
event = Schedule->GetPresentEvent();
if (!event)
return;
map < string, string > stringTokens;
map < string, int > intTokens;
stringTokens.insert(pair<string,string>("title", (event->Title())?event->Title():""));
stringTokens.insert(pair<string,string>("subtitle", (event->ShortText())?event->ShortText():""));
stringTokens.insert(pair<string,string>("start", *event->GetTimeString()));
stringTokens.insert(pair<string,string>("stop", *event->GetEndTimeString()));
intTokens.insert(pair<string,int>("duration", event->Duration() / 60));
intTokens.insert(pair<string,int>("durationhours", event->Duration() / 3600));
stringTokens.insert(pair<string,string>("durationminutes", *cString::sprintf("%.2d", (event->Duration() / 60)%60)));
intTokens.insert(pair<string,int>("elapsed", (int)round((time(NULL) - event->StartTime())/60)));
intTokens.insert(pair<string,int>("remaining", (int)round((event->EndTime() - time(NULL))/60)));
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;
static cPlugin *pScraper = GetScraperPlugin();
if (pScraper) {
ScraperGetPosterBanner call;
call.event = event;
if (pScraper->Service("GetPosterBanner", &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 = event;
callPoster.recording = NULL;
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;
hasPoster = true;
}
if (DetachViewElement(veCurrentSchedule)) {
cViewElement *viewElement = GetViewElement(veCurrentSchedule);
if (!viewElement) {
viewElement = new cViewElementCurrentSchedule(tmplView->GetViewElement(veCurrentSchedule));
AddViewElement(veCurrentSchedule, viewElement);
viewElement->Start();
} else {
if (!viewElement->Starting())
viewElement->Render();
}
} else {
map < string, string > stringTokens;
map < string, int > intTokens;
SetCurrentSchedule(stringTokens, intTokens);
ClearViewElement(veCurrentSchedule);
DrawViewElement(veCurrentSchedule, &stringTokens, &intTokens);
}
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(veCurrentSchedule);
DrawViewElement(veCurrentSchedule, &stringTokens, &intTokens);
}
void cDisplayMenuMainView::DrawCurrentWeather(void) {
if (!ExecuteViewElement(veCurrentWeather)) {
return;
}
map < string, string > stringTokens;
map < string, int > intTokens;
if (!SetCurrentWeatherTokens(stringTokens, intTokens)){
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;
}
ClearViewElement(veCurrentWeather);
return;
DrawViewElement(veCurrentWeather, &stringTokens, &intTokens);
}
ClearViewElement(veCurrentWeather);
DrawViewElement(veCurrentWeather, &stringTokens, &intTokens);
}
void cDisplayMenuMainView::DrawCustomTokens(void) {
@ -640,9 +442,22 @@ void cDisplayMenuMainView::DrawCustomTokens(void) {
}
if (!tmplView)
return;
map < string, string > stringTokens = tmplView->GetCustomStringTokens();
map < string, int > intTokens = tmplView->GetCustomIntTokens();
DrawViewElement(veCustomTokens, &stringTokens, &intTokens);
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);
}
}
/************************************************************************

View File

@ -37,8 +37,6 @@ public:
class cDisplayMenuMainView : public cDisplayMenuView {
private:
bool initial;
double lastSystemLoad;
int lastMemUsage;
void DrawTimers(void);
void DrawDiscUsage(void);
bool DrawLoad(void);

207
views/displayviewelements.c Normal file
View File

@ -0,0 +1,207 @@
#include "displayviewelements.h"
cViewElementDevices::cViewElementDevices(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) {
init = true;
}
bool cViewElementDevices::Render(void) {
ClearTokens();
map < string, vector< map< string, string > > > deviceLoopTokens;
vector< map< string, string > > devices;
if (init)
InitDevices();
bool changed = SetDevices(init, &intTokens, &devices);
init = false;
if (!changed)
return false;
deviceLoopTokens.insert(pair< string, vector< map< string, string > > >("devices", devices));
ClearViewElement(veDevices);
DrawViewElement(veDevices, &stringTokens, &intTokens, &deviceLoopTokens);
return true;
}
/********************************************************************************************************************/
cViewElementSignal::cViewElementSignal(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) {
}
bool cViewElementSignal::Render(void) {
ClearTokens();
bool changed = SetSignal(intTokens);
if (!changed)
return false;
ClearViewElement(veSignalQuality);
DrawViewElement(veSignalQuality, &stringTokens, &intTokens);
return true;
}
/********************************************************************************************************************/
cViewElementWeather::cViewElementWeather(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) {
}
bool cViewElementWeather::Render(void) {
ClearTokens();
if (!SetCurrentWeatherTokens(stringTokens, intTokens)){
ClearViewElement(veCurrentWeather);
return false;
}
ClearViewElement(veCurrentWeather);
DrawViewElement(veCurrentWeather, &stringTokens, &intTokens);
return true;
}
/********************************************************************************************************************/
cViewElementDate::cViewElementDate(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) {
}
bool cViewElementDate::Render(void) {
ClearTokens();
if (!SetDate(stringTokens, intTokens)) {
return false;
}
ClearViewElement(veDateTime);
DrawViewElement(veDateTime, &stringTokens, &intTokens);
return true;
}
/********************************************************************************************************************/
cViewElementTime::cViewElementTime(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) {
}
bool cViewElementTime::Render(void) {
ClearTokens();
if (!SetTime(stringTokens, intTokens)) {
return false;
}
ClearViewElement(veTime);
DrawViewElement(veTime, &stringTokens, &intTokens);
return true;
}
/********************************************************************************************************************/
cViewElementScraperContent::cViewElementScraperContent(const cEvent *event, ScraperContentType type, cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) {
this->event = event;
this->type = type;
}
bool cViewElementScraperContent::Render(void) {
ClearTokens();
SetPosterBanner(event, stringTokens, intTokens);
ClearViewElement(veScraperContent);
DrawViewElement(veScraperContent, &stringTokens, &intTokens);
return true;
}
/********************************************************************************************************************/
cViewElementCustomTokens::cViewElementCustomTokens(cTemplateViewElement *tmplViewElement, cTemplateView *tmplView) : cViewElement(tmplViewElement) {
this->tmplView = tmplView;
}
bool cViewElementCustomTokens::Render(void) {
ClearTokens();
if (!tmplView)
return false;
stringTokens = tmplView->GetCustomStringTokens();
intTokens = tmplView->GetCustomIntTokens();
ClearViewElement(veCustomTokens);
DrawViewElement(veCustomTokens, &stringTokens, &intTokens);
return true;
}
/********************************************************************************************************************/
cViewElementTimers::cViewElementTimers(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) {
}
bool cViewElementTimers::Render(void) {
ClearTokens();
map < string, vector< map< string, string > > > timerLoopTokens;
vector< map< string, string > > timers;
SetTimers(&intTokens, &stringTokens, &timers);
timerLoopTokens.insert(pair< string, vector< map< string, string > > >("timers", timers));
ClearViewElement(veTimers);
DrawViewElement(veTimers, &stringTokens, &intTokens, &timerLoopTokens);
return true;
}
/********************************************************************************************************************/
cViewElementDiscUsage::cViewElementDiscUsage(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) {
}
bool cViewElementDiscUsage::Render(void) {
ClearTokens();
SetDiscUsage(stringTokens, intTokens);
ClearViewElement(veDiscUsage);
DrawViewElement(veDiscUsage, &stringTokens, &intTokens);
return true;
}
/********************************************************************************************************************/
cViewElementSystemLoad::cViewElementSystemLoad(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) {
}
bool cViewElementSystemLoad::Render(void) {
ClearTokens();
if (!SetSystemLoad(stringTokens, intTokens))
return false;
ClearViewElement(veSystemLoad);
DrawViewElement(veSystemLoad, &stringTokens, &intTokens);
return true;
}
/********************************************************************************************************************/
cViewElementSystemMemory::cViewElementSystemMemory(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) {
}
bool cViewElementSystemMemory::Render(void) {
ClearTokens();
if (!SetSystemMemory(stringTokens, intTokens))
return false;
ClearViewElement(veSystemMemory);
DrawViewElement(veSystemMemory, &stringTokens, &intTokens);
return true;
}
/********************************************************************************************************************/
cViewElementTemperature::cViewElementTemperature(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) {
}
bool cViewElementTemperature::Render(void) {
ClearTokens();
if (!SetSystemTemperatures(stringTokens, intTokens))
return false;
ClearViewElement(veTemperatures);
DrawViewElement(veTemperatures, &stringTokens, &intTokens);
return true;
}
/********************************************************************************************************************/
cViewElementCurrentSchedule::cViewElementCurrentSchedule(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) {
}
bool cViewElementCurrentSchedule::Render(void) {
ClearTokens();
SetCurrentSchedule(stringTokens, intTokens);
ClearViewElement(veCurrentSchedule);
DrawViewElement(veCurrentSchedule, &stringTokens, &intTokens);
return true;
}

121
views/displayviewelements.h Normal file
View File

@ -0,0 +1,121 @@
#ifndef __DISPLAYCHANNELVIEWELEMENTS_H
#define __DISPLAYCHANNELVIEWELEMENTS_H
#include "../libtemplate/template.h"
#include "view.h"
#include "viewhelpers.h"
class cViewElementDevices : public cViewElement, public cViewHelpers {
private:
bool init;
public:
cViewElementDevices(cTemplateViewElement *tmplViewElement);
virtual ~cViewElementDevices() {};
bool Render(void);
};
class cViewElementSignal : public cViewElement, public cViewHelpers {
private:
public:
cViewElementSignal(cTemplateViewElement *tmplViewElement);
virtual ~cViewElementSignal() {};
bool Render(void);
};
class cViewElementWeather : public cViewElement, public cViewHelpers {
private:
public:
cViewElementWeather(cTemplateViewElement *tmplViewElement);
virtual ~cViewElementWeather() {};
bool Render(void);
};
class cViewElementDate : public cViewElement, public cViewHelpers {
private:
public:
cViewElementDate(cTemplateViewElement *tmplViewElement);
virtual ~cViewElementDate() {};
bool Render(void);
};
class cViewElementTime : public cViewElement, public cViewHelpers {
private:
public:
cViewElementTime(cTemplateViewElement *tmplViewElement);
virtual ~cViewElementTime() {};
bool Render(void);
};
enum ScraperContentType {
ctPosterBanner,
ctFull
};
class cViewElementScraperContent : public cViewElement, public cViewHelpers {
private:
ScraperContentType type;
const cEvent *event;
public:
cViewElementScraperContent(const cEvent *event, ScraperContentType type, cTemplateViewElement *tmplViewElement);
virtual ~cViewElementScraperContent() {};
bool Render(void);
};
class cViewElementCustomTokens : public cViewElement, public cViewHelpers {
private:
cTemplateView *tmplView;
public:
cViewElementCustomTokens(cTemplateViewElement *tmplViewElement, cTemplateView *tmplView);
virtual ~cViewElementCustomTokens() {};
bool Render(void);
};
class cViewElementTimers : public cViewElement, public cViewHelpers {
private:
public:
cViewElementTimers(cTemplateViewElement *tmplViewElement);
virtual ~cViewElementTimers() {};
bool Render(void);
};
class cViewElementDiscUsage : public cViewElement, public cViewHelpers {
private:
public:
cViewElementDiscUsage(cTemplateViewElement *tmplViewElement);
virtual ~cViewElementDiscUsage() {};
bool Render(void);
};
class cViewElementSystemLoad : public cViewElement, public cViewHelpers {
private:
public:
cViewElementSystemLoad(cTemplateViewElement *tmplViewElement);
virtual ~cViewElementSystemLoad() {};
bool Render(void);
};
class cViewElementSystemMemory : public cViewElement, public cViewHelpers {
private:
public:
cViewElementSystemMemory(cTemplateViewElement *tmplViewElement);
virtual ~cViewElementSystemMemory() {};
bool Render(void);
};
class cViewElementTemperature : public cViewElement, public cViewHelpers {
private:
public:
cViewElementTemperature(cTemplateViewElement *tmplViewElement);
virtual ~cViewElementTemperature() {};
bool Render(void);
};
class cViewElementCurrentSchedule : public cViewElement, public cViewHelpers {
private:
public:
cViewElementCurrentSchedule(cTemplateViewElement *tmplViewElement);
virtual ~cViewElementCurrentSchedule() {};
bool Render(void);
};
#endif //__DISPLAYCHANNELVIEWELEMENTS_H

View File

@ -37,7 +37,8 @@ cView::~cView() {
cDevice::PrimaryDevice()->ScaleVideo(cRect::Null);
}
for (map<eViewElement,cViewElement*>::iterator dVeIt = detachedViewElements.begin(); dVeIt != detachedViewElements.end(); dVeIt++) {
delete dVeIt->second;
cViewElement *ve = dVeIt->second;
delete ve;
}
}
@ -94,6 +95,11 @@ void cView::DrawViewElement(eViewElement ve, map <string,string> *stringTokens,
viewElement->InitIterator();
cTemplatePixmap *pix = NULL;
while(pix = viewElement->GetNextPixmap()) {
//check if already drawn background area, this can be skipped
if (PixmapExists(pixCurrent) && pix->BackgroundArea()) {
pixCurrent++;
continue;
}
//reset Template
pix->ClearDynamicParameters();
//create Pixmap if already fully parsed
@ -151,9 +157,12 @@ void cView::DrawViewElement(eViewElement ve, map <string,string> *stringTokens,
}
void cView::ClearViewElement(eViewElement ve) {
if (!tmplView)
return;
cTemplateViewElement *viewElement = tmplView->GetViewElement(ve);
cTemplateViewElement *viewElement = NULL;
if (tmplViewElement) {
viewElement = tmplViewElement;
} else if (tmplView) {
viewElement = tmplView->GetViewElement(ve);
}
if (!viewElement)
return;
int pixCurrent = viewElement->GetPixOffset();
@ -162,7 +171,9 @@ void cView::ClearViewElement(eViewElement ve) {
cTemplatePixmap *pix = NULL;
viewElement->InitIterator();
while(pix = viewElement->GetNextPixmap()) {
Fill(pixCurrent, clrTransparent);
if (!pix->BackgroundArea()) {
Fill(pixCurrent, clrTransparent);
}
pixCurrent++;
}
}
@ -834,6 +845,7 @@ void cView::DoDrawImage(int num, cTemplateFunction *func, int x0, int y0) {
************************************************************************/
cViewElement::cViewElement(cTemplateViewElement *tmplViewElement) : cView(tmplViewElement) {
tmplViewElement->SetPixOffset(0);
delay = tmplViewElement->GetNumericParameter(ptDelay);
SetFadeTime(tmplViewElement->GetNumericParameter(ptFadeTime));
}
@ -858,82 +870,11 @@ void cViewElement::Action(void) {
}
}
void cViewElement::Draw(map < string, vector< map< string, string > > > *loopTokens) {
if (!tmplViewElement)
return;
if (tmplViewElement->DebugTokens()) {
DebugTokens("viewelement", &stringTokens, &intTokens, loopTokens);
}
//iterate through pixmaps of viewelement
int pixCurrent = 0;
tmplViewElement->InitIterator();
cTemplatePixmap *pix = NULL;
while(pix = tmplViewElement->GetNextPixmap()) {
//reset Template
pix->ClearDynamicParameters();
//create Pixmap if already fully parsed
if (!PixmapExists(pixCurrent) && pix->Ready() && pix->DoExecute() && !pix->Scrolling()) {
CreateViewPixmap(pixCurrent, pix);
}
//check if pixmap needs dynamic parameters
if ((!pix->Ready() || !pix->DoExecute()) && !pix->Scrolling()) {
//parse dynamic parameters and initiate functions
pix->ParseDynamicParameters(&intTokens, true);
if (pix->Ready() && pix->DoExecute()) {
CreateViewPixmap(pixCurrent, pix);
}
} else {
//parse dynamic parameters but not initiate functions
pix->ParseDynamicParameters(&intTokens, false);
}
//if pixmap still not valid, skip
if (!pix->Ready() && !pix->Scrolling()) {
pixCurrent++;
continue;
}
//if condition for pixmap set, check if cond is true
if (!pix->DoExecute()) {
pixCurrent++;
continue;
}
//parse dynamic tokens of pixmap functions
pix->ClearDynamicFunctionParameters();
pix->ParseDynamicFunctionParameters(&stringTokens, &intTokens);
if (!PixmapExists(pixCurrent) && pix->Scrolling()) {
cSize drawportSize;
scrolling = pix->CalculateDrawPortSize(drawportSize, loopTokens);
if (scrolling) {
/*
CreateScrollingPixmap(pixCurrent, pix, drawportSize);
pix->SetScrollingTextWidth();
veScroll = ve;
scrollingPix = pixCurrent;
scrollOrientation = pix->GetNumericParameter(ptOrientation);
scrollMode = pix->GetNumericParameter(ptScrollMode);
scrollDelay = pix->GetNumericParameter(ptDelay);
scrollSpeed = pix->GetNumericParameter(ptScrollSpeed);
*/
} else {
CreateViewPixmap(pixCurrent, pix);
}
}
if (pix->DoDebug()) {
pix->Debug();
}
DrawPixmap(pixCurrent, pix, loopTokens);
pixCurrent++;
}
void cViewElement::ClearTokens(void) {
stringTokens.clear();
intTokens.clear();
}
void cViewElement::Clear(void) {
int pixMax = NumPixmaps();
for (int pixCurrent = 0; pixCurrent < pixMax; pixCurrent++) {
Fill(pixCurrent, clrTransparent);
}
}
/***********************************************************************
* cViewListItem

View File

@ -72,12 +72,12 @@ protected:
map < string, string > stringTokens;
map < string, int > intTokens;
void Action(void);
void Draw(map < string, vector< map< string, string > > > *loopTokens = NULL);
void ClearTokens(void);
public:
cViewElement(cTemplateViewElement *tmplViewElement);
virtual ~cViewElement();
virtual void Render(void) {};
void Clear(void);
virtual bool Render(void) { return false; };
bool Starting(void) { return Running(); };
};
class cViewListItem : public cView {

View File

@ -1,15 +1,25 @@
#include <fstream>
#include <iostream>
#include <vdr/menu.h>
#include <vdr/videodir.h>
#include <sys/sysinfo.h>
#include "../services/scraper2vdr.h"
#include "../services/weatherforecast.h"
#include "../config.h"
#include "../libcore/timers.h"
#include "../libcore/helpers.h"
#include "viewhelpers.h"
cViewHelpers::cViewHelpers(void) {
numDevices = 0;
devicesInit = false;
lSignalDisplay = 0;
lSignalStrength = 0;
lSignalQuality = 0;
lastSecond = -1;
lastMinute = -1;
lastSystemLoad = 0.0;
lastMemUsage = -1;
}
cViewHelpers::~cViewHelpers() {
@ -141,6 +151,28 @@ bool cViewHelpers::SetDevices(bool initial, map<string,int> *intTokens, vector<m
return true;
}
bool cViewHelpers::SetSignal(map < string, int > &intTokens) {
bool done = false;
time_t Now = time(NULL);
if (Now != lSignalDisplay) {
int SignalStrength = cDevice::ActualDevice()->SignalStrength();
int SignalQuality = cDevice::ActualDevice()->SignalQuality();
if (SignalStrength < 0) SignalStrength = 0;
if (SignalQuality < 0) SignalQuality = 0;
if ((SignalStrength == 0)&&(SignalQuality==0))
return done;
if ((lSignalStrength != SignalStrength) || (lSignalQuality != SignalQuality)) {
intTokens.insert(pair<string,int>("signalstrength", SignalStrength));
intTokens.insert(pair<string,int>("signalquality", SignalQuality));
lSignalStrength = SignalStrength;
lSignalQuality = SignalQuality;
done = true;
}
lSignalDisplay = Now;
}
return done;
}
bool cViewHelpers::CheckNewMails(void) {
static cPlugin *pMailbox = cPluginManager::GetPlugin("mailbox");
if (!pMailbox) {
@ -359,13 +391,80 @@ void cViewHelpers::SetScraperTokens(const cEvent *event, const cRecording *recor
}
void cViewHelpers::SetPosterBanner(const cEvent *event, map < string, string > &stringTokens, map < string, int > &intTokens) {
static cPlugin *pScraper = GetScraperPlugin();
if (!pScraper) {
return;
}
ScraperGetPosterBanner call;
call.event = event;
if (pScraper->Service("GetPosterBanner", &call)) {
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;
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 = event;
callPoster.recording = NULL;
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;
hasPoster = true;
} else
return;
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));
}
}
bool cViewHelpers::SetTime(map < string, string > &stringTokens, map < string, int > &intTokens) {
time_t t = time(0); // get time now
struct tm * now = localtime(&t);
int sec = now->tm_sec;
if (sec == lastSecond)
if (sec == lastSecond) {
return false;
}
int min = now->tm_min;
int hour = now->tm_hour;
int hourMinutes = hour%12 * 5 + min / 12;
@ -433,3 +532,316 @@ bool cViewHelpers::SetCurrentWeatherTokens(map < string, string > &stringTokens,
stringTokens.insert(pair<string,string>("ozone", currentWeather.ozone));
return true;
}
void cViewHelpers::SetTimers(map<string,int> *intTokens, map<string,string> *stringTokens, vector<map<string,string> > *timers) {
cGlobalSortedTimers SortedTimers;// local and remote timers
int numTimers = SortedTimers.Size();
intTokens->insert(pair<string, int>("numtimers", numTimers));
int numTimerConflicts = SortedTimers.NumTimerConfilicts();
intTokens->insert(pair<string, int>("numtimerconflicts", numTimerConflicts));
for (int i=0; i<15; i++) {
stringstream name;
name << "timer" << i+1 << "exists";
if (i < numTimers) {
intTokens->insert(pair<string, int>(name.str(), true));
} else {
intTokens->insert(pair<string, int>(name.str(), false));
}
}
for (int i = 0; i < numTimers; i++) {
if (i >=15)
break;
map< string, string > timerVals;
const cTimer *Timer = SortedTimers[i];
const cEvent *event = Timer->Event();
if (event) {
timerVals.insert(pair< string, string >("timers[title]", event->Title()));
} else {
const char *File = Setup.FoldersInTimerMenu ? NULL : strrchr(Timer->File(), FOLDERDELIMCHAR);
if (File && strcmp(File + 1, TIMERMACRO_TITLE) && strcmp(File + 1, TIMERMACRO_EPISODE))
File++;
else
File = Timer->File();
timerVals.insert(pair< string, string >("timers[title]", File));
}
const cChannel *channel = Timer->Channel();
if (channel) {
timerVals.insert(pair< string, string >("timers[channelname]", channel->Name()));
stringstream chanNum;
chanNum << channel->Number();
timerVals.insert(pair< string, string >("timers[channelnumber]", chanNum.str()));
string channelID = *(channel->GetChannelID().ToString());
timerVals.insert(pair< string, string >("timers[channelid]", channelID));
bool logoExists = imgCache->LogoExists(channelID);
timerVals.insert(pair< string, string >("timers[channellogoexists]", logoExists ? "1" : "0"));
} else {
timerVals.insert(pair< string, string >("timers[channelname]", ""));
timerVals.insert(pair< string, string >("timers[channelnumber]", "0"));
timerVals.insert(pair< string, string >("timers[channelid]", ""));
timerVals.insert(pair< string, string >("timers[channellogoexists]", "0"));
}
timerVals.insert(pair< string, string >("timers[recording]", Timer->Recording() ? "1" : "0"));
cString timerDate("");
if (Timer->Recording()) {
timerDate = cString::sprintf("-%s", *TimeString(Timer->StopTime()));
} else {
time_t Now = time(NULL);
cString Today = WeekDayName(Now);
cString Time = TimeString(Timer->StartTime());
cString Day = WeekDayName(Timer->StartTime());
if (Timer->StartTime() > Now + 6 * SECSINDAY) {
time_t ttm = Timer->StartTime();
struct tm * timerTime = localtime(&ttm);
timerDate = cString::sprintf("%02d.%02d %s", timerTime->tm_mday, timerTime->tm_mon + 1, *Time);
} else if (strcmp(Day, Today) != 0)
timerDate = cString::sprintf("%s %s", *Day, *Time);
else
timerDate = Time;
if (Timer->Flags() & tfVps)
timerDate = cString::sprintf("VPS %s", *timerDate);
}
timerVals.insert(pair< string, string >("timers[datetime]", *timerDate));
timers->push_back(timerVals);
}
}
void cViewHelpers::SetMenuHeader(eMenuCategory cat, string menuTitle, map < string, string > &stringTokens, map < string, int > &intTokens) {
stringTokens.insert(pair<string,string>("title", menuTitle));
stringTokens.insert(pair<string,string>("vdrversion", VDRVERSION));
//check for standard menu entries
bool hasIcon = false;
string icon = imgCache->GetIconName(menuTitle, cat);
if (imgCache->MenuIconExists(icon))
hasIcon = true;
stringTokens.insert(pair<string,string>("icon", icon));
intTokens.insert(pair<string,int>("hasicon", hasIcon));
//Disc Usage
string vdrUsageString = *cVideoDiskUsage::String();
int discUsage = cVideoDiskUsage::UsedPercent();
bool discAlert = (discUsage > 95) ? true : false;
string freeTime = *cString::sprintf("%02d:%02d", cVideoDiskUsage::FreeMinutes() / 60, cVideoDiskUsage::FreeMinutes() % 60);
int freeGB = cVideoDiskUsage::FreeMB() / 1024;
intTokens.insert(pair<string, int>("usedpercent", discUsage));
intTokens.insert(pair<string, int>("freepercent", 100-discUsage));
intTokens.insert(pair<string, int>("discalert", discAlert));
intTokens.insert(pair<string, int>("freegb", freeGB));
stringTokens.insert(pair<string,string>("freetime", freeTime));
stringTokens.insert(pair<string,string>("vdrusagestring", vdrUsageString));
}
void cViewHelpers::SetDiscUsage(map < string, string > &stringTokens, map < string, int > &intTokens) {
string vdrUsageString = *cVideoDiskUsage::String();
int discUsage = cVideoDiskUsage::UsedPercent();
bool discAlert = (discUsage > 95) ? true : false;
string freeTime = *cString::sprintf("%02d:%02d", cVideoDiskUsage::FreeMinutes() / 60, cVideoDiskUsage::FreeMinutes() % 60);
int freeGB = cVideoDiskUsage::FreeMB() / 1024;
intTokens.insert(pair<string, int>("usedpercent", discUsage));
intTokens.insert(pair<string, int>("freepercent", 100-discUsage));
intTokens.insert(pair<string, int>("discalert", discAlert));
intTokens.insert(pair<string, int>("freegb", freeGB));
stringTokens.insert(pair<string,string>("freetime", freeTime));
stringTokens.insert(pair<string,string>("vdrusagestring", vdrUsageString));
}
bool cViewHelpers::SetSystemLoad(map < string, string > &stringTokens, map < string, int > &intTokens) {
double systemLoad;
if (getloadavg(&systemLoad, 1) > 0) {
if (lastSystemLoad == systemLoad) {
return false;
}
string load = *cString::sprintf("%.2f", systemLoad);
int loadHand = systemLoad * 1000;
int loadHandValue = 0;
if (loadHand > 2500)
loadHandValue = 2525;
else {
int loadHandDec = loadHand - (loadHand / 100) * 100;
if (loadHandDec <= 12)
loadHandDec = 0;
else if (loadHandDec <= 37)
loadHandDec = 25;
else if (loadHandDec <= 62)
loadHandDec = 50;
else if (loadHandDec <= 87)
loadHandDec = 75;
else
loadHandDec = 0;
loadHandValue = loadHand / 100 * 100 + loadHandDec;
}
stringTokens.insert(pair<string,string>("load", load));
intTokens.insert(pair<string,int>("loadhand", loadHandValue));
lastSystemLoad = systemLoad;
} else {
return false;
}
return true;
}
bool cViewHelpers::SetSystemMemory(map < string, string > &stringTokens, map < string, int > &intTokens) {
struct sysinfo memInfo;
sysinfo (&memInfo);
long long totalMem = memInfo.totalram;
totalMem += memInfo.totalswap;
totalMem *= memInfo.mem_unit;
int totalMemMB = totalMem / 1024 / 1024;
long long usedMem = memInfo.totalram - memInfo.freeram;
usedMem += memInfo.totalswap - memInfo.freeswap;
usedMem *= memInfo.mem_unit;
int usedMemMB = usedMem / 1024 / 1024;
if (lastMemUsage == usedMemMB) {
return false;
}
lastMemUsage = usedMemMB;
intTokens.insert(pair<string,int>("totalmem", totalMemMB));
intTokens.insert(pair<string,int>("usedmem", usedMemMB));
if (totalMemMB > 0)
intTokens.insert(pair<string,int>("usedmempercent", usedMemMB * 100 / totalMemMB));
return true;
}
bool cViewHelpers::SetSystemTemperatures(map < string, string > &stringTokens, map < string, int > &intTokens) {
cString execCommand = cString::sprintf("cd \"%s/\"; \"%s/temperatures\"", SCRIPTFOLDER, SCRIPTFOLDER);
system(*execCommand);
string tempCPU, tempGPU;
int cpu, gpu;
cString itemFilename = cString::sprintf("%s/cpu", SCRIPTOUTPUTPATH );
ifstream file(*itemFilename, ifstream::in);
if( file.is_open() ) {
std::getline(file, tempCPU);
if (tempCPU.size() > 2) {
cpu = atoi(tempCPU.substr(0,2).c_str());
} else
cpu = 0;
file.close();
} else {
tempCPU = "0°C";
cpu = 0;
}
itemFilename = cString::sprintf("%s/gpu", SCRIPTOUTPUTPATH );
ifstream file2(*itemFilename, ifstream::in);
if( file2.is_open() ) {
std::getline(file2, tempGPU);
if (tempGPU.size() > 2) {
gpu = atoi(tempGPU.substr(0,2).c_str());
} else
gpu = 0;
file2.close();
} else {
tempGPU = "0°C";
gpu = 0;
}
intTokens.insert(pair<string,int>("cputemp", cpu));
intTokens.insert(pair<string,int>("gputemp", gpu));
return true;
}
void cViewHelpers::SetCurrentSchedule(map < string, string > &stringTokens, map < string, int > &intTokens) {
cDevice *device = cDevice::PrimaryDevice();
const cChannel *channel = NULL;
if (!device->Replaying() || device->Transferring()) {
channel = Channels.GetByNumber(device->CurrentChannel());
}
if (!channel)
return;
const cEvent *event = NULL;
cSchedulesLock SchedulesLock;
if (const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock))
if (const cSchedule *Schedule = Schedules->GetSchedule(channel))
event = Schedule->GetPresentEvent();
if (!event)
return;
stringTokens.insert(pair<string,string>("title", (event->Title())?event->Title():""));
stringTokens.insert(pair<string,string>("subtitle", (event->ShortText())?event->ShortText():""));
stringTokens.insert(pair<string,string>("start", *event->GetTimeString()));
stringTokens.insert(pair<string,string>("stop", *event->GetEndTimeString()));
intTokens.insert(pair<string,int>("duration", event->Duration() / 60));
intTokens.insert(pair<string,int>("durationhours", event->Duration() / 3600));
stringTokens.insert(pair<string,string>("durationminutes", *cString::sprintf("%.2d", (event->Duration() / 60)%60)));
intTokens.insert(pair<string,int>("elapsed", (int)round((time(NULL) - event->StartTime())/60)));
intTokens.insert(pair<string,int>("remaining", (int)round((event->EndTime() - time(NULL))/60)));
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;
static cPlugin *pScraper = GetScraperPlugin();
if (pScraper) {
ScraperGetPosterBanner call;
call.event = event;
if (pScraper->Service("GetPosterBanner", &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 = event;
callPoster.recording = NULL;
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;
hasPoster = true;
}
}
}
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));
}

View File

@ -8,16 +8,30 @@ private:
int* lastSignalStrength;
int* lastSignalQuality;
bool* recDevices;
int lSignalDisplay;
int lSignalStrength;
int lSignalQuality;
int lastSecond;
int lastMinute;
double lastSystemLoad;
int lastMemUsage;
protected:
void InitDevices(void);
bool SetDevices(bool initial, map<string,int> *intTokens, vector<map<string,string> > *devices);
bool SetSignal(map < string, int > &intTokens);
bool CheckNewMails(void);
void SetScraperTokens(const cEvent *event, const cRecording *recording, map < string, string > &stringTokens, map < string, int > &intTokens, map < string, vector< map< string, string > > > &loopTokens);
void SetPosterBanner(const cEvent *event, map < string, string > &stringTokens, map < string, int > &intTokens);
bool SetTime(map < string, string > &stringTokens, map < string, int > &intTokens);
bool SetDate(map < string, string > &stringTokens, map < string, int > &intTokens);
bool SetCurrentWeatherTokens(map < string, string > &stringTokens, map < string, int > &intTokens);
void SetTimers(map<string,int> *intTokens, map<string,string> *stringTokens, vector<map<string,string> > *timers);
void SetMenuHeader(eMenuCategory cat, string menuTitle, map < string, string > &stringTokens, map < string, int > &intTokens);
void SetDiscUsage(map < string, string > &stringTokens, map < string, int > &intTokens);
bool SetSystemLoad(map < string, string > &stringTokens, map < string, int > &intTokens);
bool SetSystemMemory(map < string, string > &stringTokens, map < string, int > &intTokens);
bool SetSystemTemperatures(map < string, string > &stringTokens, map < string, int > &intTokens);
void SetCurrentSchedule(map < string, string > &stringTokens, map < string, int > &intTokens);
public:
cViewHelpers(void);
virtual ~cViewHelpers(void);