Kaydet (Commit) 6e32e575 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: tdf#103915 when global dark theme is set fall back to breeze_dark

otherwise don't assume a desired iconset ending in *dark means breeze_dark
is a good fallback

Change-Id: Ia294a86e17a2c390b503d5200dfc7195759afa00
üst 32d03782
...@@ -63,7 +63,7 @@ public: ...@@ -63,7 +63,7 @@ public:
SetUseHighContrastTheme(bool); SetUseHighContrastTheme(bool);
void void
SetPreferredIconTheme(const OUString&); SetPreferredIconTheme(const OUString&, bool bDarkIconTheme);
bool bool
operator==(const vcl::IconThemeSelector&) const; operator==(const vcl::IconThemeSelector&) const;
...@@ -85,6 +85,7 @@ private: ...@@ -85,6 +85,7 @@ private:
OUString mPreferredIconTheme; OUString mPreferredIconTheme;
bool mUseHighContrastTheme; bool mUseHighContrastTheme;
bool mPreferDarkIconTheme;
friend class ::IconThemeSelectorTest; friend class ::IconThemeSelectorTest;
}; };
......
...@@ -548,7 +548,7 @@ public: ...@@ -548,7 +548,7 @@ public:
/** Set a preferred icon theme. /** Set a preferred icon theme.
* This theme will be preferred in GetAutomaticallyChosenIconTheme() * This theme will be preferred in GetAutomaticallyChosenIconTheme()
*/ */
void SetPreferredIconTheme(const OUString&); void SetPreferredIconTheme(const OUString&, bool bDarkIconTheme = false);
const DialogStyle& GetDialogStyle() const; const DialogStyle& GetDialogStyle() const;
void SetDialogStyle( const DialogStyle& rStyle ); void SetDialogStyle( const DialogStyle& rStyle );
......
...@@ -43,7 +43,8 @@ bool icon_theme_is_in_installed_themes(const OUString& theme, ...@@ -43,7 +43,8 @@ bool icon_theme_is_in_installed_themes(const OUString& theme,
} // end anonymous namespace } // end anonymous namespace
IconThemeSelector::IconThemeSelector() IconThemeSelector::IconThemeSelector()
: mUseHighContrastTheme(false) : mUseHighContrastTheme(false)
, mPreferDarkIconTheme(false)
{ {
} }
...@@ -83,7 +84,7 @@ IconThemeSelector::SelectIconThemeForDesktopEnvironment( ...@@ -83,7 +84,7 @@ IconThemeSelector::SelectIconThemeForDesktopEnvironment(
return mPreferredIconTheme; return mPreferredIconTheme;
} }
//if a dark variant is preferred, and we didn't have an exact match, then try our one and only dark theme //if a dark variant is preferred, and we didn't have an exact match, then try our one and only dark theme
if (mPreferredIconTheme.endsWith("_dark") && icon_theme_is_in_installed_themes("breeze_dark", installedThemes)) { if (mPreferDarkIconTheme && icon_theme_is_in_installed_themes("breeze_dark", installedThemes)) {
return OUString("breeze_dark"); return OUString("breeze_dark");
} }
} }
...@@ -121,9 +122,10 @@ IconThemeSelector::SetUseHighContrastTheme(bool v) ...@@ -121,9 +122,10 @@ IconThemeSelector::SetUseHighContrastTheme(bool v)
} }
void void
IconThemeSelector::SetPreferredIconTheme(const OUString& theme) IconThemeSelector::SetPreferredIconTheme(const OUString& theme, bool bDarkIconTheme)
{ {
mPreferredIconTheme = theme; mPreferredIconTheme = theme;
mPreferDarkIconTheme = bDarkIconTheme;
} }
bool bool
...@@ -135,6 +137,9 @@ IconThemeSelector::operator==(const vcl::IconThemeSelector& other) const ...@@ -135,6 +137,9 @@ IconThemeSelector::operator==(const vcl::IconThemeSelector& other) const
if (mPreferredIconTheme != other.mPreferredIconTheme) { if (mPreferredIconTheme != other.mPreferredIconTheme) {
return false; return false;
} }
if (mPreferDarkIconTheme != other.mPreferDarkIconTheme) {
return false;
}
if (mUseHighContrastTheme != other.mUseHighContrastTheme) { if (mUseHighContrastTheme != other.mUseHighContrastTheme) {
return false; return false;
} }
......
...@@ -3026,9 +3026,9 @@ StyleSettings::GetHighContrastMode() const ...@@ -3026,9 +3026,9 @@ StyleSettings::GetHighContrastMode() const
} }
void void
StyleSettings::SetPreferredIconTheme(const OUString& theme) StyleSettings::SetPreferredIconTheme(const OUString& theme, bool bDarkIconTheme)
{ {
mxData->mIconThemeSelector->SetPreferredIconTheme(theme); mxData->mIconThemeSelector->SetPreferredIconTheme(theme, bDarkIconTheme);
} }
void void
......
...@@ -2726,14 +2726,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) ...@@ -2726,14 +2726,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
"gtk-application-prefer-dark-theme", &bDarkIconTheme, "gtk-application-prefer-dark-theme", &bDarkIconTheme,
nullptr ); nullptr );
OUString sIconThemeName(OUString::createFromAscii(pIconThemeName)); OUString sIconThemeName(OUString::createFromAscii(pIconThemeName));
if (sIconThemeName.endsWithIgnoreAsciiCase("-dark", &sIconThemeName) || aStyleSet.SetPreferredIconTheme(sIconThemeName, bDarkIconTheme);
sIconThemeName.endsWithIgnoreAsciiCase("_dark", &sIconThemeName))
{
bDarkIconTheme = true;
}
if (bDarkIconTheme)
sIconThemeName += "_dark";
aStyleSet.SetPreferredIconTheme(sIconThemeName);
g_free( pIconThemeName ); g_free( pIconThemeName );
aStyleSet.SetToolbarIconSize( ToolbarIconSize::Large ); aStyleSet.SetToolbarIconSize( ToolbarIconSize::Large );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment