BALL::VIEW::IconLoader Class Reference

#include <BALL/VIEW/KERNEL/iconLoader.h>

List of all members.

Public Member Functions

 IconLoader ()
 IconLoader (const QStringList &icon_dirs)
 IconLoader (const std::list< String > &icon_dirs)
 ~IconLoader ()
void appendIconPath (const String &path)
const QIcon & getIcon (const String &name)

Static Public Member Functions

static IconLoaderinstance ()

Private Member Functions

void setup_ ()
QIcon * loadIcon_ (const String &name)

Private Attributes

QReadWriteLock hash_map_lock_
const QIcon *const invalid_
std::list< int > sizes_
QStringList icon_dirs_
HashMap< String, QIcon * > icon_map_

Static Private Attributes

static QMutex mutex_
static boost::shared_ptr
< IconLoader
loader_

Detailed Description

This class is an icon loader for the VIEW classes. It handles icon themes as defined in the freedesktop.org standard. It automatically detects all present resolutions of an icon and loads them. Furthermore it features an icon cache in order to minimize disk access. There are essentially two ways to use this class: Use it in a singleton wise fashion or create an specialized instance.

Definition at line 28 of file iconLoader.h.


Constructor & Destructor Documentation

BALL::VIEW::IconLoader::IconLoader (  ) 

Creates an IconLoader instance using BALL_DATA_PATH/graphics/icons as icon path.

BALL::VIEW::IconLoader::IconLoader ( const QStringList &  icon_dirs  )  [explicit]

Creates an IconLoader using the directories in icon_dirs as icon paths.

Parameters:
icon_dirs A list of paths to icon directories.
BALL::VIEW::IconLoader::IconLoader ( const std::list< String > &  icon_dirs  )  [explicit]

Creates an IconLoader using the directories in icon_dirs as icon paths.

Parameters:
icon_dirs A list of paths to icon directories.
BALL::VIEW::IconLoader::~IconLoader (  ) 

Destructor. It deletes all cached icons and thus invalidates all external pointers to these icons.


Member Function Documentation

void BALL::VIEW::IconLoader::appendIconPath ( const String path  ) 

Add another icon directory. The directory must be organised in a freedesktop.org compliant fashion. Essentially this means its layout has to look like this: path/nxn/context/icon.png

Parameters:
path The path to an icon directory.
const QIcon& BALL::VIEW::IconLoader::getIcon ( const String name  ) 

Retrieve the icon identified by name from the directory.

Parameters:
The icons name. A usual example looks like: "actions/document-save"
static IconLoader& BALL::VIEW::IconLoader::instance (  )  [static]

Return the global instance of the icon loader.

QIcon* BALL::VIEW::IconLoader::loadIcon_ ( const String name  )  [private]
void BALL::VIEW::IconLoader::setup_ (  )  [private]

Member Data Documentation

QReadWriteLock BALL::VIEW::IconLoader::hash_map_lock_ [private]

Definition at line 83 of file iconLoader.h.

QStringList BALL::VIEW::IconLoader::icon_dirs_ [private]

Definition at line 88 of file iconLoader.h.

Definition at line 89 of file iconLoader.h.

const QIcon* const BALL::VIEW::IconLoader::invalid_ [private]

Definition at line 86 of file iconLoader.h.

boost::shared_ptr<IconLoader> BALL::VIEW::IconLoader::loader_ [static, private]

Definition at line 82 of file iconLoader.h.

QMutex BALL::VIEW::IconLoader::mutex_ [static, private]

Definition at line 81 of file iconLoader.h.

std::list<int> BALL::VIEW::IconLoader::sizes_ [private]

Definition at line 87 of file iconLoader.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Generated by  doxygen 1.6.3