From a5d7d6437dbc5a72279b1f5fbfb21d4c337dedc9 Mon Sep 17 00:00:00 2001 From: louis Date: Fri, 14 Aug 2015 17:23:12 +0200 Subject: [PATCH] added possibility to define help texts for skin setup parameters --- HISTORY | 3 ++ dtd/setup.dtd | 1 + libcore/skinsetup.c | 12 +++-- libcore/skinsetup.h | 5 +- libtemplate/xmlparser.c | 5 +- po/de_DE.po | 6 ++- po/fi_FI.po | 5 +- setup.c | 47 ++++++++++++++++--- setup.h | 8 ++++ skins/metrixhd/setup.xml | 40 ++++++++++++---- .../xmlfiles/displaymenudetailtext.xml | 7 +-- 11 files changed, 110 insertions(+), 29 deletions(-) diff --git a/HISTORY b/HISTORY index 0363c46..bc869db 100644 --- a/HISTORY +++ b/HISTORY @@ -428,3 +428,6 @@ Version 0.7.0 Version 0.7.1 - fixed bug that setup int parameters do not respect the max value +- added possibility to define help texts for skin setup parameters + +Version 0.7.2 diff --git a/dtd/setup.dtd b/dtd/setup.dtd index 15f1928..0eb88b5 100644 --- a/dtd/setup.dtd +++ b/dtd/setup.dtd @@ -17,6 +17,7 @@ min NMTOKEN #IMPLIED max NMTOKEN #IMPLIED displaytext CDATA #REQUIRED + helptext CDATA #IMPLIED options CDATA #IMPLIED > diff --git a/libcore/skinsetup.c b/libcore/skinsetup.c index 1630cc9..3a6b7cf 100644 --- a/libcore/skinsetup.c +++ b/libcore/skinsetup.c @@ -9,6 +9,7 @@ cSkinSetupParameter::cSkinSetupParameter(void) { type = sptUnknown; name = ""; displayText = ""; + helpText = ""; min = 0; max = 1000; value = 0; @@ -106,11 +107,12 @@ void cSkinSetupMenu::InitIterators(void) { subMenuIt = subMenus.begin(); } -void cSkinSetupMenu::SetParameter(eSetupParameterType paramType, string name, string displayText, string min, string max, string value, string options) { +void cSkinSetupMenu::SetParameter(eSetupParameterType paramType, string name, string displayText, string helpText, string min, string max, string value, string options) { cSkinSetupParameter *param = new cSkinSetupParameter(); param->type = paramType; param->name = name; param->displayText = displayText; + param->helpText = helpText; if (min.size() && paramType == sptInt) { param->min = atoi(min.c_str()); @@ -221,7 +223,7 @@ void cSkinSetup::SubMenuDone(void) { } } -void cSkinSetup::SetParameter(string type, string name, string displayText, string min, string max, string value, string options) { +void cSkinSetup::SetParameter(string type, string name, string displayText, string helpText, string min, string max, string value, string options) { if (!type.size() || !name.size() || !displayText.size() || !value.size()) { esyslog("skindesigner: invalid setup parameter for skin %s", skin.c_str()); return; @@ -238,7 +240,7 @@ void cSkinSetup::SetParameter(string type, string name, string displayText, stri esyslog("skindesigner: invalid setup parameter for skin %s", skin.c_str()); return; } - currentMenu->SetParameter(paramType, name, displayText, min, max, value, options); + currentMenu->SetParameter(paramType, name, displayText, helpText, min, max, value, options); } cSkinSetupParameter *cSkinSetup::GetNextParameter(void) { @@ -278,6 +280,10 @@ void cSkinSetup::TranslateSetup(void) { if (Translate(param->displayText, transl)) { param->displayText = transl; } + string translHelp = ""; + if (Translate(param->helpText, translHelp)) { + param->helpText = translHelp; + } if (param->type == sptString && param->numOptions > 0) { param->optionsTranslated = new const char*[param->numOptions]; for (int i = 0; i < param->numOptions; i++) { diff --git a/libcore/skinsetup.h b/libcore/skinsetup.h index a664ebc..0ae49cc 100644 --- a/libcore/skinsetup.h +++ b/libcore/skinsetup.h @@ -29,6 +29,7 @@ public: eSetupParameterType type; string name; string displayText; + string helpText; int min; int max; int value; @@ -59,7 +60,7 @@ public: void SetParent(cSkinSetupMenu *p) { parent = p; }; cSkinSetupMenu *GetParent(void) { return parent; }; void AddSubMenu(cSkinSetupMenu *sub) { subMenus.push_back(sub); }; - void SetParameter(eSetupParameterType paramType, string name, string displayText, string min, string max, string value, string options); + void SetParameter(eSetupParameterType paramType, string name, string displayText, string helpText, string min, string max, string value, string options); void InitIterators(void); void InitParameterIterator(void) { paramIt = parameters.begin(); }; cSkinSetupParameter *GetNextParameter(bool deep = true); @@ -86,7 +87,7 @@ public: bool ReadFromXML(void); void SetSubMenu(string name, string displayText); void SubMenuDone(void); - void SetParameter(string type, string name, string displayText, string min, string max, string value, string options); + void SetParameter(string type, string name, string displayText, string helpText, string min, string max, string value, string options); void InitParameterIterator(void) { rootMenu->InitIterators(); }; cSkinSetupParameter *GetNextParameter(void); cSkinSetupParameter *GetParameter(string name); diff --git a/libtemplate/xmlparser.c b/libtemplate/xmlparser.c index 17fa2c6..8db3d3d 100644 --- a/libtemplate/xmlparser.c +++ b/libtemplate/xmlparser.c @@ -588,6 +588,8 @@ void cXmlParser::ParseSetupParameter(void) { string paramName = ""; string attributeDisplayText = "displaytext"; string paramDisplayText = ""; + string attributeHelpText = "helptext"; + string paramHelpText = ""; string attributeMin = "min"; string paramMin = ""; string attributeMax = "max"; @@ -599,12 +601,13 @@ void cXmlParser::ParseSetupParameter(void) { GetAttribute(attributeType, paramType); GetAttribute(attributeName, paramName); GetAttribute(attributeDisplayText, paramDisplayText); + GetAttribute(attributeHelpText, paramHelpText); GetAttribute(attributeMin, paramMin); GetAttribute(attributeMax, paramMax); GetAttribute(attributeOptions, paramOptions); GetNodeValue(paramValue); - skinSetup->SetParameter(paramType, paramName, paramDisplayText, paramMin, paramMax, paramValue, paramOptions); + skinSetup->SetParameter(paramType, paramName, paramDisplayText, paramHelpText, paramMin, paramMax, paramValue, paramOptions); } void cXmlParser::ValidateAttributes(const char *nodeName, vector &attributes) { diff --git a/po/de_DE.po b/po/de_DE.po index 185622e..a46d874 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-skindesigner 0.0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-07-17 17:02+0200\n" +"POT-Creation-Date: 2015-08-14 17:20+0200\n" "PO-Revision-Date: 2014-09-27 11:02+0200\n" "Last-Translator: Louis Braun \n" "Language-Team: \n" @@ -156,6 +156,9 @@ msgstr "Weitere verfügbare Skins" msgid "Preview Skin" msgstr "Skin Vorschau" +msgid "Help" +msgstr "Hilfe" + msgid "Author" msgstr "Autor" @@ -164,3 +167,4 @@ msgstr "Benutze Schriften" msgid "Supported Plugins" msgstr "Unterstützte Plugins" + diff --git a/po/fi_FI.po b/po/fi_FI.po index ec665a1..12b3ed7 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-skindesigner 0.2.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-07-17 17:02+0200\n" +"POT-Creation-Date: 2015-08-14 17:20+0200\n" "PO-Revision-Date: 2015-01-25 01:25+0200\n" "Last-Translator: Rolf Ahrenberg\n" "Language-Team: Finnish\n" @@ -156,6 +156,9 @@ msgstr "" msgid "Preview Skin" msgstr "" +msgid "Help" +msgstr "" + msgid "Author" msgstr "" diff --git a/setup.c b/setup.c index f8fae07..3b6c432 100644 --- a/setup.c +++ b/setup.c @@ -1,5 +1,6 @@ #include #include "libcore/curlfuncs.h" +#include #include "setup.h" // --- cInstallManager ----------------------------------------------------------- @@ -386,6 +387,12 @@ cOsdMenu(*cString::sprintf("%s: %s \"%s\" %s", trVDR("Setup"), tr("Skin"), skin. SetMenuCategory(mcPluginSetup); this->skin = skin; this->menu = menu; + buttonRed = tr("Update"); + buttonGreen = tr("Help"); + buttonYellow = tr("Delete Skin"); + showRed = false; + showYellow = false; + hadHelp = false; Set(); } @@ -397,6 +404,9 @@ eOSState cSkindesignerSkinSetup::ProcessKey(eKeys Key) { if (state == osEnd) return osEnd; state = cOsdMenu::ProcessKey(Key); + if (Key == kUp || Key == kDown) { + ShowButtons(Current()); + } if (state == osUnknown) { switch (Key) { case kOk: { @@ -443,6 +453,17 @@ eOSState cSkindesignerSkinSetup::ProcessKey(eKeys Key) { state = osContinue; break; } + case kGreen: { + string helpText = helpTexts[Current()]; + if (helpText.size() == 0) { + state = osContinue; + break; + } + const char* ItemText = Get(Current())->Text(); + string title = *cString::sprintf("%s - %s", buttonGreen.c_str(), ItemText); + state = AddSubMenu(new cMenuText(title.c_str(), helpText.c_str())); + break; + } default: break; } @@ -457,13 +478,11 @@ void cSkindesignerSkinSetup::Set(void) { } cSkinRepo *repo = config.GetSkinRepo(skin); - if (repo) { - if (repo->Type() == rtGit) - SetHelp(tr("Update"), NULL, tr("Delete Skin"), NULL); - else - SetHelp(NULL, NULL, tr("Delete Skin"), NULL); - } - + if (repo && repo->Type() == rtGit) + showRed = true; + if (repo) + showYellow = true; + setupMenu->InitParameterIterator(); cSkinSetupParameter *param = NULL; while (param = setupMenu->GetNextParameter(false)) { @@ -474,13 +493,27 @@ void cSkindesignerSkinSetup::Set(void) { } else if (param->type == sptString) { Add(new cMenuEditStraItem(param->displayText.c_str(), ¶m->value, param->numOptions, param->optionsTranslated)); } + helpTexts.push_back(param->helpText); } setupMenu->InitSubmenuIterator(); cSkinSetupMenu *subMenu = NULL; while (subMenu = setupMenu->GetNextSubMenu(false)) { Add(new cSkinSetupSubMenu(subMenu->GetName(), subMenu->GetDisplayText())); + helpTexts.push_back(""); } + + ShowButtons(0, true); +} + +void cSkindesignerSkinSetup::ShowButtons(int current, bool force) { + bool showGreen = helpTexts[current].size() > 0 ? true : false; + bool changed = false; + if ((hadHelp && !showGreen) || (!hadHelp && showGreen)) + changed = true; + hadHelp = showGreen; + if (changed || force) + SetHelp(showRed ? buttonRed.c_str() : "", showGreen ? buttonGreen.c_str() : "", showYellow ? buttonYellow.c_str() : "", NULL); } // --- cSkindesignerSkinPreview ----------------------------------------------------------- diff --git a/setup.h b/setup.h index 5e2f659..5bf5c14 100644 --- a/setup.h +++ b/setup.h @@ -93,6 +93,14 @@ class cSkindesignerSkinSetup : public cOsdMenu, cInstallManager { private: string skin; string menu; + vector helpTexts; + string buttonRed; + string buttonGreen; + string buttonYellow; + bool showRed; + bool showYellow; + bool hadHelp; + void ShowButtons(int current, bool force = false); protected: virtual eOSState ProcessKey(eKeys Key); void Set(void); diff --git a/skins/metrixhd/setup.xml b/skins/metrixhd/setup.xml index ad1d246..dc5039b 100644 --- a/skins/metrixhd/setup.xml +++ b/skins/metrixhd/setup.xml @@ -3,12 +3,12 @@ - 0 - 0 - 0 - 0 - 0 - 1 + 0 + 0 + 0 + 0 + 0 + 1 1 1 @@ -19,27 +19,51 @@ Einblendzeit [ms] Häivytyksen kesto [ms] + + Fade time in ms. If this is set to a value larger 0 all OSD elements beside the VDR menu fade in and out. + Einblendzeit in ms. Ist dieser Wert auf einen Wert > 0 gesetzt, werden alle OSD Elemente ausser dem VDR Menu ein- und ausgeblendet + Shift time Channel Display [ms] Einfahrzeit Channel Display [ms] + + Shifting time in ms. If this is set to a value larger 0 all OSD elements beside the VDR menu are shifted in and out from the bottom of the screen. If fadetime is also set to a value larger 0, still shifting is performed + Einfahrzeit in ms. Ist dieser Wert auf einen Wert > 0 gesetzt, werden alle OSD Elemente ausser dem VDR Menu vom unteren Rand des Bildschirms herein- und herausgefahren. Falls fadetime ebenfalls auf einen Wert größer 0 gesetzt ist, wird das OSD trotzdem herein- und herausgefahren. + Shift time Channel Date, Time, Weather [ms] Einfahrzeit Channel Date, Time, Wetter [ms] + + Shifting time of OSD Elements date, time and weather when switching in ms. If set to 0, the elements are shown immediately. + Einfahrzeit der OSD Elemente Datum, Zeit und Wetter während des Umschaltens in ms. Steht dieser Wert auf 0, werden die Elemente sofort angezeigt. + Shift time Timers Main Menu [ms] Einfahrzeit Timer Hauptmenü [ms] + + Shifting time of timers display in main menu in ms. If set to 0, the timers are shown immediately. + Einfahrzeit der Timer im Hauptmenü in ms. Steht dieser Wert auf 0, werden die Timer sofort angezeigt. + - Show DVB device info when switching channel - DVB Karten Info beim Umschalten anzeigen + Show DVB device info + DVB Karten Info anzeigen Näytä DVB-tiedot kanavanvaihdossa + + If set to true, information about usage of each available DVB device is displayed during channel switching and in the main menu + Falls diese Option aktiviert ist, werden beim Umschalten und im Hauptmenü Informationen über alle verfügbaren DVB Devices ausgegeben. + Orientation of main menu Ausrichtung des Hauptmenüs + + Orientation of main menu. If orientation is set to horizontal, only the current list element is displayed. If set to vertical, 8 elements are shown in the list. + Ausrichtung des Hauptmenüs. Falls die Ausrichtung auf horizontal gesetzt ist, wird nur das aktuelle Listenelement ausgegeben. Ist die Ausrichtung vertikal, werden 8 Listenelemente angezeigt. + Orientation of recordings menu Ausrichtung des Aufzeichnugsmenüs diff --git a/skins/metrixhd/xmlfiles/displaymenudetailtext.xml b/skins/metrixhd/xmlfiles/displaymenudetailtext.xml index 59cda9b..08c37b2 100644 --- a/skins/metrixhd/xmlfiles/displaymenudetailtext.xml +++ b/skins/metrixhd/xmlfiles/displaymenudetailtext.xml @@ -4,11 +4,6 @@ -
- - - -
@@ -70,6 +65,6 @@ - +