added version check for skinrepositiries

This commit is contained in:
louis 2015-07-17 17:37:16 +02:00
parent 10e37f6b8e
commit c4b49c6cb4
10 changed files with 115 additions and 12 deletions

View File

@ -394,4 +394,5 @@ Version 0.6.1
- some changes in metrixHD - some changes in metrixHD
- changed font in metrixhd from "VDROpen Sans" to "Open Sans" - changed font in metrixhd from "VDROpen Sans" to "Open Sans"
- fixed crashes if main menu is opened consecutively - fixed crashes if main menu is opened consecutively
- added version check for skinrepositiries

View File

@ -330,7 +330,43 @@ void cDesignerConfig::SetSkinSetupParameters(void) {
void cDesignerConfig::ReadSkinRepos(void) { void cDesignerConfig::ReadSkinRepos(void) {
skinRepos.Init(*installerSkinPath); skinRepos.Init(*installerSkinPath);
skinRepos.Read(*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<string> 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<string> 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) { bool cDesignerConfig::SkinInstalled(string name) {

View File

@ -18,6 +18,7 @@
class cDesignerConfig { class cDesignerConfig {
private: private:
string version;
cString CheckSlashAtEnd(string path); cString CheckSlashAtEnd(string path);
bool epgImagePathSet; bool epgImagePathSet;
bool skinPathSet; bool skinPathSet;
@ -52,6 +53,7 @@ private:
public: public:
cDesignerConfig(); cDesignerConfig();
~cDesignerConfig(); ~cDesignerConfig();
void SetVersion(string version) {this->version = version; };
bool SetupParse(const char *Name, const char *Value); bool SetupParse(const char *Name, const char *Value);
void SetPathes(void); void SetPathes(void);
void SetSkinPath(cString path); void SetSkinPath(cString path);
@ -84,6 +86,7 @@ public:
void InitSkinRepoIterator(void) { skinRepos.InitRepoIterator(); }; void InitSkinRepoIterator(void) { skinRepos.InitRepoIterator(); };
cSkinRepo *GetNextSkinRepo(void) { return skinRepos.GetNextRepo(); }; cSkinRepo *GetNextSkinRepo(void) { return skinRepos.GetNextRepo(); };
cSkinRepo *GetSkinRepo(string name) { return skinRepos.GetRepo(name); }; cSkinRepo *GetSkinRepo(string name) { return skinRepos.GetRepo(name); };
bool CheckVersion(string name, string &neededVersion);
bool SkinInstalled(string name); bool SkinInstalled(string name);
void SetGlobals(cGlobals *globals) { tmplGlobals = globals; }; void SetGlobals(cGlobals *globals) { tmplGlobals = globals; };
void UpdateGlobals(void); void UpdateGlobals(void);

View File

@ -13,6 +13,7 @@ cSkinRepo::cSkinRepo(void) {
action = eaUndefined; action = eaUndefined;
url = ""; url = "";
author = "unknown"; author = "unknown";
minSDVersion = "0.0.1";
command = ""; command = "";
command2 = ""; command2 = "";
tempfile = ""; tempfile = "";
@ -166,6 +167,7 @@ void cSkinRepo::Debug() {
dsyslog("skindesigner: --- skinrepo %s, Type %s ---", name.c_str(), strRepoType.c_str()); dsyslog("skindesigner: --- skinrepo %s, Type %s ---", name.c_str(), strRepoType.c_str());
dsyslog("skindesigner: url %s", url.c_str()); dsyslog("skindesigner: url %s", url.c_str());
dsyslog("skindesigner: author %s", author.c_str()); dsyslog("skindesigner: author %s", author.c_str());
dsyslog("skindesigner: minimum Skindesigner Version required %s", minSDVersion.c_str());
if (specialFonts.size() > 0) { if (specialFonts.size() > 0) {
for (vector<string>::iterator it = specialFonts.begin(); it != specialFonts.end(); it++) { for (vector<string>::iterator it = specialFonts.begin(); it != specialFonts.end(); it++) {
dsyslog("skindesigner: special font %s", (*it).c_str()); dsyslog("skindesigner: special font %s", (*it).c_str());
@ -287,6 +289,10 @@ bool cSkinRepos::ParseRepository(void) {
if (GetNodeValue(value)) { if (GetNodeValue(value)) {
repo->SetAuthor(value); repo->SetAuthor(value);
} }
} else if (CheckNodeName("minimumskindesignerversion")) {
if (GetNodeValue(value)) {
repo->SetMinSDVersion(value);
}
} else if (CheckNodeName("specialfonts")) { } else if (CheckNodeName("specialfonts")) {
if (!LevelDown()) if (!LevelDown())
continue; continue;

View File

@ -31,6 +31,7 @@ private:
eAction action; eAction action;
string url; string url;
string author; string author;
string minSDVersion;
vector<string> specialFonts; vector<string> specialFonts;
vector<string> supportedPlugins; vector<string> supportedPlugins;
vector< pair < string, string > > screenshots; vector< pair < string, string > > screenshots;
@ -50,6 +51,7 @@ public:
void SetRepoType(eRepoType type) { this->repoType = type; }; void SetRepoType(eRepoType type) { this->repoType = type; };
void SetUrl(string url) { this->url = url; }; void SetUrl(string url) { this->url = url; };
void SetAuthor(string author) { this->author = author; }; void SetAuthor(string author) { this->author = author; };
void SetMinSDVersion(string minSDVersion) { this->minSDVersion = minSDVersion; };
void SetSpecialFont(string font) { specialFonts.push_back(font); }; void SetSpecialFont(string font) { specialFonts.push_back(font); };
void SetSupportedPlugin(string plugin) { supportedPlugins.push_back(plugin); }; void SetSupportedPlugin(string plugin) { supportedPlugins.push_back(plugin); };
void SetScreenshot(string desc, string url) { screenshots.push_back(pair<string, string>(desc, url)); }; void SetScreenshot(string desc, string url) { screenshots.push_back(pair<string, string>(desc, url)); };
@ -57,6 +59,7 @@ public:
eRepoType Type(void) { return repoType; }; eRepoType Type(void) { return repoType; };
string Name(void) { return name; }; string Name(void) { return name; };
string Author(void) { return author; }; string Author(void) { return author; };
string MinSDVersion(void) { return minSDVersion; };
string Url(void) { return url; }; string Url(void) { return url; };
vector<string> SpecialFonts(void) { return specialFonts; }; vector<string> SpecialFonts(void) { return specialFonts; };
vector<string> SupportedPlugins(void) { return supportedPlugins; }; vector<string> SupportedPlugins(void) { return supportedPlugins; };

View File

@ -6,7 +6,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-skindesigner 0.0.1\n" "Project-Id-Version: vdr-skindesigner 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\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" "PO-Revision-Date: 2014-09-27 11:02+0200\n"
"Last-Translator: Louis Braun <louis.braun@gmx.de>\n" "Last-Translator: Louis Braun <louis.braun@gmx.de>\n"
"Language-Team: \n" "Language-Team: \n"
@ -57,6 +57,18 @@ msgstr "Aktualisieren"
msgid "Delete Skin" msgid "Delete Skin"
msgstr "Skin löschen" 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" msgid "No Git Repsoitory available"
msgstr "Kein Git Repository verfügbar" msgstr "Kein Git Repository verfügbar"
@ -152,7 +164,3 @@ msgstr "Benutze Schriften"
msgid "Supported Plugins" msgid "Supported Plugins"
msgstr "Unterstützte Plugins" msgstr "Unterstützte Plugins"
msgid "Skin Designer"
msgstr "Skin Designer"

View File

@ -6,7 +6,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-skindesigner 0.2.0\n" "Project-Id-Version: vdr-skindesigner 0.2.0\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\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" "PO-Revision-Date: 2015-01-25 01:25+0200\n"
"Last-Translator: Rolf Ahrenberg\n" "Last-Translator: Rolf Ahrenberg\n"
"Language-Team: Finnish\n" "Language-Team: Finnish\n"
@ -57,6 +57,18 @@ msgstr ""
msgid "Delete Skin" msgid "Delete Skin"
msgstr "" msgstr ""
msgid "Skin Designer"
msgstr "Skin Designer -ulkoasu"
msgid "version"
msgstr ""
msgid "or higher"
msgstr ""
msgid "needed"
msgstr ""
msgid "No Git Repsoitory available" msgid "No Git Repsoitory available"
msgstr "" msgstr ""
@ -152,6 +164,3 @@ msgstr ""
msgid "Supported Plugins" msgid "Supported Plugins"
msgstr "" msgstr ""
msgid "Skin Designer"
msgstr "Skin Designer -ulkoasu"

38
setup.c
View File

@ -199,6 +199,18 @@ eOSState cSkinDesignerSetup::ProcessKey(eKeys Key) {
} }
// KEY RED // KEY RED
if (Key == kRed) { 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) { if (type == itSkinRepo) {
Skins.Message(mtStatus, *cString::sprintf("%s ...", tr("Installing Skin"))); Skins.Message(mtStatus, *cString::sprintf("%s ...", tr("Installing Skin")));
StartInstallation(currentSkin); StartInstallation(currentSkin);
@ -388,6 +400,18 @@ eOSState cSkindesignerSkinSetup::ProcessKey(eKeys Key) {
} }
} }
case kRed: { 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); bool gitAvailable = StartUpdate(skin);
if (gitAvailable) { if (gitAvailable) {
Skins.Message(mtStatus, *cString::sprintf("%s ...", tr("Updating Skin from Git"))); Skins.Message(mtStatus, *cString::sprintf("%s ...", tr("Updating Skin from Git")));
@ -487,7 +511,19 @@ eOSState cSkindesignerSkinPreview::ProcessKey(eKeys Key) {
state = osContinue; state = osContinue;
break; break;
} case kRed: { } 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; state = osContinue;
break; break;
} default: } default:

View File

@ -54,6 +54,7 @@ public:
cPluginSkinDesigner::cPluginSkinDesigner(void) { cPluginSkinDesigner::cPluginSkinDesigner(void) {
libskindesignerApiVersion = "undefined"; libskindesignerApiVersion = "undefined";
config.SetVersion(VERSION);
} }
cPluginSkinDesigner::~cPluginSkinDesigner() { cPluginSkinDesigner::~cPluginSkinDesigner() {

View File

@ -26,7 +26,7 @@
</translations> </translations>
<fonts> <fonts>
<font name="light">Open Sans Light:Light</font> <font name="light">Open Sans:Light</font>
<font name="semibold">Open Sans:Semibold</font> <font name="semibold">Open Sans:Semibold</font>
</fonts> </fonts>
</globals> </globals>