diff --git a/HISTORY b/HISTORY index 3966163..f4c9b00 100644 --- a/HISTORY +++ b/HISTORY @@ -114,4 +114,6 @@ Version 0.1.0 - fixed possible Nullpointer access in displaymenurootview - added currentschedule viewelement in displaymenumain - fixed bug that wrong channel was shown in header of whatson - if entering from whatsonnow \ No newline at end of file + if entering from whatsonnow +- added customtokens view element in displaymenumain +- added automatic determination of custom int tokens \ No newline at end of file diff --git a/designer.c b/designer.c index be6f874..68112ec 100644 --- a/designer.c +++ b/designer.c @@ -146,12 +146,19 @@ bool cSkinDesigner::SetCustomToken(string option) { if (!globals) return true; - map::iterator hit = globals->customTokens.find(key); - if (hit != globals->customTokens.end()) { - globals->customTokens.erase(key); + if (isNumber(val)) { + map::iterator hit = globals->customIntTokens.find(key); + if (hit != globals->customIntTokens.end()) { + globals->customIntTokens.erase(key); + } + globals->customIntTokens.insert(pair(key, atoi(val.c_str()))); + } else { + map::iterator hit = globals->customStringTokens.find(key); + if (hit != globals->customStringTokens.end()) { + globals->customStringTokens.erase(key); + } + globals->customStringTokens.insert(pair(key, val)); } - globals->customTokens.insert(pair(key, val)); - return true; } @@ -159,8 +166,11 @@ void cSkinDesigner::ListCustomTokens(void) { if (!globals) return; - for (map::iterator it = globals->customTokens.begin(); it != globals->customTokens.end(); it++) { - dsyslog("skindesigner: custom token \"%s\" = \"%s\"", (it->first).c_str(), (it->second).c_str()); + for (map::iterator it = globals->customStringTokens.begin(); it != globals->customStringTokens.end(); it++) { + dsyslog("skindesigner: custom string token \"%s\" = \"%s\"", (it->first).c_str(), (it->second).c_str()); + } + for (map::iterator it = globals->customIntTokens.begin(); it != globals->customIntTokens.end(); it++) { + dsyslog("skindesigner: custom int token \"%s\" = \"%d\"", (it->first).c_str(), it->second); } } diff --git a/dtd/displaymenu.dtd b/dtd/displaymenu.dtd index 2a3da3f..d939a36 100644 --- a/dtd/displaymenu.dtd +++ b/dtd/displaymenu.dtd @@ -65,6 +65,11 @@ debug CDATA #IMPLIED > + + + + discusage | devices | systemload | currentschedule | customtokens | menuitems)*> stringVars; map fonts; map > translations; - map customTokens; + map customStringTokens; + map customIntTokens; bool ReadFromXML(void); bool Translate(string text, string &translation); void Debug(void); diff --git a/libtemplate/templateview.h b/libtemplate/templateview.h index 20f1c51..1ad5734 100644 --- a/libtemplate/templateview.h +++ b/libtemplate/templateview.h @@ -105,7 +105,8 @@ public: int GetNumPixmapsViewElement(eViewElement ve); int GetNumListViewMenuItems(void); bool GetScalingWindow(cRect &scalingWindow); - map GetCustomTokens(void) { return globals->customTokens; }; + map GetCustomStringTokens(void) { return globals->customStringTokens; }; + map GetCustomIntTokens(void) { return globals->customIntTokens; }; //Checks for parsing template XML files bool ValidSubView(const char *subView); bool ValidViewElement(const char *viewElement); diff --git a/skins/metrixhd/xmlfiles/displaymenumain.xml b/skins/metrixhd/xmlfiles/displaymenumain.xml index a13c94b..877b736 100644 --- a/skins/metrixhd/xmlfiles/displaymenumain.xml +++ b/skins/metrixhd/xmlfiles/displaymenumain.xml @@ -233,6 +233,14 @@ + + + + + + +