BALL  1.5.0
iconLoader.h
Go to the documentation of this file.
1 #ifndef BALL_VIEW_KERNEL_ICONLOADER_H
2 #define BALL_VIEW_KERNEL_ICONLOADER_H
3 
4 #include <list>
5 #include <boost/shared_ptr.hpp>
7 
8 #include <QtCore/QMutex>
9 #include <QtCore/QReadWriteLock>
10 #include <QtCore/QStringList>
11 
12 class QIcon;
13 
14 namespace BALL
15 {
16  class String;
17 
18  namespace VIEW
19  {
29  {
30  public:
36 
42  explicit IconLoader(const QStringList& icon_dirs);
43 
49  explicit IconLoader(const std::list<String>& icon_dirs);
50 
56 
60  static IconLoader& instance();
61 
70  void appendIconPath(const String& path);
71 
77  const QIcon& getIcon(const String& name);
78 
79  private:
80  //Threads and singleton
81  static QMutex mutex_;
82  static boost::shared_ptr<IconLoader> loader_;
83  QReadWriteLock hash_map_lock_;
84 
85  //Private members
86  const QIcon* const invalid_;
87  std::list<int> sizes_;
88  QStringList icon_dirs_;
89  HashMap<String, QIcon*> icon_map_;
90 
91  //Private methods
92  void setup_();
93  QIcon* loadIcon_(const String& name);
94  };
95  }
96 }
97 
98 #endif //BALL_VIEW_KERNEL_ICONLOADER_H
99 
BALL::VIEW::IconLoader::getIcon
const QIcon & getIcon(const String &name)
BALL::VIEW::IconLoader::IconLoader
IconLoader(const std::list< String > &icon_dirs)
BALL::VIEW::IconLoader::IconLoader
IconLoader(const QStringList &icon_dirs)
hashMap.h
BALL::HashMap
HashMap class based on the STL map (containing serveral convenience functions)
Definition: hashMap.h:74
BALL::VIEW::IconLoader::~IconLoader
~IconLoader()
BALL::String
Definition: string.h:57
BALL
Definition: constants.h:13
BALL::VIEW::IconLoader::appendIconPath
void appendIconPath(const String &path)
BALL::VIEW::IconLoader::instance
static IconLoader & instance()
BALL_VIEW_EXPORT
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52
BALL::VIEW::IconLoader
Definition: iconLoader.h:29
BALL::VIEW::IconLoader::IconLoader
IconLoader()