18#include <config_mpl.h>
31 explicit SameTheme(
const OUString &rThemeId) :
m_rThemeId(rThemeId) {}
38bool icon_theme_is_in_installed_themes(
const OUString& theme,
39 const std::vector<IconThemeInfo>& installedThemes)
41 return std::any_of(installedThemes.begin(), installedThemes.end(),
48 : mUseHighContrastTheme(false)
49 , mPreferDarkIconTheme(false)
58 if (!bPreferDarkIconTheme)
61 return "colibre_dark";
65 (void)desktopEnvironment;
66 if (!bPreferDarkIconTheme)
69 return "colibre_dark";
72 if ( desktopEnvironment.equalsIgnoreAsciiCase(
"plasma5") ||
73 desktopEnvironment.equalsIgnoreAsciiCase(
"plasma6") ||
74 desktopEnvironment.equalsIgnoreAsciiCase(
"lxqt") ) {
75 if (!bPreferDarkIconTheme)
80 else if ( desktopEnvironment.equalsIgnoreAsciiCase(
"macosx") ) {
81 if (!bPreferDarkIconTheme)
86 else if ( desktopEnvironment.equalsIgnoreAsciiCase(
"gnome") ||
87 desktopEnvironment.equalsIgnoreAsciiCase(
"mate") ||
88 desktopEnvironment.equalsIgnoreAsciiCase(
"unity") ) {
89 if (!bPreferDarkIconTheme)
95 if (!bPreferDarkIconTheme)
106 const std::vector<IconThemeInfo>& installedThemes,
107 const OUString& desktopEnvironment)
const
116 if (icon_theme_is_in_installed_themes(themeForDesktop, installedThemes)) {
117 return themeForDesktop;
125 const std::vector<IconThemeInfo>& installedThemes,
126 const OUString& theme)
const
132 if (icon_theme_is_in_installed_themes(
name, installedThemes)) {
137 if (icon_theme_is_in_installed_themes(theme, installedThemes)) {
155 OUString sIconTheme = theme.toAsciiLowerCase().replace(
'-',
'_');
169 if (
this == &other) {
187 return !(*
this == other);
193 if (!installedThemes.empty()) {
194 return installedThemes.front().GetThemeId();
const OUString & m_rThemeId
static const AllSettings & GetSettings()
Gets the application's settings.
This class provides information about an icon theme.
const OUString & GetThemeId() const
static constexpr OUStringLiteral HIGH_CONTRAST_ID_BRIGHT
The name of the icon theme to use for high contrast mode.
static constexpr OUStringLiteral HIGH_CONTRAST_ID_DARK
This class helps to choose an icon theme from a list of installed themes.
static constexpr OUStringLiteral FALLBACK_LIGHT_ICON_THEME_ID
The name of the icon themes which are used as fallbacks.
bool mUseHighContrastTheme
bool SetPreferredIconTheme(const OUString &, bool bDarkIconTheme)
Returns true if the PreferredIconTheme was changed.
void SetUseHighContrastTheme(bool)
bool operator==(const vcl::IconThemeSelector &) const
OUString mPreferredIconTheme
bool operator!=(const vcl::IconThemeSelector &) const
static OUString GetIconThemeForDesktopEnvironment(const OUString &desktopEnvironment, bool bPreferDarkIconTheme)
static constexpr OUStringLiteral FALLBACK_DARK_ICON_THEME_ID
static OUString ReturnFallback(const std::vector< IconThemeInfo > &installedThemes)
Return the first element of the themes, or the fallback if the vector is empty.
OUString SelectIconTheme(const std::vector< IconThemeInfo > &installedThemes, const OUString &theme) const
Select an icon theme from the list of installed themes.
OUString SelectIconThemeForDesktopEnvironment(const std::vector< IconThemeInfo > &installedThemes, const OUString &desktopEnvironment) const
Select the standard icon theme for a desktop environment from a list of installed themes.
bool mPreferDarkIconTheme