13#include <QtCore/qstring.h>
14#include <QtCore/qbytearray.h>
15#include <QtCore/qstringlist.h>
16#include <QtGui/qicon.h>
17#include <QtGui/qmovie.h>
18#include <QtGui/qpixmap.h>
37 static bool addSearchPath(
const QString& _path);
39 static const QStringList& searchPaths(
void);
42 static QIcon& getIcon(
const QString& _subPath);
45 static QPixmap& getPixmap(
const QString& _subPath);
48 static QMovie& getMovie(
const QString& _subPath);
51 static QByteArray& getSvgData(
const QString& _subPath);
54 static void setApplicationIcon(
const QIcon& _icon);
58 static const QIcon& getApplicationIcon(
void);
62 T& getOrCreate(
const QString& _subPath, std::map<QString, T*>& _dataMap, T& _default);
64 QString findFullPath(
const QString& _subPath);
69 QStringList m_searchPaths;
71 std::map<QString, QIcon*> m_icons;
72 std::map<QString, QPixmap*> m_pixmaps;
73 std::map<QString, QMovie*> m_movies;
74 std::map<QString, QByteArray> m_svgData;
76 QPixmap m_emptyPixmap;
78 QByteArray m_emptySvgData;
79 QIcon m_applicationIcon;
85T& ot::IconManager::getOrCreate(
const QString& _subPath, std::map<QString, T*>& _dataMap, T& _default) {
89 const auto& it = _dataMap.find(_subPath);
90 if (it != _dataMap.end()) {
91 this->m_mutex.unlock();
96 QString path = this->findFullPath(_subPath);
98 this->m_mutex.unlock();
99 OT_LOG_EAS(
"Icon \"" + _subPath.toStdString() +
"\" not found");
104 T* newEntry =
new T(path);
105 _dataMap.insert_or_assign(_subPath, newEntry);
107 this->m_mutex.unlock();
#define OT_LOG_EAS(___text)
Log a error message according to the service logger configuration and assert.
Definition Logger.h:191
The IconManager loads images or animations and caches them. The IconManager has a search path list....
Definition IconManager.h:32