diff --git a/libcore/imagecache.c b/libcore/imagecache.c index 9ac9050..cfaf255 100644 --- a/libcore/imagecache.c +++ b/libcore/imagecache.c @@ -46,25 +46,24 @@ void cImageCache::CacheLogo(int width, int height) { if (width == 0 || height == 0) return; - int channelsCached = 0; + int logosCached = 0; for (const cChannel *channel = Channels.First(); channel; channel = Channels.Next(channel)) { - if (channelsCached >= config.numLogosPerSizeInitial) + if (logosCached >= config.numLogosPerSizeInitial) break; if (channel->GroupSep()) { continue; } + stringstream logoName; + logoName << *channel->GetChannelID().ToString() << "_" << width << "x" << height; + map::iterator hit = channelLogoCache.find(logoName.str()); + if (hit != channelLogoCache.end()) { + continue; + } bool success = LoadLogo(channel); if (success) { - channelsCached++; + logosCached++; cImage *image = CreateImage(width, height); - stringstream logoName; - logoName << *channel->GetChannelID().ToString() << "_" << width << "x" << height; - std::map::iterator hit = channelLogoCache.find(logoName.str()); - if (hit != channelLogoCache.end()) { - delete image; - return; - } channelLogoCache.insert(pair(logoName.str(), image)); } } @@ -158,13 +157,7 @@ bool cImageCache::SeparatorLogoExists(string name) { void cImageCache::CacheIcon(eImageType type, string name, int width, int height) { if (width < 1 || width > 1920 || height < 1 || height > 1080) return; - bool success = LoadIcon(type, name); - if (!success) - return; - stringstream iconName; - iconName << name << "_" << width << "x" << height; - cImage *image = CreateImage(width, height, true); - iconCache.insert(pair(iconName.str(), image)); + GetIcon(type, name, width, height); } cImage *cImageCache::GetIcon(eImageType type, string name, int width, int height) { @@ -281,13 +274,7 @@ bool cImageCache::MenuIconExists(string name) { void cImageCache::CacheSkinpart(string name, int width, int height) { if (width < 1 || width > 1920 || height < 1 || height > 1080) return; - bool success = LoadSkinpart(name); - if (!success) - return; - stringstream iconName; - iconName << name << "_" << width << "x" << height; - cImage *image = CreateImage(width, height, false); - skinPartsCache.insert(pair(iconName.str(), image)); + GetSkinpart(name, width, height); } cImage *cImageCache::GetSkinpart(string name, int width, int height) { diff --git a/libtemplate/template.c b/libtemplate/template.c index 4edbe4a..ef7d677 100644 --- a/libtemplate/template.c +++ b/libtemplate/template.c @@ -104,7 +104,6 @@ vector< pair > cTemplate::GetUsedFonts(void) { void cTemplate::CacheImages(void) { CacheImages(rootView); - rootView->InitSubViewIterator(); cTemplateView *subView = NULL; while(subView = rootView->GetNextSubView()) { @@ -113,9 +112,7 @@ void cTemplate::CacheImages(void) { } void cTemplate::Debug(void) { - rootView->Debug(); - } /******************************************************************* @@ -213,13 +210,7 @@ void cTemplate::CacheImages(cTemplateView *view) { viewElement->InitIterator(); cTemplatePixmap *pix = NULL; while(pix = viewElement->GetNextPixmap()) { - pix->InitIterator(); - cTemplateFunction *func = NULL; - while(func = pix->GetNextFunction()) { - if (func->GetType() == ftDrawImage) { - CacheImage(func); - } - } + CachePixmapImages(pix); } } //used images in viewLists pixmaps @@ -229,40 +220,40 @@ void cTemplate::CacheImages(cTemplateView *view) { viewList->InitIterator(); cTemplatePixmap *pix = NULL; while(pix = viewList->GetNextPixmap()) { - pix->InitIterator(); - cTemplateFunction *func = NULL; - while(func = pix->GetNextFunction()) { - if (func->GetType() == ftDrawImage) { - CacheImage(func); - } - } + CachePixmapImages(pix); } cTemplateViewElement *listElement = viewList->GetListElement(); listElement->InitIterator(); while(pix = listElement->GetNextPixmap()) { - pix->InitIterator(); - cTemplateFunction *func = NULL; - while(func = pix->GetNextFunction()) { - if (func->GetType() == ftDrawImage) { - CacheImage(func); - } - } + CachePixmapImages(pix); + } + cTemplateViewElement *currentElement = viewList->GetListElementCurrent(); + if (!currentElement) { + continue; + } + currentElement->InitIterator(); + while(pix = currentElement->GetNextPixmap()) { + CachePixmapImages(pix); } } - //used logos in viewTabs + //used images in viewTabs view->InitViewTabIterator(); cTemplateViewTab *viewTab = NULL; while(viewTab = view->GetNextViewTab()) { - viewTab->InitIterator(); - cTemplateFunction *func = NULL; - while(func = viewTab->GetNextFunction()) { - if (func->GetType() == ftDrawImage) { - CacheImage(func); - } - } + CachePixmapImages(viewTab); } } +void cTemplate::CachePixmapImages(cTemplatePixmap *pix) { + pix->InitIterator(); + cTemplateFunction *func = NULL; + while(func = pix->GetNextFunction()) { + if (func->GetType() == ftDrawImage) { + CacheImage(func); + } + } +} + void cTemplate::CacheImage(cTemplateFunction *func) { eImageType imgType = (eImageType)func->GetNumericParameter(ptImageType); int width = func->GetNumericParameter(ptWidth); diff --git a/libtemplate/template.h b/libtemplate/template.h index a4ef238..2c1cfb2 100644 --- a/libtemplate/template.h +++ b/libtemplate/template.h @@ -32,6 +32,7 @@ enum eViewType { class cTemplate { private: eViewType viewType; + void CachePixmapImages(cTemplatePixmap *pix); void CacheImage(cTemplateFunction *func); protected: cGlobals *globals; diff --git a/skindesclient-0.0.1/libskindesigner/services.h b/skindesclient-0.0.1/libskindesigner/services.h index 845cedb..2ae188d 100644 --- a/skindesclient-0.0.1/libskindesigner/services.h +++ b/skindesclient-0.0.1/libskindesigner/services.h @@ -25,26 +25,26 @@ public: // Data structure for service "RegisterPlugin" class RegisterPlugin { public: - RegisterPlugin(void) { - name = ""; - }; - void SetMenu(int key, string templateName) { - menus.insert(pair(key, templateName)); - } + RegisterPlugin(void) { + name = ""; + }; + void SetMenu(int key, string templateName) { + menus.insert(pair(key, templateName)); + } // in - string name; //name of plugin - map< int, string > menus; //menus as key -> templatename hashmap + string name; //name of plugin + map< int, string > menus; //menus as key -> templatename hashmap //out }; // Data structure for service "GetDisplayMenu" class GetDisplayMenu { public: - GetDisplayMenu(void) { - displayMenu = NULL; - }; + GetDisplayMenu(void) { + displayMenu = NULL; + }; // in -//out - cSDDisplayMenu *displayMenu; +//out + cSDDisplayMenu *displayMenu; }; #endif //__SKINDESIGNERSERVICES_H \ No newline at end of file diff --git a/skindesclient-0.0.1/libskindesigner/skindesignerosdbase.c b/skindesclient-0.0.1/libskindesigner/skindesignerosdbase.c index c837798..f23f2a6 100644 --- a/skindesclient-0.0.1/libskindesigner/skindesignerosdbase.c +++ b/skindesclient-0.0.1/libskindesigner/skindesignerosdbase.c @@ -4,11 +4,11 @@ * cSkindesignerOsdItem **********************************************************************/ cSkindesignerOsdItem::cSkindesignerOsdItem(eOSState State) : cOsdItem(State) { - sdDisplayMenu = NULL; + sdDisplayMenu = NULL; } cSkindesignerOsdItem::cSkindesignerOsdItem(const char *Text, eOSState State, bool Selectable) : cOsdItem(Text, State, Selectable) { - sdDisplayMenu = NULL; + sdDisplayMenu = NULL; } cSkindesignerOsdItem::~cSkindesignerOsdItem() { @@ -16,33 +16,33 @@ cSkindesignerOsdItem::~cSkindesignerOsdItem() { } void cSkindesignerOsdItem::SetMenuItem(cSkinDisplayMenu *DisplayMenu, int Index, bool Current, bool Selectable) { - if (sdDisplayMenu) { - if (!sdDisplayMenu->SetItemPlugin(&stringTokens, &intTokens, &loopTokens, Index, Current, Selectable)) { - DisplayMenu->SetItem(Text(), Index, Current, Selectable); - } - } else { - DisplayMenu->SetItem(Text(), Index, Current, Selectable); - } + if (sdDisplayMenu) { + if (!sdDisplayMenu->SetItemPlugin(&stringTokens, &intTokens, &loopTokens, Index, Current, Selectable)) { + DisplayMenu->SetItem(Text(), Index, Current, Selectable); + } + } else { + DisplayMenu->SetItem(Text(), Index, Current, Selectable); + } } void cSkindesignerOsdItem::AddStringToken(string key, string value) { - stringTokens.insert(pair(key, value)); + stringTokens.insert(pair(key, value)); } void cSkindesignerOsdItem::AddIntToken(string key, int value) { - intTokens.insert(pair(key, value)); + intTokens.insert(pair(key, value)); } void cSkindesignerOsdItem::AddLoopToken(string loopName, map &tokens) { - map > >::iterator hitLoop = loopTokens.find(loopName); - if (hitLoop == loopTokens.end()) { - vector > tokenVector; - tokenVector.push_back(tokens); - loopTokens.insert(pair > >(loopName, tokenVector)); - } else { - vector > *tokenVector = &hitLoop->second; - tokenVector->push_back(tokens); - } + map > >::iterator hitLoop = loopTokens.find(loopName); + if (hitLoop == loopTokens.end()) { + vector > tokenVector; + tokenVector.push_back(tokens); + loopTokens.insert(pair > >(loopName, tokenVector)); + } else { + vector > *tokenVector = &hitLoop->second; + tokenVector->push_back(tokens); + } } @@ -50,12 +50,12 @@ void cSkindesignerOsdItem::AddLoopToken(string loopName, map &to * cSkindesignerOsdMenu **********************************************************************/ cSkindesignerOsdMenu::cSkindesignerOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4) : cOsdMenu(Title, c0, c1, c2, c3, c4) { - init = true; + init = true; displayText = false; - sdDisplayMenu = NULL; - pluginName = ""; - SetMenuCategory(mcPlugin); - SetSkinDesignerDisplayMenu(); + sdDisplayMenu = NULL; + pluginName = ""; + SetMenuCategory(mcPlugin); + SetSkinDesignerDisplayMenu(); } cSkindesignerOsdMenu::~cSkindesignerOsdMenu() { @@ -63,56 +63,56 @@ cSkindesignerOsdMenu::~cSkindesignerOsdMenu() { } void cSkindesignerOsdMenu::SetPluginMenu(int menu, eMenuType type) { - if (type == mtList) - displayText = false; - else if (type == mtText) - displayText = true; + if (type == mtList) + displayText = false; + else if (type == mtText) + displayText = true; - if (sdDisplayMenu) { - sdDisplayMenu->SetPluginMenu(pluginName, menu, type, init); - } + if (sdDisplayMenu) { + sdDisplayMenu->SetPluginMenu(pluginName, menu, type, init); + } init = false; } bool cSkindesignerOsdMenu::SetSkinDesignerDisplayMenu(void) { - static cPlugin *pSkinDesigner = cPluginManager::GetPlugin("skindesigner"); - if (!pSkinDesigner) { - return false; - } - GetDisplayMenu call; - bool ok = pSkinDesigner->Service("GetDisplayMenu", &call); - if (ok && call.displayMenu) { - sdDisplayMenu = call.displayMenu; - return true; - } - return false; + static cPlugin *pSkinDesigner = cPluginManager::GetPlugin("skindesigner"); + if (!pSkinDesigner) { + return false; + } + GetDisplayMenu call; + bool ok = pSkinDesigner->Service("GetDisplayMenu", &call); + if (ok && call.displayMenu) { + sdDisplayMenu = call.displayMenu; + return true; + } + return false; } void cSkindesignerOsdMenu::ClearTokens(void) { - text = ""; + text = ""; stringTokens.clear(); intTokens.clear(); loopTokens.clear(); } void cSkindesignerOsdMenu::AddStringToken(string key, string value) { - stringTokens.insert(pair(key, value)); + stringTokens.insert(pair(key, value)); } void cSkindesignerOsdMenu::AddIntToken(string key, int value) { - intTokens.insert(pair(key, value)); + intTokens.insert(pair(key, value)); } void cSkindesignerOsdMenu::AddLoopToken(string loopName, map &tokens) { - map > >::iterator hitLoop = loopTokens.find(loopName); - if (hitLoop == loopTokens.end()) { - vector > tokenVector; - tokenVector.push_back(tokens); - loopTokens.insert(pair > >(loopName, tokenVector)); - } else { - vector > *tokenVector = &hitLoop->second; - tokenVector->push_back(tokens); - } + map > >::iterator hitLoop = loopTokens.find(loopName); + if (hitLoop == loopTokens.end()) { + vector > tokenVector; + tokenVector.push_back(tokens); + loopTokens.insert(pair > >(loopName, tokenVector)); + } else { + vector > *tokenVector = &hitLoop->second; + tokenVector->push_back(tokens); + } } void cSkindesignerOsdMenu::TextKeyLeft(void) { @@ -140,9 +140,9 @@ void cSkindesignerOsdMenu::TextKeyDown(void) { } void cSkindesignerOsdMenu::Display(void) { - if (displayText) { - if (sdDisplayMenu) { - if (sdDisplayMenu->SetPluginText(&stringTokens, &intTokens, &loopTokens)) { + if (displayText) { + if (sdDisplayMenu) { + if (sdDisplayMenu->SetPluginText(&stringTokens, &intTokens, &loopTokens)) { esyslog("skindesclient: template found"); sdDisplayMenu->Flush(); } else { @@ -151,19 +151,19 @@ void cSkindesignerOsdMenu::Display(void) { DisplayMenu()->SetText(text.c_str(), false); DisplayMenu()->Flush(); } - } else { + } else { DisplayMenu()->Clear(); - DisplayMenu()->SetText(text.c_str(), false); + DisplayMenu()->SetText(text.c_str(), false); DisplayMenu()->Flush(); - } + } return; - } - if (sdDisplayMenu) { - for (cOsdItem *item = First(); item; item = Next(item)) { - cSkindesignerOsdItem *sdItem = dynamic_cast(item); - if (sdItem) - sdItem->SetDisplayMenu(sdDisplayMenu); - } - } - cOsdMenu::Display(); + } + if (sdDisplayMenu) { + for (cOsdItem *item = First(); item; item = Next(item)) { + cSkindesignerOsdItem *sdItem = dynamic_cast(item); + if (sdItem) + sdItem->SetDisplayMenu(sdDisplayMenu); + } + } + cOsdMenu::Display(); } diff --git a/skindesclient-0.0.1/libskindesigner/skindesignerosdbase.h b/skindesclient-0.0.1/libskindesigner/skindesignerosdbase.h index f336a99..88068af 100644 --- a/skindesclient-0.0.1/libskindesigner/skindesignerosdbase.h +++ b/skindesclient-0.0.1/libskindesigner/skindesignerosdbase.h @@ -12,8 +12,8 @@ class cSkindesignerOsdItem : public cOsdItem { private: - cSDDisplayMenu *sdDisplayMenu; - map < string, string > stringTokens; + cSDDisplayMenu *sdDisplayMenu; + map < string, string > stringTokens; map < string, int > intTokens; map < string, vector< map< string, string > > > loopTokens; protected: @@ -22,9 +22,9 @@ public: cSkindesignerOsdItem(const char *Text, eOSState State = osUnknown, bool Selectable = true); virtual ~cSkindesignerOsdItem(); virtual void SetMenuItem(cSkinDisplayMenu *DisplayMenu, int Index, bool Current, bool Selectable); - void SetDisplayMenu(cSDDisplayMenu *sdDisplayMenu) { this->sdDisplayMenu = sdDisplayMenu; }; + void SetDisplayMenu(cSDDisplayMenu *sdDisplayMenu) { this->sdDisplayMenu = sdDisplayMenu; }; void AddStringToken(string key, string value); - void AddIntToken(string key, int value); + void AddIntToken(string key, int value); void AddLoopToken(string loopName, map &tokens); }; @@ -34,16 +34,16 @@ private: bool init; bool displayText; string pluginName; - cSDDisplayMenu *sdDisplayMenu; + cSDDisplayMenu *sdDisplayMenu; string text; map < string, string > stringTokens; map < string, int > intTokens; map < string, vector< map< string, string > > > loopTokens; - bool SetSkinDesignerDisplayMenu(void); + bool SetSkinDesignerDisplayMenu(void); protected: void ClearTokens(void); void SetPluginName(string name) {pluginName = name; }; - void SetPluginMenu(int menu, eMenuType type); + void SetPluginMenu(int menu, eMenuType type); void SetText(string text) { this->text = text; }; void AddStringToken(string key, string value); void AddIntToken(string key, int value); diff --git a/skindesclient-0.0.1/osdmenu.c b/skindesclient-0.0.1/osdmenu.c index aa1f983..e32b2d1 100644 --- a/skindesclient-0.0.1/osdmenu.c +++ b/skindesclient-0.0.1/osdmenu.c @@ -7,17 +7,17 @@ #include "libskindesigner/skindesignerosdbase.h" enum eMenus { - meListMain, + meListMain, meListSub, - meDetail + meDetail }; class cPlugOsdMenu : public cSkindesignerOsdMenu { private: - void SetMenu(int numItems, bool subfolder = false); + void SetMenu(int numItems, bool subfolder = false); void SetDetailView(int element); public: - cPlugOsdMenu(void); + cPlugOsdMenu(void); virtual ~cPlugOsdMenu(); virtual eOSState ProcessKey(eKeys key); }; @@ -28,12 +28,12 @@ public: //*************************************************************************** cPlugOsdMenu::cPlugOsdMenu(void) : cSkindesignerOsdMenu("Skindesigner Client") { - SetPluginName("skindesclient"); - SetMenu(10); + SetPluginName("skindesclient"); + SetMenu(10); } cPlugOsdMenu::~cPlugOsdMenu(void) { - + } eOSState cPlugOsdMenu::ProcessKey(eKeys key) { diff --git a/skins/nopacity/xmlfiles/displaymenuschedules.xml b/skins/nopacity/xmlfiles/displaymenuschedules.xml index 8330e4d..ddba121 100644 --- a/skins/nopacity/xmlfiles/displaymenuschedules.xml +++ b/skins/nopacity/xmlfiles/displaymenuschedules.xml @@ -209,5 +209,5 @@ + - \ No newline at end of file