include/vcl/themecolors.hxx        |    8 ++++----
 svtools/source/config/colorcfg.cxx |   12 ++++++------
 vcl/qt5/QtCustomStyle.cxx          |    8 ++++----
 vcl/source/app/settings.cxx        |    4 ++--
 vcl/source/app/themecolors.cxx     |    2 +-
 5 files changed, 17 insertions(+), 17 deletions(-)

New commits:
commit 31c07a54d281a0455acb5a462fb56e9b7881b251
Author:     Sahil Gautam <[email protected]>
AuthorDate: Tue Jan 7 10:31:50 2025 +0530
Commit:     Sahil Gautam <[email protected]>
CommitDate: Mon Jan 26 09:33:48 2026 +0100

    tdf#164393 ThemeColors refactor part 2
    
    - rename IsThemeLoaded() to IsThemeCached() (similar for setter) because
      it's not loading but caching colors in ThemeColors::m_aThemeColors.
      ColorConfig_Impl::Load() loads themes.
    
    Change-Id: If65302bc77d50f637176beaac47b43dff949368b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179854
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>
    (cherry picked from commit 6929168584be46583ae033c3b82574f743490c4c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198075
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Sahil Gautam <[email protected]>

diff --git a/include/vcl/themecolors.hxx b/include/vcl/themecolors.hxx
index 67551dbdac8d..55d6d5836489 100644
--- a/include/vcl/themecolors.hxx
+++ b/include/vcl/themecolors.hxx
@@ -14,15 +14,15 @@
 class VCL_DLLPUBLIC ThemeColors
 {
     ThemeColors() {}
-    static bool m_bIsThemeLoaded;
+    static bool m_bIsThemeCached;
     static ThemeColors m_aThemeColors;
 
 public:
     static ThemeColors& GetThemeColors() { return m_aThemeColors; }
     static void SetThemeColors(const ThemeColors& rThemeColors) { 
m_aThemeColors = rThemeColors; }
 
-    static bool IsThemeLoaded() { return m_bIsThemeLoaded; }
-    static void SetThemeLoaded(bool bLoaded) { m_bIsThemeLoaded = bLoaded; }
+    static bool IsThemeCached() { return m_bIsThemeCached; }
+    static void SetThemeCached(bool bCached) { m_bIsThemeCached = bCached; }
     static bool IsAutomaticTheme(std::u16string_view rThemeName)
     {
         return rThemeName == svtools::AUTOMATIC_COLOR_SCHEME;
@@ -30,7 +30,7 @@ public:
 
     static bool VclPluginCanUseThemeColors()
     {
-        return IsThemeLoaded()
+        return IsThemeCached()
                && 
!ThemeColors::IsAutomaticTheme(ThemeColors::GetThemeColors().GetThemeName());
     };
 
diff --git a/svtools/source/config/colorcfg.cxx 
b/svtools/source/config/colorcfg.cxx
index 50a70df6fd8c..febac2f0aaea 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -475,7 +475,7 @@ void ColorConfig::LoadThemeColorsFromRegistry()
     rThemeColors.SetAppBackBitmapStretched(
         
m_pImpl->GetColorConfigValue(svtools::APPBACKGROUND).bIsBitmapStretched);
 
-    ThemeColors::SetThemeLoaded(true);
+    ThemeColors::SetThemeCached(true);
 }
 
 void ColorConfig::SetupTheme()
@@ -483,17 +483,17 @@ void ColorConfig::SetupTheme()
     if (!officecfg::Office::Common::Appearance::LibreOfficeTheme::get()
         || ThemeColors::IsAutomaticTheme(GetCurrentSchemeName()))
     {
-        ThemeColors::SetThemeLoaded(false);
+        ThemeColors::SetThemeCached(false);
         return;
     }
 
-    if (!ThemeColors::IsThemeLoaded())
+    if (!ThemeColors::IsThemeCached())
     {
-        // extension to registry
+        // registry to ColorConfig::m_pImpl
         m_pImpl->Load(GetCurrentSchemeName());
         m_pImpl->CommitCurrentSchemeName();
 
-        // registry to theme
+        // ColorConfig::m_pImpl to static ThemeColors::m_aThemeColors
         LoadThemeColorsFromRegistry();
     }
 }
@@ -774,7 +774,7 @@ IMPL_LINK( ColorConfig, DataChangedHdl, VclSimpleEvent&, 
rEvent, void )
         if (pData->GetType() == DataChangedEventType::SETTINGS &&
             pData->GetFlags() & AllSettingsFlags::STYLE)
         {
-            ThemeColors::SetThemeLoaded(false);
+            ThemeColors::SetThemeCached(false);
             SetupTheme();
         }
     }
diff --git a/vcl/qt5/QtCustomStyle.cxx b/vcl/qt5/QtCustomStyle.cxx
index ea2d4771019d..26678ea530cc 100644
--- a/vcl/qt5/QtCustomStyle.cxx
+++ b/vcl/qt5/QtCustomStyle.cxx
@@ -18,7 +18,7 @@
 void QtCustomStyle::drawPrimitive(PrimitiveElement element, const 
QStyleOption* option,
                                   QPainter* painter, const QWidget* widget) 
const
 {
-    if (!ThemeColors::IsThemeLoaded() || IsSystemThemeChanged())
+    if (!ThemeColors::IsThemeCached() || IsSystemThemeChanged())
     {
         QProxyStyle::drawPrimitive(element, option, painter, widget);
         return;
@@ -45,7 +45,7 @@ void QtCustomStyle::drawPrimitive(PrimitiveElement element, 
const QStyleOption*
 
 QPalette QtCustomStyle::customPalette()
 {
-    if (!ThemeColors::IsThemeLoaded())
+    if (!ThemeColors::IsThemeCached())
         return QApplication::palette();
 
     const ThemeColors& aThemeColors = ThemeColors::GetThemeColors();
@@ -75,7 +75,7 @@ QPalette QtCustomStyle::customPalette()
 
 QPalette QtCustomStyle::GetMenuBarPalette()
 {
-    if (!ThemeColors::IsThemeLoaded() || IsSystemThemeChanged())
+    if (!ThemeColors::IsThemeCached() || IsSystemThemeChanged())
         return QApplication::palette();
 
     QPalette aPal;
@@ -92,7 +92,7 @@ QPalette QtCustomStyle::GetMenuBarPalette()
 
 QPalette QtCustomStyle::GetMenuPalette()
 {
-    if (!ThemeColors::IsThemeLoaded() || IsSystemThemeChanged())
+    if (!ThemeColors::IsThemeCached() || IsSystemThemeChanged())
         return QApplication::palette();
 
     QPalette aPal;
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index aaa577b2de89..cdd83f275bc5 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -2369,8 +2369,8 @@ void MiscSettings::SetAppColorMode(int nMode)
     //    is disabled during this step to stop SalFrame::UpdateSettings()
     //    from adding the current theme's colors which are still set to
     //    the previous light/dark mode's colors.
-    if (ThemeColors::IsThemeLoaded())
-        ThemeColors::SetThemeLoaded(false);
+    if (ThemeColors::IsThemeCached())
+        ThemeColors::SetThemeCached(false);
     AllSettings aSettings = Application::GetSettings();
     Application::MergeSystemSettings(aSettings);
     Application *pApp = GetpApp();
diff --git a/vcl/source/app/themecolors.cxx b/vcl/source/app/themecolors.cxx
index b46fdee33e8d..0652df93e523 100644
--- a/vcl/source/app/themecolors.cxx
+++ b/vcl/source/app/themecolors.cxx
@@ -9,6 +9,6 @@
 #include <vcl/themecolors.hxx>
 
 ThemeColors ThemeColors::m_aThemeColors;
-bool ThemeColors::m_bIsThemeLoaded = false;
+bool ThemeColors::m_bIsThemeCached = false;
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to