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

This class provides information about an icon theme. More...

#include <IconThemeInfo.hxx>

Public Member Functions

 IconThemeInfo (const OUString &urlToFile)
 Construct an IconThemeInfo from the URL to a file. More...
 
const OUString & GetDisplayName () const
 
const OUString & GetThemeId () const
 
const OUString & GetUrlToFile () const
 

Static Public Member Functions

static Size SizeByThemeName (std::u16string_view)
 Obtain the icon size by theme name. More...
 
static bool UrlCanBeParsed (std::u16string_view url)
 Check whether an IconThemeInfo can be constructed from a URL. More...
 
static const vcl::IconThemeInfoFindIconThemeById (const std::vector< vcl::IconThemeInfo > &themes, const OUString &themeId)
 Find an icon theme by its id in a vector. More...
 
static bool IconThemeIsInVector (const std::vector< vcl::IconThemeInfo > &themes, const OUString &themeId)
 Check whether a theme with a specified id is in a vector of IconThemeInfo. More...
 

Static Public Attributes

static constexpr OUStringLiteral HIGH_CONTRAST_ID_BRIGHT = u"sifr"
 The name of the icon theme to use for high contrast mode. More...
 
static constexpr OUStringLiteral HIGH_CONTRAST_ID_DARK = u"sifr_dark"
 

Private Member Functions

 IconThemeInfo ()
 private constructor for testing purposes only More...
 

Static Private Member Functions

static OUString FileNameToThemeId (std::u16string_view)
 Determine the icon theme name from the filename If the name has an underscore, the name is taken from the first underscore to the last dot, e.g., images_oxygen.zip becomes oxygen If the name does not have an underscore in it, the whole name until the last dot is returned, e.g. More...
 
static OUString ThemeIdToDisplayName (const OUString &)
 Creates the display name for the given id of a file. More...
 

Private Attributes

OUString mDisplayName
 The name which is presented to the user. More...
 
OUString mThemeId
 The theme id. More...
 
OUString mUrlToFile
 The url to the icon theme package. More...
 

Friends

class ::IconThemeInfoTest
 
class ::IconThemeScannerTest
 
class ::IconThemeSelectorTest
 

Detailed Description

This class provides information about an icon theme.

Definition at line 28 of file IconThemeInfo.hxx.

Constructor & Destructor Documentation

◆ IconThemeInfo() [1/2]

vcl::IconThemeInfo::IconThemeInfo ( const OUString &  urlToFile)

Construct an IconThemeInfo from the URL to a file.

This method will throw a std::runtime_error if the URL cannot be properly parsed. Check the URL with UrlCanBeParsed() first.

Definition at line 46 of file IconThemeInfo.cxx.

References FileNameToThemeId(), mDisplayName, mThemeId, and ThemeIdToDisplayName().

◆ IconThemeInfo() [2/2]

vcl::IconThemeInfo::IconThemeInfo ( )
private

private constructor for testing purposes only

Definition at line 42 of file IconThemeInfo.cxx.

Member Function Documentation

◆ FileNameToThemeId()

OUString vcl::IconThemeInfo::FileNameToThemeId ( std::u16string_view  filename)
staticprivate

Determine the icon theme name from the filename If the name has an underscore, the name is taken from the first underscore to the last dot, e.g., images_oxygen.zip becomes oxygen If the name does not have an underscore in it, the whole name until the last dot is returned, e.g.

default.zip becomes default

Definition at line 94 of file IconThemeInfo.cxx.

References vcl::EXTENSION_FOR_ICON_PACKAGES, and vcl::ICON_THEME_PACKAGE_PREFIX.

Referenced by IconThemeInfo().

◆ FindIconThemeById()

const vcl::IconThemeInfo & vcl::IconThemeInfo::FindIconThemeById ( const std::vector< vcl::IconThemeInfo > &  themes,
const OUString &  themeId 
)
static

Find an icon theme by its id in a vector.

Throws a runtime_error if the theme is not contained in the vector

Definition at line 161 of file IconThemeInfo.cxx.

◆ GetDisplayName()

const OUString & vcl::IconThemeInfo::GetDisplayName ( ) const
inline

Definition at line 41 of file IconThemeInfo.hxx.

Referenced by vcl::IconThemeScanner::AddIconThemeByPath().

◆ GetThemeId()

const OUString & vcl::IconThemeInfo::GetThemeId ( ) const
inline

Definition at line 43 of file IconThemeInfo.hxx.

Referenced by vcl::IconThemeScanner::AddIconThemeByPath().

◆ GetUrlToFile()

const OUString & vcl::IconThemeInfo::GetUrlToFile ( ) const
inline

Definition at line 45 of file IconThemeInfo.hxx.

◆ IconThemeIsInVector()

bool vcl::IconThemeInfo::IconThemeIsInVector ( const std::vector< vcl::IconThemeInfo > &  themes,
const OUString &  themeId 
)
static

Check whether a theme with a specified id is in a vector of IconThemeInfo.

Definition at line 173 of file IconThemeInfo.cxx.

Referenced by vcl::IconThemeScanner::IconThemeIsInstalled().

◆ SizeByThemeName()

Size vcl::IconThemeInfo::SizeByThemeName ( std::u16string_view  themeName)
static

Obtain the icon size by theme name.

Definition at line 60 of file IconThemeInfo.cxx.

References u.

Referenced by ToolBox::GetDefaultImageSize().

◆ ThemeIdToDisplayName()

OUString vcl::IconThemeInfo::ThemeIdToDisplayName ( const OUString &  themeId)
staticprivate

Creates the display name for the given id of a file.

Currently, we only uppercase the id.

Definition at line 111 of file IconThemeInfo.cxx.

Referenced by IconThemeInfo().

◆ UrlCanBeParsed()

bool vcl::IconThemeInfo::UrlCanBeParsed ( std::u16string_view  url)
static

Friends And Related Function Documentation

◆ ::IconThemeInfoTest

friend class ::IconThemeInfoTest
friend

Definition at line 91 of file IconThemeInfo.hxx.

◆ ::IconThemeScannerTest

friend class ::IconThemeScannerTest
friend

Definition at line 92 of file IconThemeInfo.hxx.

◆ ::IconThemeSelectorTest

friend class ::IconThemeSelectorTest
friend

Definition at line 93 of file IconThemeInfo.hxx.

Member Data Documentation

◆ HIGH_CONTRAST_ID_BRIGHT

constexpr OUStringLiteral vcl::IconThemeInfo::HIGH_CONTRAST_ID_BRIGHT = u"sifr"
staticconstexpr

The name of the icon theme to use for high contrast mode.

Definition at line 32 of file IconThemeInfo.hxx.

Referenced by vcl::IconThemeSelector::SelectIconTheme().

◆ HIGH_CONTRAST_ID_DARK

constexpr OUStringLiteral vcl::IconThemeInfo::HIGH_CONTRAST_ID_DARK = u"sifr_dark"
staticconstexpr

Definition at line 33 of file IconThemeInfo.hxx.

Referenced by vcl::IconThemeSelector::SelectIconTheme().

◆ mDisplayName

OUString vcl::IconThemeInfo::mDisplayName
private

The name which is presented to the user.

Definition at line 85 of file IconThemeInfo.hxx.

Referenced by IconThemeInfo().

◆ mThemeId

OUString vcl::IconThemeInfo::mThemeId
private

The theme id.

This id is used in ... to determine the file name

Definition at line 87 of file IconThemeInfo.hxx.

Referenced by IconThemeInfo().

◆ mUrlToFile

OUString vcl::IconThemeInfo::mUrlToFile
private

The url to the icon theme package.

Definition at line 89 of file IconThemeInfo.hxx.


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