LibreOffice Module vcl (master)  1
Public Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
vcl::IconThemeSelector Class Reference

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)
 

Private Attributes

OUString mPreferredIconTheme
 
bool mUseHighContrastTheme
 
bool mPreferDarkIconTheme
 

Static Private Attributes

static constexpr OUStringLiteral FALLBACK_ICON_THEME_ID = u"colibre"
 The name of the icon theme which is used as fallback. More...
 

Friends

class ::IconThemeSelectorTest
 

Detailed Description

This class helps to choose an icon theme from a list of installed themes.

The following factors influence the selection:

  1. When high contrast mode is enabled, the high contrast icon theme is selected (if it is installed).
  2. When a preferred theme has been set (e.g., in the gnome desktop settings), that theme is selected.

Definition at line 31 of file IconThemeSelector.hxx.

Constructor & Destructor Documentation

vcl::IconThemeSelector::IconThemeSelector ( )

Definition at line 44 of file IconThemeSelector.cxx.

References false.

Member Function Documentation

OUString vcl::IconThemeSelector::GetIconThemeForDesktopEnvironment ( const OUString &  desktopEnvironment)
staticprivate
bool vcl::IconThemeSelector::operator!= ( const vcl::IconThemeSelector other) const

Definition at line 162 of file IconThemeSelector.cxx.

bool vcl::IconThemeSelector::operator== ( const vcl::IconThemeSelector other) const
OUString vcl::IconThemeSelector::ReturnFallback ( const std::vector< IconThemeInfo > &  installedThemes)
staticprivate

Return the first element of the themes, or the fallback if the vector is empty.

Definition at line 168 of file IconThemeSelector.cxx.

References FALLBACK_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).

Precondition
installedThemes must not be empty

Definition at line 104 of file IconThemeSelector.cxx.

References vcl::IconThemeInfo::HIGH_CONTRAST_ID, mUseHighContrastTheme, 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.

Precondition
installedThemes must not be empty

Definition at line 81 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 128 of file IconThemeSelector.cxx.

References mPreferDarkIconTheme, and mPreferredIconTheme.

void vcl::IconThemeSelector::SetUseHighContrastTheme ( bool  v)

Definition at line 122 of file IconThemeSelector.cxx.

References mUseHighContrastTheme.

Friends And Related Function Documentation

friend class ::IconThemeSelectorTest
friend

Definition at line 91 of file IconThemeSelector.hxx.

Member Data Documentation

constexpr OUStringLiteral vcl::IconThemeSelector::FALLBACK_ICON_THEME_ID = u"colibre"
staticprivate

The name of the icon theme which is used as fallback.

Definition at line 81 of file IconThemeSelector.hxx.

Referenced by GetIconThemeForDesktopEnvironment(), and ReturnFallback().

bool vcl::IconThemeSelector::mPreferDarkIconTheme
private
OUString vcl::IconThemeSelector::mPreferredIconTheme
private
bool vcl::IconThemeSelector::mUseHighContrastTheme
private

Definition at line 88 of file IconThemeSelector.hxx.

Referenced by operator==(), SelectIconTheme(), and SetUseHighContrastTheme().


The documentation for this class was generated from the following files: