LibreOffice Module vcl (master) 1
|
This class helps to choose an icon theme from a list of installed themes. More...
#include <IconThemeSelector.hxx>
Public Member Functions | |
IconThemeSelector () | |
OUString | SelectIconTheme (const std::vector< IconThemeInfo > &installedThemes, const OUString &theme) const |
Select an icon theme from the list of installed themes. More... | |
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. More... | |
void | SetUseHighContrastTheme (bool) |
bool | SetPreferredIconTheme (const OUString &, bool bDarkIconTheme) |
Returns true if the PreferredIconTheme was changed. More... | |
bool | operator== (const vcl::IconThemeSelector &) const |
bool | operator!= (const vcl::IconThemeSelector &) const |
Static Private Member Functions | |
static OUString | ReturnFallback (const std::vector< IconThemeInfo > &installedThemes) |
Return the first element of the themes, or the fallback if the vector is empty. More... | |
static OUString | GetIconThemeForDesktopEnvironment (const OUString &desktopEnvironment, bool bPreferDarkIconTheme) |
Private Attributes | |
OUString | mPreferredIconTheme |
bool | mUseHighContrastTheme |
bool | mPreferDarkIconTheme |
Static Private Attributes | |
static constexpr OUStringLiteral | FALLBACK_LIGHT_ICON_THEME_ID = u"colibre" |
The name of the icon themes which are used as fallbacks. More... | |
static constexpr OUStringLiteral | FALLBACK_DARK_ICON_THEME_ID = u"colibre_dark" |
Friends | |
class | ::IconThemeSelectorTest |
This class helps to choose an icon theme from a list of installed themes.
The following factors influence the selection:
Definition at line 31 of file IconThemeSelector.hxx.
vcl::IconThemeSelector::IconThemeSelector | ( | ) |
Definition at line 47 of file IconThemeSelector.cxx.
|
staticprivate |
Definition at line 54 of file IconThemeSelector.cxx.
References FALLBACK_DARK_ICON_THEME_ID, FALLBACK_LIGHT_ICON_THEME_ID, and comphelper::LibreOfficeKit::isActive().
Referenced by SelectIconThemeForDesktopEnvironment().
bool vcl::IconThemeSelector::operator!= | ( | const vcl::IconThemeSelector & | other | ) | const |
Definition at line 185 of file IconThemeSelector.cxx.
bool vcl::IconThemeSelector::operator== | ( | const vcl::IconThemeSelector & | other | ) | const |
Definition at line 167 of file IconThemeSelector.cxx.
References mPreferDarkIconTheme, mPreferredIconTheme, and mUseHighContrastTheme.
|
staticprivate |
Return the first element of the themes, or the fallback if the vector is empty.
Definition at line 191 of file IconThemeSelector.cxx.
References FALLBACK_LIGHT_ICON_THEME_ID.
Referenced by SelectIconTheme(), and SelectIconThemeForDesktopEnvironment().
OUString vcl::IconThemeSelector::SelectIconTheme | ( | const std::vector< IconThemeInfo > & | installedThemes, |
const OUString & | theme | ||
) | const |
Select an icon theme from the list of installed themes.
If high contrast mode has been enabled, the highcontrast theme will be selected (if it is available).
installedThemes
must not be empty Definition at line 124 of file IconThemeSelector.cxx.
References Application::GetSettings(), vcl::IconThemeInfo::HIGH_CONTRAST_ID_BRIGHT, vcl::IconThemeInfo::HIGH_CONTRAST_ID_DARK, Color::IsDark(), mUseHighContrastTheme, name, and ReturnFallback().
OUString vcl::IconThemeSelector::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.
If a preferred theme has been set, this one will take precedence.
The same logic as in SelectIconTheme() will apply.
installedThemes
must not be empty Definition at line 105 of file IconThemeSelector.cxx.
References GetIconThemeForDesktopEnvironment(), mPreferDarkIconTheme, mPreferredIconTheme, and ReturnFallback().
bool vcl::IconThemeSelector::SetPreferredIconTheme | ( | const OUString & | theme, |
bool | bDarkIconTheme | ||
) |
Returns true if the PreferredIconTheme was changed.
Definition at line 151 of file IconThemeSelector.cxx.
References mPreferDarkIconTheme, and mPreferredIconTheme.
void vcl::IconThemeSelector::SetUseHighContrastTheme | ( | bool | v | ) |
Definition at line 145 of file IconThemeSelector.cxx.
References mUseHighContrastTheme, and v.
|
friend |
Definition at line 91 of file IconThemeSelector.hxx.
|
staticconstexprprivate |
Definition at line 82 of file IconThemeSelector.hxx.
Referenced by GetIconThemeForDesktopEnvironment().
|
staticconstexprprivate |
The name of the icon themes which are used as fallbacks.
Definition at line 81 of file IconThemeSelector.hxx.
Referenced by GetIconThemeForDesktopEnvironment(), and ReturnFallback().
|
private |
Definition at line 89 of file IconThemeSelector.hxx.
Referenced by operator==(), SelectIconThemeForDesktopEnvironment(), and SetPreferredIconTheme().
|
private |
Definition at line 87 of file IconThemeSelector.hxx.
Referenced by operator==(), SelectIconThemeForDesktopEnvironment(), and SetPreferredIconTheme().
|
private |
Definition at line 88 of file IconThemeSelector.hxx.
Referenced by operator==(), SelectIconTheme(), and SetUseHighContrastTheme().