fixed themes handling

This commit is contained in:
louis 2016-02-14 15:06:30 +01:00
parent 6eda200228
commit 7d20e87973
5 changed files with 17 additions and 6 deletions

View File

@ -31,6 +31,9 @@ cDesignerConfig::cDesignerConfig() {
cDesignerConfig::~cDesignerConfig() { cDesignerConfig::~cDesignerConfig() {
ClearSkinSetups(); ClearSkinSetups();
for (vector<cTheme*>::iterator it = themes.begin(); it != themes.end(); it++) {
delete *it;
}
} }
void cDesignerConfig::SetPathes(void) { void cDesignerConfig::SetPathes(void) {
@ -81,6 +84,10 @@ bool cDesignerConfig::GetThemeColor(string &name, tColor &col) {
return tmplGlobals->GetColor(name, col); return tmplGlobals->GetColor(name, col);
} }
void cDesignerConfig::StoreTheme(cTheme *theme) {
themes.push_back(theme);
}
void cDesignerConfig::ReadSkinFolder(cString &skinFolder, vector<string> *container) { void cDesignerConfig::ReadSkinFolder(cString &skinFolder, vector<string> *container) {
DIR *folder = NULL; DIR *folder = NULL;
struct dirent *dirEntry; struct dirent *dirEntry;
@ -171,7 +178,9 @@ cString cDesignerConfig::GetSkinPath(string skin) {
} }
void cDesignerConfig::AddNewSkinRef(string skin) { void cDesignerConfig::AddNewSkinRef(string skin) {
cSkinDesigner *newSkin = new cSkinDesigner(skin); cTheme *theme = new cTheme();
StoreTheme(theme);
cSkinDesigner *newSkin = new cSkinDesigner(skin, theme);
AddSkin(newSkin); AddSkin(newSkin);
skins.push_back(skin); skins.push_back(skin);
installerSkins.push_back(skin); installerSkins.push_back(skin);

View File

@ -35,6 +35,7 @@ private:
string osdLanguage; string osdLanguage;
cGlobals *tmplGlobals; cGlobals *tmplGlobals;
vector<cSkinDesigner*> skinRefs; vector<cSkinDesigner*> skinRefs;
vector<cTheme*> themes;
vector<cSkinDesigner*>::iterator skinRefsIterator; vector<cSkinDesigner*>::iterator skinRefsIterator;
vector<string> deliveredSkins; vector<string> deliveredSkins;
vector<string> installerSkins; vector<string> installerSkins;
@ -56,6 +57,7 @@ public:
void SetLogoPath(cString path); void SetLogoPath(cString path);
void SetEpgImagePath(cString path); void SetEpgImagePath(cString path);
bool GetThemeColor(string &name, tColor &col); bool GetThemeColor(string &name, tColor &col);
void StoreTheme(cTheme *theme);
void ReadSkins(void); void ReadSkins(void);
void ReadSkinSetup(string skin); void ReadSkinSetup(string skin);
void InitSkinIterator(void) { skinIterator = skins.begin(); }; void InitSkinIterator(void) { skinIterator = skins.begin(); };
@ -121,14 +123,12 @@ public:
cSDPluginManager *plgManager = NULL; cSDPluginManager *plgManager = NULL;
cFontManager *fontManager = NULL; cFontManager *fontManager = NULL;
cImageCache *imgCache = NULL; cImageCache *imgCache = NULL;
cTheme Theme;
cRecordingsFolderInfo recFolderInfo(Recordings); cRecordingsFolderInfo recFolderInfo(Recordings);
#else #else
extern cDesignerConfig config; extern cDesignerConfig config;
extern cSDPluginManager *plgManager; extern cSDPluginManager *plgManager;
extern cFontManager *fontManager; extern cFontManager *fontManager;
extern cImageCache *imgCache; extern cImageCache *imgCache;
extern cTheme Theme;
extern cRecordingsFolderInfo recFolderInfo; extern cRecordingsFolderInfo recFolderInfo;
#endif #endif

View File

@ -1,7 +1,7 @@
#include "designer.h" #include "designer.h"
#include "extensions/helpers.h" #include "extensions/helpers.h"
cSkinDesigner::cSkinDesigner(string skin) : cSkin(skin.c_str(), &::Theme) { cSkinDesigner::cSkinDesigner(string skin, cTheme *theme) : cSkin(skin.c_str(), theme) {
init = true; init = true;
this->skin = skin; this->skin = skin;

View File

@ -41,7 +41,7 @@ private:
void LoadPluginViews(void); void LoadPluginViews(void);
void CacheViews(void); void CacheViews(void);
public: public:
cSkinDesigner(string skin); cSkinDesigner(string skin, cTheme *theme);
virtual ~cSkinDesigner(void); virtual ~cSkinDesigner(void);
virtual const char *Description(void); virtual const char *Description(void);
virtual cSkinDisplayChannel *DisplayChannel(bool WithInfo); virtual cSkinDisplayChannel *DisplayChannel(bool WithInfo);

View File

@ -140,7 +140,9 @@ bool cPluginSkinDesigner::Start(void) {
bool skinAvailable = false; bool skinAvailable = false;
while (config.GetSkin(skin)) { while (config.GetSkin(skin)) {
config.ReadSkinSetup(skin); config.ReadSkinSetup(skin);
cSkinDesigner *newSkin = new cSkinDesigner(skin); cTheme *theme = new cTheme();
config.StoreTheme(theme);
cSkinDesigner *newSkin = new cSkinDesigner(skin, theme);
config.AddSkin(newSkin); config.AddSkin(newSkin);
skinAvailable = true; skinAvailable = true;
if (!trueColorAvailable) { if (!trueColorAvailable) {