From e4806ab08d0293d395c1718ab16d28ba2ae9d0ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Wed, 20 Mar 2013 07:59:35 +0100 Subject: Add SVG icon rendering/cache --- gui/iconcache.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 gui/iconcache.h (limited to 'gui/iconcache.h') diff --git a/gui/iconcache.h b/gui/iconcache.h new file mode 100644 index 00000000..5c5e4142 --- /dev/null +++ b/gui/iconcache.h @@ -0,0 +1,43 @@ +#pragma once + +#include +#include + +class Private; + +class IconCache +{ +public: + static IconCache* instance() + { + if (!m_Instance) + { + mutex.lock(); + if (!m_Instance) + m_Instance = new IconCache; + mutex.unlock(); + } + return m_Instance; + } + + static void drop() + { + mutex.lock(); + delete m_Instance; + m_Instance = 0; + mutex.unlock(); + } + + QIcon getIcon(QString name); + +private: + IconCache(); + // hide copy constructor + IconCache(const IconCache &); + // hide assign op + IconCache& operator=(const IconCache &); + static IconCache* m_Instance; + static QMutex mutex; + Private* d; +}; + \ No newline at end of file -- cgit v1.2.3