summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--config.c28
-rw-r--r--config.h7
-rw-r--r--displaychannel.c14
-rw-r--r--displaymenu.c2
-rw-r--r--displaymenuview.c2
-rw-r--r--imagecache.c213
-rw-r--r--imagecache.h17
-rw-r--r--menudetailview.c24
-rw-r--r--menudetailview.h5
-rw-r--r--menuitem.c28
-rw-r--r--po/ca_ES.po50
-rw-r--r--po/de_DE.po52
-rw-r--r--po/it_IT.po50
-rw-r--r--po/sk_SK.po50
-rw-r--r--setup.c41
-rw-r--r--setup.h11
-rw-r--r--timers.c17
18 files changed, 508 insertions, 104 deletions
diff --git a/HISTORY b/HISTORY
index ec2dd89..9d66946 100644
--- a/HISTORY
+++ b/HISTORY
@@ -295,3 +295,4 @@ Version 0.1.4
- Added cache for images and fonts
- Changed and added some color definitions
- Added theme "Keep it light" (thanks @Saman for providing the theme)
+- Added additional configurable channel logo cache
diff --git a/config.c b/config.c
index 4330558..b03c14b 100644
--- a/config.c
+++ b/config.c
@@ -6,6 +6,7 @@ cNopacityConfig::cNopacityConfig() {
logoPathSet = false;
epgImagePathSet = false;
iconPathSet = false;
+ pathValuesSet = false;
//Common
mainMenuEntry = false;
fontIndex = 0;
@@ -119,8 +120,6 @@ cNopacityConfig::cNopacityConfig() {
menuHeaderLogoHeight = 70;
menuItemLogoWidth = 130;
menuItemLogoHeight = 100;
- detailViewLogoWidth = 260;
- detailViewLogoHeight = 200;
timersLogoWidth = 90;
timersLogoHeight = 70;
epgImageWidth = 210;
@@ -173,6 +172,10 @@ cNopacityConfig::cNopacityConfig() {
rssFeed[2] = 0;
rssFeed[3] = 0;
rssFeed[4] = 0;
+ //Channel Logo Caching
+ limitLogoCache = 1;
+ numLogosInitial = 30;
+ numLogosMax = 50;
}
cNopacityConfig::~cNopacityConfig() {
@@ -222,14 +225,16 @@ void cNopacityConfig::setDynamicValues() {
else if (rssScrollSpeed == 2)
rssScrollFrameTime = 5;
+ if (!pathValuesSet) {
+ pathValuesSet = true;
+ logoPathDefault = cString::sprintf("%s/logos/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
+ iconPathDefault = cString::sprintf("%s/icons/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
+ epgImagePathDefault = cString::sprintf("%s/epgimages/", cPlugin::CacheDirectory(PLUGIN_NAME_I18N));
- logoPathDefault = cString::sprintf("%s/logos/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
- iconPathDefault = cString::sprintf("%s/icons/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
- epgImagePathDefault = cString::sprintf("%s/epgimages/", cPlugin::CacheDirectory(PLUGIN_NAME_I18N));
-
- dsyslog("nopacity: using Logo Directory %s", (logoPathSet)?(*logoPath):(*logoPathDefault));
- dsyslog("nopacity: using Icon Directory %s", (iconPathSet)?(*iconPath):(*iconPathDefault));
- dsyslog("nopacity: using EPG Images Directory %s", (epgImagePathSet)?(*epgImagePath):(*epgImagePathDefault));
+ dsyslog("nopacity: using Logo Directory %s", (logoPathSet)?(*logoPath):(*logoPathDefault));
+ dsyslog("nopacity: using Icon Directory %s", (iconPathSet)?(*iconPath):(*iconPathDefault));
+ dsyslog("nopacity: using EPG Images Directory %s", (epgImagePathSet)?(*epgImagePath):(*epgImagePathDefault));
+ }
}
void cNopacityConfig::loadRssFeeds(void) {
@@ -409,8 +414,6 @@ bool cNopacityConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "menuItemLogoHeight") == 0) menuItemLogoHeight = atoi(Value);
else if (strcmp(Name, "menuHeaderLogoWidth") == 0) menuHeaderLogoWidth = atoi(Value);
else if (strcmp(Name, "menuHeaderLogoHeight") == 0) menuHeaderLogoHeight = atoi(Value);
- else if (strcmp(Name, "detailViewLogoWidth") == 0) detailViewLogoWidth = atoi(Value);
- else if (strcmp(Name, "detailViewLogoHeight") == 0) detailViewLogoHeight = atoi(Value);
else if (strcmp(Name, "timersLogoWidth") == 0) timersLogoWidth = atoi(Value);
else if (strcmp(Name, "timersLogoHeight") == 0) timersLogoHeight = atoi(Value);
else if (strcmp(Name, "epgImageWidth") == 0) epgImageWidth = atoi(Value);
@@ -462,6 +465,9 @@ bool cNopacityConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "rssFeedHeightStandalone") == 0) rssFeedHeightStandalone = atoi(Value);
else if (strcmp(Name, "fontRssFeedStandalone") == 0) fontRssFeedStandalone = atoi(Value);
else if (strcmp(Name, "rssFeedStandalonePos") == 0) rssFeedStandalonePos = atoi(Value);
+ else if (strcmp(Name, "limitLogoCache") == 0) limitLogoCache = atoi(Value);
+ else if (strcmp(Name, "numLogosInitial") == 0) numLogosInitial = atoi(Value);
+ else if (strcmp(Name, "numLogosMax") == 0) numLogosMax = atoi(Value);
else return false;
return true;
diff --git a/config.h b/config.h
index e8ef390..6d89b64 100644
--- a/config.h
+++ b/config.h
@@ -22,6 +22,7 @@ class cNopacityConfig {
cString logoPathDefault;
cString iconPathDefault;
cString epgImagePathDefault;
+ bool pathValuesSet;
void setDynamicValues();
void loadRssFeeds(void);
//Theme Setting
@@ -152,8 +153,6 @@ class cNopacityConfig {
int menuItemLogoHeight;
int menuHeaderLogoWidth;
int menuHeaderLogoHeight;
- int detailViewLogoWidth;
- int detailViewLogoHeight;
int timersLogoWidth;
int timersLogoHeight;
int epgImageWidth;
@@ -204,6 +203,10 @@ class cNopacityConfig {
int rssScrollSpeed;
int rssScrollFrameTime;
int rssFeed[5];
+ //Channel Logo Caching
+ int limitLogoCache;
+ int numLogosInitial;
+ int numLogosMax;
};
#endif //__NOPACITY_CONFIG_H \ No newline at end of file
diff --git a/displaychannel.c b/displaychannel.c
index bf25b28..7310e9b 100644
--- a/displaychannel.c
+++ b/displaychannel.c
@@ -3,7 +3,8 @@
cNopacityDisplayChannel::cNopacityDisplayChannel(cImageCache *imgCache, bool WithInfo) {
if (firstDisplay) {
- imgCache->CreateCache2();
+ imgCache->CreateCacheDelayed();
+ std::string sizeBackgrCache = imgCache->GetCacheSize(ctBackground);
firstDisplay = false;
doOutput = false;
return;
@@ -271,7 +272,6 @@ void cNopacityDisplayChannel::DrawIconsSingle(const cChannel *Channel) {
pixmapStreamInfo->Fill(clrTransparent);
int iconSize = geoManager->channelIconSize;
int iconX = 0;
- cImageLoader imgLoader;
if (Channel->Vpid() && Channel->Tpid()) {
cImage *imgIcon = imgCache->GetSkinIcon("skinIcons/txton", iconSize, iconSize);
@@ -522,12 +522,10 @@ void cNopacityDisplayChannel::SetChannel(const cChannel *Channel, int Number) {
}
cString channelString = cString::sprintf("%s %s", *ChannelNumber, *ChannelName);
pixmapChannelInfo->DrawText(cPoint(geoManager->channelInfoHeight/2, (geoManager->channelInfoHeight-fontManager->channelHeader->Height())/2), channelString, Theme.Color(clrChannelHead), clrTransparent, fontManager->channelHeader);
- if (config.logoPosition != lpNone) {
- cImageLoader imgLoader;
- if (imgLoader.LoadLogo(*ChannelName)) {
- pixmapLogo->DrawImage(cPoint(config.logoBorder, (geoManager->channelHeight-config.logoHeight)/2), imgLoader.GetImage());
- } else if (Channel && imgLoader.LoadLogo(*(Channel->GetChannelID().ToString()))) {
- pixmapLogo->DrawImage(cPoint(config.logoBorder, (geoManager->channelHeight-config.logoHeight)/2), imgLoader.GetImage());
+ if (Channel && config.logoPosition != lpNone) {
+ cImage *logo = imgCache->GetLogo(ctLogo, Channel);
+ if (logo) {
+ pixmapLogo->DrawImage(cPoint(config.logoBorder, (geoManager->channelHeight-config.logoHeight)/2), *logo);
}
}
ShowSignalMeter();
diff --git a/displaymenu.c b/displaymenu.c
index ef85f25..df69c7f 100644
--- a/displaymenu.c
+++ b/displaymenu.c
@@ -666,7 +666,7 @@ void cNopacityDisplayMenu::SetEvent(const cEvent *Event) {
if (!Event)
return;
menuView->AdjustContentBackground(this->MenuCategory(), menuCategoryLast, videoWindowRect);
- detailView = new cNopacityMenuDetailEventView(osd, Event);
+ detailView = new cNopacityMenuDetailEventView(osd, imgCache, Event);
menuView->SetDetailViewSize(dvEvent, detailView);
detailView->SetFonts();
detailView->SetContent();
diff --git a/displaymenuview.c b/displaymenuview.c
index d811018..e7b50e5 100644
--- a/displaymenuview.c
+++ b/displaymenuview.c
@@ -693,7 +693,7 @@ void cNopacityDisplayMenuView::SetDetailViewSize(eDetailViewType detailViewType,
switch (detailViewType) {
case dvEvent:
- detailHeaderHeight = max(config.detailViewLogoHeight, config.epgImageHeight)+4;
+ detailHeaderHeight = max(config.logoHeight, config.epgImageHeight)+4;
contentBorder = config.borderDetailedEPG;
break;
case dvRecording:
diff --git a/imagecache.c b/imagecache.c
index 667097e..adc7afb 100644
--- a/imagecache.c
+++ b/imagecache.c
@@ -7,11 +7,16 @@ using namespace Magick;
cImageCache::cImageCache() : cImageMagickWrapper() {
initComplete = false;
+ tempStaticLogo = NULL;
osdTheme = Setup.OSDTheme;
}
cImageCache::~cImageCache() {
Clear();
+ if (tempStaticLogo) {
+ delete tempStaticLogo;
+ tempStaticLogo = NULL;
+ }
}
void cImageCache::CreateCache(void) {
@@ -29,9 +34,29 @@ void cImageCache::CreateCache(void) {
sImgProperties iconProps = skinIcons[i].second;
LoadIcon(ctSkinIcon, iconName, iconProps.width, iconProps.height, iconProps.preserveAspect);
}
+ //Channel Logos
+ if (config.numLogosInitial > 0) {
+ int channelsCached = 0;
+ for (const cChannel *channel = Channels.First(); channel; channel = Channels.Next(channel)) {
+ if (channelsCached >= config.numLogosInitial)
+ break;
+ if (!channel->GroupSep()) {
+ bool success = LoadLogo(channel);
+ if (success) {
+ channelsCached++;
+ InsertIntoLogoCache(ctLogo, channel->Number());
+ }
+ success = LoadLogo(channel);
+ if (success) {
+ InsertIntoLogoCache(ctLogoMenuItem, channel->Number());
+ }
+ }
+
+ }
+ }
}
-void cImageCache::CreateCache2(void) {
+void cImageCache::CreateCacheDelayed(void) {
CreateBackgroundImages();
}
@@ -46,7 +71,7 @@ bool cImageCache::ThemeChanged(void) {
void cImageCache::Reload(void) {
Clear();
CreateCache();
- CreateCache2();
+ CreateCacheDelayed();
}
cImage *cImageCache::GetMenuIcon(std::string name) {
@@ -83,6 +108,50 @@ cImage *cImageCache::GetSkinIcon(std::string name, int width, int height, bool p
return NULL;
}
+cImage *cImageCache::GetLogo(eCacheType type, const cChannel *channel) {
+ if (!channel)
+ return NULL;
+
+ std::map<int, cImage*> *cache;
+ if (type == ctLogo)
+ cache = &logoCache;
+ else if (type == ctLogoMenuItem)
+ cache = &logoMenuItemCache;
+ else if (type == ctLogoTimer)
+ cache = &logoTimerCache;
+
+ std::map<int, cImage*>::iterator hit = cache->find(channel->Number());
+
+ if (hit != cache->end()) {
+ return (cImage*)hit->second;
+ } else {
+ bool success = LoadLogo(channel);
+ if (success) {
+ if (config.limitLogoCache && (cache->size() >= config.numLogosMax)) {
+ //logo cache is full, don't cache anymore
+ cPoint logoSize = LogoSize(type);
+ int width = logoSize.X();
+ int height = logoSize.Y();
+ buffer.sample(Geometry(width, height));
+ if (tempStaticLogo) {
+ delete tempStaticLogo;
+ tempStaticLogo = NULL;
+ }
+ tempStaticLogo = CreateImage();
+ return tempStaticLogo;
+ } else {
+ //add requested logo to cache
+ InsertIntoLogoCache(type, channel->Number());
+ hit = cache->find(channel->Number());
+ if (hit != cache->end()) {
+ return (cImage*)hit->second;
+ }
+ }
+ }
+ }
+ return NULL;
+}
+
cImage *cImageCache::GetBackground(eBackgroundType type) {
if (!initComplete)
return NULL;
@@ -102,7 +171,48 @@ cImage cImageCache::GetBackground(tColor back, tColor blend, int width, int heig
return CreateImageCopy();
}
+std::string cImageCache::GetCacheSize(eCacheType type) {
+ std::stringstream result;
+ int sizeByte = 0;
+ int numImages = 0;
+ if ((type == ctMenuIcon) || (type == ctSkinIcon)) {
+ std::map<std::string, cImage*> *cache;
+ if (type == ctMenuIcon)
+ cache = &menuIconCache;
+ else if (type == ctSkinIcon)
+ cache = &skinIconCache;
+
+ for(std::map<std::string, cImage*>::const_iterator it = cache->begin(); it != cache->end(); it++) {
+ cImage *img = (cImage*)it->second;
+ sizeByte += img->Width() * img->Height() * sizeof(tColor);
+ }
+ numImages = cache->size();
+ } else if ((type == ctLogo) || (type == ctLogoMenuItem) || (type == ctLogoTimer)) {
+ std::map<int, cImage*> *cache;
+ if (type == ctLogo)
+ cache = &logoCache;
+ else if (type == ctLogoMenuItem)
+ cache = &logoMenuItemCache;
+ else if (type == ctLogoTimer)
+ cache = &logoTimerCache;
+
+ for(std::map<int, cImage*>::const_iterator it = cache->begin(); it != cache->end(); it++) {
+ cImage *img = (cImage*)it->second;
+ sizeByte += img->Width() * img->Height() * sizeof(tColor);
+ }
+ numImages = cache->size();
+ } else if (type == ctBackground) {
+ for(std::vector<cImage*>::const_iterator it = backgroundImages.begin(); it != backgroundImages.end(); it++) {
+ cImage *img = (cImage*)*it;
+ sizeByte += img->Width() * img->Height() * sizeof(tColor);
+ }
+ numImages = backgroundImages.size();
+ }
+ result << numImages << " " << tr("images") << " / " << sizeByte/1024 << " KByte";
+ return result.str();
+}
+
std::vector<std::pair<std::string, cPoint> > cImageCache::GetMenuIcons(void) {
std::vector<std::pair<std::string, cPoint> > menuIcons;
//MainMenuIcons
@@ -193,11 +303,11 @@ bool cImageCache::LoadIcon(eCacheType type, std::string name, int width, int hei
cString iconPathTheme = cString::sprintf("%s%s/", *config.iconPath, Setup.OSDTheme);
success = LoadImage(name, *iconPathTheme, "png");
if (success) {
- InsertIntoCache(type, name, width, height, preserveAspect);
+ InsertIntoIconCache(type, name, width, height, preserveAspect);
} else {
success = LoadImage(name, *config.iconPath, "png");
if (success) {
- InsertIntoCache(type, name, width, height, preserveAspect);
+ InsertIntoIconCache(type, name, width, height, preserveAspect);
}
}
}
@@ -205,18 +315,18 @@ bool cImageCache::LoadIcon(eCacheType type, std::string name, int width, int hei
cString iconPathTheme = cString::sprintf("%s%s/", *config.iconPathDefault, Setup.OSDTheme);
success = LoadImage(name, *iconPathTheme, "png");
if (success) {
- InsertIntoCache(type, name, width, height, preserveAspect);
+ InsertIntoIconCache(type, name, width, height, preserveAspect);
} else {
success = LoadImage(name, *config.iconPathDefault, "png");
if (success) {
- InsertIntoCache(type, name, width, height, preserveAspect);
+ InsertIntoIconCache(type, name, width, height, preserveAspect);
}
}
}
return success;
}
-void cImageCache::InsertIntoCache(eCacheType type, std::string name, int width, int height, bool preserveAspect) {
+void cImageCache::InsertIntoIconCache(eCacheType type, std::string name, int width, int height, bool preserveAspect) {
if (preserveAspect) {
buffer.sample(Geometry(width, height));
} else {
@@ -230,6 +340,80 @@ void cImageCache::InsertIntoCache(eCacheType type, std::string name, int width,
skinIconCache.insert(std::pair<std::string, cImage*>(name, image));
}
+bool cImageCache::LoadLogo(const cChannel *channel) {
+ if (!channel)
+ return false;
+ std::string channelID = StrToLowerCase(*(channel->GetChannelID().ToString()));
+ std::string logoLower = StrToLowerCase(channel->Name());
+ bool success = false;
+ if (config.logoPathSet) {
+ cString logoThemePath = cString::sprintf("%s%s/", *config.logoPath, Setup.OSDTheme);
+ success = LoadImage(channelID.c_str(), *logoThemePath, *config.logoExtension);
+ if (success)
+ return true;
+ success = LoadImage(logoLower.c_str(), *logoThemePath, *config.logoExtension);
+ if (success)
+ return true;
+ success = LoadImage(channelID.c_str(), *config.logoPath, *config.logoExtension);
+ if (success)
+ return true;
+ success = LoadImage(logoLower.c_str(), *config.logoPath, *config.logoExtension);
+ if (success)
+ return true;
+ }
+ cString logoThemePath = cString::sprintf("%s%s/", *config.logoPathDefault, Setup.OSDTheme);
+ success = LoadImage(channelID.c_str(), *logoThemePath, *config.logoExtension);
+ if (success)
+ return true;
+ success = LoadImage(logoLower.c_str(), *logoThemePath, *config.logoExtension);
+ if (success)
+ return true;
+ success = LoadImage(channelID.c_str(), *config.logoPathDefault, *config.logoExtension);
+ if (success)
+ return true;
+ success = LoadImage(logoLower.c_str(), *config.logoPathDefault, *config.logoExtension);
+ if (success)
+ return true;
+
+ return false;
+}
+
+void cImageCache::InsertIntoLogoCache(eCacheType type, int channelNumber) {
+ cPoint logoSize = LogoSize(type);
+ int width = logoSize.X();
+ int height = logoSize.Y();
+ buffer.sample(Geometry(width, height));
+ cImage *image = CreateImage();
+ if (type == ctLogo)
+ logoCache.insert(std::pair<int, cImage*>(channelNumber, image));
+ else if (type == ctLogoMenuItem)
+ logoMenuItemCache.insert(std::pair<int, cImage*>(channelNumber, image));
+ else if (type == ctLogoTimer)
+ logoTimerCache.insert(std::pair<int, cImage*>(channelNumber, image));
+}
+
+cPoint cImageCache::LogoSize(eCacheType type) {
+ int width, height;
+ switch (type) {
+ case ctLogo:
+ width = config.logoWidth;
+ height = config.logoHeight;
+ break;
+ case ctLogoMenuItem:
+ width = config.menuItemLogoWidth;
+ height = config.menuItemLogoHeight;
+ break;
+ case ctLogoTimer:
+ width = config.timersLogoWidth;
+ height = config.timersLogoHeight;
+ break;
+ default:
+ width = 1;
+ height = 1;
+ }
+ return cPoint(width, height);
+}
+
void cImageCache::CreateBackgroundImages(void) {
//Default Menus
CreateBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), geoManager->menuItemWidthDefault-2, geoManager->menuItemHeightDefault-2);
@@ -313,4 +497,19 @@ void cImageCache::Clear(void) {
delete img;
}
backgroundImages.clear();
+ for(std::map<int, cImage*>::const_iterator it = logoCache.begin(); it != logoCache.end(); it++) {
+ cImage *img = (cImage*)it->second;
+ delete img;
+ }
+ logoCache.clear();
+ for(std::map<int, cImage*>::const_iterator it = logoMenuItemCache.begin(); it != logoMenuItemCache.end(); it++) {
+ cImage *img = (cImage*)it->second;
+ delete img;
+ }
+ logoMenuItemCache.clear();
+ for(std::map<int, cImage*>::const_iterator it = logoTimerCache.begin(); it != logoTimerCache.end(); it++) {
+ cImage *img = (cImage*)it->second;
+ delete img;
+ }
+ logoTimerCache.clear();
} \ No newline at end of file
diff --git a/imagecache.h b/imagecache.h
index eb91d0d..f528011 100644
--- a/imagecache.h
+++ b/imagecache.h
@@ -12,6 +12,10 @@ using namespace Magick;
enum eCacheType {
ctMenuIcon = 0,
ctSkinIcon,
+ ctLogo,
+ ctLogoMenuItem,
+ ctLogoTimer,
+ ctBackground,
};
enum eBackgroundType {
btNone = -1,
@@ -49,23 +53,32 @@ public:
cImageCache();
~cImageCache();
void CreateCache(void);
- void CreateCache2(void);
+ void CreateCacheDelayed(void);
void Reload(void);
bool ThemeChanged(void);
cImage *GetMenuIcon(std::string name);
cImage *GetSkinIcon(std::string name, int width=0, int height=0, bool preserveAspect = true);
+ cImage *GetLogo(eCacheType type, const cChannel *channel);
cImage *GetBackground(eBackgroundType type);
cImage GetBackground(tColor back, tColor blend, int width, int height, bool flip = false);
+ std::string GetCacheSize(eCacheType type);
private:
bool initComplete;
+ cImage *tempStaticLogo;
std::string osdTheme;
std::map<std::string, cImage*> menuIconCache;
std::map<std::string, cImage*> skinIconCache;
+ std::map<int, cImage*> logoCache;
+ std::map<int, cImage*> logoMenuItemCache;
+ std::map<int, cImage*> logoTimerCache;
std::vector<cImage*> backgroundImages;
std::vector<std::pair<std::string, cPoint> > GetMenuIcons(void);
std::vector<std::pair<std::string, sImgProperties> > GetSkinIcons(void);
bool LoadIcon(eCacheType type, std::string name, int width, int height, bool preserveAspect = true);
- void InsertIntoCache(eCacheType type, std::string name, int width, int height, bool preserveAspect = true);
+ void InsertIntoIconCache(eCacheType type, std::string name, int width, int height, bool preserveAspect = true);
+ bool LoadLogo(const cChannel *channel);
+ void InsertIntoLogoCache(eCacheType type, int channelNumber);
+ cPoint LogoSize(eCacheType type);
void CreateBackgroundImages(void);
void Clear(void);
};
diff --git a/menudetailview.c b/menudetailview.c
index 962f28f..226c373 100644
--- a/menudetailview.c
+++ b/menudetailview.c
@@ -5,8 +5,9 @@
#include <dirent.h>
#include <vector>
-cNopacityMenuDetailView::cNopacityMenuDetailView(cOsd *osd) {
+cNopacityMenuDetailView::cNopacityMenuDetailView(cOsd *osd, cImageCache *imgCache) {
this->osd = osd;
+ this->imgCache = imgCache;
hasScrollbar = false;
hasManualPoster = false;
manualPosterPath = "";
@@ -274,7 +275,7 @@ bool cNopacityMenuDetailView::Scroll(bool Up, bool Page) {
//---------------cNopacityMenuDetailEventView---------------------
-cNopacityMenuDetailEventView::cNopacityMenuDetailEventView(cOsd *osd, const cEvent *Event) : cNopacityMenuDetailView(osd) {
+cNopacityMenuDetailEventView::cNopacityMenuDetailEventView(cOsd *osd, cImageCache *imgCache, const cEvent *Event) : cNopacityMenuDetailView(osd, imgCache) {
event = Event;
numEPGPics = 0;
}
@@ -378,7 +379,7 @@ void cNopacityMenuDetailEventView::CreatePixmaps(void) {
pixmapHeader = osd->CreatePixmap(3, cRect(x, top, width, headerHeight));
pixmapContent = osd->CreatePixmap(3, cRect(x + contentX, top + headerHeight, contentWidth, contentHeight),
cRect(0, 0, contentWidth, contentDrawPortHeight));
- pixmapLogo = osd->CreatePixmap(4, cRect(x + border, top + max((headerHeight-config.logoHeight)/2,1), config.detailViewLogoWidth, config.detailViewLogoHeight));
+ pixmapLogo = osd->CreatePixmap(4, cRect(x + border, top + max((headerHeight-config.logoHeight)/2,1), config.logoWidth, config.logoHeight));
pixmapHeader->Fill(clrTransparent);
pixmapHeader->DrawRectangle(cRect(0, headerHeight - 2, width, 2), Theme.Color(clrMenuBorder));
@@ -454,15 +455,16 @@ int cNopacityMenuDetailEventView::HeightEPGPics(void) {
}
void cNopacityMenuDetailEventView::DrawHeader(void) {
- cImageLoader imgLoader;
- int logoWidth = config.detailViewLogoWidth;
+ int logoWidth = config.logoWidth;
cChannel *channel = Channels.GetByChannelID(event->ChannelID(), true);
- if (channel && channel->Name() && imgLoader.LoadLogo(channel->Name(), logoWidth, config.detailViewLogoHeight)) {
- pixmapLogo->DrawImage(cPoint(0, max((headerHeight - config.detailViewLogoHeight - border)/2, 0)), imgLoader.GetImage());
- } else if (channel && imgLoader.LoadLogo(*(channel->GetChannelID().ToString()), logoWidth, config.detailViewLogoHeight)) {
- pixmapLogo->DrawImage(cPoint(0, max((headerHeight - config.detailViewLogoHeight - border)/2, 0)), imgLoader.GetImage());
+ if (channel) {
+ cImage *logo = imgCache->GetLogo(ctLogo, channel);
+ if (logo) {
+ pixmapLogo->DrawImage(cPoint(0, max((headerHeight - config.logoHeight - border)/2, 0)), *logo);
+ }
}
int widthTextHeader = width - 4 * border - logoWidth;
+ cImageLoader imgLoader;
if (imgLoader.LoadEPGImage(event->EventID())) {
pixmapHeader->DrawImage(cPoint(width - config.epgImageWidth - border, (headerHeight-config.epgImageHeight)/2), imgLoader.GetImage());
if (config.roundedCorners) {
@@ -585,7 +587,7 @@ void cNopacityMenuDetailEventView::DrawEPGPictures(int height) {
//------------------cNopacityMenuDetailRecordingView------------------
-cNopacityMenuDetailRecordingView::cNopacityMenuDetailRecordingView(cOsd *osd, const cRecording *Recording) : cNopacityMenuDetailView(osd) {
+cNopacityMenuDetailRecordingView::cNopacityMenuDetailRecordingView(cOsd *osd, const cRecording *Recording) : cNopacityMenuDetailView(osd, NULL) {
recording = Recording;
info = Recording->Info();
}
@@ -1014,7 +1016,7 @@ int cNopacityMenuDetailRecordingView::ReadSizeVdr(const char *strPath) {
//---------------cNopacityMenuDetailTextView---------------------
-cNopacityMenuDetailTextView::cNopacityMenuDetailTextView(cOsd *osd, const char *text) : cNopacityMenuDetailView(osd) {
+cNopacityMenuDetailTextView::cNopacityMenuDetailTextView(cOsd *osd, const char *text) : cNopacityMenuDetailView(osd, NULL) {
this->text = text;
}
diff --git a/menudetailview.h b/menudetailview.h
index 6b12e5a..90c8d2b 100644
--- a/menudetailview.h
+++ b/menudetailview.h
@@ -4,6 +4,7 @@
class cNopacityMenuDetailView : public cThread {
protected:
cOsd *osd;
+ cImageCache *imgCache;
bool hasScrollbar;
int x, width, height, top;
int headerHeight;
@@ -39,7 +40,7 @@ protected:
void DrawFanart(int height);
virtual void Action(void) {};
public:
- cNopacityMenuDetailView(cOsd *osd);
+ cNopacityMenuDetailView(cOsd *osd, cImageCache *imgCache);
virtual ~cNopacityMenuDetailView(void);
void SetGeometry(int x, int width, int height, int top, int contentBorder, int headerHeight);
virtual void SetFonts(void) = 0;
@@ -65,7 +66,7 @@ private:
void DrawEPGPictures(int height);
void Action(void);
public:
- cNopacityMenuDetailEventView(cOsd *osd, const cEvent *Event);
+ cNopacityMenuDetailEventView(cOsd *osd, cImageCache *imgCache, const cEvent *Event);
virtual ~cNopacityMenuDetailEventView(void);
void SetContent(void);
void SetContentHeight(void);
diff --git a/menuitem.c b/menuitem.c
index a4190bf..cf6dca1 100644
--- a/menuitem.c
+++ b/menuitem.c
@@ -531,11 +531,9 @@ void cNopacityScheduleMenuItem::DrawBackground(int textLeft) {
void cNopacityScheduleMenuItem::DrawLogo(int logoWidth, int logoHeight) {
if (Channel && Channel->Name()) {
- cImageLoader imgLoader;
- if (imgLoader.LoadLogo(Channel->Name(), logoWidth, logoHeight)) {
- pixmapIcon->DrawImage(cPoint(1, 1), imgLoader.GetImage());
- } else if (imgLoader.LoadLogo(*(Channel->GetChannelID().ToString()), logoWidth, logoHeight)) {
- pixmapIcon->DrawImage(cPoint(1, 1), imgLoader.GetImage());
+ cImage *logo = imgCache->GetLogo(ctLogoMenuItem, Channel);
+ if (logo) {
+ pixmapIcon->DrawImage(cPoint(1,1), *logo);
} else {
cTextWrapper channel;
channel.Set(Channel->Name(), font, logoWidth);
@@ -776,15 +774,11 @@ std::string cNopacityChannelMenuItem::readEPG(void) {
void cNopacityChannelMenuItem::Render() {
if (selectable) { //Channels
DrawBackground();
- int logoWidth = config.menuItemLogoWidth;
- int logoHeight = config.menuItemLogoHeight;
if (!drawn) {
- cImageLoader imgLoader;
- if (imgLoader.LoadLogo(Channel->Name(), logoWidth, logoHeight)) {
- pixmapIcon->DrawImage(cPoint(1, 1), imgLoader.GetImage());
- } else if (imgLoader.LoadLogo(*(Channel->GetChannelID().ToString()), logoWidth, logoHeight)) {
- pixmapIcon->DrawImage(cPoint(1, 1), imgLoader.GetImage());
- }
+ cImage *logo = imgCache->GetLogo(ctLogoMenuItem, Channel);
+ if (logo) {
+ pixmapIcon->DrawImage(cPoint(1,1), *logo);
+ }
drawn = true;
}
SetTextShort();
@@ -953,11 +947,9 @@ void cNopacityTimerMenuItem::Render() {
void cNopacityTimerMenuItem::DrawLogo(int logoWidth, int logoHeight) {
if (Timer && Timer->Channel() && Timer->Channel()->Name()) {
- cImageLoader imgLoader;
- if (imgLoader.LoadLogo(Timer->Channel()->Name(), logoWidth, logoHeight)) {
- pixmapIcon->DrawImage(cPoint(1, 1), imgLoader.GetImage());
- } else if (imgLoader.LoadLogo(*(Timer->Channel()->GetChannelID().ToString()), logoWidth, logoHeight)) {
- pixmapIcon->DrawImage(cPoint(1, 1), imgLoader.GetImage());
+ cImage *logo = imgCache->GetLogo(ctLogoMenuItem, Timer->Channel());
+ if (logo) {
+ pixmapIcon->DrawImage(cPoint(1,1), *logo);
} else {
cTextWrapper channel;
channel.Set(Timer->Channel()->Name(), font, logoWidth);
diff --git a/po/ca_ES.po b/po/ca_ES.po
index 8f63321..cfef07f 100644
--- a/po/ca_ES.po
+++ b/po/ca_ES.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: skinnopacity 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2013-09-30 19:08+0200\n"
+"POT-Creation-Date: 2013-10-03 10:12+0200\n"
"PO-Revision-Date: 2013-03-19 22:56+0100\n"
"Last-Translator: Gabychan <gbonich@gmail.com>\n"
"Language-Team: \n"
@@ -26,6 +26,9 @@ msgstr "lliure"
msgid "Volume"
msgstr "Volum"
+msgid "images"
+msgstr ""
+
msgid "Actors"
msgstr ""
@@ -104,6 +107,9 @@ msgstr "Pistes d'àudio"
msgid "Messages"
msgstr "Missatges"
+msgid "Image Caching"
+msgstr ""
+
msgid "RSS Feeds"
msgstr "Feeds RSS"
@@ -332,12 +338,6 @@ msgstr "Mostra imatges addicionals a vista detallada EPG"
msgid "Number of EPG pictures to display"
msgstr "Nombre d'imatges EPG a mostrar"
-msgid "Detail EPG View Logo Width"
-msgstr "Amplada logo a vista detallada EPG"
-
-msgid "Detail EPG View Logo Height"
-msgstr "Alçada logo a vista detallada EPG"
-
msgid "Detail EPG View EPG Image Width"
msgstr "Amplada imatges a vista detallada EPG"
@@ -521,6 +521,36 @@ msgstr "Amplada Visualització volum (% Amplada OSD)"
msgid "Height of Volume Display (Percent of OSD Height)"
msgstr "Alçada Visualització volum (% Alçada OSD)"
+msgid "Limit Logo Cache"
+msgstr ""
+
+msgid "Maximal number of logos to cache"
+msgstr ""
+
+msgid "Number of logos to cache at start"
+msgstr ""
+
+msgid "Cache Sizes"
+msgstr ""
+
+msgid "Menu Icon cache"
+msgstr ""
+
+msgid "Skin Icon image cache"
+msgstr ""
+
+msgid "Logo cache"
+msgstr ""
+
+msgid "Menu Item Logo cache"
+msgstr ""
+
+msgid "Timer Logo cache"
+msgstr ""
+
+msgid "Background Images cache"
+msgstr ""
+
msgid "none"
msgstr "cap"
@@ -571,3 +601,9 @@ msgstr "conflicte"
msgid "conflicts"
msgstr "conflictes"
+
+#~ msgid "Detail EPG View Logo Width"
+#~ msgstr "Amplada logo a vista detallada EPG"
+
+#~ msgid "Detail EPG View Logo Height"
+#~ msgstr "Alçada logo a vista detallada EPG"
diff --git a/po/de_DE.po b/po/de_DE.po
index 16e5ee0..8addf92 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: skinnopacity 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2013-09-18 11:22+0200\n"
+"POT-Creation-Date: 2013-10-03 10:12+0200\n"
"PO-Revision-Date: 2012-11-11 17:49+0200\n"
"Last-Translator: louis\n"
"Language-Team: \n"
@@ -23,6 +23,9 @@ msgstr "frei"
msgid "Volume"
msgstr "Lautstärke"
+msgid "images"
+msgstr "Bilder"
+
msgid "Actors"
msgstr "Schauspieler"
@@ -60,7 +63,7 @@ msgid "Duration"
msgstr "Dauer"
msgid "recording"
-msgstr "Rec"
+msgstr "Aufnahme"
msgid "recordings"
msgstr "Aufnahmen"
@@ -101,6 +104,9 @@ msgstr "Audio Spuren"
msgid "Messages"
msgstr "Nachrichten"
+msgid "Image Caching"
+msgstr "Bilder Cache"
+
msgid "RSS Feeds"
msgstr "RSS Feeds"
@@ -329,12 +335,6 @@ msgstr "Weitere EPG Bilder in der detaillierten EPG Ansicht anzeigen"
msgid "Number of EPG pictures to display"
msgstr "Anzahl der zusätzlichen EPG Bilder"
-msgid "Detail EPG View Logo Width"
-msgstr "Breite der Kanallogos in der EPG Detailanzeige"
-
-msgid "Detail EPG View Logo Height"
-msgstr "Höhe der Kanallogos in der EPG Detailanzeige"
-
msgid "Detail EPG View EPG Image Width"
msgstr "Breite der EPG Bilder in der EPG Detailanzeige"
@@ -518,6 +518,36 @@ msgstr "Breite der Lautstärken Anzeige (% der OSD Breite)"
msgid "Height of Volume Display (Percent of OSD Height)"
msgstr "Höhe der Lautstärken Anzeige (% der OSD Höhe)"
+msgid "Limit Logo Cache"
+msgstr "Logo Cache beschränken"
+
+msgid "Maximal number of logos to cache"
+msgstr "Maximale Anzahl Logos"
+
+msgid "Number of logos to cache at start"
+msgstr "Anzahl der zu cachenden Logos beim Start"
+
+msgid "Cache Sizes"
+msgstr "Cache Größe"
+
+msgid "Menu Icon cache"
+msgstr "Menü Icon Cache"
+
+msgid "Skin Icon image cache"
+msgstr "Skin Icon Cache"
+
+msgid "Logo cache"
+msgstr "Logo Cache"
+
+msgid "Menu Item Logo cache"
+msgstr "Menüelement Logo Cache"
+
+msgid "Timer Logo cache"
+msgstr "Timer Logo Cache"
+
+msgid "Background Images cache"
+msgstr "Hintergrundbilder Cache"
+
msgid "none"
msgstr "keiner"
@@ -568,3 +598,9 @@ msgstr "Konflikt"
msgid "conflicts"
msgstr "Konflikte"
+
+#~ msgid "Detail EPG View Logo Width"
+#~ msgstr "Breite der Kanallogos in der EPG Detailanzeige"
+
+#~ msgid "Detail EPG View Logo Height"
+#~ msgstr "Höhe der Kanallogos in der EPG Detailanzeige"
diff --git a/po/it_IT.po b/po/it_IT.po
index 551419f..81c2940 100644
--- a/po/it_IT.po
+++ b/po/it_IT.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: skinnopacity 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2013-09-30 19:08+0200\n"
+"POT-Creation-Date: 2013-10-03 10:12+0200\n"
"PO-Revision-Date: 2013-03-19 22:56+0100\n"
"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n"
"Language-Team: \n"
@@ -26,6 +26,9 @@ msgstr "disponibili"
msgid "Volume"
msgstr "Volume"
+msgid "images"
+msgstr ""
+
msgid "Actors"
msgstr ""
@@ -104,6 +107,9 @@ msgstr "Tracce audio"
msgid "Messages"
msgstr "Messaggi"
+msgid "Image Caching"
+msgstr ""
+
msgid "RSS Feeds"
msgstr ""
@@ -332,12 +338,6 @@ msgstr "Mostra immagini EPG aggiuntivo in vista dettagli EPG"
msgid "Number of EPG pictures to display"
msgstr "Numero di immagini EPG da mostrare"
-msgid "Detail EPG View Logo Width"
-msgstr "Larghezza logo vista dettagli EPG"
-
-msgid "Detail EPG View Logo Height"
-msgstr "Altezza logo vista dettagli EPG"
-
msgid "Detail EPG View EPG Image Width"
msgstr "Larghezza immagine vista dettagli EPG"
@@ -521,6 +521,36 @@ msgstr "Larghezza di Mostra volume (% altezza OSD)"
msgid "Height of Volume Display (Percent of OSD Height)"
msgstr "Altezza di Mostra volume (% altezza OSD)"
+msgid "Limit Logo Cache"
+msgstr ""
+
+msgid "Maximal number of logos to cache"
+msgstr ""
+
+msgid "Number of logos to cache at start"
+msgstr ""
+
+msgid "Cache Sizes"
+msgstr ""
+
+msgid "Menu Icon cache"
+msgstr ""
+
+msgid "Skin Icon image cache"
+msgstr ""
+
+msgid "Logo cache"
+msgstr ""
+
+msgid "Menu Item Logo cache"
+msgstr ""
+
+msgid "Timer Logo cache"
+msgstr ""
+
+msgid "Background Images cache"
+msgstr ""
+
msgid "none"
msgstr ""
@@ -571,3 +601,9 @@ msgstr "conflitto"
msgid "conflicts"
msgstr "conflitti"
+
+#~ msgid "Detail EPG View Logo Width"
+#~ msgstr "Larghezza logo vista dettagli EPG"
+
+#~ msgid "Detail EPG View Logo Height"
+#~ msgstr "Altezza logo vista dettagli EPG"
diff --git a/po/sk_SK.po b/po/sk_SK.po
index 044f99e..cd291e1 100644
--- a/po/sk_SK.po
+++ b/po/sk_SK.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-skinnopacity\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2013-09-30 19:08+0200\n"
+"POT-Creation-Date: 2013-10-03 10:12+0200\n"
"PO-Revision-Date: 2013-09-16 19:34+0100\n"
"Last-Translator: Milan Hrala <hrala.milan@gmail.com>\n"
"Language-Team: \n"
@@ -23,6 +23,9 @@ msgstr "voµné"
msgid "Volume"
msgstr "Hlasitos»"
+msgid "images"
+msgstr ""
+
msgid "Actors"
msgstr "Herci"
@@ -101,6 +104,9 @@ msgstr "Zvuková stopa"
msgid "Messages"
msgstr "Správy"
+msgid "Image Caching"
+msgstr ""
+
msgid "RSS Feeds"
msgstr "RSS èítaèky"
@@ -329,12 +335,6 @@ msgstr "Zobrazi» viac obrázkov v podrobnostiach EPG"
msgid "Number of EPG pictures to display"
msgstr "Poèet EPG obrázkov na obrazovke"
-msgid "Detail EPG View Logo Width"
-msgstr "©írka loga v podrobnom zobrazení EPG"
-
-msgid "Detail EPG View Logo Height"
-msgstr "Vý¹ka loga v podrobnom zobrazení EPG"
-
msgid "Detail EPG View EPG Image Width"
msgstr "©írka obrázku v podrobnom zobrazení EPG"
@@ -518,6 +518,36 @@ msgstr "©írka zobrazenia hlasitosti (Percent z OSD ¹írky)"
msgid "Height of Volume Display (Percent of OSD Height)"
msgstr "Vý¹ka zobrazenia hlasitosti (Percento z OSD vý¹ky)"
+msgid "Limit Logo Cache"
+msgstr ""
+
+msgid "Maximal number of logos to cache"
+msgstr ""
+
+msgid "Number of logos to cache at start"
+msgstr ""
+
+msgid "Cache Sizes"
+msgstr ""
+
+msgid "Menu Icon cache"
+msgstr ""
+
+msgid "Skin Icon image cache"
+msgstr ""
+
+msgid "Logo cache"
+msgstr ""
+
+msgid "Menu Item Logo cache"
+msgstr ""
+
+msgid "Timer Logo cache"
+msgstr ""
+
+msgid "Background Images cache"
+msgstr ""
+
msgid "none"
msgstr "¾iadny"
@@ -568,3 +598,9 @@ msgstr "konflikt"
msgid "conflicts"
msgstr "konflikty"
+
+#~ msgid "Detail EPG View Logo Width"
+#~ msgstr "©írka loga v podrobnom zobrazení EPG"
+
+#~ msgid "Detail EPG View Logo Height"
+#~ msgstr "Vý¹ka loga v podrobnom zobrazení EPG"
diff --git a/setup.c b/setup.c
index 038780a..5278fd4 100644
--- a/setup.c
+++ b/setup.c
@@ -10,10 +10,12 @@ cNopacitySetup::cNopacitySetup(cImageCache *imgCache) {
cNopacitySetup::~cNopacitySetup() {
config.setDynamicValues();
+ int start = cTimeMs::Now();
geoManager->SetGeometry();
fontManager->DeleteFonts();
fontManager->SetFonts();
imgCache->Reload();
+ dsyslog("nopacity: Cache reloaded in %d ms", int(cTimeMs::Now()-start));
}
@@ -32,6 +34,7 @@ void cNopacitySetup::Setup(void) {
Add(new cOsdItem(tr("Audio Tracks")));
Add(new cOsdItem(tr("Messages")));
Add(new cOsdItem(tr("Volume")));
+ Add(new cOsdItem(tr("Image Caching")));
Add(new cOsdItem(tr("RSS Feeds")));
SetCurrent(Get(currentItem));
@@ -68,6 +71,8 @@ eOSState cNopacitySetup::ProcessKey(eKeys Key) {
state = AddSubMenu(new cNopacitySetupMessageDisplay(&tmpNopacityConfig));
if (strcmp(ItemText, tr("Volume")) == 0)
state = AddSubMenu(new cNopacitySetupVolumeDisplay(&tmpNopacityConfig));
+ if (strcmp(ItemText, tr("Image Caching")) == 0)
+ state = AddSubMenu(new cNopacitySetupCaching(&tmpNopacityConfig, imgCache));
if (strcmp(ItemText, tr("RSS Feeds")) == 0)
state = AddSubMenu(new cNopacitySetupRssFeed(&tmpNopacityConfig));
}
@@ -178,8 +183,6 @@ void cNopacitySetup::Store(void) {
SetupStore("menuItemLogoHeight", config.menuItemLogoHeight);
SetupStore("menuHeaderLogoWidth", config.menuHeaderLogoWidth);
SetupStore("menuHeaderLogoHeight", config.menuHeaderLogoHeight);
- SetupStore("detailViewLogoWidth", config.detailViewLogoWidth);
- SetupStore("detailViewLogoHeight", config.detailViewLogoHeight);
SetupStore("timersLogoWidth", config.timersLogoWidth);
SetupStore("timersLogoHeight", config.timersLogoHeight);
SetupStore("epgImageWidth", config.epgImageWidth);
@@ -231,6 +234,9 @@ void cNopacitySetup::Store(void) {
SetupStore("rssFeedHeightStandalone", config.rssFeedHeightStandalone);
SetupStore("fontRssFeedStandalone", config.fontRssFeedStandalone);
SetupStore("rssFeedStandalonePos", config.rssFeedStandalonePos);
+ SetupStore("limitLogoCache", config.limitLogoCache);
+ SetupStore("numLogosInitial", config.numLogosInitial);
+ SetupStore("numLogosMax", config.numLogosMax);
}
//------------------------------------------------------------------------------------------------------------------
@@ -401,8 +407,6 @@ void cNopacitySetupMenuDisplaySchedules::Set(void) {
Add(new cMenuEditStraItem(tr("Display additional EPG Pictures in detailed EPG View"), &tmpNopacityConfig->displayAdditionalEPGPictures, 3, displayEPGPictures));
if (tmpNopacityConfig->displayAdditionalEPGPictures)
Add(new cMenuEditIntItem(cString::sprintf("%s%s", *spacer, tr("Number of EPG pictures to display")), &tmpNopacityConfig->numAdditionalEPGPictures, 1, 9));
- Add(new cMenuEditIntItem(tr("Detail EPG View Logo Width"), &tmpNopacityConfig->detailViewLogoWidth, 30, 500));
- Add(new cMenuEditIntItem(tr("Detail EPG View Logo Height"), &tmpNopacityConfig->detailViewLogoHeight, 30, 500));
Add(new cMenuEditIntItem(tr("Detail EPG View EPG Image Width"), &tmpNopacityConfig->epgImageWidth, 30, 500));
Add(new cMenuEditIntItem(tr("Detail EPG View EPG Image Height"), &tmpNopacityConfig->epgImageHeight, 30, 500));
Add(new cMenuEditIntItem(tr("Detail EPG View additional EPG Image Width"), &tmpNopacityConfig->epgImageWidthLarge, 100, 800));
@@ -630,6 +634,35 @@ void cNopacitySetupVolumeDisplay::Set(void) {
Display();
}
+//-----Image Caching-------------------------------------------------------------------------------------------------------------
+
+cNopacitySetupCaching::cNopacitySetupCaching(cNopacityConfig* data, cImageCache *imgCache) : cMenuSetupSubMenu(tr("Image Caching"), data) {
+ this->imgCache = imgCache;
+ Set();
+}
+
+void cNopacitySetupCaching::Set(void) {
+ int currentItem = Current();
+ Clear();
+
+ Add(new cMenuEditBoolItem(tr("Limit Logo Cache"), &tmpNopacityConfig->limitLogoCache));
+ if (tmpNopacityConfig->limitLogoCache) {
+ Add(new cMenuEditIntItem(cString::sprintf("%s%s", *spacer, tr("Maximal number of logos to cache")), &tmpNopacityConfig->numLogosMax, 1, 9999));
+ }
+ Add(new cMenuEditIntItem(tr("Number of logos to cache at start"), &tmpNopacityConfig->numLogosInitial, 0, 9999));
+
+ Add(InfoItem(tr("Cache Sizes"), ""));
+ Add(InfoItem(tr("Menu Icon cache"), (imgCache->GetCacheSize(ctMenuIcon)).c_str()));
+ Add(InfoItem(tr("Skin Icon image cache"), (imgCache->GetCacheSize(ctSkinIcon)).c_str()));
+ Add(InfoItem(tr("Logo cache"), (imgCache->GetCacheSize(ctLogo)).c_str()));
+ Add(InfoItem(tr("Menu Item Logo cache"), (imgCache->GetCacheSize(ctLogoMenuItem)).c_str()));
+ Add(InfoItem(tr("Timer Logo cache"), (imgCache->GetCacheSize(ctLogoTimer)).c_str()));
+ Add(InfoItem(tr("Background Images cache"), (imgCache->GetCacheSize(ctBackground)).c_str()));
+
+ SetCurrent(Get(currentItem));
+ Display();
+}
+
//-----RSS Feeds-------------------------------------------------------------------------------------------------------------
cNopacitySetupRssFeed::cNopacitySetupRssFeed(cNopacityConfig* data) : cMenuSetupSubMenu(tr("RSS Feeds"), data) {
diff --git a/setup.h b/setup.h
index 4e8a4a0..6429ae4 100644
--- a/setup.h
+++ b/setup.h
@@ -6,8 +6,8 @@ class cNopacitySetup : public cMenuSetupPage {
cNopacitySetup(cImageCache *imgCache);
virtual ~cNopacitySetup();
private:
- cImageCache *imgCache;
cNopacityConfig tmpNopacityConfig;
+ cImageCache *imgCache;
cStringList fontNames;
void Setup(void);
protected:
@@ -121,6 +121,15 @@ class cNopacitySetupVolumeDisplay : public cMenuSetupSubMenu {
public:
cNopacitySetupVolumeDisplay(cNopacityConfig *data);
};
+
+class cNopacitySetupCaching : public cMenuSetupSubMenu {
+ protected:
+ cImageCache *imgCache;
+ void Set(void);
+ public:
+ cNopacitySetupCaching(cNopacityConfig *data, cImageCache *imgCache);
+};
+
class cNopacitySetupRssFeed : public cMenuSetupSubMenu {
protected:
const char *scrollSpeed[3];
diff --git a/timers.c b/timers.c
index a90521d..929d5d7 100644
--- a/timers.c
+++ b/timers.c
@@ -176,13 +176,16 @@ void cNopacityTimer::DrawLogo(void) {
int logoWidth = config.timersLogoWidth;
int logoHeight = config.timersLogoHeight;
const cChannel *Channel = timer->Channel();
- if (Channel && Channel->Name()) {
- cImageLoader imgLoader;
- if (showTimerLogo && imgLoader.LoadLogo(Channel->Name(), logoWidth, logoHeight)) {
- pixmapLogo->DrawImage(cPoint((width - logoWidth)/2, 1), imgLoader.GetImage());
- } else if (showTimerLogo && imgLoader.LoadLogo(*(Channel->GetChannelID().ToString()), logoWidth, logoHeight)) {
- pixmapLogo->DrawImage(cPoint((width - logoWidth)/2, 1), imgLoader.GetImage());
- } else {
+ if (Channel) {
+ bool logoFound = false;
+ if (showTimerLogo) {
+ cImage *logo = imgCache->GetLogo(ctLogoTimer, Channel);
+ if (logo) {
+ logoFound = true;
+ pixmapLogo->DrawImage(cPoint((width - logoWidth)/2, 1), *logo);
+ }
+ }
+ if (!showTimerLogo || !logoFound) {
cTextWrapper channel;
channel.Set(Channel->Name(), fontLarge, width - 10);
int lines = channel.Lines();