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

View File

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

View File

@ -1,7 +1,7 @@
#include "designer.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;
this->skin = skin;

View File

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

View File

@ -140,7 +140,9 @@ bool cPluginSkinDesigner::Start(void) {
bool skinAvailable = false;
while (config.GetSkin(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);
skinAvailable = true;
if (!trueColorAvailable) {