diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-03-20 07:59:35 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-03-20 07:59:35 +0100 |
commit | e4806ab08d0293d395c1718ab16d28ba2ae9d0ed (patch) | |
tree | d4a2a79461fb4215f556d9c08f93ba451f862560 /gui/iconcache.h | |
parent | 7d7e4034f48b578c87a4651075c2b73dc236181b (diff) | |
download | MultiMC-e4806ab08d0293d395c1718ab16d28ba2ae9d0ed.tar MultiMC-e4806ab08d0293d395c1718ab16d28ba2ae9d0ed.tar.gz MultiMC-e4806ab08d0293d395c1718ab16d28ba2ae9d0ed.tar.lz MultiMC-e4806ab08d0293d395c1718ab16d28ba2ae9d0ed.tar.xz MultiMC-e4806ab08d0293d395c1718ab16d28ba2ae9d0ed.zip |
Add SVG icon rendering/cache
Diffstat (limited to 'gui/iconcache.h')
-rw-r--r-- | gui/iconcache.h | 43 |
1 files changed, 43 insertions, 0 deletions
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 <QMutex> +#include <QtGui/QIcon> + +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 |