diff options
author | Orochimarufan <orochimarufan.x3@gmail.com> | 2013-03-22 14:01:54 +0100 |
---|---|---|
committer | Orochimarufan <orochimarufan.x3@gmail.com> | 2013-03-22 14:01:54 +0100 |
commit | cd1fdbbbc2953c5e34d8c0ae6861bec4a7f6532e (patch) | |
tree | a4148d6bb1704e635807c37b36013e9a33820a80 /gui/iconcache.h | |
parent | f4c9cb8c1d395422b7e4f1c27ac92b6df08a39bb (diff) | |
parent | e4806ab08d0293d395c1718ab16d28ba2ae9d0ed (diff) | |
download | MultiMC-cd1fdbbbc2953c5e34d8c0ae6861bec4a7f6532e.tar MultiMC-cd1fdbbbc2953c5e34d8c0ae6861bec4a7f6532e.tar.gz MultiMC-cd1fdbbbc2953c5e34d8c0ae6861bec4a7f6532e.tar.lz MultiMC-cd1fdbbbc2953c5e34d8c0ae6861bec4a7f6532e.tar.xz MultiMC-cd1fdbbbc2953c5e34d8c0ae6861bec4a7f6532e.zip |
Merge branch 'master' of http://github.com/peterix/MultiMC5
Conflicts:
CMakeLists.txt
main.cpp
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 |