added growl support

This commit is contained in:
theonering 2010-03-06 17:28:14 +01:00
parent 7fde21d496
commit 787f62d6ea
7 changed files with 63 additions and 12 deletions

View File

@ -1,9 +0,0 @@
#ifndef LIBGROWL_H
#define LIBGROWL_H
//registers all alert classes in the aray as default alerts
void reister(string classes[]);
//send a notification and return its registration id
int send(string title,string body,string iconPath,int timeout);
#endif // LIBGROWL_H

View File

@ -1,11 +1,12 @@
SET(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}/plugins)
add_subdirectory(freedesktopnotification)
#add_subdirectory(freedesktopnotification)
add_subdirectory(freedesktopfrontend)
add_subdirectory(redirector)
add_subdirectory(webposter)
add_subdirectory(registredapps)
add_subdirectory(snarlnetwork)
add_subdirectory(snarl)
#add_subdirectory(snarl)
#add_subdirectory(dbusbinding)
add_subdirectory(growl)

View File

@ -0,0 +1,8 @@
find_library(GROWL_CPP NAMES growl++ )
set( GROWL__SRC
growl_backend.cpp
)
automoc4_add_library(growl_backend MODULE ${GROWL__SRC} )
target_link_libraries(growl_backend snore ${QT_QTCORE_LIBRARY} ${GROWL_CPP} )

View File

@ -0,0 +1,28 @@
#include "growl_backend.h"
#include <growl++.hpp>
#include <QtCore>
Q_EXPORT_PLUGIN2(growl_backend,Growl_Backend)
Growl_Backend::Growl_Backend():id(0)
{
setProperty("name","Growl");
const char *n[1] = { "SnoreNotification"};
growl=new Growl(GROWL_TCP,NULL,"SnoreNotify",n,1);
}
Growl_Backend::~Growl_Backend(){
delete growl;
}
int Growl_Backend::notify(QSharedPointer<Notification>notification){
QString title=Notification::toPlainText(notification->title);
QString text=Notification::toPlainText(notification->text);
qDebug()<<title<<text;
growl->Notify("SnoreNotification",title.toLatin1().data(),text.toLatin1().data(),NULL,notification->getIcon().toLatin1().data());
return ++id;
}
void Growl_Backend::closeNotification(int nr){
}
#include "growl_backend.moc"

View File

@ -0,0 +1,20 @@
#ifndef GROWL_BACKEND_H
#define GROWL_BACKEND_H
#include "core/interface.h"
class Growl_Backend:public Notification_Backend
{
Q_OBJECT
Q_INTERFACES(Notification_Backend);
public:
Growl_Backend();
~Growl_Backend();
bool isPrimaryNotificationBackend(){return true;}
private:
int id;
class Growl *growl;
public slots:
int notify(QSharedPointer<Notification>notification);
void closeNotification(int nr);
};
#endif // GROWL_BACKEND_H

View File

@ -16,7 +16,9 @@ Snarl_Backend::Snarl_Backend()
this->installEventFilter(this);
}
Snarl_Backend::~Snarl_Backend(){
delete snarlInterface;
}
int Snarl_Backend::notify(QSharedPointer<Notification>notification){
int timeout=notification->timeout>=0?notification->timeout:10;

View File

@ -9,6 +9,7 @@ class Snarl_Backend:public Notification_Backend
Q_INTERFACES(Notification_Backend)
public:
Snarl_Backend();
~Snarl_Backend();
bool isPrimaryNotificationBackend(){return true;}