From 18c08b0b08256b7b18357b2d79ff3eea2fa91009 Mon Sep 17 00:00:00 2001 From: Aleksei Nikiforov Date: Fri, 1 Oct 2021 10:34:52 +0300 Subject: [PATCH 3/3] tdf#115439 Use SVG icon themes as defaults for qt5/kf5 backends Change-Id: I38d4565d1fd3844aa4c641c8a2611a6e33357d7a --- vcl/inc/IconThemeSelector.hxx | 1 + vcl/qt5/Qt5Frame.cxx | 2 +- vcl/source/app/IconThemeSelector.cxx | 19 +++++++++++++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/vcl/inc/IconThemeSelector.hxx b/vcl/inc/IconThemeSelector.hxx index 7e2dfc0da1dd..8b3ec5fe0c1a 100644 --- a/vcl/inc/IconThemeSelector.hxx +++ b/vcl/inc/IconThemeSelector.hxx @@ -78,6 +78,7 @@ private: /** The name of the icon theme which is used as fallback */ static constexpr OUStringLiteral FALLBACK_ICON_THEME_ID = u"colibre"; + static constexpr OUStringLiteral FALLBACK_ICON_THEME_ID_SVG = u"colibre_svg"; static OUString diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 36ce1222cb5e..6f1ec070879a 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -1143,7 +1143,7 @@ void Qt5Frame::UpdateSettings(AllSettings& rSettings) style.SetMenuBarHighlightTextColor(style.GetMenuHighlightTextColor()); // Icon theme - style.SetPreferredIconTheme(toOUString(QIcon::themeName())); + style.SetPreferredIconTheme(toOUString(QIcon::themeName() + QStringLiteral("_svg"))); // Scroll bar size style.SetScrollBarSize(QApplication::style()->pixelMetric(QStyle::PM_ScrollBarExtent)); diff --git a/vcl/source/app/IconThemeSelector.cxx b/vcl/source/app/IconThemeSelector.cxx index 253242bcd5ad..3f3e160ea1d9 100644 --- a/vcl/source/app/IconThemeSelector.cxx +++ b/vcl/source/app/IconThemeSelector.cxx @@ -13,6 +13,7 @@ #include #include +#include #include @@ -57,21 +58,31 @@ IconThemeSelector::GetIconThemeForDesktopEnvironment(const OUString& desktopEnvi (void)desktopEnvironment; return "colibre"; #else + bool bUseSvg = false; + + if (ImplGetSVData() + && ImplGetSVData()->maAppData.mxToolkitName + && (ImplGetSVData()->maAppData.mxToolkitName->match("qt5") + || ImplGetSVData()->maAppData.mxToolkitName->match("kf5"))) + { + bUseSvg = true; + } + OUString r; if ( desktopEnvironment.equalsIgnoreAsciiCase("plasma5") || desktopEnvironment.equalsIgnoreAsciiCase("lxqt") ) { - r = "breeze"; + r = bUseSvg ? OUString("breeze_svg") : OUString("breeze"); } else if ( desktopEnvironment.equalsIgnoreAsciiCase("macosx") ) { - r = "sukapura"; + r = bUseSvg ? OUString("sukapura_svg") : OUString("sukapura"); } else if ( desktopEnvironment.equalsIgnoreAsciiCase("gnome") || desktopEnvironment.equalsIgnoreAsciiCase("mate") || desktopEnvironment.equalsIgnoreAsciiCase("unity") ) { - r = "elementary"; + r = bUseSvg ? OUString("elementary_svg") : OUString("elementary"); } else { - r = FALLBACK_ICON_THEME_ID; + r = bUseSvg ? OUString(FALLBACK_ICON_THEME_ID_SVG) : OUString(FALLBACK_ICON_THEME_ID); } return r; #endif // _WIN32 -- 2.33.0