extended logging

This commit is contained in:
Patrick von Reth 2014-01-19 20:46:46 +01:00
parent fb500722f1
commit ad55f76dc9
8 changed files with 53 additions and 24 deletions

View File

@ -81,5 +81,24 @@ Hint &Application::hints()
const Hint &Application::constHints() const
{
return d->m_hint;
return d->m_hint;
}
QDebug operator<< ( QDebug debug, const Snore::Application &app )
{
if(app.isValid())
{
debug << "Snore::Application(" << app.name() << ", ";
foreach(const Alert &a, app.alerts())
{
debug << a << ", ";
}
debug << app.constHints() << ")" ;
}
else
{
debug << "Snore::Application(0x00)" ;
}
return debug.maybeSpace();
}

View File

@ -52,20 +52,10 @@ private:
};
inline QDebug operator<< ( QDebug debug, const Snore::Application &app )
{
if(app.isValid())
{
debug << "Snore::Application(" << app.name() << ", " << app.alerts() << ")";//," << app.hints() << ")" ;
}
else
{
debug << "Snore::Application(0x00)" ;
}
return debug.maybeSpace();
}
}
SNORE_EXPORT QDebug operator<< ( QDebug debug, const Snore::Application &app );
#endif // APPLICATION_H

View File

@ -51,11 +51,11 @@ bool Hint::contains(const QString &key) const
return m_data.contains(key);
}
//QDebug operator<<( QDebug debug, const Snore::Hint &hint )
//{
// debug << "Snore::Hint(" << hint.m_data << ")" ;
// return debug.maybeSpace();
//}
QDebug operator<<( QDebug debug, const Snore::Hint &hint )
{
debug << "Snore::Hint(" << hint.m_data << ", " << hint.m_privateData << ")" ;
return debug.maybeSpace();
}
void Hint::setPrivateValue(const void *owner, const QString &key, const QVariant &value)

View File

@ -25,6 +25,13 @@
#include "snore_exports.h"
namespace Snore
{
class Hint;
}
SNORE_EXPORT QDebug operator<< ( QDebug, const Snore::Hint &);
namespace Snore
{
@ -47,6 +54,8 @@ private:
QVariantHash m_data;
QHash<QPair<const void*,QString>, QVariant> m_privateData;
friend SNORE_EXPORT QDebug (::operator<<) ( QDebug, const Snore::Hint &);
};

View File

@ -92,6 +92,6 @@ bool Snore::Icon::isRemoteFile() const
QDebug operator<< ( QDebug debug, const Snore::Icon &icon )
{
debug << "Snore::Icon(" << (icon.url().isEmpty()?icon.localUrl():icon.url()) << ")" ;
debug << "Snore::Icon(" << (icon.url().isEmpty()?icon.d->m_localUrl:icon.url()) << ")" ;
return debug.maybeSpace();
}

View File

@ -23,11 +23,17 @@
#include <QSharedData>
#include <QDebug>
namespace Snore{
class Icon;
}
SNORE_EXPORT QDebug operator<< ( QDebug, const Snore::Icon &);
namespace Snore{
class IconData;
class SNORE_EXPORT Icon
{
public:
@ -49,11 +55,10 @@ public:
private:
QExplicitlySharedDataPointer<IconData> d;
friend SNORE_EXPORT QDebug (::operator<<) ( QDebug, const Snore::Icon &);
};
}
SNORE_EXPORT QDebug operator<< ( QDebug, const Snore::Icon &);
#endif // NOTIFICATION_ICON_H

View File

@ -151,6 +151,11 @@ Hint &Notification::hints()
return d->m_hints;
}
const Hint &Notification::constHints() const
{
return d->m_hints;
}
void Notification::setSilent(bool silent)
{
d->m_hints.setValue("silent", silent);

View File

@ -65,6 +65,7 @@ public:
void addAction(const Action &a);
const NotificationEnums::CloseReasons::closeReasons &closeReason();
Hint &hints();
const Hint &constHints() const;
void setSilent(bool silent);
@ -98,7 +99,7 @@ inline QDebug operator<< ( QDebug debug, const Snore::Notification &noti )
{
if(noti.isValid())
{
debug << "Snore::Notification(" << noti.title() << ", " << noti.text() << "," << noti.id() << ")" ;
debug << "Snore::Notification(" << noti.title() << ", " << noti.text() << "," << noti.id() << ", " << noti.constHints() << ")" ;
}
else
{