summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2014-12-19 15:39:21 +0100
committerlouis <louis.braun@gmx.de>2014-12-19 15:39:21 +0100
commitb0fd4604032be9a902b5bdd07037a5fc0ff16337 (patch)
tree146aa97dde6e7543708986ad0f30bc70d1fea952
parenta443d53e85de7e2f7e2ac56c5297d792ca103268 (diff)
downloadvdr-plugin-skindesigner-b0fd4604032be9a902b5bdd07037a5fc0ff16337.tar.gz
vdr-plugin-skindesigner-b0fd4604032be9a902b5bdd07037a5fc0ff16337.tar.bz2
added customtokens view element in displaymenumain, added automatic determination of custom int tokens
-rw-r--r--HISTORY4
-rw-r--r--designer.c24
-rw-r--r--dtd/displaymenu.dtd7
-rw-r--r--libtemplate/globals.h3
-rw-r--r--libtemplate/templateview.h3
-rw-r--r--skins/metrixhd/xmlfiles/displaymenumain.xml8
-rw-r--r--skinskeleton/xmlfiles/displaymenumain.xml8
-rw-r--r--views/displaychannelview.c4
-rw-r--r--views/displaymenuview.c12
-rw-r--r--views/displaymenuview.h1
10 files changed, 61 insertions, 13 deletions
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<string, string>::iterator hit = globals->customTokens.find(key);
- if (hit != globals->customTokens.end()) {
- globals->customTokens.erase(key);
+ if (isNumber(val)) {
+ map<string, int>::iterator hit = globals->customIntTokens.find(key);
+ if (hit != globals->customIntTokens.end()) {
+ globals->customIntTokens.erase(key);
+ }
+ globals->customIntTokens.insert(pair<string,int>(key, atoi(val.c_str())));
+ } else {
+ map<string, string>::iterator hit = globals->customStringTokens.find(key);
+ if (hit != globals->customStringTokens.end()) {
+ globals->customStringTokens.erase(key);
+ }
+ globals->customStringTokens.insert(pair<string,string>(key, val));
}
- globals->customTokens.insert(pair<string,string>(key, val));
-
return true;
}
@@ -159,8 +166,11 @@ void cSkinDesigner::ListCustomTokens(void) {
if (!globals)
return;
- for (map<string, string>::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<string, string>::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<string, int>::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
>
+<!ELEMENT customtokens (area|areascroll)*>
+<!ATTLIST customtokens
+ debug CDATA #IMPLIED
+>
+
<!ELEMENT scrollbar (area|areascroll)*>
<!ATTLIST scrollbar
debug CDATA #IMPLIED
@@ -94,7 +99,7 @@
>
<!ELEMENT menumain (background | header | datetime | colorbuttons | scrollbar | timers |
- discusage | devices | systemload | currentschedule | menuitems)*>
+ discusage | devices | systemload | currentschedule | customtokens | menuitems)*>
<!ATTLIST menumain
x CDATA #REQUIRED
y CDATA #REQUIRED
diff --git a/libtemplate/globals.h b/libtemplate/globals.h
index 09c9756..17f5242 100644
--- a/libtemplate/globals.h
+++ b/libtemplate/globals.h
@@ -31,7 +31,8 @@ public:
map <string, string> stringVars;
map <string, string> fonts;
map <string, map< string, string > > translations;
- map <string, string> customTokens;
+ map <string, string> customStringTokens;
+ map <string, int> 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<string,string> GetCustomTokens(void) { return globals->customTokens; };
+ map<string,string> GetCustomStringTokens(void) { return globals->customStringTokens; };
+ map<string,int> 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 @@
</area>
</systemload>
+ <!-- Available Variables customtokens:
+ all custom tokens set by the svdrp command SCTK are available in this viewelement
+ For instance, use an appropriate script which runs periodically as cronjob and
+ sets these custom tokens with svdrpsend or dbus2vdr
+ -->
+ <customtokens>
+ </customtokens>
+
<menuitems x="0" y="7%" orientation="vertical" width="70%" height="56%" align="center" numlistelements="8">
<!-- Available Variables main menu listelement:
{nummenuitem} number of item in list, starts with 1
diff --git a/skinskeleton/xmlfiles/displaymenumain.xml b/skinskeleton/xmlfiles/displaymenumain.xml
index d6d0173..18aa1d2 100644
--- a/skinskeleton/xmlfiles/displaymenumain.xml
+++ b/skinskeleton/xmlfiles/displaymenumain.xml
@@ -79,6 +79,14 @@
<currentschedule>
</currentschedule>
+ <!-- Available Variables customtokens:
+ all custom tokens set by the svdrp command SCTK are available in this viewelement
+ For instance, use an appropriate script which runs periodically as cronjob and
+ sets these custom tokens with svdrpsend or dbus2vdr
+ -->
+ <customtokens>
+ </customtokens>
+
<menuitems x="0" y="0" orientation="vertical" width="100%" height="100%" align="center" numlistelements="8">
<!-- Available Variables main menu listelement:
{nummenuitem} number of item in list, starts with 1
diff --git a/views/displaychannelview.c b/views/displaychannelview.c
index 9a85ab4..8c2b90c 100644
--- a/views/displaychannelview.c
+++ b/views/displaychannelview.c
@@ -539,8 +539,8 @@ void cDisplayChannelView::DrawCustomTokens(void) {
}
if (!tmplView)
return;
- map < string, string > stringTokens = tmplView->GetCustomTokens();
- map < string, int > intTokens;
+ map < string, string > stringTokens = tmplView->GetCustomStringTokens();
+ map < string, int > intTokens = tmplView->GetCustomIntTokens();
DrawViewElement(veCustomTokens, &stringTokens, &intTokens);
}
diff --git a/views/displaymenuview.c b/views/displaymenuview.c
index 69337c9..5f9b0b8 100644
--- a/views/displaymenuview.c
+++ b/views/displaymenuview.c
@@ -230,6 +230,7 @@ void cDisplayMenuMainView::DrawStaticViewElements(void) {
DrawTimers();
DrawDiscUsage();
DrawCurrentSchedule();
+ DrawCustomTokens();
}
bool cDisplayMenuMainView::DrawDynamicViewElements(void) {
@@ -501,6 +502,17 @@ void cDisplayMenuMainView::DrawCurrentSchedule(void) {
DrawViewElement(veCurrentSchedule, &stringTokens, &intTokens);
}
+void cDisplayMenuMainView::DrawCustomTokens(void) {
+ if (!ViewElementImplemented(veCustomTokens)) {
+ return;
+ }
+ if (!tmplView)
+ return;
+ map < string, string > stringTokens = tmplView->GetCustomStringTokens();
+ map < string, int > intTokens = tmplView->GetCustomIntTokens();
+ DrawViewElement(veCustomTokens, &stringTokens, &intTokens);
+}
+
/************************************************************************
* cDisplayMenuSchedulesView
************************************************************************/
diff --git a/views/displaymenuview.h b/views/displaymenuview.h
index dbed6b6..04bc986 100644
--- a/views/displaymenuview.h
+++ b/views/displaymenuview.h
@@ -39,6 +39,7 @@ private:
bool DrawLoad(void);
bool DrawDevices(void);
void DrawCurrentSchedule(void);
+ void DrawCustomTokens(void);
public:
cDisplayMenuMainView(cTemplateView *tmplView, bool menuInit);
virtual ~cDisplayMenuMainView();