diff options
-rw-r--r-- | fontmanager.c | 101 | ||||
-rw-r--r-- | fontmanager.h | 16 | ||||
-rw-r--r-- | nopacity.c | 7 | ||||
-rw-r--r-- | setup.c | 4 |
4 files changed, 35 insertions, 93 deletions
diff --git a/fontmanager.c b/fontmanager.c index 6715865..8666380 100644 --- a/fontmanager.c +++ b/fontmanager.c @@ -5,35 +5,7 @@ cFontManager *fontManager; cFontManager::cFontManager() { -} - -cFontManager::~cFontManager() { - DeleteFonts(); -} - -void cFontManager::SetFonts() { - SetFontsMenu(); - SetFontsChannel(); - SetFontsReplay(); - SetFontsMessage(); - SetFontsTrack(); - SetFontsVolume(); -} - -void cFontManager::DeleteFonts() { - DeleteFontsMenu(); - DeleteFontsChannel(); - DeleteFontsReplay(); - DeleteFontsMessage(); - DeleteFontsTrack(); - DeleteFontsVolume(); -} - -cFont *cFontManager::CreateFont(int size) { - return cFont::CreateFont(config.fontName, size); -} - -void cFontManager::SetFontsMenu(void) { + // Menu fonts menuHeader = CreateFont(geoManager->menuHeaderHeight / 2 + config.GetValue("fontHeader")); menuDate = CreateFont(geoManager->menuHeaderHeight / 2 + config.GetValue("fontDate")); menuItemLarge = CreateFont(geoManager->menuItemHeightMain/3 + 4 + config.GetValue("fontMenuitemLarge")); @@ -54,9 +26,28 @@ void cFontManager::SetFontsMenu(void) { menuMessage = CreateFont(geoManager->messageHeight / 3 + config.GetValue("fontMessageMenu")); menuEPGInfoWindow = CreateFont(geoManager->menuContentHeight / 30 + config.GetValue("fontEPGInfoWindow")); menuEPGInfoWindowLarge = CreateFont(geoManager->menuContentHeight / 20 + config.GetValue("fontEPGInfoWindowLarge")); + // Channel fonts + channelHeader = CreateFont(geoManager->channelHeaderHeight - 8 + config.GetValue("fontChannelHeaderSize")); + channelDate = CreateFont(geoManager->channelHeaderHeight/2 + config.GetValue("fontChannelDateSize")); + channelEPG = CreateFont(geoManager->channelEpgInfoLineHeight + config.GetValue("fontEPGSize")); + channelEPGSmall = CreateFont(geoManager->channelEpgInfoLineHeight - 6 + config.GetValue("fontEPGSmallSize")); + channelSourceInfo = CreateFont(geoManager->channelFooterHeight/2 + config.GetValue("fontChannelSourceInfoSize"));; + channelChannelGroup = CreateFont(geoManager->channelEpgInfoHeight/3 + config.GetValue("fontChannelGroupSize")); + channelChannelGroupSmall = CreateFont(geoManager->channelEpgInfoHeight/3 - 5 + config.GetValue("fontChannelGroupSmallSize")); + // Replay fonts + replayHeader = CreateFont(geoManager->replayHeaderHeight - 8 + config.GetValue("fontReplayHeader")); + replayText = CreateFont(geoManager->replayCurrentHeight); + //Message fonts + messageText = CreateFont(geoManager->messageHeight / 4 + 15 + config.GetValue("fontMessage")); + // Track fonts + trackText = CreateFont(geoManager->menuItemHeightTracks/3 + config.GetValue("fontTracks")); + trackHeader = CreateFont(geoManager->menuItemHeightTracks/2 + config.GetValue("fontTracksHeader")); + // Volume fonts + volumeText = CreateFont(geoManager->volumeLabelHeight - 6 + config.GetValue("fontVolume")); } -void cFontManager::DeleteFontsMenu(void) { +cFontManager::~cFontManager() { + // Menu fonts delete menuHeader; delete menuDate; delete menuItemLarge; @@ -77,19 +68,7 @@ void cFontManager::DeleteFontsMenu(void) { delete menuMessage; delete menuEPGInfoWindow; delete menuEPGInfoWindowLarge; -} - -void cFontManager::SetFontsChannel(void) { - channelHeader = CreateFont(geoManager->channelHeaderHeight - 8 + config.GetValue("fontChannelHeaderSize")); - channelDate = CreateFont(geoManager->channelHeaderHeight/2 + config.GetValue("fontChannelDateSize")); - channelEPG = CreateFont(geoManager->channelEpgInfoLineHeight + config.GetValue("fontEPGSize")); - channelEPGSmall = CreateFont(geoManager->channelEpgInfoLineHeight - 6 + config.GetValue("fontEPGSmallSize")); - channelSourceInfo = CreateFont(geoManager->channelFooterHeight/2 + config.GetValue("fontChannelSourceInfoSize"));; - channelChannelGroup = CreateFont(geoManager->channelEpgInfoHeight/3 + config.GetValue("fontChannelGroupSize")); - channelChannelGroupSmall = CreateFont(geoManager->channelEpgInfoHeight/3 - 5 + config.GetValue("fontChannelGroupSmallSize")); -} - -void cFontManager::DeleteFontsChannel(void) { + // Channel fonts delete channelHeader; delete channelDate; delete channelEPG; @@ -97,40 +76,18 @@ void cFontManager::DeleteFontsChannel(void) { delete channelSourceInfo; delete channelChannelGroup; delete channelChannelGroupSmall; -} - -void cFontManager::SetFontsReplay(void) { - replayHeader = CreateFont(geoManager->replayHeaderHeight - 8 + config.GetValue("fontReplayHeader")); - replayText = CreateFont(geoManager->replayCurrentHeight); -} - -void cFontManager::DeleteFontsReplay(void) { + // Replay fonts delete replayHeader; delete replayText; -} - -void cFontManager::SetFontsMessage(void) { - messageText = CreateFont(geoManager->messageHeight / 4 + 15 + config.GetValue("fontMessage")); -} - -void cFontManager::DeleteFontsMessage(void) { + //Message fonts delete messageText; -} - -void cFontManager::SetFontsTrack(void) { - trackText = CreateFont(geoManager->menuItemHeightTracks/3 + config.GetValue("fontTracks")); - trackHeader = CreateFont(geoManager->menuItemHeightTracks/2 + config.GetValue("fontTracksHeader")); -} - -void cFontManager::DeleteFontsTrack(void) { + // Track fonts delete trackText; delete trackHeader; + // Volume fonts + delete volumeText; } -void cFontManager::SetFontsVolume(void) { - volumeText = CreateFont(geoManager->volumeLabelHeight - 6 + config.GetValue("fontVolume")); -} - -void cFontManager::DeleteFontsVolume(void) { - delete volumeText; +cFont *cFontManager::CreateFont(int size) { + return cFont::CreateFont(config.fontName, size); } diff --git a/fontmanager.h b/fontmanager.h index 7d3ef51..b285bcd 100644 --- a/fontmanager.h +++ b/fontmanager.h @@ -5,24 +5,10 @@ class cFontManager { private: - void SetFontsMenu(void); - void DeleteFontsMenu(void); - void SetFontsChannel(void); - void DeleteFontsChannel(void); - void SetFontsReplay(void); - void DeleteFontsReplay(void); - void SetFontsMessage(void); - void DeleteFontsMessage(void); - void SetFontsTrack(void); - void DeleteFontsTrack(void); - void SetFontsVolume(void); - void DeleteFontsVolume(void); + cFont *CreateFont(int size); public: cFontManager(); ~cFontManager(); - cFont *CreateFont(int size); - void SetFonts(void); - void DeleteFonts(void); //Fonts DisplayMenu cFont *menuHeader; cFont *menuDate; @@ -20,8 +20,7 @@ cNopacity::cNopacity(void) : cSkin("nOpacity", &::Theme) { config.SetFontName(); geoManager = new cGeometryManager(); geoManager->SetGeometry(); - fontManager = new cFontManager(); - fontManager->SetFonts(); + fontManager = NULL; imgCache = new cImageCache(); imgCache->CreateCache(); } @@ -78,8 +77,8 @@ void cNopacity::ReloadCaches(void) { config.SetThemeSetup(); config.SetFontName(); geoManager->SetGeometry(); - fontManager->DeleteFonts(); - fontManager->SetFonts(); + delete fontManager; + fontManager = new cFontManager(); imgCache->Reload(); dsyslog("nopacity: Cache reloaded in %d ms", int(cTimeMs::Now()-start)); } @@ -11,8 +11,8 @@ cNopacitySetup::~cNopacitySetup() { config.SetFontName(); int start = cTimeMs::Now(); geoManager->SetGeometry(); - fontManager->DeleteFonts(); - fontManager->SetFonts(); + delete fontManager; + fontManager = new cFontManager(); imgCache->Reload(); dsyslog("nopacity: Cache reloaded in %d ms", int(cTimeMs::Now()-start)); } |