refactoring

This commit is contained in:
Patrick von Reth 2012-01-30 22:10:32 +01:00
parent 556bd5398f
commit e236763168
56 changed files with 341 additions and 350 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.pyc
*~

View File

@ -14,13 +14,13 @@ add_subdirectory(notification)
add_subdirectory(plugins)
set ( SnoreNotify_SRCS ${SnoreNotify_SRCS}
snoreserver.cpp
snore.cpp
application.cpp
${CMAKE_CURRENT_BINARY_DIR}/version.cpp
)
set ( SnoreNotify_HDR ${SnoreNotify_HDR}
snoreserver.h
snore.h
application.h
snore_exports.h
version.h

View File

@ -15,7 +15,7 @@
****************************************************************************************/
#include "icon.h"
#include "../snoreserver.h"
#include "../snore.h"
#include <QCryptographicHash>
#include <QBuffer>
@ -99,7 +99,7 @@ const QString &SnoreIcon::localUrl()const{
if(hasedImages.contains(hash())){
d->m_localFileName = hasedImages[hash()];
}else{
d->m_localFileName = SnoreServer::snoreTMP();
d->m_localFileName = SnoreCore::snoreTMP();
d->m_localFileName = d->m_localFileName .append("/").append(hash()).append(".png");
hasedImages[hash()] = d->m_localFileName;
d->m_img.save(d->m_localFileName ,"PNG");

View File

@ -15,7 +15,7 @@
****************************************************************************************/
#include "notification.h"
#include "snoreserver.h"
#include "snore.h"
#include "notification/icon.h"
#include "plugins/plugincontainer.h"

View File

@ -17,7 +17,6 @@
#ifndef NOTIFICATION_H
#define NOTIFICATION_H
#include "../snore_exports.h"
#include "../application.h"
#include "icon.h"
#include <QVariant>
@ -28,9 +27,9 @@ namespace NotificationEnums{
namespace Prioritys{
enum priority{
LOW=-1,
NORMAL,
HIGH
LOW = -1,
NORMAL = 0,
HIGH = +1
};
Q_DECLARE_FLAGS(prioritys, priority)
Q_DECLARE_OPERATORS_FOR_FLAGS(prioritys)

View File

@ -15,7 +15,7 @@
****************************************************************************************/
#include "../snoreserver.h"
#include "../snore.h"
#include "plugins.h"
#include "snorebackend.h"
#include "snorefrontend.h"
@ -40,7 +40,7 @@ PluginContainer::PluginContainer(QString fileName, QString pluginName, PluginCon
SnorePlugin *PluginContainer::load(){
if(m_instance != NULL)
return m_instance;
QPluginLoader loader ( SnoreServer::pluginDir().absoluteFilePath(file()));
QPluginLoader loader ( SnoreCore::pluginDir().absoluteFilePath(file()));
qDebug()<<"Trying to load"<<file();
if ( !loader.load())
{

View File

@ -22,7 +22,7 @@
#include <QFlag>
namespace Snore{
class SnoreServer;
class SnoreCore;
class SnorePlugin;
class SnoreFrontend;
class SnoreBackend;
@ -45,14 +45,14 @@ public:
const PluginContainer::PluginType type();
static Snore::PluginContainer::PluginType typeFromString(const QString &t);
static PluginContainer::PluginType typeFromString(const QString &t);
static const QStringList &types();
private:
QPointer<SnorePlugin> m_instance;
QString m_pluginFile;
QString m_pluginName;
Snore::PluginContainer::PluginType m_pluginType;
PluginContainer::PluginType m_pluginType;
};
}

View File

@ -14,7 +14,7 @@
* this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************************/
#include "../snoreserver.h"
#include "../snore.h"
#include "snorebackend.h"
#include "snorefrontend.h"
@ -35,7 +35,7 @@ SnorePlugin::~SnorePlugin()
qDebug()<<m_name<<this<<"deleted";
}
bool SnorePlugin::init( SnoreServer *snore )
bool SnorePlugin::init( SnoreCore *snore )
{
qDebug()<<"Initialize"<<m_name<<this<<snore;
this->m_snore = snore;
@ -47,7 +47,7 @@ bool SnorePlugin::isInitialized(){
return m_initialized;
}
SnoreServer* SnorePlugin::snore()
SnoreCore* SnorePlugin::snore()
{
return m_snore.data();
}

View File

@ -18,14 +18,13 @@
#define SNORE_PLUGINS_H
#include "../snore_exports.h"
#include "../notification/notification.h"
#include "plugincontainer.h"
#include <QPointer>
#include <QFlag>
namespace Snore{
class Application;
class SnoreServer;
class SnoreCore;
class SNORE_EXPORT SnorePlugin:public QObject
@ -34,9 +33,9 @@ class SNORE_EXPORT SnorePlugin:public QObject
public:
SnorePlugin ( QString name);
virtual ~SnorePlugin();
virtual bool init( SnoreServer* snore );
virtual bool init( SnoreCore* snore );
bool isInitialized();
SnoreServer* snore();
SnoreCore* snore();
const QString &name() const;
protected:
@ -49,7 +48,7 @@ private:
SnorePlugin() {}
QString m_name;
bool m_initialized;
QPointer<SnoreServer> m_snore;
QPointer<SnoreCore> m_snore;
QHash<uint,QTimer*> m_timeouts;
QList<uint> m_timeout_order;

View File

@ -15,7 +15,8 @@
****************************************************************************************/
#include "snorebackend.h"
#include "../snoreserver.h"
#include "../snore.h"
#include "../application.h"
#include <QTimer>
#include <QPluginLoader>
@ -35,20 +36,20 @@ SnoreBackend::~SnoreBackend()
qDebug()<<"Deleting"<<name();
}
bool SnoreBackend::init( SnoreServer *snore )
bool SnoreBackend::init( SnoreCore *snore )
{
if(!SnorePlugin::init(snore))
return false;
connect( snore,SIGNAL( closeNotify( Snore::Notification ) ),this,SLOT( closeNotification( Snore::Notification) ) );
connect( snore,SIGNAL( applicationInitialized( Snore::Application* ) ),this,SLOT( registerApplication( Snore::Application* ) ) );
connect( snore,SIGNAL( applicationRemoved( Snore::Application* ) ),this,SLOT( unregisterApplication( Snore::Application* ) ) );
connect( snore,SIGNAL( closeNotify( SnoreCore::Notification ) ),this,SLOT( closeNotification( SnoreCore::Notification) ) );
connect( snore,SIGNAL( applicationInitialized( SnoreCore::Application* ) ),this,SLOT( registerApplication( SnoreCore::Application* ) ) );
connect( snore,SIGNAL( applicationRemoved( SnoreCore::Application* ) ),this,SLOT( unregisterApplication( SnoreCore::Application* ) ) );
foreach(Application *a,snore->aplications()){
this->registerApplication(a);
}
return true;
}
SnoreSecondaryBackend::SnoreSecondaryBackend(const QString &name)
@ -62,9 +63,9 @@ SnoreSecondaryBackend::~SnoreSecondaryBackend()
qDebug()<<"Deleting"<<name();
}
bool SnoreSecondaryBackend::init(SnoreServer *snore)
bool SnoreSecondaryBackend::init(SnoreCore *snore)
{
connect( snore,SIGNAL( notify(Snore::Notification) ),this,SLOT( notify( Snore::Notification ) ) );
connect( snore,SIGNAL( notify(SnoreCore::Notification) ),this,SLOT( notify( SnoreCore::Notification ) ) );
return SnoreBackend::init(snore);
}

View File

@ -25,7 +25,7 @@
#include <QtCore>
namespace Snore{
class SnoreServer;
class SnoreCore;
class SNORE_EXPORT SnoreBackend:public SnorePlugin
{
@ -34,14 +34,14 @@ class SNORE_EXPORT SnoreBackend:public SnorePlugin
public:
SnoreBackend ( QString name );
virtual ~SnoreBackend();
virtual bool init(SnoreServer *snore);
virtual bool init(SnoreCore *snore);
public slots:
virtual void registerApplication ( Snore::Application *application ) =0;
virtual void unregisterApplication ( Snore::Application *application ) =0;
virtual uint notify ( Snore::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;
@ -53,7 +53,7 @@ Q_DECLARE_INTERFACE ( Snore::SnoreBackend,
"org.Snore.NotificationBackend/1.0" )
namespace Snore{
class SnoreServer;
class SnoreCore;
class SNORE_EXPORT SnoreSecondaryBackend:public SnoreBackend
{
@ -62,7 +62,7 @@ class SNORE_EXPORT SnoreSecondaryBackend:public SnoreBackend
public:
SnoreSecondaryBackend(const QString &name);
virtual ~SnoreSecondaryBackend();
virtual bool init(SnoreServer *snore);
virtual bool init(SnoreCore *snore);
};

View File

@ -15,7 +15,7 @@
****************************************************************************************/
#include "snorefrontend.h"
#include "../snoreserver.h"
#include "../snore.h"
#include <QTimer>
#include <QPluginLoader>
@ -35,11 +35,11 @@ SnoreFrontend::~SnoreFrontend()
qDebug()<<"Deleting"<<name();
}
bool SnoreFrontend::init( SnoreServer *snore )
bool SnoreFrontend::init( SnoreCore *snore )
{
if(!SnorePlugin::init(snore))
return false;
connect( snore,SIGNAL ( closeNotify( Snore::Notification ) ),this,SLOT ( notificationClosed( Snore::Notification) ) );
connect( snore,SIGNAL ( closeNotify( SnoreCore::Notification ) ),this,SLOT ( notificationClosed( SnoreCore::Notification) ) );
return true;
}
}

View File

@ -25,7 +25,7 @@
namespace Snore{
class Application;
class SnoreServer;
class SnoreCore;
class SnorePlugin;
@ -36,7 +36,7 @@ class SNORE_EXPORT SnoreFrontend:public SnorePlugin
public:
SnoreFrontend ( const QString &name);
virtual ~SnoreFrontend();
virtual bool init(SnoreServer *snore);
virtual bool init(SnoreCore *snore);
public slots:
virtual void actionInvoked( Snore::Notification notification )=0;

View File

@ -14,7 +14,7 @@
* this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************************/
#include "snoreserver.h"
#include "snore.h"
#include "notification/notification.h"
#include "plugins/plugincontainer.h"
#include "plugins/plugins.h"
@ -34,21 +34,21 @@
namespace Snore{
QHash<QString,PluginContainer*> SnoreServer::s_pluginCache = QHash<QString,PluginContainer*>() ;
QHash<QString,PluginContainer*> SnoreCore::s_pluginCache = QHash<QString,PluginContainer*>() ;
QString SnoreServer::s_pluginPath = QString(qApp->applicationDirPath()+"/snoreplugins");
QString SnoreCore::s_pluginPath = QString(qApp->applicationDirPath()+"/snoreplugins");
QString const SnoreServer::version(){
QString const SnoreCore::version(){
return QString().append(Version::major()).append(".").append(Version::minor()).append(Version::suffix());
}
QString const SnoreServer::snoreTMP(){
QString const SnoreCore::snoreTMP(){
static const QString tmp = QDir::temp().path() +"/SnoreNotify/";
return tmp;
}
SnoreServer::SnoreServer ( QSystemTrayIcon *trayIcon ) :
SnoreCore::SnoreCore ( QSystemTrayIcon *trayIcon ) :
m_notificationBackend ( NULL ),
m_trayIcon ( trayIcon )
{
@ -60,10 +60,10 @@ SnoreServer::SnoreServer ( QSystemTrayIcon *trayIcon ) :
}
QHash<QString, PluginContainer *> SnoreServer::pluginCache(){
QHash<QString, PluginContainer *> SnoreCore::pluginCache(){
if(!s_pluginCache.isEmpty())
return s_pluginCache;
QSettings cache(SnoreServer::pluginDir().absoluteFilePath("plugin.cache"),QSettings::IniFormat);
QSettings cache(SnoreCore::pluginDir().absoluteFilePath("plugin.cache"),QSettings::IniFormat);
QString version = cache.value("version").toString();
int size = cache.beginReadArray("plugins");
if(size == 0 || version != Version::revision()){
@ -81,16 +81,16 @@ QHash<QString, PluginContainer *> SnoreServer::pluginCache(){
return s_pluginCache;
}
void SnoreServer::updatePluginCache(const QString &pluginPath){
void SnoreCore::updatePluginCache(const QString &pluginPath){
if(!pluginPath.isEmpty())
s_pluginPath = pluginPath;
QSettings cache(SnoreServer::pluginDir().absoluteFilePath("plugin.cache"),QSettings::IniFormat);
QSettings cache(SnoreCore::pluginDir().absoluteFilePath("plugin.cache"),QSettings::IniFormat);
qDebug()<<"Updating plugin cache"<<cache.fileName();
s_pluginCache.clear();
foreach(const QString &type,PluginContainer::types()){
QDir plPath(SnoreServer::pluginDir().absoluteFilePath(type));
QDir plPath(SnoreCore::pluginDir().absoluteFilePath(type));
qDebug()<<"Searching for plugins in"<<plPath.path();
foreach (QString fileName, plPath.entryList(QDir::Files)) {
QString filepath(plPath.absoluteFilePath(fileName));
@ -107,7 +107,7 @@ void SnoreServer::updatePluginCache(const QString &pluginPath){
plugin->deleteLater();
continue;
}
PluginContainer *info = new PluginContainer( SnoreServer::pluginDir().relativeFilePath(filepath),sp->name(),PluginContainer::typeFromString(type));
PluginContainer *info = new PluginContainer( SnoreCore::pluginDir().relativeFilePath(filepath),sp->name(),PluginContainer::typeFromString(type));
s_pluginCache.insert(info->name(),info);
sp->deleteLater();
qDebug()<<"added "<<info->name()<<"to cache";
@ -127,7 +127,7 @@ void SnoreServer::updatePluginCache(const QString &pluginPath){
cache.endArray();
}
const QDir &SnoreServer::pluginDir()
const QDir &SnoreCore::pluginDir()
{
//TODO:fix logic
static QDir *plDir = NULL;
@ -141,10 +141,10 @@ const QDir &SnoreServer::pluginDir()
return *plDir;
}
void SnoreServer::publicatePlugin ( PluginContainer::PluginTypes types )
void SnoreCore::publicatePlugin ( PluginContainer::PluginTypes types )
{
qDebug()<<"PluginInfo"<<SnoreServer::pluginCache().keys();
foreach ( PluginContainer *info, SnoreServer::pluginCache().values())
qDebug()<<"PluginInfo"<<SnoreCore::pluginCache().keys();
foreach ( PluginContainer *info, SnoreCore::pluginCache().values())
{
if(types == PluginContainer::ALL or types.testFlag(info->type())){
switch(info->type()){
@ -192,7 +192,7 @@ void SnoreServer::publicatePlugin ( PluginContainer::PluginTypes types )
}
}
uint SnoreServer::broadcastNotification ( Notification notification )
uint SnoreCore::broadcastNotification ( Notification notification )
{
qDebug()<<"Broadcasting"<<notification.title()<<notification.timeout();
emit notify ( notification );
@ -208,13 +208,13 @@ uint SnoreServer::broadcastNotification ( Notification notification )
return -1;
}
void SnoreServer::closeNotification ( Notification notification,const NotificationEnums::CloseReasons::closeReasons &reason )
void SnoreCore::closeNotification ( Notification notification,const NotificationEnums::CloseReasons::closeReasons &reason )
{
notification.setCloseReason(reason);
emit closeNotify ( notification );
}
void SnoreServer::notificationActionInvoked ( Notification notification )
void SnoreCore::notificationActionInvoked ( Notification notification )
{
emit actionInvoked(notification);
SnoreFrontend *nf= notification.source();
@ -224,46 +224,46 @@ void SnoreServer::notificationActionInvoked ( Notification notification )
}
}
void SnoreServer::addApplication ( Application *application )
void SnoreCore::addApplication ( Application *application )
{
m_applications.insert ( application->name(),application );
}
void SnoreServer::applicationIsInitialized ( Application *application )
void SnoreCore::applicationIsInitialized ( Application *application )
{
application->setInitialized ( true );
emit applicationInitialized ( application );
}
void SnoreServer::removeApplication ( const QString& appName )
void SnoreCore::removeApplication ( const QString& appName )
{
qDebug()<<"Remove Application"<<appName;
emit applicationRemoved ( m_applications.value ( appName ) );
m_applications.take ( appName )->deleteLater();
}
const ApplicationsList &SnoreServer::aplications() const
const ApplicationsList &SnoreCore::aplications() const
{
return m_applications;
}
const QStringList &SnoreServer::notificationBackends() const
const QStringList &SnoreCore::notificationBackends() const
{
return m_notificationBackends;
}
const QStringList &SnoreServer::notificationFrontends() const
const QStringList &SnoreCore::notificationFrontends() const
{
return m_Frontends;
}
const QStringList &SnoreServer::secondaryNotificationBackends() const
const QStringList &SnoreCore::secondaryNotificationBackends() const
{
return m_secondaryNotificationBackends;
}
void SnoreServer::setPrimaryNotificationBackend ( const QString &backend )
void SnoreCore::setPrimaryNotificationBackend ( const QString &backend )
{
if(!pluginCache().contains(backend)){
qDebug()<<"Unknown Backend:"<<backend;
@ -275,14 +275,16 @@ void SnoreServer::setPrimaryNotificationBackend ( const QString &backend )
m_notificationBackend->init(this);
}
const QString &SnoreServer::primaryNotificationBackend(){
const QString &SnoreCore::primaryNotificationBackend(){
if(m_notificationBackend == NULL)
return "";
return m_notificationBackend->name();
}
QSystemTrayIcon *SnoreServer::trayIcon(){
QSystemTrayIcon *SnoreCore::trayIcon(){
return m_trayIcon;
}
}
#include "snoreserver.moc"
#include "snore.moc"

View File

@ -18,6 +18,7 @@
#define SNORESERVER_H
#include "snore_exports.h"
#include "application.h"
#include "plugins/plugincontainer.h"
#include "notification/notification.h"
@ -27,7 +28,7 @@ class QSystemTrayIcon;
class QDir;
namespace Snore{
class SNORE_EXPORT SnoreServer:public QObject
class SNORE_EXPORT SnoreCore:public QObject
{
Q_OBJECT
public:
@ -37,7 +38,7 @@ public:
static const QDir &pluginDir();
public:
SnoreServer (QSystemTrayIcon *trayIcon=0 );
SnoreCore (QSystemTrayIcon *trayIcon=0 );
void publicatePlugin ( PluginContainer::PluginTypes types );
@ -79,11 +80,11 @@ private:
signals:
void applicationInitialized ( Snore::Application* );
void applicationRemoved ( Snore::Application* );
void notify ( Snore::Notification noti );
void applicationInitialized( Snore::Application* );
void applicationRemoved( Snore::Application* );
void notify( Snore::Notification noti );
void actionInvoked( Snore::Notification );
void closeNotify ( Snore::Notification );
void closeNotify( Snore::Notification );
};

View File

@ -1,49 +0,0 @@
/****************************************************************************************
* Copyright (c) 2010-2012 Patrick von Reth <patrick.vonreth@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License as published by the Free Software *
* Foundation; either version 2 of the License, or (at your option) any later *
* version. *
* *
* This program 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License along with *
* this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************************/
#ifndef SNORENOTIFICATIONINSTANCE_H
#define SNORENOTIFICATIONINSTANCE_H
#include "snore_exports.h"
#include "snoreserver.h"
#include "application.h"
#include "interface.h"
class SNORE_EXPORT SnoreNotificationInstance:public Notification_Frontend
{
Q_OBJECT
public:
SnoreNotificationInstance ( const QString &appname, SnoreServer *parent, const QString &icon="" );
~SnoreNotificationInstance();
void addAlert ( const QString &name,const QString &title = 0, const QString &icon="" );
void registerWithBackends();
void unregisterWithBackends();
int notify ( const QString &alert,const QString &title,const QString &text,const QString &icon = 0,int timeout = 10, NotificationEnums::Prioritys::prioritys priority = NotificationEnums::Prioritys::NORMAL,const QList<Notification::Action*> *actions = NULL);
void actionInvoked ( Notification notification );
void notificationClosed ( Notification notification );
signals:
void notificationActionInvoked ( const Notification &notification );
private:
SnoreNotificationInstance();
Application *_app;
SnoreServer *_snore;
};
#endif // SNORENOTIFICATIONINSTANCE_H

View File

@ -1,12 +1,6 @@
set(CMAKE_SHARED_MODULE_PREFIX)
set(SNORE_BACKEND_INSTALL_PATH ${PLUGIN_INSTALL_PATH}/backend)
set(SNORE_SECONDARY_BACKEND_INSTALL_PATH ${PLUGIN_INSTALL_PATH}/secondary_backend)
set(SNORE_FRONTEND_INSTALL_PATH ${PLUGIN_INSTALL_PATH}/frontend)
set(SNORE_PLUGINS_INSTALL_PATH ${PLUGIN_INSTALL_PATH}/plugin)
add_subdirectory(freedesktopnotification)
add_subdirectory(freedesktopfrontend)
add_subdirectory(snarlnetwork)
add_subdirectory(snarl)
add_subdirectory(growl)
add_subdirectory(trayicon)
add_subdirectory(backends)
add_subdirectory(frontends)
add_subdirectory(secondary_backends)
add_subdirectory(plugins)

View File

@ -0,0 +1,6 @@
set(SNORE_BACKEND_INSTALL_PATH ${PLUGIN_INSTALL_PATH}/backend)
add_subdirectory(freedesktop)
add_subdirectory(snarl)
add_subdirectory(growl)
add_subdirectory(trayicon)

View File

@ -5,26 +5,26 @@ if( WITH_GROWL_BACKEND )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
endif(CMAKE_COMPILER_IS_GNUCXX)
set( GROWL__SRC
growl_backend.cpp
growl.cpp
)
automoc4_add_library(growl_backend MODULE ${GROWL__SRC} )
target_link_libraries(growl_backend snorecore ${QT_QTCORE_LIBRARY} ${CRYPTOPP_LIBRARIES} ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY})
automoc4_add_library(growl MODULE ${GROWL__SRC} )
target_link_libraries(growl snorecore ${QT_QTCORE_LIBRARY} ${CRYPTOPP_LIBRARIES} ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY})
if(MINGW)
#fiexes a multiple defenition error with static boost
SET_TARGET_PROPERTIES(growl_backend PROPERTIES LINK_FLAGS -Wl,--allow-multiple-definition)
SET_TARGET_PROPERTIES(growl PROPERTIES LINK_FLAGS -Wl,--allow-multiple-definition)
endif(MINGW)
if(WIN32)
target_link_libraries(growl_backend wsock32 ws2_32)
target_link_libraries(growl wsock32 ws2_32)
endif(WIN32)
if(UNIX)
target_link_libraries(growl_backend pthread)
target_link_libraries(growl pthread)
endif(UNIX)
install(TARGETS growl_backend ${SNORE_BACKEND_INSTALL_PATH})
install(TARGETS growl ${SNORE_BACKEND_INSTALL_PATH})
else(CRYPTOPP_LIBRARIES AND Boost_SYSTEM_LIBRARY)
if(NOT CRYPTOPP_LIBRARIES)
message(STATUS "Cant build the growl backend because the dependency Cryptopp is missing")

View File

@ -14,40 +14,40 @@
* this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************************/
#include "growl_backend.h"
#include "growl.h"
#include "gntp.h"
#include "core/snoreserver.h"
#include "core/snore.h"
#include <QtCore>
using namespace Snore;
Q_EXPORT_PLUGIN2(growl_backend,Growl_Backend)
Q_EXPORT_PLUGIN2(growl,Growl)
Growl_Backend *Growl_Backend::instance = NULL;
Growl *Growl::s_instance = NULL;
Growl_Backend::Growl_Backend():
Growl::Growl():
SnoreBackend("Growl"),
_id(0)
m_id(0)
{
instance = this;
s_instance = this;
}
Growl_Backend::~Growl_Backend(){
if(snore()!=NULL){
foreach(Application *a,this->snore()->aplications().values()){
unregisterApplication(a);
Growl::~Growl(){
if(snore() != NULL){
foreach(Application *a,snore()->aplications()){
this->unregisterApplication(a);
}
}
}
void Growl_Backend::registerApplication(Application *application){
void Growl::registerApplication(Application *application){
gntp *growl = new gntp(application->name().toUtf8().constData(),application->icon().localUrl().toUtf8().constData());
gntp::gntp_callback callback(&gntpCallback);
gntp::gntp_callback callback(&Growl::gntpCallback);
growl->set_gntp_callback(callback);
std::vector<std::string> alerts;
foreach(Alert *a,application->alerts()){
@ -59,41 +59,41 @@ void Growl_Backend::registerApplication(Application *application){
}catch(const std::exception& e){
qDebug()<<"Growl:"<<e.what();
}
_applications.insert(application->name(),growl);
m_applications.insert(application->name(),growl);
}
void Growl_Backend::unregisterApplication(Application *application){
gntp *growl = _applications.take(application->name());
void Growl::unregisterApplication(Application *application){
gntp *growl = m_applications.take(application->name());
if(growl == NULL)
return;
delete growl;
}
uint Growl_Backend::notify(Notification notification){
gntp *growl = _applications.value(notification.application());
uint Growl::notify(Notification notification){
gntp *growl = m_applications.value(notification.application());
if(growl == NULL)
return -1;
//qDebug()<<"Notify Growl:"<<notification.application()<<Notification.toPlainText(notification.title());
try{
growl->notify(notification.alert().toUtf8().constData(),_id,
growl->notify(notification.alert().toUtf8().constData(),m_id,
Notification::toPlainText(notification.title()).toUtf8().constData(),
Notification::toPlainText(notification.text()).toUtf8().constData(),
notification.icon().localUrl().isEmpty()?NULL:notification.icon().localUrl().toUtf8().constData(),NULL,"1");
activeNotifications.insert(_id,notification);
activeNotifications.insert(m_id,notification);
}catch(const std::exception& e){
qDebug()<<"Growl:"<<e.what();
}
return _id++;
return m_id++;
}
void Growl_Backend::closeNotification(Notification notification){
void Growl::closeNotification(Notification notification){
Q_UNUSED(notification);
}
void Growl_Backend::gntpCallback(const int &id,const std::string &reason,const std::string &data){
void Growl::gntpCallback(const int &id,const std::string &reason,const std::string &data){
qDebug()<<"Growl Callback"<<id<<QString(reason.c_str())<<QString(data.c_str());
Notification n = instance->activeNotifications.take(id);
Notification n = s_instance->activeNotifications.take(id);
NotificationEnums::CloseReasons::closeReasons r = NotificationEnums::CloseReasons::NONE;
if(reason == "TIMEDOUT")
r = NotificationEnums::CloseReasons::TIMED_OUT;
@ -102,11 +102,11 @@ void Growl_Backend::gntpCallback(const int &id,const std::string &reason,const s
else if(reason == "CLICK"){
r = NotificationEnums::CloseReasons::CLOSED;
n.setActionInvoked(QString(data.c_str()).toInt());
instance->snore()->notificationActionInvoked(n);
s_instance->snore()->notificationActionInvoked(n);
}
instance->snore()->closeNotification(n,r);
s_instance->snore()->closeNotification(n,r);
}
#include "growl_backend.moc"
#include "growl.moc"

View File

@ -20,19 +20,20 @@
#include <string>
class Growl_Backend:public Snore::SnoreBackend
class Growl:public Snore::SnoreBackend
{
Q_OBJECT
Q_INTERFACES(Snore::SnoreBackend)
public:
Growl_Backend();
~Growl_Backend();
Growl();
~Growl();
static void gntpCallback(const int &id,const std::string &reason,const std::string &data);
private:
//a static instance for the static callback methode
static Growl_Backend *instance;
uint _id;
QHash<QString,class gntp*> _applications;
static Growl *s_instance;
uint m_id;
QHash<QString,class gntp*> m_applications;
public slots:
void registerApplication(Snore::Application *application);

View File

@ -0,0 +1,13 @@
if(WIN32)
message(STATUS "Adding Snarl notification backend")
set( SNARL_SRC
SnarlInterface.cpp
snarl.cpp
)
automoc4_add_library(snarl MODULE ${SNARL_SRC} )
target_link_libraries(snarl snorecore ${QT_QTCORE_LIBRARY} )
install(TARGETS snarl ${SNORE_BACKEND_INSTALL_PATH})
endif(WIN32)

View File

@ -14,13 +14,16 @@
* this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************************/
#include "snarl_backend.h"
#include "snarl.h"
#include "core/snoreserver.h"
#include "core/snore.h"
#include "core/plugins/snorebackend.h"
#include <QtCore>
#include <QTextEdit>
#include <QtDebug>
#include <QWidget>
#include <iostream>
@ -33,43 +36,112 @@
using namespace Snore;
using namespace Snarl::V42;
Q_EXPORT_PLUGIN2(snarl_backend,Snarl_Backend)
Q_EXPORT_PLUGIN2(snarl,SnarlBackend)
Snarl_Backend::Snarl_Backend():
class SnarlBackend::SnarlWidget:public QWidget
{
Q_OBJECT
public:
SnarlWidget(SnarlBackend * snarl):
m_snarl(snarl)
{
SNARL_GLOBAL_MESSAGE = SnarlInterface::Broadcast();
}
bool winEvent( MSG * msg, long * result ){
if(msg->message == SNARL_GLOBAL_MESSAGE){
int action = msg->wParam;
if(action == SnarlEnums::SnarlLaunched){
foreach(Application *a,m_snarl->snore()->aplications()){
m_snarl->registerApplication(a);
}
}
}else if(msg->message == SNORENOTIFIER_MESSAGE_ID){
int action = msg->wParam & 0xffff;
int data = (msg->wParam & 0xffffffff) >> 16;
uint notificationID = msg->lParam;
qDebug()<<"_snarl->activeNotifications"<<m_snarl->activeNotifications.keys();
Notification notification(m_snarl->activeNotifications[notificationID]);
qDebug()<<"recived a Snarl callback id:"<<notificationID<<"action:"<<action<<"data:"<<data;
NotificationEnums::CloseReasons::closeReasons reason = NotificationEnums::CloseReasons::NONE;
switch(action){
case SnarlEnums::CallbackInvoked:
reason = NotificationEnums::CloseReasons::CLOSED;
break;
case SnarlEnums::NotifyAction:
reason = NotificationEnums::CloseReasons::CLOSED;
notification.setActionInvoked(data);
m_snarl->snore()->notificationActionInvoked(notification);
break;
case SnarlEnums::CallbackClosed:
reason = NotificationEnums::CloseReasons::DISMISSED;
break;
case SnarlEnums::CallbackTimedOut:
reason = NotificationEnums::CloseReasons::TIMED_OUT;
break;
//away stuff
case SnarlEnums::SnarlUserAway:
qDebug()<<"Snalr user has gone away";
m_snarl->m_away = true;
break;
case SnarlEnums::SnarlUserBack:
qDebug()<<"Snalr user has returned";
m_snarl->activeNotifications.clear();
m_snarl->m_away = false;
break;
default:
qDebug()<<"Unknown snarl action found!!";
return false;
}
m_snarl->snore()->closeNotification(notification,reason);
return true;
}
return false;
}
private:
uint SNARL_GLOBAL_MESSAGE;
SnarlBackend* m_snarl;
};
SnarlBackend::SnarlBackend():
SnoreBackend("Snarl"),
_away(false)
m_away(false)
{
}
Snarl_Backend::~Snarl_Backend()
SnarlBackend::~SnarlBackend()
{
if(snore()!=NULL){
foreach(Application *a,this->snore()->aplications().values()){
unregisterApplication(a);
if(snore() != NULL){
foreach(Application *a,snore()->aplications()){
this->unregisterApplication(a);
}
}
delete m_defautSnarlinetrface;
}
bool Snarl_Backend::init(SnoreServer *snore){
winIDWidget = new SnarlWidget(this);
bool SnarlBackend::init(SnoreCore *snore){
m_eventLoop = new SnarlBackend::SnarlWidget(this);
SnarlInterface *snarlInterface = new SnarlInterface();
_applications.insert("SnoreNotify",snarlInterface);
m_applications.insert("SnoreNotify",snarlInterface);
qDebug()<<"Initiating Snarl Backend, Snarl version: "<<snarlInterface->GetVersion();
m_defautSnarlinetrface = new SnarlInterface();
return SnoreBackend::init(snore);
}
void Snarl_Backend::registerApplication(Application *application){
void SnarlBackend::registerApplication(Application *application){
SnarlInterface *snarlInterface = NULL;
if(_applications.contains(application->name())){
snarlInterface = _applications.value(application->name());
if(m_applications.contains(application->name())){
snarlInterface = m_applications.value(application->name());
}else{
snarlInterface = new SnarlInterface();
_applications.insert(application->name(),snarlInterface);
m_applications.insert(application->name(),snarlInterface);
}
qDebug()<<"Register with Snarl"<<application->name();
QString appName = application->name();
@ -77,7 +149,7 @@ void Snarl_Backend::registerApplication(Application *application){
snarlInterface->Register(appName.toUtf8().constData(),
application->name().toUtf8().constData(),
application->icon().localUrl().toUtf8().constData(),
0,winIDWidget->winId(),SNORENOTIFIER_MESSAGE_ID);
0,m_eventLoop->winId(),SNORENOTIFIER_MESSAGE_ID);
foreach(Alert *alert,application->alerts()){
qDebug()<<"registering snarl alert"<<application->name();
@ -87,8 +159,8 @@ void Snarl_Backend::registerApplication(Application *application){
}
}
void Snarl_Backend::unregisterApplication(Application *application){
SnarlInterface *snarlInterface = _applications.take(application->name());
void SnarlBackend::unregisterApplication(Application *application){
SnarlInterface *snarlInterface = m_applications.take(application->name());
if(snarlInterface == NULL)
return;
QString appName = application->name();
@ -97,12 +169,12 @@ void Snarl_Backend::unregisterApplication(Application *application){
delete snarlInterface;
}
uint Snarl_Backend::notify(Notification notification){
SnarlInterface *snarlInterface = _applications.value(notification.application());
uint SnarlBackend::notify(Notification notification){
SnarlInterface *snarlInterface = m_applications.value(notification.application());
qDebug()<<"Snarl using the notification instance of:"<<notification.application();
if(snarlInterface == NULL){
qDebug()<<notification.application()<<"not in snarl interfaces, defaulting";
qDebug()<<_applications.keys();
qDebug()<<m_applications.keys();
snarlInterface = m_defautSnarlinetrface;
}
uint id = notification.id();
@ -120,7 +192,7 @@ uint Snarl_Backend::notify(Notification notification){
snarlInterface->AddAction(id,a->name.toUtf8().constData(),QString("@").append(QString::number(a->id)).toUtf8().constData());
}
//add ack stuff
if(!_away)
if(!m_away)
activeNotifications[id] = notification;
}else{
//update message
@ -137,70 +209,15 @@ uint Snarl_Backend::notify(Notification notification){
return id;
}
void Snarl_Backend::closeNotification(Notification notification){
void SnarlBackend::closeNotification(Notification notification){
m_defautSnarlinetrface->Hide(notification.id());
activeNotifications.remove(notification.id());
}
SnarlWidget::SnarlWidget(Snarl_Backend * snarl):
_snarl(snarl)
{
SNARL_GLOBAL_MESSAGE = SnarlInterface::Broadcast();
}
bool SnarlWidget::winEvent(MSG * msg, long * result){
if(msg->message == SNARL_GLOBAL_MESSAGE){
int action = msg->wParam;
if(action == SnarlEnums::SnarlLaunched){
foreach(Application *a,_snarl->snore()->aplications()){
_snarl->registerApplication(a);
}
}
}else if(msg->message == SNORENOTIFIER_MESSAGE_ID){
int action = msg->wParam & 0xffff;
int data = (msg->wParam & 0xffffffff) >> 16;
uint notificationID = msg->lParam;
qDebug()<<"_snarl->activeNotifications"<<_snarl->activeNotifications.keys();
Notification notification(_snarl->activeNotifications[notificationID]);
qDebug()<<"recived a Snarl callback id:"<<notificationID<<"action:"<<action<<"data:"<<data;
NotificationEnums::CloseReasons::closeReasons reason = NotificationEnums::CloseReasons::NONE;
switch(action){
case SnarlEnums::CallbackInvoked:
reason = NotificationEnums::CloseReasons::CLOSED;
break;
case SnarlEnums::NotifyAction:
reason = NotificationEnums::CloseReasons::CLOSED;
notification.setActionInvoked(data);
_snarl->snore()->notificationActionInvoked(notification);
break;
case SnarlEnums::CallbackClosed:
reason = NotificationEnums::CloseReasons::DISMISSED;
break;
case SnarlEnums::CallbackTimedOut:
reason = NotificationEnums::CloseReasons::TIMED_OUT;
break;
//away stuff
case SnarlEnums::SnarlUserAway:
qDebug()<<"Snalr user has gone away";
_snarl->_away = true;
break;
case SnarlEnums::SnarlUserBack:
qDebug()<<"Snalr user has returned";
_snarl->activeNotifications.clear();
_snarl->_away = false;
break;
default:
qDebug()<<"Unknown snarl action found!!";
return false;
}
_snarl->snore()->closeNotification(notification,reason);
return true;
}
return false;
}
#include "snarl_backend.moc"
#include "snarl.moc"

View File

@ -19,29 +19,22 @@
#include "core/plugins/snorebackend.h"
#include "SnarlInterface.h"
#include <QWidget>
namespace Snore{
class SnoreServer;
}
class SnarlWidget;
class Snarl_Backend:public Snore::SnoreBackend
class SnarlBackend:public Snore::SnoreBackend
{
Q_OBJECT
Q_INTERFACES(Snore::SnoreBackend)
friend class SnarlWidget;
public:
Snarl_Backend();
~Snarl_Backend();
virtual bool init(Snore::SnoreServer *snore);
SnarlBackend();
~SnarlBackend();
virtual bool init(Snore::SnoreCore *snore);
private:
SnarlWidget* winIDWidget;
QHash<QString,Snarl::V42::SnarlInterface*> _applications;
class SnarlWidget;
SnarlBackend::SnarlWidget* m_eventLoop;
QHash<QString,Snarl::V42::SnarlInterface*> m_applications;
Snarl::V42::SnarlInterface* m_defautSnarlinetrface;
bool _away;
bool m_away;
public slots:
void registerApplication(Snore::Application *application);
@ -51,18 +44,6 @@ public slots:
};
class SnarlWidget:public QWidget
{
Q_OBJECT
public:
SnarlWidget(Snarl_Backend* snarl);
bool winEvent( MSG * message, long * result );
private:
uint SNARL_GLOBAL_MESSAGE;
Snarl_Backend* _snarl;
};

View File

@ -0,0 +1,7 @@
set( trayicon_SRC
trayiconnotifer.cpp
)
automoc4_add_library(trayicon MODULE ${trayicon_SRC} )
target_link_libraries(trayicon snorecore ${QT_QTCORE_LIBRARY} )
install(TARGETS trayicon ${SNORE_BACKEND_INSTALL_PATH})

View File

@ -1,5 +1,5 @@
#include "trayiconnotifer.h"
#include "core/snoreserver.h"
#include "core/snore.h"
#include <QtCore>
#include <QSystemTrayIcon>
@ -8,7 +8,7 @@
#include <QDebug>
using namespace Snore;
Q_EXPORT_PLUGIN2(trayicon_backend,TrayIconNotifer)
Q_EXPORT_PLUGIN2(trayicon,TrayIconNotifer)
TrayIconNotifer::TrayIconNotifer () :
SnoreBackend ( "SystemTray" ),
@ -18,12 +18,12 @@ TrayIconNotifer::TrayIconNotifer () :
}
bool TrayIconNotifer::init(SnoreServer *snore){
connect(m_trayIcon,SIGNAL(messageClicked()),this,SLOT(actionInvoked()));
m_trayIcon = snore->trayIcon();
if(m_trayIcon == NULL)
return false;
return SnoreBackend::init(snore);
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::registerApplication ( Application *application )

View File

@ -6,7 +6,7 @@
#include <QTime>
namespace Snore{
class SnoreServer;
class SnoreCore;
}
class QSystemTrayIcon;
@ -17,7 +17,7 @@ class TrayIconNotifer:public Snore::SnoreBackend
Q_INTERFACES(Snore::SnoreBackend)
public:
TrayIconNotifer ();
virtual bool init(Snore::SnoreServer *snore);
virtual bool init(Snore::SnoreCore *snore);
bool isPrimaryNotificationBackend();
public slots:

View File

@ -0,0 +1,6 @@
set(SNORE_FRONTEND_INSTALL_PATH ${PLUGIN_INSTALL_PATH}/frontend)
add_subdirectory(freedesktop)
add_subdirectory(snarlnetwork)

View File

@ -0,0 +1,35 @@
if(QT_QTDBUS_FOUND AND WITH_FREEDESKTOP_FRONTEND)
message(STATUS "Adding freedesktop notification frontend")
set ( FREEDESKTOP_NOTIFICATION_FRONTEND_SRC
freedesktopnotificationfrontend.cpp
../../backends/freedesktop/fredesktopnotification.cpp
)
qt4_add_dbus_adaptor( FREEDESKTOP_NOTIFICATION_FRONTEND_SRC org.freedesktop.Notifications.xml freedesktopnotificationfrontend.h FreedesktopNotification_Frontend)
automoc4_add_library(freedesktop MODULE ${FREEDESKTOP_NOTIFICATION_FRONTEND_SRC} )
target_link_libraries(freedesktop snorecore ${QT_QTDBUS_LIBRARY} ${QT_QTGUI_LIBRARY} )
if(KDE4_FOUND)
target_link_libraries(freedesktop ${KDE4_KDEUI_LIBRARY})
endif(KDE4_FOUND)
#install the dbus interface
if(WIN32)
set(SNORE_LOCATION ../bin/snorenotify)
else(WIN32)
set(SNORE_LOCATION ${CMAKE_INSTALL_PREFIX}/bin/snorenotify)
endif(WIN32)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/org.freedesktop.Notifications.service.cmake ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Notifications.service)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Notifications.service
DESTINATION share/dbus-1/services/)
install(TARGETS freedesktop ${SNORE_FRONTEND_INSTALL_PATH})
endif(QT_QTDBUS_FOUND AND WITH_FREEDESKTOP_FRONTEND)

View File

@ -3,16 +3,16 @@ if(QT_QTDBUS_FOUND AND WITH_FREEDESKTOP_FRONTEND)
set ( FREEDESKTOP_NOTIFICATION_FRONTEND_SRC
freedesktopnotificationfrontend.cpp
../freedesktopnotification/fredesktopnotification.cpp
../../backends/freedesktop/fredesktopnotification.cpp
)
qt4_add_dbus_adaptor( FREEDESKTOP_NOTIFICATION_FRONTEND_SRC org.freedesktop.Notifications.xml freedesktopnotificationfrontend.h FreedesktopNotification_Frontend)
automoc4_add_library(freedesktop_frontend MODULE ${FREEDESKTOP_NOTIFICATION_FRONTEND_SRC} )
target_link_libraries(freedesktop_frontend snorecore ${QT_QTDBUS_LIBRARY} ${QT_QTGUI_LIBRARY} )
automoc4_add_library(freedesktop MODULE ${FREEDESKTOP_NOTIFICATION_FRONTEND_SRC} )
target_link_libraries(freedesktop snorecore ${QT_QTDBUS_LIBRARY} ${QT_QTGUI_LIBRARY} )
if(KDE4_FOUND)
target_link_libraries(freedesktop_frontend ${KDE4_KDEUI_LIBRARY})
target_link_libraries(freedesktop ${KDE4_KDEUI_LIBRARY})
endif(KDE4_FOUND)
@ -27,7 +27,7 @@ if(QT_QTDBUS_FOUND AND WITH_FREEDESKTOP_FRONTEND)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Notifications.service
DESTINATION share/dbus-1/services/)
install(TARGETS freedesktop_frontend ${SNORE_FRONTEND_INSTALL_PATH})
install(TARGETS freedesktop ${SNORE_FRONTEND_INSTALL_PATH})
endif(QT_QTDBUS_FOUND AND WITH_FREEDESKTOP_FRONTEND)

View File

@ -17,8 +17,8 @@
#include "freedesktopnotificationfrontend.h"
#include "notificationsadaptor.h"
#include "plugins/freedesktopnotification/fredesktopnotification.h"
#include "core/snoreserver.h"
#include "plugins/backends/freedesktop/fredesktopnotification.h"
#include "core/snore.h"
#include <QtCore>
#include <QtDBus>
@ -32,7 +32,7 @@ using namespace Snore;
Q_EXPORT_PLUGIN2(freedesktop_frontend,FreedesktopNotification_Frontend)
FreedesktopNotification_Frontend::FreedesktopNotification_Frontend():
SnoreFrontend("FreedesktopNotification_Frontend")
SnoreFrontend("Freedesktop")
{
}
@ -42,7 +42,7 @@ FreedesktopNotification_Frontend::~FreedesktopNotification_Frontend(){
dbus.unregisterService( "org.freedesktop.Notifications" );
}
bool FreedesktopNotification_Frontend::init(SnoreServer *snore){
bool FreedesktopNotification_Frontend::init(SnoreCore *snore){
new NotificationsAdaptor(this);
QDBusConnection dbus = QDBusConnection::sessionBus();
dbus.registerService( "org.freedesktop.Notifications" );

View File

@ -25,7 +25,7 @@ class FreedesktopNotification_Frontend:public Snore::SnoreFrontend{
public:
FreedesktopNotification_Frontend();
~FreedesktopNotification_Frontend();
virtual bool init(Snore::SnoreServer *snore);
virtual bool init(Snore::SnoreCore *snore);
void actionInvoked(Snore::Notification notification);
void notificationClosed(Snore::Notification notification);

View File

@ -17,7 +17,7 @@
#include "parser.h"
#include "snarlnetwork.h"
#include "core/snoreserver.h"
#include "core/snore.h"
#include "core/notification/notification.h"

View File

@ -15,7 +15,7 @@
****************************************************************************************/
#include "snarlnetwork.h"
#include "core/snoreserver.h"
#include "core/snore.h"
#include <QtCore>
#include <QTcpServer>
@ -28,7 +28,7 @@ Q_EXPORT_PLUGIN2(snalnetwork,SnarlNetworkFrontend)
SnarlNetworkFrontend::SnarlNetworkFrontend():
SnoreFrontend("SnarlNetworkFrontend")
SnoreFrontend("SnarlNetwork")
{
}
@ -36,7 +36,7 @@ SnarlNetworkFrontend::SnarlNetworkFrontend():
SnarlNetworkFrontend::~SnarlNetworkFrontend(){
}
bool SnarlNetworkFrontend::init(SnoreServer *snore){
bool SnarlNetworkFrontend::init(SnoreCore *snore){
parser=new Parser(this);
tcpServer=new QTcpServer(this);
if(!tcpServer->listen(QHostAddress::Any,port)){

View File

@ -23,7 +23,7 @@
namespace Snore{
class Notification;
class SnoreServer;
class SnoreCore;
}
struct SnarlNotification{
@ -45,7 +45,7 @@ public:
public:
SnarlNetworkFrontend();
~SnarlNetworkFrontend();
virtual bool init(Snore::SnoreServer *snore);
virtual bool init(Snore::SnoreCore *snore);
void actionInvoked(Snore::Notification notification);
void notificationClosed(Snore::Notification notification);

View File

@ -0,0 +1,3 @@
set(SNORE_PLUGINS_INSTALL_PATH ${PLUGIN_INSTALL_PATH}/plugin)

View File

@ -0,0 +1,2 @@
set(SNORE_SECONDARY_BACKEND_INSTALL_PATH ${PLUGIN_INSTALL_PATH}/secondary_backend)

View File

@ -1,12 +0,0 @@
if(WIN32)
message(STATUS "Adding Snarl notification backend")
set( SNARL__SRC
SnarlInterface.cpp
snarl_backend.cpp
)
automoc4_add_library(snarln_backend MODULE ${SNARL__SRC} )
target_link_libraries(snarln_backend snorecore ${QT_QTCORE_LIBRARY} )
install(TARGETS snarln_backend ${SNORE_BACKEND_INSTALL_PATH})
endif(WIN32)

View File

@ -1,7 +0,0 @@
set( trayicon_SRC
trayiconnotifer.cpp
)
automoc4_add_library(trayicon_backend MODULE ${trayicon_SRC} )
target_link_libraries(trayicon_backend snorecore ${QT_QTCORE_LIBRARY} )
install(TARGETS trayicon_backend ${SNORE_BACKEND_INSTALL_PATH})

View File

@ -1,10 +0,0 @@
set( trayicon_SRC
trayiconnotifer.cpp
)
automoc4_add_library(trayicon_backend MODULE ${trayicon_SRC} )
target_link_libraries(trayicon_backend snorecore ${QT_QTCORE_LIBRARY} )
install(TARGETS snarln_backend ${SNORE_BACKEND_INSTALL_PATH})
endif(WIN32)

View File

@ -16,7 +16,7 @@
#include "snorenotify.h"
#include "trayicon.h"
#include "core/snoreserver.h"
#include "core/snore.h"
#include <QDir>
#include <QFile>
@ -35,7 +35,7 @@ SnoreNotify::SnoreNotify():
m_settings("TheOneRing","SnoreNotify")
{
m_trayIcon = new TrayIcon();
m_snore = new Snore::SnoreServer(m_trayIcon->trayIcon());
m_snore = new SnoreCore(m_trayIcon->trayIcon());
m_snore->publicatePlugin(PluginContainer::ALL);
load();
m_trayIcon->initConextMenu(m_snore);

View File

@ -20,7 +20,7 @@
#include <QtCore>
namespace Snore{
class SnoreServer;
class SnoreCore;
}
class SnoreNotify:public QObject
@ -34,7 +34,7 @@ public:
private:
class TrayIcon *m_trayIcon;
Snore::SnoreServer *m_snore;
Snore::SnoreCore *m_snore;
class QSettings m_settings;
private slots:

View File

@ -15,7 +15,7 @@
****************************************************************************************/
#include "trayicon.h"
#include "core/snoreserver.h"
#include "core/snore.h"
#include <QSystemTrayIcon>
#include <QMenu>
@ -28,7 +28,7 @@ TrayIcon::TrayIcon()
_trayIcon = new QSystemTrayIcon(QIcon(":/root/snore.png"));
}
void TrayIcon::initConextMenu(SnoreServer *snore){
void TrayIcon::initConextMenu(SnoreCore *snore){
_snore = snore;
_trayIcon->setVisible(true);

View File

@ -20,7 +20,7 @@
#include <QtCore>
namespace Snore{
class SnoreServer;
class SnoreCore;
}
class TrayIcon:public QObject
@ -28,7 +28,7 @@ class TrayIcon:public QObject
Q_OBJECT
public:
TrayIcon();
void initConextMenu(Snore::SnoreServer *snore);
void initConextMenu(Snore::SnoreCore *snore);
void hide();
class QSystemTrayIcon* trayIcon();
@ -36,7 +36,7 @@ private:
class QSystemTrayIcon *_trayIcon;
class QMenu *_trayMenu;
class QList<class QAction*> _backendActions;
class Snore::SnoreServer *_snore;
class Snore::SnoreCore *_snore;
public slots: