fixed bug that new font was displayed first after VDR restart when font was changed in OSD Setup menu

This commit is contained in:
louis 2014-10-18 10:28:38 +02:00
parent 3d1a2f1090
commit 762115bf81
4 changed files with 46 additions and 2 deletions

View File

@ -25,3 +25,4 @@ Version 0.0.2
- introduced new viewelement audioinfo in displaychannel - introduced new viewelement audioinfo in displaychannel
- added setup option to choose Menu Item display method between "at one go" and "after one another" - added setup option to choose Menu Item display method between "at one go" and "after one another"
- fixed bug that new skin was not properly loaded sometimes when skin was changed in OSD Setup menu - fixed bug that new skin was not properly loaded sometimes when skin was changed in OSD Setup menu
- fixed bug that new font was displayed first after VDR restart when font was changed in OSD Setup menu

View File

@ -23,10 +23,10 @@ cDesignerConfig::cDesignerConfig() {
//menu display style, display menu items //menu display style, display menu items
//one after each other or in one step //one after each other or in one step
blockFlush = 1; blockFlush = 1;
//remember current skin and theme //remember current skin and theme, osd size and osd fonts
SetSkin(); SetSkin();
//remember osd size
SetOSDSize(); SetOSDSize();
SetOSDFonts();
} }
cDesignerConfig::~cDesignerConfig() { cDesignerConfig::~cDesignerConfig() {
@ -146,6 +146,28 @@ bool cDesignerConfig::OsdSizeChanged(void) {
return false; return false;
} }
void cDesignerConfig::SetOSDFonts(void) {
fontFix = Setup.FontFix;
fontOsd = Setup.FontOsd;
fontSml = Setup.FontSml;
}
bool cDesignerConfig::OsdFontsChanged(void) {
bool changed = false;
if (fontFix.compare(Setup.FontFix) != 0) {
changed = true;
}
if (fontOsd.compare(Setup.FontOsd) != 0) {
changed = true;
}
if (fontSml.compare(Setup.FontSml) != 0) {
changed = true;
}
if (changed)
SetOSDFonts();
return changed;
}
cString cDesignerConfig::CheckSlashAtEnd(std::string path) { cString cDesignerConfig::CheckSlashAtEnd(std::string path) {
try { try {
if (!(path.at(path.size()-1) == '/')) if (!(path.at(path.size()-1) == '/'))

View File

@ -19,6 +19,9 @@ private:
cRect osdSize; cRect osdSize;
string osdSkin; string osdSkin;
string osdTheme; string osdTheme;
string fontFix;
string fontOsd;
string fontSml;
public: public:
cDesignerConfig(); cDesignerConfig();
~cDesignerConfig(); ~cDesignerConfig();
@ -36,6 +39,8 @@ public:
bool SkinChanged(void); bool SkinChanged(void);
void SetOSDSize(void); void SetOSDSize(void);
bool OsdSizeChanged(void); bool OsdSizeChanged(void);
void SetOSDFonts(void);
bool OsdFontsChanged(void);
cString logoExtension; cString logoExtension;
cString skinPath; cString skinPath;
cString logoPath; cString logoPath;

View File

@ -163,6 +163,7 @@ void cSkinDesigner::Init(void) {
if (init) { if (init) {
config.SetSkin(); config.SetSkin();
config.SetOSDSize(); config.SetOSDSize();
config.SetOSDFonts();
} }
dsyslog("skindesigner: initializing skin %s", skin.c_str()); dsyslog("skindesigner: initializing skin %s", skin.c_str());
@ -188,6 +189,21 @@ void cSkinDesigner::Init(void) {
watch.Stop("templates loaded and cache created"); watch.Stop("templates loaded and cache created");
} }
init = false; init = false;
} else if (config.OsdFontsChanged()) {
dsyslog("skindesigner: reloading fonts");
if (fontManager)
delete fontManager;
fontManager = new cFontManager();
cStopWatch watch;
bool ok = LoadTemplates();
if (!ok) {
esyslog("skindesigner: error during loading of templates - using LCARS as backup");
backupSkin = new cSkinLCARS();
useBackupSkin = true;
} else {
CacheTemplates();
watch.Stop("templates loaded and cache created");
}
} }
} }