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(
"lxqt") ) {
74 if (!bPreferDarkIconTheme)
79 else if ( desktopEnvironment.equalsIgnoreAsciiCase(
"macosx") ) {
80 if (!bPreferDarkIconTheme)
85 else if ( desktopEnvironment.equalsIgnoreAsciiCase(
"gnome") ||
86 desktopEnvironment.equalsIgnoreAsciiCase(
"mate") ||
87 desktopEnvironment.equalsIgnoreAsciiCase(
"unity") ) {
88 if (!bPreferDarkIconTheme)
94 if (!bPreferDarkIconTheme)
105 const std::vector<IconThemeInfo>& installedThemes,
106 const OUString& desktopEnvironment)
const
115 if (icon_theme_is_in_installed_themes(themeForDesktop, installedThemes)) {
116 return themeForDesktop;
124 const std::vector<IconThemeInfo>& installedThemes,
125 const OUString& theme)
const
131 if (icon_theme_is_in_installed_themes(
name, installedThemes)) {
136 if (icon_theme_is_in_installed_themes(theme, installedThemes)) {
154 OUString sIconTheme = theme.toAsciiLowerCase().replace(
'-',
'_');
168 if (
this == &other) {
186 return !(*
this == other);
192 if (!installedThemes.empty()) {
193 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