diff --git a/config.c b/config.c index 4ddb618..b77a164 100644 --- a/config.c +++ b/config.c @@ -27,7 +27,9 @@ cDesignerConfig::cDesignerConfig() { } cDesignerConfig::~cDesignerConfig() { - esyslog("skindesigner: config destruktor"); + for (map < string, cSkinSetup* >::iterator it = skinSetups.begin(); it != skinSetups.end(); it++) { + delete it->second; + } } void cDesignerConfig::SetPathes(void) { @@ -78,8 +80,10 @@ void cDesignerConfig::ReadSkins(void) { void cDesignerConfig::ReadSkinSetup(string skin) { cSkinSetup *skinSetup = new cSkinSetup(skin); - skinSetup->ReadFromXML(); - skinSetup->Debug(); + if (skinSetup->ReadFromXML()) { + //skinSetup->Debug(); + skinSetups.insert(pair(skin, skinSetup)); + } } bool cDesignerConfig::GetSkin(string &skin) { @@ -91,6 +95,15 @@ bool cDesignerConfig::GetSkin(string &skin) { return true; } +cSkinSetup* cDesignerConfig::GetSkinSetup(string &skin) { + map< string, cSkinSetup* >::iterator hit = skinSetups.find(skin); + if (hit != skinSetups.end()) { + return hit->second; + } + return NULL; +} + + void cDesignerConfig::CheckDecimalPoint(void) { struct lconv *pLocInfo; pLocInfo = localeconv(); diff --git a/config.h b/config.h index 1e1b2e9..36c67e3 100644 --- a/config.h +++ b/config.h @@ -29,6 +29,7 @@ private: string osdLanguage; map < string, map < int, string > > plugins; map < string, map < int, string > >::iterator plugIt; + map< string, cSkinSetup* > skinSetups; public: cDesignerConfig(); ~cDesignerConfig(); @@ -41,6 +42,7 @@ public: void ReadSkinSetup(string skin); void InitSkinIterator(void) { skinIterator = skins.begin(); }; bool GetSkin(string &skin); + cSkinSetup* GetSkinSetup(string &skin); void CheckDecimalPoint(void); void SetSkin(void); bool SkinChanged(void); diff --git a/designer.c b/designer.c index 7630d79..7d70d07 100644 --- a/designer.c +++ b/designer.c @@ -263,14 +263,11 @@ bool cSkinDesigner::LoadTemplates(void) { return false; } -/* - cSkinSetup *skinSetups = new cSkinSetup(); - config.InitSkinIterator(); - string skin = ""; - while (config.GetSkin(skin)) { - skinSetups->ReadFromXML(skin); + cSkinSetup *skinSetup = config.GetSkinSetup(skin); + if (skinSetup) { + skinSetup->AddToGlobals(globals); } -*/ + DeleteTemplates(); channelTemplate = new cTemplate(vtDisplayChannel); diff --git a/dtd/setup.dtd b/dtd/setup.dtd index 81a801b..a0c7c86 100644 --- a/dtd/setup.dtd +++ b/dtd/setup.dtd @@ -1,7 +1,8 @@ - + + + + + + + diff --git a/libcore/skinsetup.c b/libcore/skinsetup.c index c01f2d7..a1484f3 100644 --- a/libcore/skinsetup.c +++ b/libcore/skinsetup.c @@ -5,15 +5,14 @@ cSkinSetup::cSkinSetup(string skin) { this->skin = skin; } -void cSkinSetup::ReadFromXML(void) { - esyslog("skindesigner: reading setup for skin %s", skin.c_str()); +bool cSkinSetup::ReadFromXML(void) { string xmlFile = "setup.xml"; cXmlParser parser; if (!parser.ReadSkinSetup(this, skin, xmlFile)) { - esyslog("skindesigner: no setup file for skin %s found", skin.c_str()); - return; + return false; } parser.ParseSkinSetup(skin); + return true; } void cSkinSetup::SetParameter(xmlChar *type, xmlChar *name, xmlChar* displayText, xmlChar *min, xmlChar *max, xmlChar *value) { @@ -44,12 +43,35 @@ void cSkinSetup::SetParameter(xmlChar *type, xmlChar *name, xmlChar* displayText } param.value = atoi((const char*)value); - parameters.push_back(param); + parameters.insert(pair(param.name, param)); } +void cSkinSetup::SetTranslation(string translationToken, map < string, string > transl) { + translations.insert(pair >(translationToken, transl)); +} + +void cSkinSetup::AddToGlobals(cGlobals *globals) { + if (!globals) + return; + for (map::iterator p = parameters.begin(); p != parameters.end(); p++) { + string paramName = p->first; + cSkinSetupParameter param = p->second; + globals->intVars.erase(paramName); + globals->intVars.insert(pair(paramName, param.value)); + } +} void cSkinSetup::Debug(void) { dsyslog("skindesigner: Skin \"%s\" Setup Parameters", skin.c_str()); - for (vector::iterator p = parameters.begin(); p != parameters.end(); p++) - p->Debug(); + for (map::iterator p = parameters.begin(); p != parameters.end(); p++) { + (p->second).Debug(); + } + dsyslog("skindesigner: Skin \"%s\" Setup Parameter Translations", skin.c_str()); + for (map >::iterator trans = translations.begin(); trans != translations.end(); trans++) { + dsyslog("skindesigner: translation token %s", (trans->first).c_str()); + map transValues = trans->second; + for (map::iterator trans2 = transValues.begin(); trans2 != transValues.end(); trans2++) { + dsyslog("skindesigner: translation language %s value \"%s\"", (trans2->first).c_str(), (trans2->second).c_str()); + } + } } diff --git a/libcore/skinsetup.h b/libcore/skinsetup.h index 4f8a93c..e5fcdc8 100644 --- a/libcore/skinsetup.h +++ b/libcore/skinsetup.h @@ -8,6 +8,7 @@ #include #include #include +#include "../libtemplate/globals.h" #include "skinsetupparameter.h" using namespace std; @@ -17,12 +18,15 @@ using namespace std; class cSkinSetup { private: string skin; - vector parameters; + map parameters; + map > translations; public: cSkinSetup(string skin); virtual ~cSkinSetup(void) {}; - void ReadFromXML(void); + bool ReadFromXML(void); void SetParameter(xmlChar *type, xmlChar *name, xmlChar* displayText, xmlChar *min, xmlChar *max, xmlChar *value); + void SetTranslation(string translationToken, map < string, string > transl); + void AddToGlobals(cGlobals *globals); void Debug(void); }; diff --git a/libcore/skinsetupparameter.c b/libcore/skinsetupparameter.c index 6f142f6..e6c3672 100644 --- a/libcore/skinsetupparameter.c +++ b/libcore/skinsetupparameter.c @@ -10,15 +10,12 @@ cSkinSetupParameter::cSkinSetupParameter(void) { } void cSkinSetupParameter::Debug(void) { + string sType = "unknown"; if (type == sptBool) - dsyslog("skindesigner: type bool"); + sType = "bool"; else if (type == sptInt) - dsyslog("skindesigner: type integer"); - else - dsyslog("skindesigner: type UNKNOWN"); - dsyslog("skindesigner: name %s", name.c_str()); - dsyslog("skindesigner: displayText %s", displayText.c_str()); + sType = "int"; + dsyslog("skindesigner: name \"%s\", type %s, displayText \"%s\", Value %d", name.c_str(), sType.c_str(), displayText.c_str(), value); if (type == sptInt) dsyslog("skindesigner: min %d, max %d", min, max); - dsyslog("skindesigner: Value %d", value); } \ No newline at end of file diff --git a/libtemplate/xmlparser.c b/libtemplate/xmlparser.c index dd93a0d..01b48a6 100644 --- a/libtemplate/xmlparser.c +++ b/libtemplate/xmlparser.c @@ -128,11 +128,8 @@ bool cXmlParser::ReadSkinSetup(cSkinSetup *skinSetup, string skin, string xmlFil this->skinSetup = skinSetup; string xmlPath = *cString::sprintf("%s%s/%s", *config.skinPath, skin.c_str(), xmlFile.c_str()); - esyslog("skindesigner: reading skin setup %s", xmlPath.c_str()); - if (!FileExists(xmlPath)) return false; - if (ctxt == NULL) { esyslog("skindesigner: Failed to allocate parser context"); return false; @@ -151,12 +148,9 @@ bool cXmlParser::ReadSkinSetup(cSkinSetup *skinSetup, string skin, string xmlFil esyslog("skindesigner: Failed to validate %s", xmlPath.c_str()); return false; } - if (root == NULL) { - esyslog("skindesigner: ERROR: Skin Setup %s is empty", xmlPath.c_str()); return false; } - if (xmlStrcmp(root->name, (const xmlChar *) "setup")) { return false; } @@ -271,8 +265,6 @@ bool cXmlParser::ParseGlobals(void) { } bool cXmlParser::ParseSkinSetup(string skin) { - esyslog("skindesigner: parsing skinsetup from %s", skin.c_str()); - xmlNodePtr node = root->xmlChildrenNode; while (node != NULL) { @@ -284,6 +276,10 @@ bool cXmlParser::ParseSkinSetup(string skin) { ParseSetupParameter(node->xmlChildrenNode); node = node->next; continue; + } else if (!xmlStrcmp(node->name, (const xmlChar *) "translations")) { + ParseTranslations(node->xmlChildrenNode); + node = node->next; + continue; } node = node->next; } @@ -610,7 +606,11 @@ void cXmlParser::ParseTranslations(xmlNodePtr node) { xmlFree(value); nodeTrans = nodeTrans->next; } - globals->translations.insert(pair >((const char*)tokenName, tokenTranslations)); + if (globals) { + globals->translations.insert(pair >((const char*)tokenName, tokenTranslations)); + } else if (skinSetup) { + skinSetup->SetTranslation((const char*)tokenName, tokenTranslations); + } xmlFree(tokenName); node = node->next; } diff --git a/skins/blackhole/setup.xml b/skins/blackhole/setup.xml index c75e183..db097f9 100644 --- a/skins/blackhole/setup.xml +++ b/skins/blackhole/setup.xml @@ -12,8 +12,26 @@ "displayname" is used to display the option in the setup menu. --> - 0 - 1 - 300 + 0 + 1 + 300 + + + + + Show Signalstrength and -quality when switching channel + Signalstärke und -qualität beim Umschalten anzeigen + + + Show Poster when switching channel + Poster beim Umschalten anzeigen + + + Fade In and Out time in ms + Fade In and Out Zeit in ms + +