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

This class scans a folder for icon themes and provides the results. More...

#include <IconThemeScanner.hxx>

Public Member Functions

const std::vector< IconThemeInfo > & GetFoundIconThemes () const
 
const IconThemeInfoGetIconThemeInfo (const OUString &themeId)
 Get the IconThemeInfo for a theme. More...
 
bool IconThemeIsInstalled (const OUString &themeId) const
 Checks whether the theme with the provided name has been found in the scanned directory. More...
 

Static Public Member Functions

static std::shared_ptr< IconThemeScannerCreate (std::u16string_view path)
 Factory method to create the object. More...
 
static OUString GetStandardIconThemePath ()
 This method will return the standard path where icon themes are located. More...
 

Private Member Functions

 IconThemeScanner ()
 
void ScanDirectoryForIconThemes (std::u16string_view path)
 Scan a directory for icon themes. More...
 
bool AddIconThemeByPath (const OUString &path)
 Adds the provided icon theme by path. More...
 

Static Private Member Functions

static std::vector< OUString > ReadIconThemesFromPath (const OUString &dir)
 Scans the provided directory for icon themes. More...
 
static bool FileIsValidIconTheme (const OUString &)
 Check whether a single file is valid. More...
 

Private Attributes

std::vector< IconThemeInfomFoundIconThemes
 

Friends

class ::IconThemeScannerTest
 

Detailed Description

This class scans a folder for icon themes and provides the results.

Definition at line 28 of file IconThemeScanner.hxx.

Constructor & Destructor Documentation

◆ IconThemeScanner()

vcl::IconThemeScanner::IconThemeScanner ( )
private

Definition at line 60 of file IconThemeScanner.cxx.

Member Function Documentation

◆ AddIconThemeByPath()

bool vcl::IconThemeScanner::AddIconThemeByPath ( const OUString &  path)
private

◆ Create()

std::shared_ptr< IconThemeScanner > vcl::IconThemeScanner::Create ( std::u16string_view  path)
static

Factory method to create the object.

Provide a path to search for IconThemes.

Definition at line 172 of file IconThemeScanner.cxx.

Referenced by StyleSettings::DetermineIconTheme(), StyleSettings::GetAutomaticallyChosenIconTheme(), and StyleSettings::GetInstalledIconThemes().

◆ FileIsValidIconTheme()

bool vcl::IconThemeScanner::FileIsValidIconTheme ( const OUString &  filename)
staticprivate

Check whether a single file is valid.

Definition at line 145 of file IconThemeScanner.cxx.

References SAL_INFO, and vcl::IconThemeInfo::UrlCanBeParsed().

Referenced by ReadIconThemesFromPath().

◆ GetFoundIconThemes()

const std::vector< IconThemeInfo > & vcl::IconThemeScanner::GetFoundIconThemes ( ) const
inline

Definition at line 40 of file IconThemeScanner.hxx.

◆ GetIconThemeInfo()

const vcl::IconThemeInfo & vcl::IconThemeScanner::GetIconThemeInfo ( const OUString &  themeId)

Get the IconThemeInfo for a theme.

If the theme id is not among the found themes, a std::runtime_error will be thrown. Use IconThemeIsInstalled() to check whether it is available.

Definition at line 202 of file IconThemeScanner.cxx.

References mFoundIconThemes, and SAL_WARN.

◆ GetStandardIconThemePath()

OUString vcl::IconThemeScanner::GetStandardIconThemePath ( )
static

This method will return the standard path where icon themes are located.

Definition at line 180 of file IconThemeScanner.cxx.

References SvtPathOptions::GetIconsetPath().

Referenced by ImplImageTree::createStyle(), StyleSettings::DetermineIconTheme(), StyleSettings::GetAutomaticallyChosenIconTheme(), and StyleSettings::GetInstalledIconThemes().

◆ IconThemeIsInstalled()

bool vcl::IconThemeScanner::IconThemeIsInstalled ( const OUString &  themeId) const

Checks whether the theme with the provided name has been found in the scanned directory.

Definition at line 166 of file IconThemeScanner.cxx.

References vcl::IconThemeInfo::IconThemeIsInVector(), and mFoundIconThemes.

◆ ReadIconThemesFromPath()

std::vector< OUString > vcl::IconThemeScanner::ReadIconThemesFromPath ( const OUString &  dir)
staticprivate

Scans the provided directory for icon themes.

The returned strings will contain the URLs to the icon themes.

Definition at line 116 of file IconThemeScanner.cxx.

References FileIsValidIconTheme(), and SAL_INFO.

Referenced by ScanDirectoryForIconThemes().

◆ ScanDirectoryForIconThemes()

void vcl::IconThemeScanner::ScanDirectoryForIconThemes ( std::u16string_view  path)
private

Scan a directory for icon themes.

Returns
There are several cases when this method will fail:
  • The directory does not exist
  • There are no files which match the pattern images_xxx.zip

Definition at line 63 of file IconThemeScanner.cxx.

References AddIconThemeByPath(), o3tl::getToken(), mFoundIconThemes, nIndex, ReadIconThemesFromPath(), SAL_INFO, and SAL_WARN.

Friends And Related Function Documentation

◆ ::IconThemeScannerTest

friend class ::IconThemeScannerTest
friend

Definition at line 79 of file IconThemeScanner.hxx.

Member Data Documentation

◆ mFoundIconThemes

std::vector<IconThemeInfo> vcl::IconThemeScanner::mFoundIconThemes
private

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