From f483aef4a85e9451e2e348541d981b31b5af51d3 Mon Sep 17 00:00:00 2001 From: louis Date: Fri, 22 May 2015 13:34:23 +0200 Subject: [PATCH] implemented skininstaller config file --- Makefile | 1 + README | 11 ++++++++--- config.c | 23 ++++++++++++++++++++++- config.h | 6 ++++++ libcore/helpers.c | 2 +- skindesigner.c | 10 ++++++++-- 6 files changed, 46 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index cc1c790..a99944f 100644 --- a/Makefile +++ b/Makefile @@ -74,6 +74,7 @@ OBJS = $(PLUGIN).o \ libcore/imageloader.o \ libcore/recfolderinfo.o \ libcore/skinsetup.o \ + libcore/skinrepo.o \ libcore/extrecinfo.o \ libcore/timers.o \ libtemplate/globals.o \ diff --git a/README b/README index 3d886c8..dcd850b 100644 --- a/README +++ b/README @@ -65,7 +65,12 @@ After installation you have to care about the paths for the XML skins and epg im The following paths can be set at startup: -s , --skinpath= - Path to the XML skins (Default: /plugins/skindesigner/skins/) + Path where XML skins get installed by "make install" or by package manager + (Default: /plugins/skindesigner/skins/) + +-i , --installerpath= + Path where XML skins are installed by the Skindesigner Installer + (Default: /plugins/skindesigner/installerskins/) -l , --logopath= Path to common logo set for all skins (Default: /plugins/skindesigner/logos/) @@ -73,11 +78,11 @@ The following paths can be set at startup: -e path, --epgimages=path Path to the epgimages (Default: /epgimages/) -ResourceDirectory and CacheDirectory are taken from your VDR configuration +ResourceDirectory, ConfigDirectory and CacheDirectory are taken from your VDR configuration (make.config or vdr.pc). During a "make install" the included skins are automatically copied from -/skins/ to the configured path. +/skins/ to the configured skin path. For S2-6400 Users: Disable High Level OSD, otherwise the plugin will not be loaded because lack of true color support diff --git a/config.c b/config.c index b870cec..92feb46 100644 --- a/config.c +++ b/config.c @@ -6,6 +6,7 @@ cDesignerConfig::cDesignerConfig() { tmplGlobals = NULL; epgImagePathSet = false; skinPathSet = false; + installerSkinPathSet = false; logoPathSet = false; //Common numLogosPerSizeInitial = 30; @@ -37,12 +38,15 @@ cDesignerConfig::~cDesignerConfig() { void cDesignerConfig::SetPathes(void) { if (!skinPathSet) skinPath = cString::sprintf("%s/skins/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N)); + if (!installerSkinPathSet) + installerSkinPath = cString::sprintf("%s/installerskins/", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N)); if (!logoPathSet) logoPath = cString::sprintf("%s/logos/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N)); if (!epgImagePathSet) epgImagePath = cString::sprintf("%s/epgimages/", cPlugin::CacheDirectory(PLUGIN_NAME_I18N)); dsyslog("skindesigner: using Skin Directory %s", *skinPath); + dsyslog("skindesigner: using Installer Skin Directory %s", *installerSkinPath); dsyslog("skindesigner: using common ChannelLogo Directory %s", *logoPath); dsyslog("skindesigner: using EPG Images Directory %s", *epgImagePath); } @@ -52,6 +56,11 @@ void cDesignerConfig::SetSkinPath(cString path) { skinPathSet = true; } +void cDesignerConfig::SetInstallerSkinPath(cString path) { + installerSkinPath = CheckSlashAtEnd(*path); + installerSkinPathSet = true; +} + void cDesignerConfig::SetLogoPath(cString path) { logoPath = CheckSlashAtEnd(*path); logoPathSet = true; @@ -141,7 +150,6 @@ cSkinSetupMenu* cDesignerConfig::GetSkinSetupMenu(string &skin, string &menu) { cSkinSetup *skinSetup = GetSkinSetup(skin); if (!skinSetup) return NULL; - esyslog("skindesigner: skinsetup found"); return skinSetup->GetMenu(menu); } @@ -195,6 +203,19 @@ void cDesignerConfig::SetSkinSetupParameters(void) { } } +void cDesignerConfig::ReadSkinRepos(void) { + skinRepos.Read(*skinPath); + skinRepos.Debug(); + /* + cSkinRepo *holo = skinRepos.GetRepo("Holo"); + if (holo) { + esyslog("skindesigner: installing Holo"); + holo->Install(*installerSkinPath); + } + */ +} + + void cDesignerConfig::UpdateGlobals(void) { string activeSkin = Setup.OSDSkin; cSkinSetup *skinSetupActiveSkin = GetSkinSetup(activeSkin); diff --git a/config.h b/config.h index 6b3a037..d3c6066 100644 --- a/config.h +++ b/config.h @@ -11,6 +11,7 @@ #include "libcore/imagecache.h" #include "libcore/recfolderinfo.h" #include "libcore/skinsetup.h" +#include "libcore/skinrepo.h" #define SCRIPTOUTPUTPATH "/tmp/skindesigner" @@ -19,6 +20,7 @@ private: cString CheckSlashAtEnd(string path); bool epgImagePathSet; bool skinPathSet; + bool installerSkinPathSet; bool logoPathSet; cRect osdSize; string osdSkin; @@ -40,12 +42,14 @@ private: map < string, cSkinSetup* > skinSetups; map < string, cSkinSetup* >::iterator setupIt; vector < pair > skinSetupParameters; + cSkinRepos skinRepos; public: cDesignerConfig(); ~cDesignerConfig(); bool SetupParse(const char *Name, const char *Value); void SetPathes(void); void SetSkinPath(cString path); + void SetInstallerSkinPath(cString path); void SetLogoPath(cString path); void SetEpgImagePath(cString path); void ReadSkins(void); @@ -62,6 +66,7 @@ public: void TranslateSetup(void); void SetSkinSetupParameters(void); void UpdateSkinSetupParameter(string name, int value); + void ReadSkinRepos(void); void SetGlobals(cGlobals *globals) { tmplGlobals = globals; }; void UpdateGlobals(void); void CheckDecimalPoint(void); @@ -84,6 +89,7 @@ public: int GetPluginViewElementID(string pluginName, string viewElementName, int viewID); int GetPluginViewGridID(string pluginName, string viewGridName, int viewID); cString skinPath; + cString installerSkinPath; cString logoPath; cString epgImagePath; bool replaceDecPoint; diff --git a/libcore/helpers.c b/libcore/helpers.c index add1f7a..6aef313 100644 --- a/libcore/helpers.c +++ b/libcore/helpers.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "helpers.h" #include @@ -245,4 +246,3 @@ string GetScreenAspectString(double aspect, bool *isWideScreen) { } return name; } - diff --git a/skindesigner.c b/skindesigner.c index 619210a..0a05143 100644 --- a/skindesigner.c +++ b/skindesigner.c @@ -62,7 +62,8 @@ cPluginSkinDesigner::~cPluginSkinDesigner() { const char *cPluginSkinDesigner::CommandLineHelp(void) { return - " -s , --skinpath= Set directory where xml skins are stored\n" + " -s , --skinpath= Set directory where xml skins are stored by Package Manager\n" + " -i , --installerpath= Set directory where xml skins are stored by Installer\n" " -l , --logopath= Set directory where a common logo set for all skins is stored\n" " -e , --epgimages= Set directory where epgimages are stored\n"; } @@ -73,11 +74,12 @@ bool cPluginSkinDesigner::ProcessArgs(int argc, char *argv[]) { { "epgimages", required_argument, NULL, 'e' }, { "logopath", required_argument, NULL, 'l' }, { "skinpath", required_argument, NULL, 's' }, + { "installerpath", required_argument, NULL, 'i' }, { 0, 0, 0, 0 } }; int c; - while ((c = getopt_long(argc, argv, "e:s:l:", long_options, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "e:s:l:i:", long_options, NULL)) != -1) { switch (c) { case 'e': config.SetEpgImagePath(cString(optarg)); @@ -88,6 +90,9 @@ bool cPluginSkinDesigner::ProcessArgs(int argc, char *argv[]) { case 's': config.SetSkinPath(cString(optarg)); break; + case 'i': + config.SetInstallerSkinPath(cString(optarg)); + break; default: return false; } @@ -128,6 +133,7 @@ bool cPluginSkinDesigner::Start(void) { } config.TranslateSetup(); config.SetSkinSetupParameters(); + config.ReadSkinRepos(); if (skins.size() == 0) { esyslog("skindesigner: no skins found! Using default Skin LCARS!");