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
|
- added currentschedule viewelement in displaymenumain
|
||||||
- fixed bug that wrong channel was shown in header of whatson
|
- fixed bug that wrong channel was shown in header of whatson
|
||||||
if entering from whatsonnow
|
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)
|
if (!globals)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
map<string, string>::iterator hit = globals->customTokens.find(key);
|
if (isNumber(val)) {
|
||||||
if (hit != globals->customTokens.end()) {
|
map<string, int>::iterator hit = globals->customIntTokens.find(key);
|
||||||
globals->customTokens.erase(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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,8 +166,11 @@ void cSkinDesigner::ListCustomTokens(void) {
|
|||||||
if (!globals)
|
if (!globals)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (map<string, string>::iterator it = globals->customTokens.begin(); it != globals->customTokens.end(); it++) {
|
for (map<string, string>::iterator it = globals->customStringTokens.begin(); it != globals->customStringTokens.end(); it++) {
|
||||||
dsyslog("skindesigner: custom token \"%s\" = \"%s\"", (it->first).c_str(), (it->second).c_str());
|
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
|
debug CDATA #IMPLIED
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<!ELEMENT customtokens (area|areascroll)*>
|
||||||
|
<!ATTLIST customtokens
|
||||||
|
debug CDATA #IMPLIED
|
||||||
|
>
|
||||||
|
|
||||||
<!ELEMENT scrollbar (area|areascroll)*>
|
<!ELEMENT scrollbar (area|areascroll)*>
|
||||||
<!ATTLIST scrollbar
|
<!ATTLIST scrollbar
|
||||||
debug CDATA #IMPLIED
|
debug CDATA #IMPLIED
|
||||||
@ -94,7 +99,7 @@
|
|||||||
>
|
>
|
||||||
|
|
||||||
<!ELEMENT menumain (background | header | datetime | colorbuttons | scrollbar | timers |
|
<!ELEMENT menumain (background | header | datetime | colorbuttons | scrollbar | timers |
|
||||||
discusage | devices | systemload | currentschedule | menuitems)*>
|
discusage | devices | systemload | currentschedule | customtokens | menuitems)*>
|
||||||
<!ATTLIST menumain
|
<!ATTLIST menumain
|
||||||
x CDATA #REQUIRED
|
x CDATA #REQUIRED
|
||||||
y CDATA #REQUIRED
|
y CDATA #REQUIRED
|
||||||
|
@ -31,7 +31,8 @@ public:
|
|||||||
map <string, string> stringVars;
|
map <string, string> stringVars;
|
||||||
map <string, string> fonts;
|
map <string, string> fonts;
|
||||||
map <string, map< string, string > > translations;
|
map <string, map< string, string > > translations;
|
||||||
map <string, string> customTokens;
|
map <string, string> customStringTokens;
|
||||||
|
map <string, int> customIntTokens;
|
||||||
bool ReadFromXML(void);
|
bool ReadFromXML(void);
|
||||||
bool Translate(string text, string &translation);
|
bool Translate(string text, string &translation);
|
||||||
void Debug(void);
|
void Debug(void);
|
||||||
|
@ -105,7 +105,8 @@ public:
|
|||||||
int GetNumPixmapsViewElement(eViewElement ve);
|
int GetNumPixmapsViewElement(eViewElement ve);
|
||||||
int GetNumListViewMenuItems(void);
|
int GetNumListViewMenuItems(void);
|
||||||
bool GetScalingWindow(cRect &scalingWindow);
|
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
|
//Checks for parsing template XML files
|
||||||
bool ValidSubView(const char *subView);
|
bool ValidSubView(const char *subView);
|
||||||
bool ValidViewElement(const char *viewElement);
|
bool ValidViewElement(const char *viewElement);
|
||||||
|
@ -233,6 +233,14 @@
|
|||||||
</area>
|
</area>
|
||||||
</systemload>
|
</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">
|
<menuitems x="0" y="7%" orientation="vertical" width="70%" height="56%" align="center" numlistelements="8">
|
||||||
<!-- Available Variables main menu listelement:
|
<!-- Available Variables main menu listelement:
|
||||||
{nummenuitem} number of item in list, starts with 1
|
{nummenuitem} number of item in list, starts with 1
|
||||||
|
@ -79,6 +79,14 @@
|
|||||||
<currentschedule>
|
<currentschedule>
|
||||||
</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">
|
<menuitems x="0" y="0" orientation="vertical" width="100%" height="100%" align="center" numlistelements="8">
|
||||||
<!-- Available Variables main menu listelement:
|
<!-- Available Variables main menu listelement:
|
||||||
{nummenuitem} number of item in list, starts with 1
|
{nummenuitem} number of item in list, starts with 1
|
||||||
|
@ -539,8 +539,8 @@ void cDisplayChannelView::DrawCustomTokens(void) {
|
|||||||
}
|
}
|
||||||
if (!tmplView)
|
if (!tmplView)
|
||||||
return;
|
return;
|
||||||
map < string, string > stringTokens = tmplView->GetCustomTokens();
|
map < string, string > stringTokens = tmplView->GetCustomStringTokens();
|
||||||
map < string, int > intTokens;
|
map < string, int > intTokens = tmplView->GetCustomIntTokens();
|
||||||
DrawViewElement(veCustomTokens, &stringTokens, &intTokens);
|
DrawViewElement(veCustomTokens, &stringTokens, &intTokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,6 +230,7 @@ void cDisplayMenuMainView::DrawStaticViewElements(void) {
|
|||||||
DrawTimers();
|
DrawTimers();
|
||||||
DrawDiscUsage();
|
DrawDiscUsage();
|
||||||
DrawCurrentSchedule();
|
DrawCurrentSchedule();
|
||||||
|
DrawCustomTokens();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cDisplayMenuMainView::DrawDynamicViewElements(void) {
|
bool cDisplayMenuMainView::DrawDynamicViewElements(void) {
|
||||||
@ -501,6 +502,17 @@ void cDisplayMenuMainView::DrawCurrentSchedule(void) {
|
|||||||
DrawViewElement(veCurrentSchedule, &stringTokens, &intTokens);
|
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
|
* cDisplayMenuSchedulesView
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
@ -39,6 +39,7 @@ private:
|
|||||||
bool DrawLoad(void);
|
bool DrawLoad(void);
|
||||||
bool DrawDevices(void);
|
bool DrawDevices(void);
|
||||||
void DrawCurrentSchedule(void);
|
void DrawCurrentSchedule(void);
|
||||||
|
void DrawCustomTokens(void);
|
||||||
public:
|
public:
|
||||||
cDisplayMenuMainView(cTemplateView *tmplView, bool menuInit);
|
cDisplayMenuMainView(cTemplateView *tmplView, bool menuInit);
|
||||||
virtual ~cDisplayMenuMainView();
|
virtual ~cDisplayMenuMainView();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user