mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
added customtokens view element in displaymenumain, added automatic determination of custom int tokens
This commit is contained in:
parent
a443d53e85
commit
b0fd460403
2
HISTORY
2
HISTORY
@ -115,3 +115,5 @@ Version 0.1.0
|
||||
- added currentschedule viewelement in displaymenumain
|
||||
- fixed bug that wrong channel was shown in header of whatson
|
||||
if entering from whatsonnow
|
||||
- added customtokens view element in displaymenumain
|
||||
- added automatic determination of custom int tokens
|
24
designer.c
24
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
************************************************************************/
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user