diff --git a/HISTORY b/HISTORY index 6e37536..f95803b 100644 --- a/HISTORY +++ b/HISTORY @@ -192,3 +192,9 @@ Version 0.2.1 - fixed bug that global tokens were not parsed correctly - added finnish translation +- some more nopacity optimizations - thanx@utility +- added possibiliy to use submenus in the skin setup menus +- reloading active skin directly after closing setup menu so that + changes of setup parameters are immediately in use + +Version 0.2.2 diff --git a/config.c b/config.c index 61ccb55..8b018f7 100644 --- a/config.c +++ b/config.c @@ -25,6 +25,7 @@ cDesignerConfig::cDesignerConfig() { SetOSDSize(); SetOSDFonts(); osdLanguage = ""; + setupCloseDoReload = false; } cDesignerConfig::~cDesignerConfig() { @@ -88,7 +89,7 @@ void cDesignerConfig::DebugSkinSetups(void) { dsyslog("skindesigner: skin setups:"); InitSetupIterator(); cSkinSetup *skinSetup = NULL; - while (skinSetup = GetSkinSetup()) { + while (skinSetup = GetNextSkinSetup()) { skinSetup->Debug(); } } @@ -125,7 +126,7 @@ cSkinSetup* cDesignerConfig::GetSkinSetup(string &skin) { return NULL; } -cSkinSetup* cDesignerConfig::GetSkinSetup(void) { +cSkinSetup* cDesignerConfig::GetNextSkinSetup(void) { if (setupIt == skinSetups.end()) { return NULL; } @@ -134,6 +135,15 @@ cSkinSetup* cDesignerConfig::GetSkinSetup(void) { return skinSetup; } +cSkinSetupMenu* cDesignerConfig::GetSkinSetupMenu(string &skin, string &menu) { + cSkinSetup *skinSetup = GetSkinSetup(skin); + if (!skinSetup) + return NULL; + esyslog("skindesigner: skinsetup found"); + return skinSetup->GetMenu(menu); +} + + void cDesignerConfig::TranslateSetup(void) { for (map< string, cSkinSetup* >::iterator it = skinSetups.begin(); it != skinSetups.end(); it++) { (it->second)->TranslateSetup(); diff --git a/config.h b/config.h index ab53c44..a10ad5f 100644 --- a/config.h +++ b/config.h @@ -49,7 +49,8 @@ public: void DebugSkinSetups(void); void DebugSkinSetupParameters(void); cSkinSetup* GetSkinSetup(string &skin); - cSkinSetup* GetSkinSetup(void); + cSkinSetup* GetNextSkinSetup(void); + cSkinSetupMenu* GetSkinSetupMenu(string &skin, string &menu); void InitSetupIterator(void) { setupIt = skinSetups.begin(); }; void TranslateSetup(void); void SetSkinSetupParameters(void); @@ -85,6 +86,8 @@ public: int rerunDistance; int rerunMaxChannel; int blockFlush; + //TemplateReload on Setup Close + bool setupCloseDoReload; }; #ifdef DEFINE_CONFIG diff --git a/designer.c b/designer.c index 676050f..c279650 100644 --- a/designer.c +++ b/designer.c @@ -163,8 +163,8 @@ void cSkinDesigner::ListCustomTokens(void) { * PRIVATE FUNCTIONS *********************************************************************************/ void cSkinDesigner::Init(void) { - if (init || config.OsdSizeChanged() || config.SkinChanged() || config.OsdLanguageChanged()) { - + if (init || config.OsdSizeChanged() || config.SkinChanged() || config.OsdLanguageChanged() || config.setupCloseDoReload) { + config.setupCloseDoReload = false; if (init) { config.SetSkin(); config.SetOSDSize(); diff --git a/dtd/setup.dtd b/dtd/setup.dtd index a0c7c86..d56fc40 100644 --- a/dtd/setup.dtd +++ b/dtd/setup.dtd @@ -1,9 +1,15 @@ - - + + + + + ::iterator p = parameters.begin(); p != parameters.end(); p++) { + delete p->second; + } + for (vector < cSkinSetupMenu* >::iterator s = subMenus.begin(); s != subMenus.end(); s++) { + delete (*s); + } +} + +cSkinSetupParameter *cSkinSetupMenu::GetNextParameter(bool deep) { + cSkinSetupParameter *param = NULL; + if (paramIt != parameters.end()) { + param = paramIt->second; + paramIt++; + return param; + } + if (!deep) + return NULL; + + if (subMenuIt != subMenus.end()) { + param = (*subMenuIt)->GetNextParameter(); + if (!param) { + subMenuIt++; + if (subMenuIt != subMenus.end()) { + (*subMenuIt)->InitIterators(); + param = (*subMenuIt)->GetNextParameter(); + } + } + } + return param; +} + +cSkinSetupParameter *cSkinSetupMenu::GetParameter(string name) { + map < string, cSkinSetupParameter* >::iterator hit = parameters.find(name); + if (hit != parameters.end()) + return hit->second; + + cSkinSetupParameter *paramHit = NULL; + for (vector < cSkinSetupMenu* >::iterator subMenu = subMenus.begin(); subMenu != subMenus.end(); subMenu++) { + paramHit = (*subMenu)->GetParameter(name); + if (paramHit) + return paramHit; + } + return NULL; +} + +void cSkinSetupMenu::InitIterators(void) { + paramIt = parameters.begin(); + subMenuIt = subMenus.begin(); + while (subMenuIt != subMenus.end()) { + (*subMenuIt)->InitIterators(); + subMenuIt++; + } + subMenuIt = subMenus.begin(); +} + +void cSkinSetupMenu::SetParameter(eSetupParameterType paramType, xmlChar *name, xmlChar* displayText, xmlChar *min, xmlChar *max, xmlChar *value) { + cSkinSetupParameter *param = new cSkinSetupParameter(); + param->type = paramType; + param->name = (const char*)name; + param->displayText = (const char*)displayText; + + if (min && paramType == sptInt) { + param->min = atoi((const char*)min); + } + if (max && paramType == sptInt) { + param->max = atoi((const char*)max); + } + param->value = atoi((const char*)value); + + parameters.insert(pair< string, cSkinSetupParameter* >(param->name, param)); +} + +cSkinSetupMenu *cSkinSetupMenu::GetMenu(string &name) { + for (vector::iterator m = subMenus.begin(); m != subMenus.end(); m++) { + cSkinSetupMenu *menu = (*m); + if (!name.compare(menu->GetName())) + return menu; + menu = menu->GetMenu(name); + if (menu) + return menu; + } + return NULL; +} + +cSkinSetupMenu *cSkinSetupMenu::GetNextSubMenu(bool deep) { + cSkinSetupMenu *menu = NULL; + if (subMenuIt != subMenus.end()) { + if (deep) { + menu = (*subMenuIt)->GetNextSubMenu(deep); + if (menu) + return menu; + } + menu = *subMenuIt; + subMenuIt++; + return menu; + } + return NULL; +} + + +void cSkinSetupMenu::Debug(bool deep) { + dsyslog("skindesigner: Menu %s Setup Parameters", name.c_str()); + for (map < string, cSkinSetupParameter* >::iterator p = parameters.begin(); p != parameters.end(); p++) { + (p->second)->Debug(); + } + if (subMenus.empty()) + return; + for (vector < cSkinSetupMenu* >::iterator s = subMenus.begin(); s != subMenus.end(); s++) { + dsyslog("skindesigner: SubMenu %s, Parent %s", ((*s)->GetName()).c_str(), ((*s)->GetParent()->GetName()).c_str()); + if (deep) + (*s)->Debug(); + } +} // --- cSkinSetup ----------------------------------------------------------- cSkinSetup::cSkinSetup(string skin) { this->skin = skin; + rootMenu = new cSkinSetupMenu(); + rootMenu->SetName("root"); + currentMenu = rootMenu; } cSkinSetup::~cSkinSetup() { - for (map < string, cSkinSetupParameter* >::iterator p = parameters.begin(); p != parameters.end(); p++) { - delete p->second; - } + delete rootMenu; } bool cSkinSetup::ReadFromXML(void) { - string xmlFile = "setup.xml"; + string xmlPath = *cString::sprintf("%s%s/setup.xml", *config.skinPath, skin.c_str()); cXmlParser parser; - if (!parser.ReadSkinSetup(this, skin, xmlFile)) { + if (!parser.ReadSkinSetup(this, xmlPath)) { return false; } parser.ParseSkinSetup(skin); return true; } -void cSkinSetup::SetParameter(xmlChar *type, xmlChar *name, xmlChar* displayText, xmlChar *min, xmlChar *max, xmlChar *value) { - if (!type || !name || !displayText || !value) { - esyslog("skindesigner: invalid setup parameter for skin %s", skin.c_str()); - return; - } - eSetupParameterType paramType = sptUnknown; - if (!xmlStrcmp(type, (const xmlChar *) "int")) { - paramType = sptInt; - } else if (!xmlStrcmp(type, (const xmlChar *) "bool")) { - paramType = sptBool; - } - if (paramType == sptUnknown) { - esyslog("skindesigner: invalid setup parameter for skin %s", skin.c_str()); - return; - } - - cSkinSetupParameter *param = new cSkinSetupParameter(); - param->type = paramType; - param->name = (const char*)name; - param->displayText = (const char*)displayText; - - if (min && paramType == sptInt) { - param->min = atoi((const char*)min); - } - if (max && paramType == sptInt) { - param->max = atoi((const char*)max); - } - param->value = atoi((const char*)value); - - parameters.insert(pair< string, cSkinSetupParameter* >(param->name, param)); +void cSkinSetup::SetSubMenu(xmlChar *name, xmlChar *displayText) { + cSkinSetupMenu *subMenu = new cSkinSetupMenu(); + subMenu->SetName((const char*)name); + subMenu->SetDisplayText((const char*)displayText); + subMenu->SetParent(currentMenu); + currentMenu->AddSubMenu(subMenu); + currentMenu = subMenu; } -cSkinSetupParameter *cSkinSetup::GetParameter(void) { - if (paramIt == parameters.end()) - return NULL; - cSkinSetupParameter *param = paramIt->second; - paramIt++; - return param; +void cSkinSetup::SubMenuDone(void) { + cSkinSetupMenu *parent = currentMenu->GetParent(); + if (parent) { + currentMenu = parent; + } +} + +void cSkinSetup::SetParameter(xmlChar *type, xmlChar *name, xmlChar* displayText, xmlChar *min, xmlChar *max, xmlChar *value) { + if (!type || !name || !displayText || !value) { + esyslog("skindesigner: invalid setup parameter for skin %s", skin.c_str()); + return; + } + eSetupParameterType paramType = sptUnknown; + if (!xmlStrcmp(type, (const xmlChar *) "int")) { + paramType = sptInt; + } else if (!xmlStrcmp(type, (const xmlChar *) "bool")) { + paramType = sptBool; + } + if (paramType == sptUnknown) { + esyslog("skindesigner: invalid setup parameter for skin %s", skin.c_str()); + return; + } + currentMenu->SetParameter(paramType, name, displayText, min, max, value); +} + +cSkinSetupParameter *cSkinSetup::GetNextParameter(void) { + return rootMenu->GetNextParameter(); } cSkinSetupParameter *cSkinSetup::GetParameter(string name) { - map < string, cSkinSetupParameter* >::iterator hit = parameters.find(name); - if (hit != parameters.end()) - return hit->second; - return NULL; + return rootMenu->GetParameter(name); } - void cSkinSetup::SetTranslation(string translationToken, map < string, string > transl) { translations.insert(pair >(translationToken, transl)); } @@ -100,21 +217,37 @@ void cSkinSetup::SetTranslation(string translationToken, map < string, string > void cSkinSetup::AddToGlobals(cGlobals *globals) { if (!globals) return; - for (map < string, cSkinSetupParameter* >::iterator p = parameters.begin(); p != parameters.end(); p++) { - cSkinSetupParameter *param = p->second; + rootMenu->InitIterators(); + cSkinSetupParameter *param = NULL; + while (param = rootMenu->GetNextParameter()) { globals->AddInt(param->name, param->value); } } void cSkinSetup::TranslateSetup(void) { - InitParameterIterator(); + rootMenu->InitIterators(); cSkinSetupParameter *param = NULL; - while (param = GetParameter()) { + while (param = rootMenu->GetNextParameter()) { string transl = ""; if (Translate(param->displayText, transl)) { param->displayText = transl; } } + + rootMenu->InitIterators(); + cSkinSetupMenu *subMenu = NULL; + while (subMenu = rootMenu->GetNextSubMenu()) { + string transl = ""; + if (Translate(subMenu->GetDisplayText(), transl)) { + subMenu->SetDisplayText(transl); + } + } +} + +cSkinSetupMenu *cSkinSetup::GetMenu(string &name) { + if (name.size() == 0) + return rootMenu; + return rootMenu->GetMenu(name); } bool cSkinSetup::Translate(string text, string &translation) { @@ -161,11 +294,8 @@ string cSkinSetup::DoTranslate(string token) { } void cSkinSetup::Debug(void) { - dsyslog("skindesigner: Skin \"%s\" Setup Parameters", skin.c_str()); - for (map < string, cSkinSetupParameter* >::iterator p = parameters.begin(); p != parameters.end(); p++) { - (p->second)->Debug(); - } - + rootMenu->Debug(); + return; 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()); diff --git a/libcore/skinsetup.h b/libcore/skinsetup.h index 4b0082d..6e99799 100644 --- a/libcore/skinsetup.h +++ b/libcore/skinsetup.h @@ -34,28 +34,63 @@ public: void Debug(void); }; +// --- cSkinSetupMenu ----------------------------------------------------------- + +class cSkinSetupMenu { +private: + string name; + string displayText; + cSkinSetupMenu *parent; + vector < cSkinSetupMenu* > subMenus; + vector < cSkinSetupMenu* >::iterator subMenuIt; + map < string, cSkinSetupParameter* > parameters; + map < string, cSkinSetupParameter* >::iterator paramIt; +public: + cSkinSetupMenu(void); + virtual ~cSkinSetupMenu(void); + void SetName(string name) { this->name = name; }; + void SetDisplayText(string displayText) { this->displayText = displayText; }; + string GetName(void) { return name; }; + string GetDisplayText(void) { return displayText; }; + void SetParent(cSkinSetupMenu *p) { parent = p; }; + cSkinSetupMenu *GetParent(void) { return parent; }; + void AddSubMenu(cSkinSetupMenu *sub) { subMenus.push_back(sub); }; + void SetParameter(eSetupParameterType paramType, xmlChar *name, xmlChar* displayText, xmlChar *min, xmlChar *max, xmlChar *value); + void InitIterators(void); + void InitParameterIterator(void) { paramIt = parameters.begin(); }; + cSkinSetupParameter *GetNextParameter(bool deep = true); + cSkinSetupParameter *GetParameter(string name); + void InitSubmenuIterator(void) { subMenuIt = subMenus.begin(); }; + cSkinSetupMenu *GetNextSubMenu(bool deep = true); + cSkinSetupMenu *GetMenu(string &name); + void Debug(bool deep = true); +}; + // --- cSkinSetup ----------------------------------------------------------- class cSkinSetup { private: - string skin; - map < string, cSkinSetupParameter* > parameters; - map < string, cSkinSetupParameter* >::iterator paramIt; - map < string, map< string, string > > translations; + string skin; + cSkinSetupMenu *rootMenu; + cSkinSetupMenu *currentMenu; + map < string, map< string, string > > translations; string DoTranslate(string token); bool Translate(string text, string &translation); public: cSkinSetup(string skin); virtual ~cSkinSetup(void); bool ReadFromXML(void); + void SetSubMenu(xmlChar *name, xmlChar *displayText); + void SubMenuDone(void); void SetParameter(xmlChar *type, xmlChar *name, xmlChar* displayText, xmlChar *min, xmlChar *max, xmlChar *value); + void InitParameterIterator(void) { rootMenu->InitIterators(); }; + cSkinSetupParameter *GetNextParameter(void); + cSkinSetupParameter *GetParameter(string name); void SetTranslation(string translationToken, map < string, string > transl); void AddToGlobals(cGlobals *globals); void TranslateSetup(void); - void InitParameterIterator(void) { paramIt = parameters.begin(); }; - cSkinSetupParameter *GetParameter(void); - cSkinSetupParameter *GetParameter(string name); string GetSkin(void) { return skin; }; + cSkinSetupMenu *GetMenu(string &name); void Debug(void); }; diff --git a/libtemplate/xmlparser.c b/libtemplate/xmlparser.c index 8df22e8..0162780 100644 --- a/libtemplate/xmlparser.c +++ b/libtemplate/xmlparser.c @@ -135,28 +135,27 @@ bool cXmlParser::ReadGlobals(cGlobals *globals, string xmlFile, bool mandatory) return true; } -bool cXmlParser::ReadSkinSetup(cSkinSetup *skinSetup, string skin, string xmlFile) { +bool cXmlParser::ReadSkinSetup(cSkinSetup *skinSetup, string xmlFile) { this->skinSetup = skinSetup; - string xmlPath = *cString::sprintf("%s%s/%s", *config.skinPath, skin.c_str(), xmlFile.c_str()); - if (!FileExists(xmlPath)) + if (!FileExists(xmlFile)) return false; if (ctxt == NULL) { esyslog("skindesigner: Failed to allocate parser context"); return false; } - doc = xmlCtxtReadFile(ctxt, xmlPath.c_str(), NULL, XML_PARSE_NOENT | XML_PARSE_DTDVALID); + doc = xmlCtxtReadFile(ctxt, xmlFile.c_str(), NULL, XML_PARSE_NOENT | XML_PARSE_DTDVALID); if (doc == NULL ) { - esyslog("skindesigner: ERROR: skin setup %s not parsed successfully.", xmlPath.c_str()); + esyslog("skindesigner: ERROR: skin setup %s not parsed successfully.", xmlFile.c_str()); return false; } root = xmlDocGetRootElement(doc); if (ctxt->valid == 0) { - esyslog("skindesigner: Failed to validate %s", xmlPath.c_str()); + esyslog("skindesigner: Failed to validate %s", xmlFile.c_str()); return false; } if (root == NULL) { @@ -282,8 +281,8 @@ bool cXmlParser::ParseSkinSetup(string skin) { node = node->next; continue; } - if (!xmlStrcmp(node->name, (const xmlChar *) "parameters")) { - ParseSetupParameter(node->xmlChildrenNode); + if (!xmlStrcmp(node->name, (const xmlChar *) "menu")) { + ParseSetupMenu(node->xmlChildrenNode); node = node->next; continue; } else if (!xmlStrcmp(node->name, (const xmlChar *) "translations")) { @@ -325,64 +324,88 @@ string cXmlParser::GetPath(string xmlFile) { return path; } -void cXmlParser::ParseSetupParameter(xmlNodePtr node) { +void cXmlParser::ParseSetupMenu(xmlNodePtr node) { if (!node) return; if (!skinSetup) return; while (node != NULL) { - if (node->type != XML_ELEMENT_NODE) { node = node->next; continue; } - if (xmlStrcmp(node->name, (const xmlChar *) "parameter")) { - node = node->next; - continue; - } - xmlAttrPtr attr = node->properties; - if (attr == NULL) { - node = node->next; - continue; - } - xmlChar *paramType = NULL; - xmlChar *paramName = NULL; - xmlChar *paramDisplayText = NULL; - xmlChar *paramMin = NULL; - xmlChar *paramMax = NULL; - xmlChar *paramValue = NULL; - while (NULL != attr) { - if (!xmlStrcmp(attr->name, (const xmlChar *) "type")) { - paramType = xmlGetProp(node, attr->name); - } else if (!xmlStrcmp(attr->name, (const xmlChar *) "name")) { - paramName = xmlGetProp(node, attr->name); - } else if (!xmlStrcmp(attr->name, (const xmlChar *) "displaytext")) { - paramDisplayText = xmlGetProp(node, attr->name); - } else if (!xmlStrcmp(attr->name, (const xmlChar *) "min")) { - paramMin = xmlGetProp(node, attr->name); - } else if (!xmlStrcmp(attr->name, (const xmlChar *) "max")) { - paramMax = xmlGetProp(node, attr->name); - } - attr = attr->next; - } - paramValue = xmlNodeListGetString(doc, node->xmlChildrenNode, 1); - skinSetup->SetParameter(paramType, paramName, paramDisplayText, paramMin, paramMax, paramValue); - if (paramType) - xmlFree(paramType); - if (paramName) - xmlFree(paramName); - if (paramDisplayText) - xmlFree(paramDisplayText); - if (paramMin) - xmlFree(paramMin); - if (paramMax) - xmlFree(paramMax); - if (paramValue) - xmlFree(paramValue); + if (!xmlStrcmp(node->name, (const xmlChar *) "parameter")) { + ParseSetupParameter(node); + } else if (!xmlStrcmp(node->name, (const xmlChar *) "submenu")) { + xmlAttrPtr attr = node->properties; + xmlChar *subMenuName = NULL; + xmlChar *subDisplayText = NULL; + while (NULL != attr) { + if (!xmlStrcmp(attr->name, (const xmlChar *) "name")) { + subMenuName = xmlGetProp(node, attr->name); + } else if (!xmlStrcmp(attr->name, (const xmlChar *) "displaytext")) { + subDisplayText = xmlGetProp(node, attr->name); + } + attr = attr->next; + } + skinSetup->SetSubMenu(subMenuName, subDisplayText); + ParseSetupMenu(node->xmlChildrenNode); + if (subMenuName) + xmlFree(subMenuName); + if (subDisplayText) + xmlFree(subDisplayText); + } node = node->next; } + skinSetup->SubMenuDone(); +} + +void cXmlParser::ParseSetupParameter(xmlNodePtr node) { + if (!node) + return; + if (!skinSetup) + return; + + xmlAttrPtr attr = node->properties; + if (attr == NULL) { + return; + } + xmlChar *paramType = NULL; + xmlChar *paramName = NULL; + xmlChar *paramDisplayText = NULL; + xmlChar *paramMin = NULL; + xmlChar *paramMax = NULL; + xmlChar *paramValue = NULL; + while (NULL != attr) { + if (!xmlStrcmp(attr->name, (const xmlChar *) "type")) { + paramType = xmlGetProp(node, attr->name); + } else if (!xmlStrcmp(attr->name, (const xmlChar *) "name")) { + paramName = xmlGetProp(node, attr->name); + } else if (!xmlStrcmp(attr->name, (const xmlChar *) "displaytext")) { + paramDisplayText = xmlGetProp(node, attr->name); + } else if (!xmlStrcmp(attr->name, (const xmlChar *) "min")) { + paramMin = xmlGetProp(node, attr->name); + } else if (!xmlStrcmp(attr->name, (const xmlChar *) "max")) { + paramMax = xmlGetProp(node, attr->name); + } + attr = attr->next; + } + paramValue = xmlNodeListGetString(doc, node->xmlChildrenNode, 1); + skinSetup->SetParameter(paramType, paramName, paramDisplayText, paramMin, paramMax, paramValue); + if (paramType) + xmlFree(paramType); + if (paramName) + xmlFree(paramName); + if (paramDisplayText) + xmlFree(paramDisplayText); + if (paramMin) + xmlFree(paramMin); + if (paramMax) + xmlFree(paramMax); + if (paramValue) + xmlFree(paramValue); } void cXmlParser::ParseGlobalColors(xmlNodePtr node) { diff --git a/libtemplate/xmlparser.h b/libtemplate/xmlparser.h index 27399bd..20f6763 100644 --- a/libtemplate/xmlparser.h +++ b/libtemplate/xmlparser.h @@ -31,6 +31,7 @@ private: xmlDocPtr doc; xmlNodePtr root; string GetPath(string xmlFile); + void ParseSetupMenu(xmlNodePtr node); void ParseSetupParameter(xmlNodePtr node); void ParseGlobalColors(xmlNodePtr node); void InsertColor(string name, string value); @@ -51,7 +52,7 @@ public: bool ReadView(cTemplateView *view, string xmlFile); bool ReadPluginView(string plugName, int templateNumber, string templateName); bool ReadGlobals(cGlobals *globals, string xmlFile, bool mandatory); - bool ReadSkinSetup(cSkinSetup *skinSetup, string skin, string xmlFile); + bool ReadSkinSetup(cSkinSetup *skinSetup, string xmlFile); bool ParseView(void); bool ParsePluginView(string plugName, int templateNumber); bool ParseGlobals(void); diff --git a/setup.c b/setup.c index 4523adf..611cc69 100644 --- a/setup.c +++ b/setup.c @@ -15,6 +15,7 @@ cSkinDesignerSetup::cSkinDesignerSetup() { } cSkinDesignerSetup::~cSkinDesignerSetup() { + config.setupCloseDoReload = true; } @@ -44,7 +45,7 @@ eOSState cSkinDesignerSetup::ProcessKey(eKeys Key) { size_t hit = itemText.find(tr("Skin")); if (hit == 0) { string skin = itemText.substr(strlen(tr("Skin"))+1); - state = AddSubMenu(new cSkindesignerSkinSetup(skin)); + state = AddSubMenu(new cSkindesignerSkinSetup(skin, "")); } break; } default: @@ -67,11 +68,11 @@ void cSkinDesignerSetup::Store(void) { config.InitSetupIterator(); cSkinSetup *skinSetup = NULL; - while (skinSetup = config.GetSkinSetup()) { + while (skinSetup = config.GetNextSkinSetup()) { string skin = skinSetup->GetSkin(); skinSetup->InitParameterIterator(); cSkinSetupParameter *param = NULL; - while (param = skinSetup->GetParameter()) { + while (param = skinSetup->GetNextParameter()) { cString paramName = cString::sprintf("%s.%s", skin.c_str(), param->name.c_str()); SetupStore(*paramName, param->value); config.UpdateSkinSetupParameter(*paramName, param->value); @@ -157,10 +158,18 @@ void cSkinDesignerSetup::ImageCacheStatistics(void) { cList::Last()->SetSelectable(false); } +// --- cSkinSetupSubMenu ----------------------------------------------------------- + +cSkinSetupSubMenu::cSkinSetupSubMenu(string name, string displayText) : cOsdItem(displayText.c_str()) { + this->name = name; +} + // --- cSkindesignerSkinSetup ----------------------------------------------------------- -cSkindesignerSkinSetup::cSkindesignerSkinSetup(string skin) : cOsdMenu(*cString::sprintf("%s: %s \"%s\"", trVDR("Setup"), tr("Skin"), skin.c_str()), 30) { +cSkindesignerSkinSetup::cSkindesignerSkinSetup(string skin, string name) : +cOsdMenu(*cString::sprintf("%s: %s \"%s\" %s", trVDR("Setup"), tr("Skin"), skin.c_str(), name.c_str()), 30) { this->skin = skin; + this->name = name; Set(); } @@ -171,9 +180,16 @@ eOSState cSkindesignerSkinSetup::ProcessKey(eKeys Key) { eOSState state = cOsdMenu::ProcessKey(Key); if (state == osUnknown) { switch (Key) { - case kOk: - return osBack; - default: + case kOk: { + cOsdItem *current = Get(Current()); + cSkinSetupSubMenu *subMenuItem = dynamic_cast(current); + if (subMenuItem) { + state = AddSubMenu(new cSkindesignerSkinSetup(skin, subMenuItem->GetName())); + break; + } else { + return osBack; + } + } default: break; } } @@ -181,13 +197,13 @@ eOSState cSkindesignerSkinSetup::ProcessKey(eKeys Key) { } void cSkindesignerSkinSetup::Set(void) { - cSkinSetup *skinSetup = config.GetSkinSetup(skin); - if (!skinSetup) + cSkinSetupMenu *menu = config.GetSkinSetupMenu(skin, name); + if (!menu) { return; - - skinSetup->InitParameterIterator(); + } + menu->InitParameterIterator(); cSkinSetupParameter *param = NULL; - while (param = skinSetup->GetParameter()) { + while (param = menu->GetNextParameter(false)) { if (param->type == sptInt) { Add(new cMenuEditIntItem(param->displayText.c_str(), ¶m->value, param->min, param->max)); } else if (param->type == sptBool) { @@ -195,4 +211,9 @@ void cSkindesignerSkinSetup::Set(void) { } } + menu->InitSubmenuIterator(); + cSkinSetupMenu *subMenu = NULL; + while (subMenu = menu->GetNextSubMenu(false)) { + Add(new cSkinSetupSubMenu(subMenu->GetName(), subMenu->GetDisplayText())); + } } diff --git a/setup.h b/setup.h index f831d74..c06a5cf 100644 --- a/setup.h +++ b/setup.h @@ -29,16 +29,28 @@ public: virtual ~cSkinDesignerSetup(); }; +// --- cSkinSetupSubMenu ----------------------------------------------------------- + +class cSkinSetupSubMenu : public cOsdItem { +private: + string name; +public: + cSkinSetupSubMenu(string name, string displayText); + virtual ~cSkinSetupSubMenu() {}; + string GetName(void) { return name; }; +}; + // --- cSkindesignerSkinSetup ----------------------------------------------------------- class cSkindesignerSkinSetup : public cOsdMenu { private: string skin; + string name; protected: virtual eOSState ProcessKey(eKeys Key); void Set(void); public: - cSkindesignerSkinSetup(string skin); + cSkindesignerSkinSetup(string skin, string menu); virtual ~cSkindesignerSkinSetup(); }; diff --git a/skindesigner.c b/skindesigner.c index 5961e46..b641cd8 100644 --- a/skindesigner.c +++ b/skindesigner.c @@ -19,7 +19,7 @@ #endif -static const char *VERSION = "0.2.1"; +static const char *VERSION = "0.2.2"; static const char *DESCRIPTION = trNOOP("Skin Designer"); class cPluginSkinDesigner : public cPlugin { diff --git a/skins/blackhole/setup.xml b/skins/blackhole/setup.xml index d9b8875..e590344 100644 --- a/skins/blackhole/setup.xml +++ b/skins/blackhole/setup.xml @@ -2,17 +2,7 @@ - - + 0 1 1 @@ -21,11 +11,8 @@ 10 16 1 - + - Show DVB device info when switching channel @@ -43,24 +30,24 @@ Näytä ikonit päävalikossa - Fade time in ms (needs VDR restart) - Einblendzeit in ms (erfordert VDR Neustart) - Häivytyksen kesto [ms] (uud.käynnistys) + Fade time in ms + Einblendzeit in ms + Häivytyksen kesto [ms] - Items in main menu (needs VDR restart) - Elemente im Hauptmenü (erfordert VDR Neustart) - Valinnat päävalikossa (uud.käynnistys) + Items in main menu + Elemente im Hauptmenü + Valinnat päävalikossa - Items in schedules, timers, ... menus (needs VDR restart) - Elemente in Programm, Timer, ... Menüs (erfordert VDR Neustart) - Valinnat alivalikoissa (uud.käynnistys) + Items in schedules, timers, ... menus + Elemente in Programm, Timer, ... Menüs + Valinnat alivalikoissa - Items in default list menu (needs VDR restart) - Elemente im Standard ListenMenü (erfordert VDR Neustart) - Valinnat valikkolistoissa (uud.käynnistys) + Items in default list menu + Elemente im Standard ListenMenü + Valinnat valikkolistoissa Show shorttexts in schedules menus diff --git a/skins/metrixhd/setup.xml b/skins/metrixhd/setup.xml index 034d0c0..abaf1c6 100644 --- a/skins/metrixhd/setup.xml +++ b/skins/metrixhd/setup.xml @@ -2,29 +2,16 @@ - - + 0 0 - + - - Fade time in ms (needs VDR restart) - Einblendzeit in ms (erfordert VDR Neustart) - Häivytyksen kesto [ms] (uud.käynnistys) + Fade time in ms + Einblendzeit in ms + Häivytyksen kesto [ms] Show DVB device info when switching channel diff --git a/skins/nopacity/setup.xml b/skins/nopacity/setup.xml new file mode 100644 index 0000000..6482021 --- /dev/null +++ b/skins/nopacity/setup.xml @@ -0,0 +1,30 @@ + + + + + + 1 + 1 + 300 + 20 + + + + + Show Poster when switching channel + Poster beim Umschalten anzeigen + + + Show Weather in infobar + Wetter in Infobar anzeigen + + + Fade time in ms + Einblendzeit in ms + + + Transpareny channel, replay and volume + Transparenz bei Kanal,Wiedergabe und Lautstärke + + + diff --git a/skins/nopacity/themes/darkred/theme.xml b/skins/nopacity/themes/darkred/theme.xml index 7ba4794..56b7df4 100644 --- a/skins/nopacity/themes/darkred/theme.xml +++ b/skins/nopacity/themes/darkred/theme.xml @@ -11,6 +11,7 @@ 99FFFFFF FF000000 FF3D0000 + FF3D0000 FF2B0000 FF858585 B0000000 @@ -23,6 +24,5 @@ 00000000 - 300 diff --git a/skins/nopacity/themes/default/theme.xml b/skins/nopacity/themes/default/theme.xml index ec3898e..82c075c 100644 --- a/skins/nopacity/themes/default/theme.xml +++ b/skins/nopacity/themes/default/theme.xml @@ -11,6 +11,7 @@ 99FFFFFF FF000000 FF8EAB21 + FF8EAB21 FF4C5C11 FF858585 B012273F @@ -23,6 +24,5 @@ 00000000 - 300 diff --git a/skins/nopacity/xmlfiles/displaychannel.xml b/skins/nopacity/xmlfiles/displaychannel.xml index aabe707..354e1a7 100644 --- a/skins/nopacity/xmlfiles/displaychannel.xml +++ b/skins/nopacity/xmlfiles/displaychannel.xml @@ -4,7 +4,7 @@ - + @@ -47,7 +47,7 @@ - + @@ -195,10 +195,10 @@ {isbanner} true if image is a banner, false if it is a poster --> - + - + @@ -211,14 +211,14 @@ {error} true if message is a error message --> - + - - + + diff --git a/skins/nopacity/xmlfiles/displaymenuchannels.xml b/skins/nopacity/xmlfiles/displaymenuchannels.xml index b90ece5..8a0ff34 100644 --- a/skins/nopacity/xmlfiles/displaymenuchannels.xml +++ b/skins/nopacity/xmlfiles/displaymenuchannels.xml @@ -3,7 +3,7 @@ - + diff --git a/skins/nopacity/xmlfiles/displaymenudetailepg.xml b/skins/nopacity/xmlfiles/displaymenudetailepg.xml index 32e7c17..a49ad36 100644 --- a/skins/nopacity/xmlfiles/displaymenudetailepg.xml +++ b/skins/nopacity/xmlfiles/displaymenudetailepg.xml @@ -12,7 +12,7 @@ - + - + - - + + diff --git a/skins/nopacity/xmlfiles/displayreplay.xml b/skins/nopacity/xmlfiles/displayreplay.xml index cb6fd90..e77fc20 100644 --- a/skins/nopacity/xmlfiles/displayreplay.xml +++ b/skins/nopacity/xmlfiles/displayreplay.xml @@ -4,7 +4,7 @@ - + @@ -204,14 +204,14 @@ {error} true if message is a error message --> - + - - + + diff --git a/skins/nopacity/xmlfiles/displayvolume.xml b/skins/nopacity/xmlfiles/displayvolume.xml index 8fa20c6..6c54ee9 100644 --- a/skins/nopacity/xmlfiles/displayvolume.xml +++ b/skins/nopacity/xmlfiles/displayvolume.xml @@ -14,7 +14,7 @@ --> - + diff --git a/skins/nopacity/xmlfiles/plug-weatherforecast-weatherforecast.xml b/skins/nopacity/xmlfiles/plug-weatherforecast-weatherforecast.xml index 08a10e3..521db36 100644 --- a/skins/nopacity/xmlfiles/plug-weatherforecast-weatherforecast.xml +++ b/skins/nopacity/xmlfiles/plug-weatherforecast-weatherforecast.xml @@ -6,7 +6,7 @@ - + diff --git a/skins/nopacity/xmlfiles/plug-weatherforecast-weatherforecastdetailcurrent.xml b/skins/nopacity/xmlfiles/plug-weatherforecast-weatherforecastdetailcurrent.xml index 8aa3d4f..ae9c2a6 100644 --- a/skins/nopacity/xmlfiles/plug-weatherforecast-weatherforecastdetailcurrent.xml +++ b/skins/nopacity/xmlfiles/plug-weatherforecast-weatherforecastdetailcurrent.xml @@ -15,7 +15,7 @@ - + - - + +