diff --git a/HISTORY b/HISTORY index 4d24d57..b82dece 100644 --- a/HISTORY +++ b/HISTORY @@ -394,4 +394,5 @@ Version 0.6.1 - some changes in metrixHD - changed font in metrixhd from "VDROpen Sans" to "Open Sans" - fixed crashes if main menu is opened consecutively +- added version check for skinrepositiries diff --git a/config.c b/config.c index eb178ce..fb8abee 100644 --- a/config.c +++ b/config.c @@ -330,7 +330,43 @@ void cDesignerConfig::SetSkinSetupParameters(void) { void cDesignerConfig::ReadSkinRepos(void) { skinRepos.Init(*installerSkinPath); skinRepos.Read(*installerSkinPath); - dsyslog("skindesigner: read %d skinrepositories from %s", skinRepos.Count(), *skinPath); + dsyslog("skindesigner: read %d skinrepositories from %s", skinRepos.Count(), *installerSkinPath); +} + +bool cDesignerConfig::CheckVersion(string name, string &neededVersion) { + cSkinRepo *repo = skinRepos.GetRepo(name); + if (!repo) + return false; + neededVersion = repo->MinSDVersion(); + + splitstring minVer(neededVersion.c_str()); + vector tokensMinVer = minVer.split('.', 1); + if (tokensMinVer.size() != 3) { + esyslog("skindesigner: incorrect minimumskindesignerversion definition: %s", neededVersion.c_str()); + return false; + } + splitstring ver(version.c_str()); + vector tokensVer = ver.split('.', 1); + if (tokensVer.size() != 3) { + esyslog("skindesigner: incorrect version definition: %s", version.c_str()); + return false; + } + + int minVerMajor = atoi(tokensMinVer[0].c_str()); + int minVerMinor = atoi(tokensMinVer[1].c_str()); + int minVerMikro = atoi(tokensMinVer[2].c_str()); + int verMajor = atoi(tokensVer[0].c_str()); + int verMinor = atoi(tokensVer[1].c_str()); + int verMikro = atoi(tokensVer[2].c_str()); + + if (minVerMajor > verMajor) { + return false; + } else if (minVerMinor > verMinor) { + return false; + } else if (minVerMikro > verMikro) { + return false; + } + return true; } bool cDesignerConfig::SkinInstalled(string name) { diff --git a/config.h b/config.h index 2dccca6..1bd4d5a 100644 --- a/config.h +++ b/config.h @@ -18,6 +18,7 @@ class cDesignerConfig { private: + string version; cString CheckSlashAtEnd(string path); bool epgImagePathSet; bool skinPathSet; @@ -52,6 +53,7 @@ private: public: cDesignerConfig(); ~cDesignerConfig(); + void SetVersion(string version) {this->version = version; }; bool SetupParse(const char *Name, const char *Value); void SetPathes(void); void SetSkinPath(cString path); @@ -84,6 +86,7 @@ public: void InitSkinRepoIterator(void) { skinRepos.InitRepoIterator(); }; cSkinRepo *GetNextSkinRepo(void) { return skinRepos.GetNextRepo(); }; cSkinRepo *GetSkinRepo(string name) { return skinRepos.GetRepo(name); }; + bool CheckVersion(string name, string &neededVersion); bool SkinInstalled(string name); void SetGlobals(cGlobals *globals) { tmplGlobals = globals; }; void UpdateGlobals(void); diff --git a/libcore/skinrepo.c b/libcore/skinrepo.c index 5979e57..e815421 100644 --- a/libcore/skinrepo.c +++ b/libcore/skinrepo.c @@ -13,6 +13,7 @@ cSkinRepo::cSkinRepo(void) { action = eaUndefined; url = ""; author = "unknown"; + minSDVersion = "0.0.1"; command = ""; command2 = ""; tempfile = ""; @@ -166,6 +167,7 @@ void cSkinRepo::Debug() { dsyslog("skindesigner: --- skinrepo %s, Type %s ---", name.c_str(), strRepoType.c_str()); dsyslog("skindesigner: url %s", url.c_str()); dsyslog("skindesigner: author %s", author.c_str()); + dsyslog("skindesigner: minimum Skindesigner Version required %s", minSDVersion.c_str()); if (specialFonts.size() > 0) { for (vector::iterator it = specialFonts.begin(); it != specialFonts.end(); it++) { dsyslog("skindesigner: special font %s", (*it).c_str()); @@ -287,6 +289,10 @@ bool cSkinRepos::ParseRepository(void) { if (GetNodeValue(value)) { repo->SetAuthor(value); } + } else if (CheckNodeName("minimumskindesignerversion")) { + if (GetNodeValue(value)) { + repo->SetMinSDVersion(value); + } } else if (CheckNodeName("specialfonts")) { if (!LevelDown()) continue; diff --git a/libcore/skinrepo.h b/libcore/skinrepo.h index d4cc88f..7452ad4 100644 --- a/libcore/skinrepo.h +++ b/libcore/skinrepo.h @@ -31,6 +31,7 @@ private: eAction action; string url; string author; + string minSDVersion; vector specialFonts; vector supportedPlugins; vector< pair < string, string > > screenshots; @@ -50,6 +51,7 @@ public: void SetRepoType(eRepoType type) { this->repoType = type; }; void SetUrl(string url) { this->url = url; }; void SetAuthor(string author) { this->author = author; }; + void SetMinSDVersion(string minSDVersion) { this->minSDVersion = minSDVersion; }; void SetSpecialFont(string font) { specialFonts.push_back(font); }; void SetSupportedPlugin(string plugin) { supportedPlugins.push_back(plugin); }; void SetScreenshot(string desc, string url) { screenshots.push_back(pair(desc, url)); }; @@ -57,6 +59,7 @@ public: eRepoType Type(void) { return repoType; }; string Name(void) { return name; }; string Author(void) { return author; }; + string MinSDVersion(void) { return minSDVersion; }; string Url(void) { return url; }; vector SpecialFonts(void) { return specialFonts; }; vector SupportedPlugins(void) { return supportedPlugins; }; diff --git a/po/de_DE.po b/po/de_DE.po index a1e95cc..185622e 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-06-13 15:07+0200\n" +"POT-Creation-Date: 2015-07-17 17:02+0200\n" "PO-Revision-Date: 2014-09-27 11:02+0200\n" "Last-Translator: Louis Braun \n" "Language-Team: \n" @@ -57,6 +57,18 @@ msgstr "Aktualisieren" msgid "Delete Skin" msgstr "Skin löschen" +msgid "Skin Designer" +msgstr "Skin Designer" + +msgid "version" +msgstr "Version" + +msgid "or higher" +msgstr "oder höher" + +msgid "needed" +msgstr "benötigt" + msgid "No Git Repsoitory available" msgstr "Kein Git Repository verfügbar" @@ -152,7 +164,3 @@ msgstr "Benutze Schriften" msgid "Supported Plugins" msgstr "Unterstützte Plugins" - -msgid "Skin Designer" -msgstr "Skin Designer" - diff --git a/po/fi_FI.po b/po/fi_FI.po index 4a0115d..ec665a1 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-06-13 15:07+0200\n" +"POT-Creation-Date: 2015-07-17 17:02+0200\n" "PO-Revision-Date: 2015-01-25 01:25+0200\n" "Last-Translator: Rolf Ahrenberg\n" "Language-Team: Finnish\n" @@ -57,6 +57,18 @@ msgstr "" msgid "Delete Skin" msgstr "" +msgid "Skin Designer" +msgstr "Skin Designer -ulkoasu" + +msgid "version" +msgstr "" + +msgid "or higher" +msgstr "" + +msgid "needed" +msgstr "" + msgid "No Git Repsoitory available" msgstr "" @@ -152,6 +164,3 @@ msgstr "" msgid "Supported Plugins" msgstr "" - -msgid "Skin Designer" -msgstr "Skin Designer -ulkoasu" diff --git a/setup.c b/setup.c index 1f2f22f..71ef0b9 100644 --- a/setup.c +++ b/setup.c @@ -199,6 +199,18 @@ eOSState cSkinDesignerSetup::ProcessKey(eKeys Key) { } // KEY RED if (Key == kRed) { + string versionNeeded = ""; + bool versionOk = config.CheckVersion(currentSkin, versionNeeded); + if (!versionOk) { + cString error = cString::sprintf("%s %s %s %s %s", + tr("Skin Designer"), + tr("version"), + versionNeeded.c_str(), + tr("or higher"), + tr("needed")); + Skins.Message(mtError, *error); + return state; + } if (type == itSkinRepo) { Skins.Message(mtStatus, *cString::sprintf("%s ...", tr("Installing Skin"))); StartInstallation(currentSkin); @@ -388,6 +400,18 @@ eOSState cSkindesignerSkinSetup::ProcessKey(eKeys Key) { } } case kRed: { + string versionNeeded = ""; + bool versionOk = config.CheckVersion(skin, versionNeeded); + if (!versionOk) { + cString error = cString::sprintf("%s %s %s %s %s", + tr("Skin Designer"), + tr("version"), + versionNeeded.c_str(), + tr("or higher"), + tr("needed")); + Skins.Message(mtError, *error); + break; + } bool gitAvailable = StartUpdate(skin); if (gitAvailable) { Skins.Message(mtStatus, *cString::sprintf("%s ...", tr("Updating Skin from Git"))); @@ -487,7 +511,19 @@ eOSState cSkindesignerSkinPreview::ProcessKey(eKeys Key) { state = osContinue; break; } case kRed: { - StartInstallation(currentSkin); + string versionNeeded = ""; + bool versionOk = config.CheckVersion(currentSkin, versionNeeded); + if (!versionOk) { + cString error = cString::sprintf("%s %s %s %s %s", + tr("Skin Designer"), + tr("version"), + versionNeeded.c_str(), + tr("or higher"), + tr("needed")); + Skins.Message(mtError, *error); + } else { + StartInstallation(currentSkin); + } state = osContinue; break; } default: diff --git a/skindesigner.c b/skindesigner.c index b297fab..28e52cc 100644 --- a/skindesigner.c +++ b/skindesigner.c @@ -54,6 +54,7 @@ public: cPluginSkinDesigner::cPluginSkinDesigner(void) { libskindesignerApiVersion = "undefined"; + config.SetVersion(VERSION); } cPluginSkinDesigner::~cPluginSkinDesigner() { diff --git a/skins/metrixhd/themes/default/theme.xml b/skins/metrixhd/themes/default/theme.xml index 6a40a76..98142cd 100644 --- a/skins/metrixhd/themes/default/theme.xml +++ b/skins/metrixhd/themes/default/theme.xml @@ -26,7 +26,7 @@ - Open Sans Light:Light + Open Sans:Light Open Sans:Semibold