diff options
author | Martijn Kaijser <martijn@xbmc.org> | 2016-10-02 20:39:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-02 20:39:01 +0200 |
commit | 27988ab932a6a2c323d23d5390a42c9a232f2212 (patch) | |
tree | ac5a7a69ec7bacbc6688c949571b33b8d4b0b2aa | |
parent | 89a2597e2d828d2099669c2464ddf88c69ed6028 (diff) | |
parent | 923263d0081e39d117d0edac6bb1378927d69235 (diff) |
Merge pull request #10602 from tamland/fix_font_reset
fix font setting reset on skin change
-rw-r--r-- | xbmc/Application.cpp | 32 | ||||
-rw-r--r-- | xbmc/Application.h | 2 |
2 files changed, 16 insertions, 18 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index b13393ec44..c780168e0f 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -262,6 +262,7 @@ CApplication::CApplication(void) , m_fallbackLanguageLoaded(false) , m_WaitingExternalCalls(0) , m_ProcessedExternalCalls(0) + , m_ignoreSkinSettingChanges(false) { m_network = NULL; TiXmlBase::SetCondenseWhiteSpace(false); @@ -1350,21 +1351,19 @@ void CApplication::OnSettingChanged(const CSetting *setting) return; const std::string &settingId = setting->GetId(); - // check if we should ignore this change event due to changing skins in which case we have to - // change several settings and each one of them could lead to a complete skin reload which would - // result in multiple skin reloads. Therefore we manually specify to ignore specific settings - // which are going to be changed. - if (settingId == m_skinReloadSettingIgnore) - { - m_skinReloadSettingIgnore.clear(); - return; - } if (settingId == CSettings::SETTING_LOOKANDFEEL_SKIN || settingId == CSettings::SETTING_LOOKANDFEEL_FONT || settingId == CSettings::SETTING_LOOKANDFEEL_SKINTHEME || settingId == CSettings::SETTING_LOOKANDFEEL_SKINCOLORS) { + // check if we should ignore this change event due to changing skins in which case we have to + // change several settings and each one of them could lead to a complete skin reload which would + // result in multiple skin reloads. Therefore we manually specify to ignore specific settings + // which are going to be changed. + if (m_ignoreSkinSettingChanges) + return; + // if the skin changes and the current color/theme/font is not the default one, reset // the it to the default value if (settingId == CSettings::SETTING_LOOKANDFEEL_SKIN) @@ -1372,28 +1371,28 @@ void CApplication::OnSettingChanged(const CSetting *setting) CSetting* skinRelatedSetting = CSettings::GetInstance().GetSetting(CSettings::SETTING_LOOKANDFEEL_SKINCOLORS); if (!skinRelatedSetting->IsDefault()) { - m_skinReloadSettingIgnore = skinRelatedSetting->GetId(); + m_ignoreSkinSettingChanges = true; skinRelatedSetting->Reset(); } skinRelatedSetting = CSettings::GetInstance().GetSetting(CSettings::SETTING_LOOKANDFEEL_SKINTHEME); if (!skinRelatedSetting->IsDefault()) { - m_skinReloadSettingIgnore = skinRelatedSetting->GetId(); + m_ignoreSkinSettingChanges = true; skinRelatedSetting->Reset(); } - setting = CSettings::GetInstance().GetSetting(CSettings::SETTING_LOOKANDFEEL_FONT); - if (!setting->IsDefault()) + skinRelatedSetting = CSettings::GetInstance().GetSetting(CSettings::SETTING_LOOKANDFEEL_FONT); + if (!skinRelatedSetting->IsDefault()) { - m_skinReloadSettingIgnore = skinRelatedSetting->GetId(); + m_ignoreSkinSettingChanges = true; skinRelatedSetting->Reset(); } } else if (settingId == CSettings::SETTING_LOOKANDFEEL_SKINTHEME) { CSettingString* skinColorsSetting = static_cast<CSettingString*>(CSettings::GetInstance().GetSetting(CSettings::SETTING_LOOKANDFEEL_SKINCOLORS)); - m_skinReloadSettingIgnore = skinColorsSetting->GetId(); + m_ignoreSkinSettingChanges = true; // we also need to adjust the skin color setting std::string colorTheme = ((CSettingString*)setting)->GetValue(); @@ -1404,8 +1403,7 @@ void CApplication::OnSettingChanged(const CSetting *setting) skinColorsSetting->SetValue(colorTheme); } - // reset the settings to ignore during changing skins - m_skinReloadSettingIgnore.clear(); + m_ignoreSkinSettingChanges = false; if (g_SkinInfo) { diff --git a/xbmc/Application.h b/xbmc/Application.h index 39b59fa9ba..22aca8173d 100644 --- a/xbmc/Application.h +++ b/xbmc/Application.h @@ -427,7 +427,7 @@ protected: bool NotifyActionListeners(const CAction &action) const; bool m_confirmSkinChange; - std::string m_skinReloadSettingIgnore; + bool m_ignoreSkinSettingChanges; bool m_saveSkinOnUnloading; bool m_autoExecScriptExecuted; |