mirror of
https://github.com/status-im/snorenotify.git
synced 2025-02-26 23:10:39 +00:00
Make SnoreCore instance static on class level
Signed-off-by: Max Risuhin <risuhin.max@gmail.com>
This commit is contained in:
parent
12b925a45f
commit
0a397a3fab
@ -32,9 +32,12 @@
|
||||
#include <QGuiApplication>
|
||||
#include <QSettings>
|
||||
#include <QThread>
|
||||
#include <QMutex>
|
||||
|
||||
using namespace Snore;
|
||||
|
||||
SnoreCore *SnoreCore::inst = nullptr;
|
||||
|
||||
SnoreCore::SnoreCore(QObject *parent):
|
||||
QObject(parent)
|
||||
{
|
||||
@ -48,17 +51,19 @@ SnoreCore::SnoreCore(QObject *parent):
|
||||
|
||||
SnoreCore &SnoreCore::instance()
|
||||
{
|
||||
static SnoreCore *instance = nullptr;
|
||||
if (!instance) {
|
||||
qCDebug(SNORE) << "Getting SnoreCore instance: " << inst;
|
||||
if (!inst) {
|
||||
qCDebug(SNORE) << "Creating new SnoreCore instance: " << inst;
|
||||
qRegisterMetaType<Application>();
|
||||
qRegisterMetaType<LambdaHint>();
|
||||
qRegisterMetaType<Notification>();
|
||||
qRegisterMetaType<SnorePlugin::PluginTypes>();
|
||||
qRegisterMetaTypeStreamOperators<SnorePlugin::PluginTypes>();
|
||||
instance = new SnoreCore(qApp);
|
||||
inst = new SnoreCore(qApp);
|
||||
SnoreCorePrivate::instance()->init();
|
||||
qCDebug(SNORE) << "Creating new SnoreCore instance is finished: " << inst;
|
||||
}
|
||||
return *instance;
|
||||
return *inst;
|
||||
}
|
||||
|
||||
SnoreCore::~SnoreCore()
|
||||
|
@ -174,6 +174,7 @@ private:
|
||||
SnoreCore(QObject *parent);
|
||||
SnoreCorePrivate *d_ptr;
|
||||
|
||||
static SnoreCore* inst;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user