BALL
1.4.1
|
00001 #ifndef BALL_VIEW_KERNEL_ICONLOADER_H 00002 #define BALL_VIEW_KERNEL_ICONLOADER_H 00003 00004 #include <list> 00005 #include <boost/shared_ptr.hpp> 00006 #include <BALL/DATATYPE/hashMap.h> 00007 00008 #include <QtCore/QMutex> 00009 #include <QtCore/QReadWriteLock> 00010 #include <QtCore/QStringList> 00011 00012 class QIcon; 00013 00014 namespace BALL 00015 { 00016 class String; 00017 00018 namespace VIEW 00019 { 00028 class BALL_VIEW_EXPORT IconLoader 00029 { 00030 public: 00035 IconLoader(); 00036 00042 explicit IconLoader(const QStringList& icon_dirs); 00043 00049 explicit IconLoader(const std::list<String>& icon_dirs); 00050 00055 ~IconLoader(); 00056 00060 static IconLoader& instance(); 00061 00070 void appendIconPath(const String& path); 00071 00077 const QIcon& getIcon(const String& name); 00078 00079 private: 00080 //Threads and singleton 00081 static QMutex mutex_; 00082 static boost::shared_ptr<IconLoader> loader_; 00083 QReadWriteLock hash_map_lock_; 00084 00085 //Private members 00086 const QIcon* const invalid_; 00087 std::list<int> sizes_; 00088 QStringList icon_dirs_; 00089 HashMap<String, QIcon*> icon_map_; 00090 00091 //Private methods 00092 void setup_(); 00093 QIcon* loadIcon_(const String& name); 00094 }; 00095 } 00096 } 00097 00098 #endif //BALL_VIEW_KERNEL_ICONLOADER_H 00099