mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 15:58:31 +00:00
refresh custom token display with each custom token change
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
#include <locale.h>
|
||||
|
||||
cGlobals::cGlobals(void) {
|
||||
customTokenChange = 0;
|
||||
lastCustomTokenQuery = 0;
|
||||
|
||||
fonts.insert(pair<string, string>("vdrOsd", Setup.FontOsd));
|
||||
fonts.insert(pair<string, string>("vdrFix", Setup.FontFix));
|
||||
fonts.insert(pair<string, string>("vdrSml", Setup.FontSml));
|
||||
@@ -198,11 +201,13 @@ string cGlobals::DoTranslate(string token) {
|
||||
void cGlobals::AddCustomInt(string &name, int value) {
|
||||
customIntTokens.erase(name);
|
||||
customIntTokens.insert(pair<string,int>(name, value));
|
||||
customTokenChange = time(0);
|
||||
}
|
||||
|
||||
void cGlobals::AddCustomString(string &name, string &value) {
|
||||
customStringTokens.erase(name);
|
||||
customStringTokens.insert(pair<string,string>(name, value));
|
||||
customTokenChange = time(0);
|
||||
}
|
||||
|
||||
bool cGlobals::GetCustomInt(string name, int &val) {
|
||||
@@ -214,6 +219,24 @@ bool cGlobals::GetCustomInt(string name, int &val) {
|
||||
return false;
|
||||
}
|
||||
|
||||
map <string, string> cGlobals::GetCustomStringTokens(void) {
|
||||
lastCustomTokenQuery = time(0);
|
||||
return customStringTokens;
|
||||
}
|
||||
|
||||
map <string, int> cGlobals::GetCustomIntTokens(void) {
|
||||
lastCustomTokenQuery = time(0);
|
||||
return customIntTokens;
|
||||
}
|
||||
|
||||
bool cGlobals::CustomTokenChange(void) {
|
||||
if (!lastCustomTokenQuery)
|
||||
return true;
|
||||
if (lastCustomTokenQuery < customTokenChange)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void cGlobals::ListCustomTokens(void) {
|
||||
for (map<string, string>::iterator it = customStringTokens.begin(); it != customStringTokens.end(); it++) {
|
||||
dsyslog("skindesigner: custom string token \"%s\" = \"%s\"", (it->first).c_str(), (it->second).c_str());
|
||||
|
||||
@@ -20,6 +20,8 @@ typedef uint32_t tColor;
|
||||
|
||||
class cGlobals {
|
||||
private:
|
||||
time_t customTokenChange;
|
||||
time_t lastCustomTokenQuery;
|
||||
string language;
|
||||
string DoTranslate(string token);
|
||||
map <string, tColor> colors;
|
||||
@@ -50,8 +52,9 @@ public:
|
||||
void AddCustomInt(string &name, int value);
|
||||
void AddCustomString(string &name, string &value);
|
||||
bool GetCustomInt(string name, int &val);
|
||||
map <string, string> GetCustomStringTokens(void) { return customStringTokens; };
|
||||
map <string, int> GetCustomIntTokens(void) { return customIntTokens; };
|
||||
map <string, string> GetCustomStringTokens(void);
|
||||
map <string, int> GetCustomIntTokens(void);
|
||||
bool CustomTokenChange(void);
|
||||
void ListCustomTokens(void);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
@@ -125,6 +125,7 @@ public:
|
||||
bool GetScalingWindow(cRect &scalingWindow);
|
||||
map<string,string> GetCustomStringTokens(void) { return globals->GetCustomStringTokens(); };
|
||||
map<string,int> GetCustomIntTokens(void) { return globals->GetCustomIntTokens(); };
|
||||
bool CustomTokenChange(void) { return globals->CustomTokenChange(); };
|
||||
//Checks for parsing template XML files
|
||||
bool ValidSubView(const char *subView);
|
||||
bool ValidViewElement(const char *viewElement);
|
||||
|
||||
Reference in New Issue
Block a user