diff --git a/src/core/plugins/plugins.cpp b/src/core/plugins/plugins.cpp index 32d4983..c55ffcc 100644 --- a/src/core/plugins/plugins.cpp +++ b/src/core/plugins/plugins.cpp @@ -27,13 +27,16 @@ #include #include #include +#include using namespace Snore; SnorePlugin::SnorePlugin ( const QString &name ) : m_name ( name ), m_initialized(false) -{} +{ + moveToThread( qApp->thread() ); +} SnorePlugin::~SnorePlugin() { diff --git a/src/plugins/backends/snore/snorenotifier.cpp b/src/plugins/backends/snore/snorenotifier.cpp index 01ccbe6..7fb5b81 100644 --- a/src/plugins/backends/snore/snorenotifier.cpp +++ b/src/plugins/backends/snore/snorenotifier.cpp @@ -32,9 +32,6 @@ SnoreNotifier::SnoreNotifier(): SnoreBackend("Snore", true, true, true), m_widgets(2) { - moveToThread(qApp->thread());//TODO cleanup - QTimer::singleShot(0, this, SLOT(setup())); - } SnoreNotifier::~SnoreNotifier() @@ -117,3 +114,26 @@ void SnoreNotifier::setup() connect(w, SIGNAL(invoked()), this, SLOT(slotInvoked())); } } + + +bool SnoreNotifier::initialize(SnoreCore *snore) +{ + if(SnoreBackend::initialize(snore)) + { + return metaObject()->invokeMethod(this, "setup", Qt::QueuedConnection); + } + return false; +} + +bool SnoreNotifier::deinitialize() +{ + if(SnoreBackend::deinitialize()) + { + for(int i=0;ideleteLater(); + } + return true; + } + return false; +} diff --git a/src/plugins/backends/snore/snorenotifier.h b/src/plugins/backends/snore/snorenotifier.h index f51ac13..e729569 100644 --- a/src/plugins/backends/snore/snorenotifier.h +++ b/src/plugins/backends/snore/snorenotifier.h @@ -33,7 +33,9 @@ public: SnoreNotifier(); ~SnoreNotifier(); - // SnoreBackend interface + virtual bool initialize(Snore::SnoreCore *snore); + virtual bool deinitialize(); + public slots: virtual void slotNotify(Snore::Notification notification); virtual void slotCloseNotification(Snore::Notification notification); @@ -48,6 +50,8 @@ private: QList m_queue; QVector m_widgets; + + }; #endif // SNORENOTIFIER_H