diff options
| author | louis <louis.braun@gmx.de> | 2015-03-13 18:00:39 +0100 |
|---|---|---|
| committer | louis <louis.braun@gmx.de> | 2015-03-13 18:00:39 +0100 |
| commit | 229b1274a5c7bd8bf4d1b101dab83094ff3f9c06 (patch) | |
| tree | 225bcfd1972beb0d59da93cc8f5fcf58925e6e06 /libtemplate | |
| parent | b84af82ef5253df5c4c90e305951ba127ac02374 (diff) | |
| download | vdr-plugin-skindesigner-229b1274a5c7bd8bf4d1b101dab83094ff3f9c06.tar.gz vdr-plugin-skindesigner-229b1274a5c7bd8bf4d1b101dab83094ff3f9c06.tar.bz2 | |
checking setup conditions for viewelements
Diffstat (limited to 'libtemplate')
| -rw-r--r-- | libtemplate/templateview.c | 9 | ||||
| -rw-r--r-- | libtemplate/templateview.h | 1 | ||||
| -rw-r--r-- | libtemplate/templateviewelement.c | 9 | ||||
| -rw-r--r-- | libtemplate/templateviewelement.h | 1 | ||||
| -rw-r--r-- | libtemplate/xmlparser.c | 11 | ||||
| -rw-r--r-- | libtemplate/xmlparser.h | 2 |
6 files changed, 26 insertions, 7 deletions
diff --git a/libtemplate/templateview.c b/libtemplate/templateview.c index c37b5f0..60cd36a 100644 --- a/libtemplate/templateview.c +++ b/libtemplate/templateview.c @@ -194,6 +194,14 @@ int cTemplateView::GetNumPixmapsViewElement(eViewElement ve) { return viewElement->GetNumPixmaps(); } +bool cTemplateView::ExecuteView(eViewElement ve) { + map < eViewElement, cTemplateViewElement* >::iterator hit = viewElements.find(ve); + if (hit == viewElements.end()) + return false; + cTemplateViewElement *viewElement = hit->second; + return viewElement->Execute(); +} + int cTemplateView::GetNumListViewMenuItems(void) { int numElements = 0; cTemplateViewList *menuList = GetViewList(vlMenuItem); @@ -552,6 +560,7 @@ void cTemplateView::SetFunctionDefinitions(void) { attributes.insert("delay"); attributes.insert("fadetime"); attributes.insert("name"); + attributes.insert("condition"); funcsAllowed.insert(pair< string, set<string> >(name, attributes)); name = "area"; diff --git a/libtemplate/templateview.h b/libtemplate/templateview.h index 79564b7..c8ee2e1 100644 --- a/libtemplate/templateview.h +++ b/libtemplate/templateview.h @@ -109,6 +109,7 @@ public: cRect GetOsdSize(void); int GetNumPixmaps(void); int GetNumPixmapsViewElement(eViewElement ve); + bool ExecuteView(eViewElement ve); int GetNumListViewMenuItems(void); bool GetScalingWindow(cRect &scalingWindow); map<string,string> GetCustomStringTokens(void) { return globals->GetCustomStringTokens(); }; diff --git a/libtemplate/templateviewelement.c b/libtemplate/templateviewelement.c index 1a2ef6e..8c9541a 100644 --- a/libtemplate/templateviewelement.c +++ b/libtemplate/templateviewelement.c @@ -46,7 +46,7 @@ bool cTemplateViewElement::CalculateParameters(void) { parameters->SetContainer(containerX, containerY, containerWidth, containerHeight);
parameters->SetGlobals(globals);
paramsValid = parameters->CalculateParameters();
-
+ parameters->ParseParameters();
return paramsValid;
}
@@ -118,6 +118,13 @@ cTemplateFunction *cTemplateViewElement::GetFunction(string name) { return NULL;
}
+bool cTemplateViewElement::Execute(void) {
+ if (!parameters)
+ return true;
+ return parameters->DoExecute();
+}
+
+
bool cTemplateViewElement::DebugTokens(void) {
if (!parameters)
return false;
diff --git a/libtemplate/templateviewelement.h b/libtemplate/templateviewelement.h index be7bb74..1456de6 100644 --- a/libtemplate/templateviewelement.h +++ b/libtemplate/templateviewelement.h @@ -105,6 +105,7 @@ public: void InitIterator(void);
cTemplatePixmap *GetNextPixmap(void);
cTemplateFunction *GetFunction(string name);
+ bool Execute(void);
bool DebugTokens(void);
virtual void Debug(void);
};
diff --git a/libtemplate/xmlparser.c b/libtemplate/xmlparser.c index aa7d498..f5f3d6e 100644 --- a/libtemplate/xmlparser.c +++ b/libtemplate/xmlparser.c @@ -191,7 +191,7 @@ bool cXmlParser::ParseView(void) { } else if (view->ValidViewElement((const char*)node->name)) { xmlAttrPtr attr = node->properties; vector<pair<string, string> > attribs; - ParseAttributes(attr, node, attribs); + ParseAttributes(attr, node, attribs, true); ParseViewElement(node->name, node->xmlChildrenNode, attribs); } else if (view->ValidViewList((const char*)node->name)) { ParseViewList(node); @@ -682,7 +682,7 @@ bool cXmlParser::ParseSubView(xmlNodePtr node) { if (subView->ValidViewElement((const char*)childNode->name)) { xmlAttrPtr attr = childNode->properties; vector<pair<string, string> > attribs; - ParseAttributes(attr, childNode, attribs); + ParseAttributes(attr, childNode, attribs, true); ParseViewElement(childNode->name, childNode->xmlChildrenNode, attribs, subView); } else if (subView->ValidViewList((const char*)childNode->name)) { ParseViewList(childNode, subView); @@ -954,7 +954,7 @@ void cXmlParser::ParseLoopFunctionCalls(xmlNodePtr node, cTemplateLoopFunction * } } -bool cXmlParser::ParseAttributes(xmlAttrPtr attr, xmlNodePtr node, vector<pair<string, string> > &attribs) { +bool cXmlParser::ParseAttributes(xmlAttrPtr attr, xmlNodePtr node, vector<pair<string, string> > &attribs, bool isViewElement) { if (attr == NULL) { return false; } @@ -965,15 +965,16 @@ bool cXmlParser::ParseAttributes(xmlAttrPtr attr, xmlNodePtr node, vector<pair<s while (NULL != attr) { string name = (const char*)attr->name; + /* if (!name.compare("debug")) { attribs.push_back(pair<string, string>((const char*)attr->name, "true")); attr = attr->next; continue; } - + */ xmlChar *value = NULL; value = xmlGetProp(node, attr->name); - if (!view->ValidAttribute((const char*)node->name, (const char*)attr->name)) { + if (!view->ValidAttribute(isViewElement ? "viewelement" : (const char*)node->name, (const char*)attr->name)) { esyslog("skindesigner: unknown attribute %s in %s", (const char*)attr->name, (const char*)node->name); attr = attr->next; if (value) diff --git a/libtemplate/xmlparser.h b/libtemplate/xmlparser.h index 8698196..58d4e91 100644 --- a/libtemplate/xmlparser.h +++ b/libtemplate/xmlparser.h @@ -47,7 +47,7 @@ private: void ParseGrid(xmlNodePtr node, vector<pair<string, string> > &attributes); void ParseFunctionCalls(xmlNodePtr node, cTemplatePixmap *pix); void ParseLoopFunctionCalls(xmlNodePtr node, cTemplateLoopFunction *loopFunc); - bool ParseAttributes(xmlAttrPtr attr, xmlNodePtr node, vector<pair<string, string> > &attribs); + bool ParseAttributes(xmlAttrPtr attr, xmlNodePtr node, vector<pair<string, string> > &attribs, bool isViewElement = false); public: cXmlParser(void); virtual ~cXmlParser(void); |
