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

vcl::IconThemeScanner::IconThemeScanner ( )
private

Definition at line 59 of file IconThemeScanner.cxx.

Member Function Documentation

bool vcl::IconThemeScanner::AddIconThemeByPath ( const OUString &  path)
private
std::shared_ptr< IconThemeScanner > vcl::IconThemeScanner::Create ( const OUString &  path)
static

Factory method to create the object.

Provide a path to search for IconThemes.

Definition at line 171 of file IconThemeScanner.cxx.

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

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

Check whether a single file is valid.

Definition at line 144 of file IconThemeScanner.cxx.

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

Referenced by ReadIconThemesFromPath().

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

Definition at line 42 of file IconThemeScanner.hxx.

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 201 of file IconThemeScanner.cxx.

References mFoundIconThemes, and SAL_WARN.

OUString vcl::IconThemeScanner::GetStandardIconThemePath ( )
static

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

Definition at line 179 of file IconThemeScanner.cxx.

References SvtPathOptions::GetIconsetPath().

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

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 165 of file IconThemeScanner.cxx.

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

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 115 of file IconThemeScanner.cxx.

References FileIsValidIconTheme(), and SAL_INFO.

Referenced by ScanDirectoryForIconThemes().

void vcl::IconThemeScanner::ScanDirectoryForIconThemes ( const OUString &  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 62 of file IconThemeScanner.cxx.

References AddIconThemeByPath(), mFoundIconThemes, ReadIconThemesFromPath(), SAL_INFO, and SAL_WARN.

Friends And Related Function Documentation

friend class ::IconThemeScannerTest
friend

Definition at line 85 of file IconThemeScanner.hxx.

Member Data Documentation

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

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