use new style connect

This commit is contained in:
Patrick von Reth 2015-04-26 15:37:47 +02:00
parent a21fd43b88
commit 641f94aa12
1 changed files with 20 additions and 20 deletions

View File

@ -49,11 +49,11 @@ bool SnoreBackend::initialize()
return false;
}
connect(SnoreCorePrivate::instance(), SIGNAL(applicationRegistered(Snore::Application)), this, SLOT(slotRegisterApplication(Snore::Application)), Qt::QueuedConnection);
connect(SnoreCorePrivate::instance(), SIGNAL(applicationDeregistered(Snore::Application)), this, SLOT(slotDeregisterApplication(Snore::Application)), Qt::QueuedConnection);
connect(SnoreCorePrivate::instance(), &SnoreCorePrivate::applicationRegistered, this, &SnoreBackend::slotRegisterApplication, Qt::QueuedConnection);
connect(SnoreCorePrivate::instance(), &SnoreCorePrivate::applicationDeregistered, this, &SnoreBackend::slotDeregisterApplication, Qt::QueuedConnection);
connect(this, SIGNAL(notificationClosed(Snore::Notification)), SnoreCorePrivate::instance(), SLOT(slotNotificationClosed(Snore::Notification)), Qt::QueuedConnection);
connect(SnoreCorePrivate::instance(), SIGNAL(notify(Snore::Notification)), this, SLOT(slotNotify(Snore::Notification)), Qt::QueuedConnection);
connect(this, &SnoreBackend::notificationClosed, SnoreCorePrivate::instance(), &SnoreCorePrivate::slotNotificationClosed, Qt::QueuedConnection);
connect(SnoreCorePrivate::instance(), &SnoreCorePrivate::notify, this, &SnoreBackend::slotNotify, Qt::QueuedConnection);
for (const Application &a : SnoreCore::instance().aplications()) {
this->slotRegisterApplication(a);
@ -62,6 +62,22 @@ bool SnoreBackend::initialize()
return true;
}
bool SnoreBackend::deinitialize()
{
if (SnorePlugin::deinitialize()) {
for (const Application &a : SnoreCore::instance().aplications()) {
slotDeregisterApplication(a);
}
disconnect(SnoreCorePrivate::instance(), &SnoreCorePrivate::applicationRegistered, this, &SnoreBackend::slotRegisterApplication);
disconnect(SnoreCorePrivate::instance(), &SnoreCorePrivate::applicationDeregistered, this, &SnoreBackend::slotDeregisterApplication);
disconnect(this, &SnoreBackend::notificationClosed, SnoreCorePrivate::instance(), &SnoreCorePrivate::slotNotificationClosed);
disconnect(SnoreCorePrivate::instance(), &SnoreCorePrivate::notify, this, &SnoreBackend::slotNotify);
return true;
}
return false;
}
void SnoreBackend::requestCloseNotification(Notification notification, Notification::CloseReasons reason)
{
if (canCloseNotification() && notification.isValid()) {
@ -166,22 +182,6 @@ void SnoreBackend::slotDeregisterApplication(const Application &application)
Q_UNUSED(application);
}
bool SnoreBackend::deinitialize()
{
if (SnorePlugin::deinitialize()) {
for (const Application &a : SnoreCore::instance().aplications()) {
slotDeregisterApplication(a);
}
disconnect(SnoreCorePrivate::instance(), SIGNAL(applicationRegistered(Snore::Application)), this, SLOT(slotRegisterApplication(Snore::Application)));
disconnect(SnoreCorePrivate::instance(), SIGNAL(applicationDeregistered(Snore::Application)), this, SLOT(slotDeregisterApplication(Snore::Application)));
disconnect(this, SIGNAL(notificationClosed(Snore::Notification)), SnoreCorePrivate::instance(), SLOT(slotNotificationClosed(Snore::Notification)));
disconnect(SnoreCorePrivate::instance(), SIGNAL(notify(Snore::Notification)), this, SLOT(slotNotify(Snore::Notification)));
return true;
}
return false;
}
void SnoreBackend::slotNotificationDisplayed(Notification notification)
{
notification.addActiveIn(this);