summaryrefslogtreecommitdiffstats
path: root/gui/iconcache.h
diff options
context:
space:
mode:
authorAndrew <forkk@forkk.net>2013-03-28 11:37:12 -0500
committerAndrew <forkk@forkk.net>2013-03-28 11:37:12 -0500
commitebb2c54975e3f0b7b891532e8e72d2ef760f96c4 (patch)
tree973de7066457a1faddffd3834eb0c260d5191ec2 /gui/iconcache.h
parent168ed3e8e58a8e5065ffa720f8d45f4cee0f2069 (diff)
parent1f13f0c665001a1a79f00cdad1e63e6c9802e55f (diff)
downloadMultiMC-ebb2c54975e3f0b7b891532e8e72d2ef760f96c4.tar
MultiMC-ebb2c54975e3f0b7b891532e8e72d2ef760f96c4.tar.gz
MultiMC-ebb2c54975e3f0b7b891532e8e72d2ef760f96c4.tar.lz
MultiMC-ebb2c54975e3f0b7b891532e8e72d2ef760f96c4.tar.xz
MultiMC-ebb2c54975e3f0b7b891532e8e72d2ef760f96c4.zip
Merge branch 'master' of git://github.com/peterix/MultiMC5
Conflicts: CMakeLists.txt gui/mainwindow.cpp
Diffstat (limited to 'gui/iconcache.h')
-rw-r--r--gui/iconcache.h43
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