summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2014-11-15 15:49:48 +0100
committerlouis <louis.braun@gmx.de>2014-11-15 15:49:48 +0100
commitc53e9e3a05ce74c47b6931907a655a0863a8478d (patch)
treedcb53833679c2dda092a43e65746099f9e64165d
parent182a6df2a93d81c3887c48fc77c62ae49b6cb21b (diff)
downloadvdr-plugin-skindesigner-c53e9e3a05ce74c47b6931907a655a0863a8478d.tar.gz
vdr-plugin-skindesigner-c53e9e3a05ce74c47b6931907a655a0863a8478d.tar.bz2
fixed {hasicon} Token in displaymenu header
-rw-r--r--HISTORY1
-rw-r--r--libcore/imagecache.c11
-rw-r--r--libcore/imagecache.h1
-rw-r--r--views/displaymenurootview.c2
-rw-r--r--views/displaymenuview.c2
5 files changed, 15 insertions, 2 deletions
diff --git a/HISTORY b/HISTORY
index 0bf51df..181a4db 100644
--- a/HISTORY
+++ b/HISTORY
@@ -83,3 +83,4 @@ Version 0.0.5
- added {channelnumber} and {channelname} Tokens in displaymenudetailepg
detailheader
+- fixed {hasicon} Token in displaymenu header
diff --git a/libcore/imagecache.c b/libcore/imagecache.c
index 369322e..9ac9050 100644
--- a/libcore/imagecache.c
+++ b/libcore/imagecache.c
@@ -267,6 +267,17 @@ string cImageCache::GetIconName(string label, eMenuCategory cat) {
return *cString::sprintf("customicons/%s", label.c_str());
}
+bool cImageCache::MenuIconExists(string name) {
+ cString iconFullPath = cString::sprintf("%smenuicons/", iconPath.c_str());
+ if (FileExists(*iconFullPath, name, "svg")) {
+ return true;
+ }
+ if (FileExists(*iconFullPath, name, "png")) {
+ return true;
+ }
+ return false;
+}
+
void cImageCache::CacheSkinpart(string name, int width, int height) {
if (width < 1 || width > 1920 || height < 1 || height > 1080)
return;
diff --git a/libcore/imagecache.h b/libcore/imagecache.h
index 4e88600..95148b2 100644
--- a/libcore/imagecache.h
+++ b/libcore/imagecache.h
@@ -26,6 +26,7 @@ public:
void CacheIcon(eImageType type, string path, int width, int height);
cImage *GetIcon(eImageType type, string name, int width, int height);
string GetIconName(string label, eMenuCategory cat = mcUndefined);
+ bool MenuIconExists(string name);
//skinparts
void CacheSkinpart(string path, int width, int height);
cImage *GetSkinpart(string name, int width, int height);
diff --git a/views/displaymenurootview.c b/views/displaymenurootview.c
index 5920502..ff6516f 100644
--- a/views/displaymenurootview.c
+++ b/views/displaymenurootview.c
@@ -458,7 +458,7 @@ void cDisplayMenuRootView::DrawHeader(void) {
bool hasIcon = false;
string icon = imgCache->GetIconName(menuTitle, cat);
- if (icon.size() > 0)
+ if (imgCache->MenuIconExists(icon))
hasIcon = true;
stringTokens.insert(pair<string,string>("icon", icon));
diff --git a/views/displaymenuview.c b/views/displaymenuview.c
index 5a54628..a6ba49b 100644
--- a/views/displaymenuview.c
+++ b/views/displaymenuview.c
@@ -42,7 +42,7 @@ bool cDisplayMenuView::DrawHeader(void) {
//check for standard menu entries
bool hasIcon = false;
string icon = imgCache->GetIconName(menuTitle, cat);
- if (icon.size() > 0)
+ if (imgCache->MenuIconExists(icon))
hasIcon = true;
stringTokens.insert(pair<string,string>("icon", icon));
intTokens.insert(pair<string,int>("hasicon", hasIcon));