vcl: Use ImplImageTree member instead of static variable
Introduce new ImplImageTree::mbPreferDark member to
replace the static variable introduced in
commit 3a9ee3a2a7
Date: Sat Sep 26 12:14:17 2026 +0200
Resolve tdf#173739 - Consider dark UI for icon fallback
, see also discussion in [1].
There's only a single ImageTree (and therefore) ImplImageTree
instance that can be retrieved using ImageTree::get.
While at it, also switch the formatting/indentation of the
`else if` in ImplImageTree::fallbackStyle to a more conventional
one.
[1] https://gerrit.libreoffice.org/c/core/+/211478/comments/d66b922c_086d381c
Change-Id: Ib5cbcd5ae0e227b4eecad256d69cbd07579d8c73
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211553
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
@@ -129,6 +129,8 @@ private:
|
||||
/// Style used for the current operations; switches switch several times during fallback search.
|
||||
OUString maCurrentStyle;
|
||||
|
||||
bool mbPreferDark;
|
||||
|
||||
IconSet& getCurrentIconSet()
|
||||
{
|
||||
return maIconSets[maCurrentStyle];
|
||||
@@ -162,7 +164,7 @@ private:
|
||||
|
||||
Must not be cyclic :-) The last theme in the chain returns an empty string.
|
||||
*/
|
||||
static OUString fallbackStyle(std::u16string_view rStyle);
|
||||
OUString fallbackStyle(std::u16string_view rStyle);
|
||||
};
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -63,8 +63,6 @@
|
||||
|
||||
using namespace css;
|
||||
|
||||
static bool bPreferDark; //initialized in ImplImageTree c'tor
|
||||
|
||||
bool ImageRequestParameters::convertToDarkTheme()
|
||||
{
|
||||
static bool bIconsForDarkTheme = !!getenv("VCL_ICONS_FOR_DARK_THEME");
|
||||
@@ -225,7 +223,7 @@ void loadImageFromStream(std::shared_ptr<SvStream> const & xStream, OUString con
|
||||
|
||||
ImplImageTree::ImplImageTree()
|
||||
{
|
||||
bPreferDark = ThemeColors::GetThemeColors().GetWindowColor().IsDark();
|
||||
mbPreferDark = ThemeColors::GetThemeColors().GetWindowColor().IsDark();
|
||||
}
|
||||
|
||||
ImplImageTree::~ImplImageTree()
|
||||
@@ -353,11 +351,10 @@ OUString ImplImageTree::fallbackStyle(std::u16string_view rsStyle)
|
||||
sResult = "breeze_dark";
|
||||
else if (rsStyle == u"colibre_dark" )
|
||||
sResult = "colibre";
|
||||
else if (mbPreferDark)
|
||||
sResult = "colibre_dark";
|
||||
else
|
||||
if (bPreferDark)
|
||||
sResult = "colibre_dark";
|
||||
else
|
||||
sResult = "colibre";
|
||||
sResult = "colibre";
|
||||
|
||||
return sResult;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user