fixed bug that string tokens are not evaluated in area conditions

This commit is contained in:
louis 2015-04-10 16:44:29 +02:00
parent 97f3d372dc
commit 5146f15e44
7 changed files with 25 additions and 12 deletions

View File

@ -287,4 +287,5 @@ Version 0.4.1
Version 0.4.2 Version 0.4.2
- fixed bug that datetime was not drawn correctly in menus - fixed bug that datetime was not drawn correctly in menus
- fixed bug that string tokens are not evaluated in area conditions

View File

@ -80,11 +80,13 @@ void cTemplatePixmap::ClearDynamicParameters(void) {
parameters->ClearDynamicParameters(); parameters->ClearDynamicParameters();
} }
void cTemplatePixmap::ParseDynamicParameters(map <string,int> *intTokens, bool initFuncs) { void cTemplatePixmap::ParseDynamicParameters(map <string,string> *stringTokens, map <string,int> *intTokens, bool initFuncs) {
parameters->ClearDynamicParameters(); parameters->ClearDynamicParameters();
parameters->SetIntTokens(intTokens); parameters->SetIntTokens(intTokens);
parameters->SetStringTokens(stringTokens);
parameters->ParseParameters(); parameters->ParseParameters();
parameters->UnsetIntTokens(); parameters->UnsetIntTokens();
parameters->UnsetStringTokens();
if (!DoExecute()) { if (!DoExecute()) {
parameters->ClearDynamicParameters(); parameters->ClearDynamicParameters();

View File

@ -63,7 +63,7 @@ public:
//Clear dynamically set pixmap parameters //Clear dynamically set pixmap parameters
void ClearDynamicParameters(void); void ClearDynamicParameters(void);
//Parse pixmap parameters with dynamically set Tokens //Parse pixmap parameters with dynamically set Tokens
void ParseDynamicParameters(map <string,int> *intTokens, bool initFuncs); void ParseDynamicParameters(map <string,string> *stringTokens, map <string,int> *intTokens, bool initFuncs);
//Parse all function parameters with dynamically set Tokens //Parse all function parameters with dynamically set Tokens
void ParseDynamicFunctionParameters(map <string,string> *stringTokens, map <string,int> *intTokens); void ParseDynamicFunctionParameters(map <string,string> *stringTokens, map <string,int> *intTokens);
//Calculate size of drawport in case area scrolls //Calculate size of drawport in case area scrolls

View File

@ -60,18 +60,28 @@
{nextrecording} true if next Schedule will be recorded {nextrecording} true if next Schedule will be recorded
--> -->
<epginfo> <epginfo>
<area x="17%" y="80%" width="66%" height="7%" layer="3"> <area condition="isset{currentsubtitle}" x="17%" y="80%" width="66%" height="7%" layer="3">
<drawtext name="starttime" x="1%" valign="center" font="{regular}" fontsize="80%" color="{clrWhite}" text="{currentstart}" /> <drawtext name="starttime" x="1%" valign="center" font="{regular}" fontsize="80%" color="{clrWhite}" text="{currentstart}" />
<drawtext align="right" name="elapsed" valign="center" font="{regular}" fontsize="75%" color="{clrWhite}" text="{currentelapsed}/{currentduration}min" /> <drawtext align="right" name="elapsed" valign="center" font="{regular}" fontsize="75%" color="{clrWhite}" text="{currentelapsed}/{currentduration}min" />
<drawtext x="{width(starttime)} + 40" y="0" width="{areawidth} - {width(starttime)} - {width(elapsed)} - 45" font="{regular}" fontsize="70%" color="{clrWhite}" text="{currenttitle}" /> <drawtext x="{width(starttime)} + 40" y="0" width="{areawidth} - {width(starttime)} - {width(elapsed)} - 45" font="{regular}" fontsize="70%" color="{clrWhite}" text="{currenttitle}" />
<drawtext x="{width(starttime)} + 40" y="56%" width="{areawidth} - {width(starttime)} - {width(elapsed)} - 45" font="{regular}" fontsize="45%" color="{clrWhite}" text="{currentsubtitle}" /> <drawtext x="{width(starttime)} + 40" y="56%" width="{areawidth} - {width(starttime)} - {width(elapsed)} - 45" font="{regular}" fontsize="45%" color="{clrWhite}" text="{currentsubtitle}" />
</area> </area>
<area x="17%" y="87%" width="66%" height="7%" layer="3"> <area condition="empty{currentsubtitle}" x="17%" y="80%" width="66%" height="7%" layer="3">
<drawtext name="starttime" x="1%" valign="center" font="{regular}" fontsize="80%" color="{clrWhite}" text="{currentstart}" />
<drawtext align="right" name="elapsed" valign="center" font="{regular}" fontsize="75%" color="{clrWhite}" text="{currentelapsed}/{currentduration}min" />
<drawtext x="{width(starttime)} + 40" valign="center" width="{areawidth} - {width(starttime)} - {width(elapsed)} - 45" font="{regular}" fontsize="75%" color="{clrWhite}" text="{currenttitle}" />
</area>
<area condition="isset{nextsubtitle}" x="17%" y="87%" width="66%" height="7%" layer="3">
<drawtext name="starttime" x="1%" valign="center" font="{regular}" fontsize="80%" color="{clrGray}" text="{nextstart}" /> <drawtext name="starttime" x="1%" valign="center" font="{regular}" fontsize="80%" color="{clrGray}" text="{nextstart}" />
<drawtext align="right" name="duration" valign="center" font="{regular}" fontsize="75%" color="{clrGray}" text="{nextduration}min" /> <drawtext align="right" name="duration" valign="center" font="{regular}" fontsize="75%" color="{clrGray}" text="{nextduration}min" />
<drawtext x="{width(starttime)} + 40" y="0" width="{areawidth} - {width(starttime)} - {width(duration)} - 45" font="{regular}" fontsize="70%" color="{clrGray}" text="{nexttitle}" /> <drawtext x="{width(starttime)} + 40" y="0" width="{areawidth} - {width(starttime)} - {width(duration)} - 45" font="{regular}" fontsize="70%" color="{clrGray}" text="{nexttitle}" />
<drawtext x="{width(starttime)} + 40" y="55%" width="{areawidth} - {width(starttime)} - {width(duration)} - 45" font="{regular}" fontsize="40%" color="{clrGray}" text="{nextsubtitle}" /> <drawtext x="{width(starttime)} + 40" y="55%" width="{areawidth} - {width(starttime)} - {width(duration)} - 45" font="{regular}" fontsize="40%" color="{clrGray}" text="{nextsubtitle}" />
</area> </area>
<area condition="empty{nextsubtitle}" x="17%" y="87%" width="66%" height="7%" layer="3">
<drawtext name="starttime" x="1%" valign="center" font="{regular}" fontsize="80%" color="{clrGray}" text="{nextstart}" />
<drawtext align="right" name="duration" valign="center" font="{regular}" fontsize="75%" color="{clrGray}" text="{nextduration}min" />
<drawtext x="{width(starttime)} + 40" valign="center" width="{areawidth} - {width(starttime)} - {width(duration)} - 45" font="{regular}" fontsize="75%" color="{clrGray}" text="{nexttitle}" />
</area>
</epginfo> </epginfo>
<!-- Available Variables progressbar: <!-- Available Variables progressbar:

View File

@ -224,7 +224,7 @@ void cDisplayMenuDetailView::InitTabs(void) {
tmplView->InitViewTabIterator(); tmplView->InitViewTabIterator();
cTemplateViewTab *tmplTab = NULL; cTemplateViewTab *tmplTab = NULL;
while(tmplTab = tmplView->GetNextViewTab()) { while(tmplTab = tmplView->GetNextViewTab()) {
tmplTab->ParseDynamicParameters(&intTokens, true); tmplTab->ParseDynamicParameters(&stringTokens, &intTokens, true);
tmplTab->ClearDynamicFunctionParameters(); tmplTab->ClearDynamicFunctionParameters();
tmplTab->ParseDynamicFunctionParameters(&stringTokens, &intTokens); tmplTab->ParseDynamicFunctionParameters(&stringTokens, &intTokens);
if (tmplTab->DoExecute()) { if (tmplTab->DoExecute()) {

View File

@ -143,7 +143,7 @@ void cDisplayPluginView::SetTabs(void) {
tmplView->InitViewTabIterator(); tmplView->InitViewTabIterator();
cTemplateViewTab *tmplTab = NULL; cTemplateViewTab *tmplTab = NULL;
while(tmplTab = tmplView->GetNextViewTab()) { while(tmplTab = tmplView->GetNextViewTab()) {
tmplTab->ParseDynamicParameters(&tabIntTokens, true); tmplTab->ParseDynamicParameters(&tabStringTokens, &tabIntTokens, true);
tmplTab->ClearDynamicFunctionParameters(); tmplTab->ClearDynamicFunctionParameters();
tmplTab->ParseDynamicFunctionParameters(&tabStringTokens, &tabIntTokens); tmplTab->ParseDynamicFunctionParameters(&tabStringTokens, &tabIntTokens);
if (tmplTab->DoExecute()) { if (tmplTab->DoExecute()) {

View File

@ -109,13 +109,13 @@ void cView::DrawViewElement(eViewElement ve, map <string,string> *stringTokens,
//check if pixmap needs dynamic parameters //check if pixmap needs dynamic parameters
if ((!pix->Ready() || !pix->DoExecute()) && !pix->Scrolling()) { if ((!pix->Ready() || !pix->DoExecute()) && !pix->Scrolling()) {
//parse dynamic parameters and initiate functions //parse dynamic parameters and initiate functions
pix->ParseDynamicParameters(intTokens, true); pix->ParseDynamicParameters(stringTokens, intTokens, true);
if (pix->Ready() && pix->DoExecute()) { if (pix->Ready() && pix->DoExecute()) {
CreateViewPixmap(pixCurrent, pix); CreateViewPixmap(pixCurrent, pix);
} }
} else { } else {
//parse dynamic parameters but not initiate functions //parse dynamic parameters but not initiate functions
pix->ParseDynamicParameters(intTokens, false); pix->ParseDynamicParameters(stringTokens, intTokens, false);
} }
//if pixmap still not valid, skip //if pixmap still not valid, skip
if (!pix->Ready() && !pix->Scrolling()) { if (!pix->Ready() && !pix->Scrolling()) {
@ -917,9 +917,9 @@ cRect cViewListItem::DrawListItem(map <string,string> *stringTokens, map <string
posItem = pix->GetPixmapSize(); posItem = pix->GetPixmapSize();
} }
if (!PixmapExists(pixCurrent)) { if (!PixmapExists(pixCurrent)) {
pix->ParseDynamicParameters(intTokens, true); pix->ParseDynamicParameters(stringTokens, intTokens, true);
} else { } else {
pix->ParseDynamicParameters(intTokens, false); pix->ParseDynamicParameters(stringTokens, intTokens, false);
} }
if (!PixmapExists(pixCurrent) && pix->Ready() && pix->DoExecute() && !pix->Scrolling()) { if (!PixmapExists(pixCurrent) && pix->Ready() && pix->DoExecute() && !pix->Scrolling()) {
CreateViewPixmap(pixCurrent, pix); CreateViewPixmap(pixCurrent, pix);
@ -1087,9 +1087,9 @@ void cGrid::Draw(void) {
while(pix = tmplViewElement->GetNextPixmap()) { while(pix = tmplViewElement->GetNextPixmap()) {
PositionPixmap(pix); PositionPixmap(pix);
if (!PixmapExists(pixCurrent)) { if (!PixmapExists(pixCurrent)) {
pix->ParseDynamicParameters(&intTokens, true); pix->ParseDynamicParameters(&stringTokens, &intTokens, true);
} else { } else {
pix->ParseDynamicParameters(&intTokens, false); pix->ParseDynamicParameters(&stringTokens, &intTokens, false);
} }
if (!PixmapExists(pixCurrent) && pix->Ready() && pix->DoExecute() && !pix->Scrolling()) { if (!PixmapExists(pixCurrent) && pix->Ready() && pix->DoExecute() && !pix->Scrolling()) {
CreateViewPixmap(pixCurrent, pix); CreateViewPixmap(pixCurrent, pix);