From f68dfe58d184d894524314b140a3fcda228c949b Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 8 Jun 2017 07:26:13 -0400 Subject: Add a new method to find/use the LIconCache within an application (static instance as opposed to a global object). --- src-qt5/core/libLumina/LIconCache.cpp | 5 +++++ src-qt5/core/libLumina/LIconCache.h | 6 ++++++ 2 files changed, 11 insertions(+) (limited to 'src-qt5/core') diff --git a/src-qt5/core/libLumina/LIconCache.cpp b/src-qt5/core/libLumina/LIconCache.cpp index cb88582d..38367cef 100644 --- a/src-qt5/core/libLumina/LIconCache.cpp +++ b/src-qt5/core/libLumina/LIconCache.cpp @@ -22,6 +22,11 @@ LIconCache::~LIconCache(){ } +LIconCache* LIconCache::instance(){ + static LIconCache cache; + return &cache; +} + // === PUBLIC === //Icon Checks bool LIconCache::exists(QString icon){ diff --git a/src-qt5/core/libLumina/LIconCache.h b/src-qt5/core/libLumina/LIconCache.h index cf585675..9834b2a3 100644 --- a/src-qt5/core/libLumina/LIconCache.h +++ b/src-qt5/core/libLumina/LIconCache.h @@ -35,6 +35,12 @@ class LIconCache : public QObject{ public: LIconCache(QObject *parent = 0); ~LIconCache(); + + //Static method for using this class (DO NOT MIX WITH GLOBAL OBJECT METHOD) + // Either use this the entire time, or use a saved/global object - pick one and stick with it + // otherwise you may end up with multiple icon cache's running for your application + static LIconCache* instance(); + //Icon Checks bool exists(QString icon); bool isLoaded(QString icon); -- cgit