use new logging function

This commit is contained in:
Patrick von Reth 2014-01-20 01:22:56 +01:00
parent 8720c0c6d7
commit f1dab6aa55
17 changed files with 65 additions and 61 deletions

View File

@ -20,6 +20,7 @@ set ( SnoreNotify_SRCS ${SnoreNotify_SRCS}
alert.cpp alert.cpp
alert_p.cpp alert_p.cpp
hint.cpp hint.cpp
log.cpp
${CMAKE_CURRENT_BINARY_DIR}/version.cpp ${CMAKE_CURRENT_BINARY_DIR}/version.cpp
${SNORENOTIFY_RCS} ${SNORENOTIFY_RCS}
) )
@ -30,6 +31,7 @@ set ( SnoreNotify_HDR ${SnoreNotify_HDR}
application.h application.h
alert.h alert.h
hint.h hint.h
log.h
snore_exports.h snore_exports.h
version.h version.h
) )

View File

@ -109,7 +109,7 @@ void IconData::download()
{ {
if(!QFile(m_localUrl).exists()) if(!QFile(m_localUrl).exists())
{ {
qDebug() << "Downloading:" << m_url; snoreDebug( SNORE_DEBUG ) << "Downloading:" << m_url;
QNetworkAccessManager manager; QNetworkAccessManager manager;
QEventLoop loop; QEventLoop loop;
QNetworkRequest request(m_url); QNetworkRequest request(m_url);

View File

@ -22,6 +22,7 @@
#include "notification/notification_p.h" #include "notification/notification_p.h"
#include "notification/icon.h" #include "notification/icon.h"
#include "../hint.h" #include "../hint.h"
#include "../log.h"
#include <QSharedData> #include <QSharedData>
@ -45,7 +46,7 @@ NotificationData::NotificationData (const Snore::Application &application, const
m_closeReason(NotificationEnums::CloseReasons::NONE) m_closeReason(NotificationEnums::CloseReasons::NONE)
{ {
notificationCount++; notificationCount++;
qDebug()<< "Creating Notification: ActiveNotifications" << notificationCount << "id" << m_id; snoreDebug( SNORE_DEBUG ) << "Creating Notification: ActiveNotifications" << notificationCount << "id" << m_id;
} }
Snore::NotificationData::NotificationData(const Notification &old, const QString &title, const QString &text, const Icon &icon, int timeout, NotificationEnums::Prioritys::prioritys priority): Snore::NotificationData::NotificationData(const Notification &old, const QString &title, const QString &text, const Icon &icon, int timeout, NotificationEnums::Prioritys::prioritys priority):
@ -62,7 +63,7 @@ Snore::NotificationData::NotificationData(const Notification &old, const QString
m_toReplace(old) m_toReplace(old)
{ {
notificationCount++; notificationCount++;
qDebug()<< "Creating Notification: ActiveNotifications" << notificationCount << "id" << m_id; snoreDebug( SNORE_DEBUG )<< "Creating Notification: ActiveNotifications" << notificationCount << "id" << m_id;
} }
NotificationData::~NotificationData() NotificationData::~NotificationData()
@ -72,7 +73,7 @@ NotificationData::~NotificationData()
m_timeoutTimer->deleteLater(); m_timeoutTimer->deleteLater();
} }
notificationCount--; notificationCount--;
qDebug() << "Deleting Notification: ActiveNotifications" << notificationCount << "id" << m_id << "Close Reason:" << m_closeReason; snoreDebug( SNORE_DEBUG ) << "Deleting Notification: ActiveNotifications" << notificationCount << "id" << m_id << "Close Reason:" << m_closeReason;
} }

View File

@ -51,7 +51,7 @@ SnorePlugin *PluginContainer::load()
{ {
if ( !m_loader.load()) if ( !m_loader.load())
{ {
qDebug() << "Failed loading plugin: " << m_loader.errorString(); snoreDebug( SNORE_DEBUG ) << "Failed loading plugin: " << m_loader.errorString();
return NULL; return NULL;
} }
return qobject_cast<SnorePlugin*> ( m_loader.instance()); return qobject_cast<SnorePlugin*> ( m_loader.instance());
@ -109,33 +109,33 @@ const QStringList &PluginContainer::types()
void PluginContainer::updatePluginCache(){ void PluginContainer::updatePluginCache(){
qDebug() << "Updating plugin cache"; snoreDebug( SNORE_DEBUG ) << "Updating plugin cache";
s_pluginCache.clear(); s_pluginCache.clear();
cache().remove(""); cache().remove("");
foreach(const QString &type,PluginContainer::types()){ foreach(const QString &type,PluginContainer::types()){
QDir plPath(SnoreCorePrivate::pluginDir().absoluteFilePath(type)); QDir plPath(SnoreCorePrivate::pluginDir().absoluteFilePath(type));
qDebug() << "Searching for plugins in" << plPath.path(); snoreDebug( SNORE_DEBUG ) << "Searching for plugins in" << plPath.path();
foreach (QString fileName, plPath.entryList(QDir::Files)) foreach (QString fileName, plPath.entryList(QDir::Files))
{ {
QString filepath(plPath.absoluteFilePath(fileName)); QString filepath(plPath.absoluteFilePath(fileName));
qDebug() << "adding" << filepath; snoreDebug( SNORE_DEBUG ) << "adding" << filepath;
QPluginLoader loader(filepath); QPluginLoader loader(filepath);
QObject *plugin = loader.instance(); QObject *plugin = loader.instance();
if (plugin == NULL) { if (plugin == NULL) {
qDebug() << "Failed loading plugin: " << filepath << loader.errorString(); snoreDebug( SNORE_DEBUG ) << "Failed loading plugin: " << filepath << loader.errorString();
continue; continue;
} }
SnorePlugin *sp = qobject_cast<SnorePlugin*>(plugin); SnorePlugin *sp = qobject_cast<SnorePlugin*>(plugin);
if(sp == NULL){ if(sp == NULL){
qDebug() << "Error:" << fileName << " is not a Snore plugin" ; snoreDebug( SNORE_DEBUG ) << "Error:" << fileName << " is not a Snore plugin" ;
loader.unload(); loader.unload();
continue; continue;
} }
PluginContainer *info = new PluginContainer( SnoreCorePrivate::pluginDir().relativeFilePath(filepath),sp->name(),PluginContainer::typeFromString(type)); PluginContainer *info = new PluginContainer( SnoreCorePrivate::pluginDir().relativeFilePath(filepath),sp->name(),PluginContainer::typeFromString(type));
s_pluginCache.insert(info->name(),info); s_pluginCache.insert(info->name(),info);
qDebug() << "added" << info->name() << "to cache"; snoreDebug( SNORE_DEBUG ) << "added" << info->name() << "to cache";
} }
} }
cache().setValue("version",Version::revision()); cache().setValue("version",Version::revision());

View File

@ -36,7 +36,7 @@ SnorePlugin::SnorePlugin ( const QString &name ) :
SnorePlugin::~SnorePlugin() SnorePlugin::~SnorePlugin()
{ {
qDebug() << m_name << this << "deleted"; snoreDebug( SNORE_DEBUG ) << m_name << this << "deleted";
deinitialize(); deinitialize();
} }
@ -47,7 +47,7 @@ bool SnorePlugin::initialize( SnoreCore *snore )
qFatal("Something went wrong, plugin %s is already initialized",this->name().toLatin1().constData()); qFatal("Something went wrong, plugin %s is already initialized",this->name().toLatin1().constData());
return false; return false;
} }
qDebug() << "Initialize" << m_name << this << snore; snoreDebug( SNORE_DEBUG ) << "Initialize" << m_name << this << snore;
this->m_snore = snore; this->m_snore = snore;
m_initialized = true; m_initialized = true;
return true; return true;
@ -72,7 +72,7 @@ bool SnorePlugin::deinitialize()
{ {
if(m_initialized) if(m_initialized)
{ {
qDebug() << "Deinitialize" << m_name << this; snoreDebug( SNORE_DEBUG ) << "Deinitialize" << m_name << this;
m_initialized = false; m_initialized = false;
return true; return true;
} }

View File

@ -41,7 +41,7 @@ SnoreBackend::SnoreBackend (const QString &name , bool canCloseNotification, boo
SnoreBackend::~SnoreBackend() SnoreBackend::~SnoreBackend()
{ {
qDebug()<<"Deleting"<<name(); snoreDebug( SNORE_DEBUG )<<"Deleting"<<name();
} }
@ -88,7 +88,7 @@ void SnoreBackend::closeNotification(Notification n, NotificationEnums::CloseRea
} }
n.data()->setCloseReason(reason); n.data()->setCloseReason(reason);
slotCloseNotification(n); slotCloseNotification(n);
qDebug() << Q_FUNC_INFO << n; snoreDebug( SNORE_DEBUG ) << n;
emit notificationClosed(n); emit notificationClosed(n);
} }
@ -111,7 +111,7 @@ SnoreSecondaryBackend::SnoreSecondaryBackend(const QString &name, bool supportsR
SnoreSecondaryBackend::~SnoreSecondaryBackend() SnoreSecondaryBackend::~SnoreSecondaryBackend()
{ {
qDebug()<<"Deleting"<<name(); snoreDebug( SNORE_DEBUG )<<"Deleting"<<name();
} }
bool SnoreSecondaryBackend::supportsRichtext() bool SnoreSecondaryBackend::supportsRichtext()
@ -199,7 +199,7 @@ void SnoreBackend::notificationTimedOut()
Notification n = snore()->getActiveNotificationByID(timer->property("notificationID").toUInt()); Notification n = snore()->getActiveNotificationByID(timer->property("notificationID").toUInt());
if(n.isValid()) if(n.isValid())
{ {
qDebug() << Q_FUNC_INFO << n; snoreDebug( SNORE_DEBUG ) << n;
snore()->requestCloseNotification(n,NotificationEnums::CloseReasons::TIMED_OUT); snore()->requestCloseNotification(n,NotificationEnums::CloseReasons::TIMED_OUT);
} }
} }

View File

@ -34,7 +34,7 @@ SnoreFrontend::SnoreFrontend ( const QString &name ) :
SnoreFrontend::~SnoreFrontend() SnoreFrontend::~SnoreFrontend()
{ {
qDebug()<<"Deleting"<<name(); snoreDebug( SNORE_DEBUG )<<"Deleting"<<name();
} }
} }

View File

@ -54,7 +54,7 @@ SnoreCore::~SnoreCore()
void SnoreCore::loadPlugins( SnorePlugin::PluginTypes types ) void SnoreCore::loadPlugins( SnorePlugin::PluginTypes types )
{ {
Q_D(SnoreCore); Q_D(SnoreCore);
qDebug() << "PluginInfo" << PluginContainer::pluginCache().keys(); snoreDebug( SNORE_DEBUG ) << "PluginInfo" << PluginContainer::pluginCache().keys();
foreach ( PluginContainer *info, PluginContainer::pluginCache().values()) foreach ( PluginContainer *info, PluginContainer::pluginCache().values())
{ {
if(types == SnorePlugin::ALL || types.testFlag(info->type())) if(types == SnorePlugin::ALL || types.testFlag(info->type()))
@ -63,7 +63,7 @@ void SnoreCore::loadPlugins( SnorePlugin::PluginTypes types )
{ {
case SnorePlugin::BACKEND: case SnorePlugin::BACKEND:
{ {
qDebug() << info->name() << "is a Notification_Backend"; snoreDebug( SNORE_DEBUG ) << info->name() << "is a Notification_Backend";
d->m_notificationBackends.append( info->name()); d->m_notificationBackends.append( info->name());
break; break;
} }
@ -78,7 +78,7 @@ void SnoreCore::loadPlugins( SnorePlugin::PluginTypes types )
} }
case SnorePlugin::FRONTEND: case SnorePlugin::FRONTEND:
{ {
qDebug() << info->name() << "is a Notification_Frontend"; snoreDebug( SNORE_DEBUG ) << info->name() << "is a Notification_Frontend";
if(!info->load()->initialize( this )){ if(!info->load()->initialize( this )){
info->unload(); info->unload();
break; break;
@ -88,7 +88,7 @@ void SnoreCore::loadPlugins( SnorePlugin::PluginTypes types )
} }
case SnorePlugin::PLUGIN: case SnorePlugin::PLUGIN:
{ {
qDebug() <<info->name()<<"is a SnorePlugin"; snoreDebug( SNORE_DEBUG ) <<info->name()<<"is a SnorePlugin";
if(!info->load()->initialize(this)){ if(!info->load()->initialize(this)){
info->unload(); info->unload();
break; break;
@ -103,7 +103,7 @@ void SnoreCore::loadPlugins( SnorePlugin::PluginTypes types )
} }
} }
}else{ }else{
qDebug()<<"dont load "<<info->file()<<info->type(); snoreDebug( SNORE_DEBUG )<<"dont load "<<info->file()<<info->type();
} }
} }
} }
@ -111,7 +111,7 @@ void SnoreCore::loadPlugins( SnorePlugin::PluginTypes types )
void SnoreCore::broadcastNotification ( Notification notification ) void SnoreCore::broadcastNotification ( Notification notification )
{ {
Q_D(SnoreCore); Q_D(SnoreCore);
qDebug()<<"Broadcasting"<<notification<<"timeout:"<<notification.timeout(); snoreDebug( SNORE_DEBUG )<<"Broadcasting"<<notification<<"timeout:"<<notification.timeout();
emit d->notify ( notification ); emit d->notify ( notification );
if ( d->m_notificationBackend != NULL ) if ( d->m_notificationBackend != NULL )
{ {
@ -124,7 +124,7 @@ void SnoreCore::registerApplication(const Application &application)
Q_D(SnoreCore); Q_D(SnoreCore);
if(!d->m_applications.contains(application.name())) if(!d->m_applications.contains(application.name()))
{ {
qDebug() << Q_FUNC_INFO << "Registering Application:" << application; snoreDebug( SNORE_DEBUG ) << "Registering Application:" << application;
d->m_applications.insert ( application.name(),application ); d->m_applications.insert ( application.name(),application );
emit d->applicationRegistered ( application ); emit d->applicationRegistered ( application );
} }
@ -167,16 +167,16 @@ bool SnoreCore::setPrimaryNotificationBackend ( const QString &backend )
Q_D(SnoreCore); Q_D(SnoreCore);
if(!PluginContainer::pluginCache().contains(backend)) if(!PluginContainer::pluginCache().contains(backend))
{ {
qDebug() << "Unknown Backend:" << backend; snoreDebug( SNORE_DEBUG ) << "Unknown Backend:" << backend;
return false; return false;
} }
qDebug() << "Setting Notification Backend to:" << backend; snoreDebug( SNORE_DEBUG ) << "Setting Notification Backend to:" << backend;
SnoreBackend* b = qobject_cast<SnoreBackend*>(PluginContainer::pluginCache()[backend]->load()); SnoreBackend* b = qobject_cast<SnoreBackend*>(PluginContainer::pluginCache()[backend]->load());
if(!b->isInitialized()) if(!b->isInitialized())
{ {
if(!b->initialize(this)) if(!b->initialize(this))
{ {
qDebug() << "Failed to initialize" << b->name(); snoreDebug( SNORE_DEBUG ) << "Failed to initialize" << b->name();
return false; return false;
} }
} }

View File

@ -21,6 +21,7 @@
#define SNORESERVER_H #define SNORESERVER_H
#include "snore_exports.h" #include "snore_exports.h"
#include "log.h"
#include "application.h" #include "application.h"
#include "notification/notification.h" #include "notification/notification.h"
#include "plugins/plugins.h" #include "plugins/plugins.h"

View File

@ -96,11 +96,11 @@ void FreedesktopBackend::slotNotify ( Notification noti )
noti.hints().setPrivateValue(this, "id", id.value()); noti.hints().setPrivateValue(this, "id", id.value());
m_dbusIdMap[id.value()] = noti.id(); m_dbusIdMap[id.value()] = noti.id();
qDebug() << Q_FUNC_INFO << noti.id() << "|" << id.value(); snoreDebug( SNORE_DEBUG ) << noti.id() << "|" << id.value();
} }
void FreedesktopBackend::slotActionInvoked(const uint &id, const QString &actionID) void FreedesktopBackend::slotActionInvoked(const uint &id, const QString &actionID)
{ {
qDebug() << Q_FUNC_INFO << id << m_dbusIdMap[id]; snoreDebug( SNORE_DEBUG ) << id << m_dbusIdMap[id];
Notification noti = getActiveNotificationByID(m_dbusIdMap[id]); Notification noti = getActiveNotificationByID(m_dbusIdMap[id]);
if(!noti.isValid()) if(!noti.isValid())
{ {
@ -113,7 +113,7 @@ void FreedesktopBackend::slotActionInvoked(const uint &id, const QString &action
void FreedesktopBackend::slotCloseNotification ( Notification notification ) void FreedesktopBackend::slotCloseNotification ( Notification notification )
{ {
uint id = notification.hints().privateValue(this, "id").toUInt(); uint id = notification.hints().privateValue(this, "id").toUInt();
qDebug() << Q_FUNC_INFO << notification.id() << id; snoreDebug( SNORE_DEBUG ) << notification.id() << id;
m_interface->CloseNotification(id); m_interface->CloseNotification(id);
} }
@ -122,7 +122,7 @@ void FreedesktopBackend::slotCloseNotification ( Notification notification )
void FreedesktopBackend::slotNotificationClosed ( const uint &id,const uint &reason ) void FreedesktopBackend::slotNotificationClosed ( const uint &id,const uint &reason )
{ {
NotificationEnums::CloseReasons::closeReasons closeReason = NotificationEnums::CloseReasons::closeReasons(reason); NotificationEnums::CloseReasons::closeReasons closeReason = NotificationEnums::CloseReasons::closeReasons(reason);
qDebug() << Q_FUNC_INFO << id << "|" << closeReason << reason; snoreDebug( SNORE_DEBUG ) << id << "|" << closeReason << reason;
if(id == 0) if(id == 0)
{ {
return; return;

View File

@ -58,7 +58,7 @@ bool Growl::initialize(SnoreCore *snore)
} }
catch(const std::exception& e) catch(const std::exception& e)
{ {
qWarning() << Q_FUNC_INFO << e.what(); qWarning() << e.what();
delete m_defaultGNTP; delete m_defaultGNTP;
m_defaultGNTP = NULL; m_defaultGNTP = NULL;
return false; return false;
@ -87,11 +87,11 @@ void Growl::slotRegisterApplication(const Application &application)
gntp::gntp_callback callback(&Growl::gntpCallback); gntp::gntp_callback callback(&Growl::gntpCallback);
growl->set_gntp_callback(callback); growl->set_gntp_callback(callback);
// qDebug() << Q_FUNC_INFO << application->name().toUtf8().constData(); // snoreDebug( SNORE_DEBUG ) << application->name().toUtf8().constData();
std::vector<std::string> alerts; std::vector<std::string> alerts;
foreach(const Alert &a,application.alerts()) foreach(const Alert &a,application.alerts())
{ {
// qDebug() << Q_FUNC_INFO << a->name().toUtf8().constData(); // snoreDebug( SNORE_DEBUG ) << a->name().toUtf8().constData();
alerts.push_back(a.name().toUtf8().constData()); alerts.push_back(a.name().toUtf8().constData());
} }
@ -100,7 +100,7 @@ void Growl::slotRegisterApplication(const Application &application)
growl->regist(alerts); growl->regist(alerts);
}catch(const std::exception& e) }catch(const std::exception& e)
{ {
qWarning() << Q_FUNC_INFO << e.what(); qWarning() << e.what();
} }
m_applications.insert(application.name(),growl); m_applications.insert(application.name(),growl);
} }
@ -124,7 +124,7 @@ void Growl::slotNotify(Notification notification)
growl = m_defaultGNTP; growl = m_defaultGNTP;
alert = "Default"; alert = "Default";
} }
// qDebug() << "Notify Growl:" <<notification.application() << alert << Snore::toPlainText(notification.title()); // snoreDebug( SNORE_DEBUG ) << "Notify Growl:" <<notification.application() << alert << Snore::toPlainText(notification.title());
try try
{ {
growl->notify(alert.toUtf8().constData(),notification.id(), growl->notify(alert.toUtf8().constData(),notification.id(),
@ -135,14 +135,14 @@ void Growl::slotNotify(Notification notification)
} }
catch(const std::exception& e) catch(const std::exception& e)
{ {
qWarning() << Q_FUNC_INFO << e.what(); qWarning() << e.what();
} }
startTimeout(notification); startTimeout(notification);
} }
void Growl::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() << Q_FUNC_INFO << id << QString(reason.c_str()) << QString(data.c_str()); // snoreDebug( SNORE_DEBUG ) << id << QString(reason.c_str()) << QString(data.c_str());
Notification n = s_instance->snore()->getActiveNotificationByID(id); Notification n = s_instance->snore()->getActiveNotificationByID(id);
NotificationEnums::CloseReasons::closeReasons r = NotificationEnums::CloseReasons::NONE; NotificationEnums::CloseReasons::closeReasons r = NotificationEnums::CloseReasons::NONE;
if(reason == "TIMEDOUT") if(reason == "TIMEDOUT")

View File

@ -92,13 +92,13 @@ public:
break; break;
//away stuff //away stuff
case SnarlEnums::SnarlUserAway: case SnarlEnums::SnarlUserAway:
qDebug()<<"Snalr user has gone away"; snoreDebug( SNORE_DEBUG )<<"Snalr user has gone away";
return true; return true;
case SnarlEnums::SnarlUserBack: case SnarlEnums::SnarlUserBack:
qDebug()<<"Snalr user has returned"; snoreDebug( SNORE_DEBUG )<<"Snalr user has returned";
return true; return true;
default: default:
qDebug()<<"Unknown snarl action found!!"; snoreDebug( SNORE_DEBUG )<<"Unknown snarl action found!!";
return false; return false;
} }
if(notification.isValid()) if(notification.isValid())
@ -108,8 +108,8 @@ public:
} }
else else
{ {
qDebug() << "Snarl notification already closed" << msg->lParam << action; snoreDebug( SNORE_DEBUG ) << "Snarl notification already closed" << msg->lParam << action;
qDebug() << m_snarl->m_idMap; snoreDebug( SNORE_DEBUG ) << m_snarl->m_idMap;
} }
return true; return true;
} }
@ -144,7 +144,7 @@ bool SnarlBackend::initialize(SnoreCore *snore)
return false; return false;
} }
m_eventLoop = new SnarlBackend::SnarlWidget(this); m_eventLoop = new SnarlBackend::SnarlWidget(this);
qDebug() << "Initiating Snarl Backend, Snarl version: " << snarlInterface->GetVersion(); snoreDebug( SNORE_DEBUG ) << "Initiating Snarl Backend, Snarl version: " << snarlInterface->GetVersion();
delete snarlInterface; delete snarlInterface;
return SnoreBackend::initialize(snore); return SnoreBackend::initialize(snore);
} }
@ -188,7 +188,7 @@ void SnarlBackend::slotDeregisterApplication(const Application &application)
{ {
if(!m_applications.contains(application.name())) if(!m_applications.contains(application.name()))
{ {
qDebug() << Q_FUNC_INFO << "Unknown apllication: " << application.name(); snoreDebug( SNORE_DEBUG ) << "Unknown apllication: " << application.name();
return; return;
} }
SnarlInterface *snarlInterface = m_applications.take(application.name()); SnarlInterface *snarlInterface = m_applications.take(application.name());
@ -200,7 +200,7 @@ void SnarlBackend::slotDeregisterApplication(const Application &application)
void SnarlBackend::slotNotify(Notification notification){ void SnarlBackend::slotNotify(Notification notification){
if(!m_applications.contains(notification.application().name())) if(!m_applications.contains(notification.application().name()))
{ {
qDebug() << Q_FUNC_INFO << "Unknown apllication: " << notification.application().name(); snoreDebug( SNORE_DEBUG ) << "Unknown apllication: " << notification.application().name();
return; return;
} }
@ -221,7 +221,7 @@ void SnarlBackend::slotNotify(Notification notification){
} }
ULONG32 id = 0; ULONG32 id = 0;
qDebug() << Q_FUNC_INFO << notification.icon(); snoreDebug( SNORE_DEBUG ) << notification.icon();
if(!notification.isUpdate()) if(!notification.isUpdate())
{ {
id = snarlInterface->Notify(notification.alert().name().toUtf8().constData(), id = snarlInterface->Notify(notification.alert().name().toUtf8().constData(),
@ -262,7 +262,7 @@ void SnarlBackend::slotCloseNotification(Notification notification)
{ {
if(!m_applications.contains(notification.application().name())) if(!m_applications.contains(notification.application().name()))
{ {
qDebug() << Q_FUNC_INFO << "Unknown apllication: " << notification.application().name(); snoreDebug( SNORE_DEBUG ) << "Unknown apllication: " << notification.application().name();
return; return;
} }
ULONG32 id = notification.hints().privateValue(this, "id").toUInt(); ULONG32 id = notification.hints().privateValue(this, "id").toUInt();

View File

@ -30,7 +30,7 @@ bool SnoreToast::initialize(SnoreCore *snore)
{ {
if(QSysInfo::windowsVersion() != QSysInfo::WV_WINDOWS8) if(QSysInfo::windowsVersion() != QSysInfo::WV_WINDOWS8)
{ {
qDebug() << "SnoreToast does not work on windows" << QSysInfo::windowsVersion(); snoreDebug( SNORE_DEBUG ) << "SnoreToast does not work on windows" << QSysInfo::windowsVersion();
return false; return false;
} }
if(snore->hints().contains("WINDOWS_APP_ID")) if(snore->hints().contains("WINDOWS_APP_ID"))
@ -49,10 +49,10 @@ bool SnoreToast::initialize(SnoreCore *snore)
<< QString("SnoreNotify\\%1").arg(qApp->applicationName()) << QString("SnoreNotify\\%1").arg(qApp->applicationName())
<< QDir::toNativeSeparators(qApp->applicationFilePath()) << QDir::toNativeSeparators(qApp->applicationFilePath())
<< m_appID; << m_appID;
qDebug() << "SnoreToast" << arguements; snoreDebug( SNORE_DEBUG ) << "SnoreToast" << arguements;
p->start("SnoreToast", arguements); p->start("SnoreToast", arguements);
p->waitForFinished(-1); p->waitForFinished(-1);
qDebug() << p->readAll(); snoreDebug( SNORE_DEBUG ) << p->readAll();
if(p->exitCode() != 0) if(p->exitCode() != 0)
{ {
return false; return false;
@ -89,7 +89,7 @@ void SnoreToast::slotNotify(Notification notification)
{ {
arguements << "-silent"; arguements << "-silent";
} }
qDebug() << "SnoreToast" << arguements; snoreDebug( SNORE_DEBUG ) << "SnoreToast" << arguements;
p->start("SnoreToast", arguements); p->start("SnoreToast", arguements);
p->setProperty("SNORE_NOTIFICATION_ID",notification.id()); p->setProperty("SNORE_NOTIFICATION_ID",notification.id());

View File

@ -58,7 +58,7 @@ void TrayIconNotifer::slotNotify( Notification notification )
void TrayIconNotifer::slotCloseNotification(Notification n) void TrayIconNotifer::slotCloseNotification(Notification n)
{ {
qDebug() << Q_FUNC_INFO << n; snoreDebug( SNORE_DEBUG ) << n;
m_currentlyDisplaying = false; m_currentlyDisplaying = false;
displayNotification(); displayNotification();
} }

View File

@ -56,7 +56,7 @@ Parser::Parser(SnarlNetworkFrontend *snarl):
void Parser::parse(Notification &sNotification,const QString &msg,QTcpSocket* client) void Parser::parse(Notification &sNotification,const QString &msg,QTcpSocket* client)
{ {
qDebug() << Q_FUNC_INFO << msg; snoreDebug( SNORE_DEBUG ) << msg;
QStringList splitted(msg.split("#?")); QStringList splitted(msg.split("#?"));
snpTypes action(ERROR); snpTypes action(ERROR);
@ -144,7 +144,7 @@ void Parser::parse(Notification &sNotification,const QString &msg,QTcpSocket* cl
case ADD_CLASS: case ADD_CLASS:
if(alertName.isEmpty()) if(alertName.isEmpty())
{ {
qDebug()<<"Error registering alert with empty name"; snoreDebug( SNORE_DEBUG )<<"Error registering alert with empty name";
break; break;
} }
if(title.isEmpty()) if(title.isEmpty())
@ -164,7 +164,7 @@ void Parser::parse(Notification &sNotification,const QString &msg,QTcpSocket* cl
} }
else else
{ {
qDebug() << appName << "already registred"; snoreDebug( SNORE_DEBUG ) << appName << "already registred";
} }
break; break;
case UNREGISTER: case UNREGISTER:

View File

@ -44,7 +44,7 @@ bool SnarlNetworkFrontend::initialize(SnoreCore *snore){
tcpServer = new QTcpServer(this); tcpServer = new QTcpServer(this);
if(!tcpServer->listen(QHostAddress::Any,port)) if(!tcpServer->listen(QHostAddress::Any,port))
{ {
qDebug()<<"The port is already used"; snoreDebug( SNORE_DEBUG )<<"The port is already used";
return false; return false;
} }
else else

View File

@ -46,7 +46,7 @@ SnoreNotify::SnoreNotify():
m_trayIcon->initConextMenu(m_snore); m_trayIcon->initConextMenu(m_snore);
connect(qApp,SIGNAL(aboutToQuit()),this,SLOT(exit())); connect(qApp,SIGNAL(aboutToQuit()),this,SLOT(exit()));
qDebug() << "Snorenotfiy initialized with" << m_snore->primaryNotificationBackend(); snoreDebug( SNORE_DEBUG ) << "Snorenotfiy initialized with" << m_snore->primaryNotificationBackend();
} }
SnoreNotify::~SnoreNotify(){ SnoreNotify::~SnoreNotify(){
@ -69,7 +69,7 @@ void SnoreNotify::save(){
} }
void SnoreNotify::exit(){ void SnoreNotify::exit(){
qDebug()<<"Saving snore settings"; snoreDebug( SNORE_DEBUG )<<"Saving snore settings";
foreach(const Application &a,m_snore->aplications()) foreach(const Application &a,m_snore->aplications())
{ {
m_snore->deregisterApplication(a); m_snore->deregisterApplication(a);