/usr/include/BALL/VIEW/KERNEL/iconLoader.h is in libballview1.4-dev 1.4.3~beta1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | #ifndef BALL_VIEW_KERNEL_ICONLOADER_H
#define BALL_VIEW_KERNEL_ICONLOADER_H
#include <list>
#include <boost/shared_ptr.hpp>
#include <BALL/DATATYPE/hashMap.h>
#include <QtCore/QMutex>
#include <QtCore/QReadWriteLock>
#include <QtCore/QStringList>
class QIcon;
namespace BALL
{
class String;
namespace VIEW
{
/**
* 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.
*/
class BALL_VIEW_EXPORT IconLoader
{
public:
/**
* Creates an IconLoader instance using BALL_DATA_PATH/graphics/icons as
* icon path.
*/
IconLoader();
/**
* Creates an IconLoader using the directories in icon_dirs as icon paths.
*
* @param icon_dirs A list of paths to icon directories.
*/
explicit IconLoader(const QStringList& icon_dirs);
/**
* Creates an IconLoader using the directories in icon_dirs as icon paths.
*
* @param icon_dirs A list of paths to icon directories.
*/
explicit IconLoader(const std::list<String>& icon_dirs);
/**
* Destructor. It deletes all cached icons and thus invalidates all external
* pointers to these icons.
*/
~IconLoader();
/**
* Return the global instance of the icon loader.
*/
static IconLoader& instance();
/**
* 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
*
* @param path The path to an icon directory.
*/
void appendIconPath(const String& path);
/**
* Retrieve the icon identified by name from the directory.
*
* @param The icons name. A usual example looks like: "actions/document-save"
*/
const QIcon& getIcon(const String& name);
private:
//Threads and singleton
static QMutex mutex_;
static boost::shared_ptr<IconLoader> loader_;
QReadWriteLock hash_map_lock_;
//Private members
const QIcon* const invalid_;
std::list<int> sizes_;
QStringList icon_dirs_;
HashMap<String, QIcon*> icon_map_;
//Private methods
void setup_();
QIcon* loadIcon_(const String& name);
};
}
}
#endif //BALL_VIEW_KERNEL_ICONLOADER_H
|