diff options
author | louis <louis.braun@gmx.de> | 2014-01-25 15:52:53 +0100 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2014-01-25 15:52:53 +0100 |
commit | 2a3eecd99e9d7d8a138543ebdb892347f68aeaa2 (patch) | |
tree | 446c81af4061046903e329fcf704c2eb7bf32252 /imageloader.c | |
parent | 0cbc226651dbce5c01167ba24edc1d417634fb39 (diff) | |
download | vdr-plugin-tvguide-2a3eecd99e9d7d8a138543ebdb892347f68aeaa2.tar.gz vdr-plugin-tvguide-2a3eecd99e9d7d8a138543ebdb892347f68aeaa2.tar.bz2 |
also check default paths when images and icons are loaded
Diffstat (limited to 'imageloader.c')
-rw-r--r-- | imageloader.c | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/imageloader.c b/imageloader.c index 3ad7ab6..6ca5d69 100644 --- a/imageloader.c +++ b/imageloader.c @@ -29,10 +29,16 @@ bool cImageLoader::LoadLogo(const cChannel *channel, int width, int height) { extension = "jpg"; } bool success = false; - success = LoadImage(channelID.c_str(), *tvguideConfig.logoPath, *extension); - if (!success) { - success = LoadImage(logoLower.c_str(), *tvguideConfig.logoPath, *extension); + if (tvguideConfig.logoPathSet) { + success = LoadImage(channelID.c_str(), *tvguideConfig.logoPath, *extension); + if (!success) { + success = LoadImage(logoLower.c_str(), *tvguideConfig.logoPath, *extension); + } } + if (!success) + success = LoadImage(channelID.c_str(), *tvguideConfig.logoPathDefault, *extension); + if (!success) + success = LoadImage(logoLower.c_str(), *tvguideConfig.logoPathDefault, *extension); if (success) buffer.sample(Geometry(width, height)); return success; @@ -77,12 +83,22 @@ bool cImageLoader::LoadPoster(const char *poster, int width, int height) { bool cImageLoader::LoadIcon(const char *cIcon, int size) { if (size==0) return false; - cString iconPathTheme = cString::sprintf("%s%s/recmenuicons/", *tvguideConfig.iconPath, *tvguideConfig.themeName); bool success = false; - success = LoadImage(cIcon, *iconPathTheme, "png"); + if (tvguideConfig.iconsPathSet) { + cString iconPathTheme = cString::sprintf("%s%s/recmenuicons/", *tvguideConfig.iconPath, *tvguideConfig.themeName); + success = LoadImage(cIcon, *iconPathTheme, "png"); + if (!success) { + cString iconPath = cString::sprintf("%srecmenuicons/", *tvguideConfig.iconPath); + success = LoadImage(cIcon, *iconPath, "png"); + } + } if (!success) { - cString iconPathdefault = cString::sprintf("%s/recmenuicons/", *tvguideConfig.iconPath); - success = LoadImage(cIcon, *iconPathdefault, "png"); + cString iconPathTheme = cString::sprintf("%s%s/recmenuicons/", *tvguideConfig.iconPathDefault, *tvguideConfig.themeName); + success = LoadImage(cIcon, *iconPathTheme, "png"); + if (!success) { + cString iconPath = cString::sprintf("%srecmenuicons/", *tvguideConfig.iconPathDefault); + success = LoadImage(cIcon, *iconPath, "png"); + } } if (!success) return false; @@ -94,8 +110,22 @@ bool cImageLoader::LoadOsdElement(cString name, int width, int height) { if ((width == 0)||(height==0)) return false; bool success = false; - cString path = cString::sprintf("%s%s%s", *tvguideConfig.iconPath, *tvguideConfig.themeName, "/osdElements/"); - success = LoadImage(*name, *path, "png"); + if (tvguideConfig.iconsPathSet) { + cString path = cString::sprintf("%s%s%s", *tvguideConfig.iconPath, *tvguideConfig.themeName, "/osdElements/"); + success = LoadImage(*name, *path, "png"); + if (!success) { + path = cString::sprintf("%s%s", *tvguideConfig.iconPath, "/osdElements/"); + success = LoadImage(*name, *path, "png"); + } + } + if (!success) { + cString path = cString::sprintf("%s%s%s", *tvguideConfig.iconPathDefault, *tvguideConfig.themeName, "/osdElements/"); + success = LoadImage(*name, *path, "png"); + } + if (!success) { + cString path = cString::sprintf("%s%s", *tvguideConfig.iconPathDefault, "/osdElements/"); + success = LoadImage(*name, *path, "png"); + } if (!success) return false; Geometry size(width, height); |