more refactoring
This commit is contained in:
parent
b34d7de18f
commit
38242655f0
|
@ -28,7 +28,7 @@
|
|||
#include <QDebug>
|
||||
|
||||
|
||||
namespace Snore{
|
||||
using namespace Snore;
|
||||
|
||||
SnoreBackend::SnoreBackend (const QString &name , bool canCloseNotification, bool supportsRichtext) :
|
||||
SnorePlugin ( name ),
|
||||
|
@ -41,6 +41,11 @@ SnoreBackend::SnoreBackend (const QString &name , bool canCloseNotification, boo
|
|||
SnoreBackend::~SnoreBackend()
|
||||
{
|
||||
qDebug()<<"Deleting"<<name();
|
||||
if(snore() != NULL){
|
||||
foreach(Application *a,snore()->aplications()){
|
||||
slotDeregisterApplication(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,7 +56,7 @@ bool SnoreBackend::init( SnoreCore *snore )
|
|||
return false;
|
||||
}
|
||||
connect( snore->d(), SIGNAL(applicationRegistered(Snore::Application*)), this, SLOT(slotRegisterApplication(Snore::Application*)));
|
||||
connect( snore->d(), SIGNAL(applicationDeregistered(Snore::Application*)), this, SLOT(slotUnregisterApplication(Snore::Application*)));
|
||||
connect( snore->d(), SIGNAL(applicationDeregistered(Snore::Application*)), this, SLOT(slotDeregisterApplication(Snore::Application*)));
|
||||
|
||||
foreach(Application *a,snore->aplications()){
|
||||
this->slotRegisterApplication(a);
|
||||
|
@ -122,10 +127,17 @@ bool SnoreBackend::supportsRichtext()
|
|||
return m_supportsRichtext;
|
||||
}
|
||||
|
||||
void SnoreBackend::slotRegisterApplication(Application *application)
|
||||
{
|
||||
Q_UNUSED(application);
|
||||
}
|
||||
|
||||
void SnoreBackend::slotDeregisterApplication(Application *application)
|
||||
{
|
||||
Q_UNUSED(application);
|
||||
}
|
||||
|
||||
void SnoreBackend::addActiveNotification(Notification n)
|
||||
{
|
||||
m_activeNotifications[n.id()] = n;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -50,8 +50,8 @@ signals:
|
|||
|
||||
|
||||
public slots:
|
||||
virtual void slotRegisterApplication ( Snore::Application *application ) = 0;
|
||||
virtual void slotUnregisterApplication ( Snore::Application *application ) = 0;
|
||||
virtual void slotRegisterApplication(Snore::Application *application );
|
||||
virtual void slotDeregisterApplication(Snore::Application *application );
|
||||
virtual void slotNotify ( Snore::Notification notification ) = 0;
|
||||
virtual void slotCloseNotification ( Snore::Notification notification );
|
||||
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*
|
||||
SnoreNotify is a Notification Framework based on Qt
|
||||
Copyright (C) 2014 Patrick von Reth <vonreth@kde.org>
|
||||
|
||||
|
||||
SnoreNotify is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
SnoreNotify is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with SnoreNotify. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "snore_p.h"
|
||||
#include "snore.h"
|
||||
#include "plugins/plugins.h"
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*
|
||||
SnoreNotify is a Notification Framework based on Qt
|
||||
Copyright (C) 2014 Patrick von Reth <vonreth@kde.org>
|
||||
|
||||
|
||||
SnoreNotify is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
SnoreNotify is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with SnoreNotify. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SNORECOREPRIVATE_H
|
||||
#define SNORECOREPRIVATE_H
|
||||
|
||||
|
|
|
@ -42,13 +42,6 @@ Growl::Growl():
|
|||
|
||||
Growl::~Growl()
|
||||
{
|
||||
if(snore() != NULL)
|
||||
{
|
||||
foreach(Application *a,snore()->aplications())
|
||||
{
|
||||
this->slotUnregisterApplication(a);
|
||||
}
|
||||
}
|
||||
delete m_defaultGNTP;
|
||||
}
|
||||
|
||||
|
@ -98,7 +91,7 @@ void Growl::slotRegisterApplication(Application *application)
|
|||
m_applications.insert(application->name(),growl);
|
||||
}
|
||||
|
||||
void Growl::slotUnregisterApplication(Application *application)
|
||||
void Growl::slotDeregisterApplication(Application *application)
|
||||
{
|
||||
gntp *growl = m_applications.take(application->name());
|
||||
if(growl == NULL)
|
||||
|
|
|
@ -45,7 +45,7 @@ private:
|
|||
|
||||
public slots:
|
||||
void slotRegisterApplication(Snore::Application *application);
|
||||
void slotUnregisterApplication(Snore::Application *application);
|
||||
void slotDeregisterApplication(Snore::Application *application);
|
||||
void slotNotify(Snore::Notification notification);
|
||||
};
|
||||
|
||||
|
|
|
@ -139,11 +139,6 @@ SnarlBackend::SnarlBackend():
|
|||
|
||||
SnarlBackend::~SnarlBackend()
|
||||
{
|
||||
if(snore() != NULL){
|
||||
foreach(Application *a,snore()->aplications()){
|
||||
this->slotUnregisterApplication(a);
|
||||
}
|
||||
}
|
||||
if(m_defautSnarlinetrface)
|
||||
delete m_defautSnarlinetrface;
|
||||
}
|
||||
|
@ -188,7 +183,7 @@ void SnarlBackend::slotRegisterApplication(Application *application){
|
|||
}
|
||||
}
|
||||
|
||||
void SnarlBackend::slotUnregisterApplication(Application *application){
|
||||
void SnarlBackend::slotDeregisterApplication(Application *application){
|
||||
SnarlInterface *snarlInterface = m_applications.take(application->name());
|
||||
if(snarlInterface == NULL)
|
||||
return;
|
||||
|
|
|
@ -42,7 +42,7 @@ private:
|
|||
|
||||
public slots:
|
||||
void slotRegisterApplication(Snore::Application *application);
|
||||
void slotUnregisterApplication(Snore::Application *application);
|
||||
void slotDeregisterApplication(Snore::Application *application);
|
||||
void slotNotify(Snore::Notification notification);
|
||||
void slotCloseNotification(Snore::Notification notification);
|
||||
|
||||
|
|
|
@ -60,16 +60,6 @@ bool SnoreToast::init(SnoreCore *snore)
|
|||
return SnoreBackend::init(snore);
|
||||
}
|
||||
|
||||
void SnoreToast::slotRegisterApplication(Application *application)
|
||||
{
|
||||
Q_UNUSED(application)
|
||||
}
|
||||
|
||||
void SnoreToast::slotUnregisterApplication(Application *application)
|
||||
{
|
||||
Q_UNUSED(application)
|
||||
}
|
||||
|
||||
void SnoreToast::slotNotify(Notification notification)
|
||||
{
|
||||
QProcess *p = new QProcess(this);
|
||||
|
|
|
@ -14,11 +14,7 @@ public:
|
|||
~SnoreToast();
|
||||
bool init(Snore::SnoreCore *snore);
|
||||
|
||||
|
||||
// SnoreBackend interface
|
||||
public slots:
|
||||
void slotRegisterApplication(Snore::Application *application);
|
||||
void slotUnregisterApplication(Snore::Application *application);
|
||||
void slotNotify(Snore::Notification notification);
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -22,21 +22,13 @@ TrayIconNotifer::TrayIconNotifer () :
|
|||
bool TrayIconNotifer::init(SnoreCore *snore){
|
||||
m_trayIcon = snore->trayIcon();
|
||||
if(m_trayIcon == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
connect(m_trayIcon,SIGNAL(messageClicked()),this,SLOT(actionInvoked()));
|
||||
return SnoreBackend::init(snore);
|
||||
}
|
||||
|
||||
|
||||
void TrayIconNotifer::slotRegisterApplication ( Application *application )
|
||||
{
|
||||
Q_UNUSED ( application )
|
||||
}
|
||||
void TrayIconNotifer::slotUnregisterApplication ( Application *application )
|
||||
{
|
||||
Q_UNUSED ( application )
|
||||
}
|
||||
|
||||
void TrayIconNotifer::slotNotify( Notification notification )
|
||||
{
|
||||
m_notificationQue.append(notification);
|
||||
|
|
|
@ -21,9 +21,7 @@ public:
|
|||
virtual bool init(Snore::SnoreCore *snore);
|
||||
|
||||
public slots:
|
||||
void slotRegisterApplication ( Snore::Application *application );
|
||||
void slotUnregisterApplication ( Snore::Application *application );
|
||||
void slotNotify ( Snore::Notification notification );
|
||||
void slotNotify(Snore::Notification notification);
|
||||
|
||||
private:
|
||||
QSystemTrayIcon *m_trayIcon;
|
||||
|
|
Loading…
Reference in New Issue