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 (const OUString &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 = u"sifr"
 The name of the icon theme to use for high contrast mode. More...
 

Private Member Functions

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

Static Private Member Functions

static OUString FileNameToThemeId (const OUString &)
 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

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 48 of file IconThemeInfo.cxx.

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

vcl::IconThemeInfo::IconThemeInfo ( )
private

private constructor for testing purposes only

Definition at line 44 of file IconThemeInfo.cxx.

Member Function Documentation

OUString vcl::IconThemeInfo::FileNameToThemeId ( const OUString &  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 96 of file IconThemeInfo.cxx.

Referenced by IconThemeInfo().

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 167 of file IconThemeInfo.cxx.

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

Definition at line 40 of file IconThemeInfo.hxx.

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

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

Definition at line 42 of file IconThemeInfo.hxx.

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

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

Definition at line 44 of file IconThemeInfo.hxx.

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 179 of file IconThemeInfo.cxx.

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

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

Obtain the icon size by theme name.

Definition at line 62 of file IconThemeInfo.cxx.

References u.

Referenced by ToolBox::GetDefaultImageSize().

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 113 of file IconThemeInfo.cxx.

Referenced by IconThemeInfo().

bool vcl::IconThemeInfo::UrlCanBeParsed ( const OUString &  url)
static

Check whether an IconThemeInfo can be constructed from a URL.

Definition at line 73 of file IconThemeInfo.cxx.

Referenced by vcl::IconThemeScanner::AddIconThemeByPath(), and vcl::IconThemeScanner::FileIsValidIconTheme().

Friends And Related Function Documentation

friend class ::IconThemeInfoTest
friend

Definition at line 90 of file IconThemeInfo.hxx.

friend class ::IconThemeScannerTest
friend

Definition at line 91 of file IconThemeInfo.hxx.

friend class ::IconThemeSelectorTest
friend

Definition at line 92 of file IconThemeInfo.hxx.

Member Data Documentation

constexpr OUStringLiteral vcl::IconThemeInfo::HIGH_CONTRAST_ID = u"sifr"
static

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().

OUString vcl::IconThemeInfo::mDisplayName
private

The name which is presented to the user.

Definition at line 84 of file IconThemeInfo.hxx.

Referenced by IconThemeInfo().

OUString vcl::IconThemeInfo::mThemeId
private

The theme id.

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

Definition at line 86 of file IconThemeInfo.hxx.

Referenced by IconThemeInfo().

OUString vcl::IconThemeInfo::mUrlToFile
private

The url to the icon theme package.

Definition at line 88 of file IconThemeInfo.hxx.


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