Set global SnoreCore isntance from main translation unit
Signed-off-by: Max Risuhin <risuhin.max@gmail.com>
This commit is contained in:
parent
0a397a3fab
commit
3bf3082ca7
|
@ -65,6 +65,7 @@ SnorePlugin *PluginContainer::load()
|
|||
}
|
||||
if (!m_plugin) {
|
||||
m_plugin = qobject_cast<SnorePlugin *> (m_loader.instance());
|
||||
m_plugin->setSnoreCoreInstance(&SnoreCore::instance());
|
||||
m_plugin->m_name = name();
|
||||
m_plugin->setDefaultSettings();
|
||||
}
|
||||
|
|
|
@ -43,6 +43,11 @@ SnorePlugin::~SnorePlugin()
|
|||
qCDebug(SNORE) << name() << this << "deleted";
|
||||
}
|
||||
|
||||
void SnorePlugin::setSnoreCoreInstance(SnoreCore *instance)
|
||||
{
|
||||
SnoreCore::setInstance(instance);
|
||||
}
|
||||
|
||||
bool SnorePlugin::isEnabled() const
|
||||
{
|
||||
return m_enabled;
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace Snore
|
|||
{
|
||||
|
||||
class PluginContainer;
|
||||
class SnoreCore;
|
||||
|
||||
/**
|
||||
* SnorePlugin represents the base class for the plugins.
|
||||
|
@ -91,6 +92,8 @@ public:
|
|||
SnorePlugin();
|
||||
virtual ~SnorePlugin();
|
||||
|
||||
void setSnoreCoreInstance(SnoreCore* instance);
|
||||
|
||||
/**
|
||||
* Sets the enabled state of the plugin to @param enabled .
|
||||
*/
|
||||
|
|
|
@ -66,6 +66,12 @@ SnoreCore &SnoreCore::instance()
|
|||
return *inst;
|
||||
}
|
||||
|
||||
void SnoreCore::setInstance(SnoreCore* i)
|
||||
{
|
||||
qCDebug(SNORE) << "SnoreCore::setInstance Old: " << inst << " New: " << i;
|
||||
inst = i;
|
||||
}
|
||||
|
||||
SnoreCore::~SnoreCore()
|
||||
{
|
||||
Q_D(SnoreCore);
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
* Creates a Notification Manager SnoreCore
|
||||
*/
|
||||
static SnoreCore &instance();
|
||||
static void setInstance(SnoreCore* i);
|
||||
~SnoreCore();
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue