mirror of
https://github.com/status-im/snorenotify.git
synced 2025-01-10 00:25:43 +00:00
fixed signal slots
This commit is contained in:
parent
2311291414
commit
dc837877fa
@ -20,6 +20,7 @@
|
||||
#include "notification/notification.h"
|
||||
|
||||
namespace Snore{
|
||||
class Application;
|
||||
|
||||
class SNORE_EXPORT SnorePlugin:public QObject
|
||||
{
|
||||
@ -32,10 +33,10 @@ public:
|
||||
const QString &name() const;
|
||||
|
||||
protected:
|
||||
QHash<uint,Notification> activeNotifications;
|
||||
void startTimeout(uint id,int timeout);
|
||||
QHash<uint,Notification> activeNotifications;
|
||||
void startTimeout(uint id,int timeout);
|
||||
private slots:
|
||||
void notificationTimedOut();
|
||||
void notificationTimedOut();
|
||||
|
||||
private:
|
||||
SnorePlugin() {}
|
||||
@ -65,12 +66,12 @@ public:
|
||||
|
||||
|
||||
public slots:
|
||||
virtual void registerApplication ( class Application *application ) =0;
|
||||
virtual void unregisterApplication ( class Application *application ) =0;
|
||||
virtual uint notify ( Notification notification ) =0;
|
||||
virtual void closeNotification (Notification notification ) =0;
|
||||
virtual void registerApplication ( Snore::Application *application ) =0;
|
||||
virtual void unregisterApplication ( Snore::Application *application ) =0;
|
||||
virtual uint notify ( Snore::Notification notification ) =0;
|
||||
virtual void closeNotification ( Snore::Notification notification ) =0;
|
||||
|
||||
|
||||
// virtual void update
|
||||
|
||||
};
|
||||
|
||||
@ -84,8 +85,8 @@ public:
|
||||
virtual ~Notification_Frontend();
|
||||
|
||||
public slots:
|
||||
virtual void actionInvoked (Notification notification )=0;
|
||||
virtual void notificationClosed ( Notification notification )=0;
|
||||
virtual void actionInvoked( Snore::Notification notification )=0;
|
||||
virtual void notificationClosed( Snore::Notification notification )=0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -24,8 +24,9 @@
|
||||
#include <QDebug>
|
||||
namespace Snore{
|
||||
|
||||
class SnoreIcon::SnoreIconData
|
||||
class SnoreIcon::SnoreIconData : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SnoreIconData():
|
||||
_isLocalFile(false)
|
||||
@ -132,4 +133,5 @@ bool SnoreIcon::isEmpty() const{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include "icon.moc"
|
||||
|
@ -29,11 +29,10 @@ static int metaid = qRegisterMetaType<Notification>();
|
||||
|
||||
static int count = 0;
|
||||
|
||||
class Notification::NotificationData
|
||||
class Notification::NotificationData : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
|
||||
NotificationData ( uint id=0 ):
|
||||
_id ( id ),
|
||||
_timeout ( 10 ),
|
||||
@ -248,3 +247,4 @@ QDataStream & operator<< ( QDataStream &stream, const Notification::Action &a)
|
||||
}
|
||||
|
||||
|
||||
#include <notification.moc>
|
@ -98,17 +98,17 @@ void SnoreServer::publicatePlugin ( SnorePlugin *plugin )
|
||||
}
|
||||
else
|
||||
{
|
||||
connect ( this,SIGNAL ( notify (Notification) ),nb,SLOT ( notify ( Notification ) ) );
|
||||
connect ( this,SIGNAL ( notify(Snore::Notification) ),nb,SLOT( notify( Snore::Notification ) ) );
|
||||
}
|
||||
_notyfier.insert ( pluginName,nb );
|
||||
|
||||
connect ( this,SIGNAL ( closeNotify ( Notification ) ),nb,SLOT ( closeNotification ( Notification) ) );
|
||||
connect ( this,SIGNAL ( applicationInitialized ( Application* ) ),nb,SLOT ( registerApplication ( Application* ) ) );
|
||||
connect ( this,SIGNAL ( applicationRemoved ( Application* ) ),nb,SLOT ( unregisterApplication ( Application* ) ) );
|
||||
connect ( this,SIGNAL( closeNotify( Snore::Notification ) ),nb,SLOT ( closeNotification( Snore::Notification) ) );
|
||||
connect ( this,SIGNAL( applicationInitialized( Snore::Application* ) ),nb,SLOT ( registerApplication( Snore::Application* ) ) );
|
||||
connect ( this,SIGNAL( applicationRemoved( Snore::Application* ) ),nb,SLOT ( unregisterApplication( Snore::Application* ) ) );
|
||||
}else{
|
||||
Notification_Frontend * nf=qobject_cast<Notification_Frontend*> ( plugin );
|
||||
if(nf != NULL){
|
||||
connect ( this,SIGNAL ( closeNotify ( Notification ) ),nf,SLOT ( notificationClosed( Notification) ) );
|
||||
connect ( this,SIGNAL ( closeNotify( Snore::Notification ) ),nf,SLOT ( notificationClosed( Snore::Notification) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -119,7 +119,7 @@ uint SnoreServer::broadcastNotification ( Notification notification )
|
||||
emit notify ( notification );
|
||||
if ( _notificationBackend != NULL )
|
||||
{
|
||||
notification.setId(_notificationBackend->notify ( notification ));
|
||||
notification.setId(_notificationBackend->notify( notification ));
|
||||
return notification.id();
|
||||
}
|
||||
return -1;
|
||||
|
@ -18,7 +18,6 @@
|
||||
#define SNORESERVER_H
|
||||
|
||||
#include "snore_exports.h"
|
||||
#include "application.h"
|
||||
#include "interface.h"
|
||||
|
||||
#include <QStringList>
|
||||
@ -35,7 +34,7 @@ public:
|
||||
static const QString snoreTMP();
|
||||
|
||||
public:
|
||||
SnoreServer (QSystemTrayIcon *trayIcon=0 );
|
||||
SnoreServer (QSystemTrayIcon *trayIcon=0 );
|
||||
void publicatePlugin ( const QString &fileName );
|
||||
void publicatePlugin ( SnorePlugin *plugin );
|
||||
|
||||
@ -68,11 +67,11 @@ private:
|
||||
|
||||
|
||||
signals:
|
||||
void applicationInitialized ( Application* );
|
||||
void applicationRemoved ( Application* );
|
||||
void notify ( Notification noti );
|
||||
void actionInvoked( Notification );
|
||||
void closeNotify ( Notification );
|
||||
void applicationInitialized ( Snore::Application* );
|
||||
void applicationRemoved ( Snore::Application* );
|
||||
void notify ( Snore::Notification noti );
|
||||
void actionInvoked( Snore::Notification );
|
||||
void closeNotify ( Snore::Notification );
|
||||
|
||||
};
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <QImage>
|
||||
|
||||
#ifdef HAVE_KDE
|
||||
#include <KIcon>
|
||||
#include <KIconLoader>
|
||||
#endif
|
||||
using namespace Snore;
|
||||
|
||||
@ -70,13 +70,11 @@ uint FreedesktopNotification_Frontend::Notify(const QString &app_name, uint repl
|
||||
hints["image_data"].value<QDBusArgument>()>>image;
|
||||
icon = SnoreIcon(image.toQImage());
|
||||
}
|
||||
if(!snore()->aplications().contains(app_name)){
|
||||
SnoreIcon appIcon;
|
||||
if(!snore()->aplications().contains(app_name)){
|
||||
#ifdef HAVE_KDE
|
||||
KIcon kicon(app_icon);
|
||||
appIcon = SnoreIcon(kicon.pixmap(100,100).toImage());
|
||||
SnoreIcon appIcon = SnoreIcon(KIconLoader::global()->iconPath(app_icon, KIconLoader::Desktop));
|
||||
#else
|
||||
appIcon = SnoreIcon(":/root/images/freedesktop-dbus.png");
|
||||
SnoreIcon appIcon = SnoreIcon(":/root/images/freedesktop-dbus.png");
|
||||
#endif
|
||||
Application *a = new Application(app_name,appIcon);
|
||||
a->addAlert(new Alert("DBus Alert","DBus Alert",appIcon));
|
||||
|
Loading…
x
Reference in New Issue
Block a user