From 14e70eceee19899740fc2682b14a3e625854e6e8 Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Tue, 28 Jan 2014 10:44:05 +0100 Subject: [PATCH] cleanup --- src/core/notification/notification.cpp | 43 ++++++++++++++------------ src/core/notification/notification.h | 7 ++--- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/core/notification/notification.cpp b/src/core/notification/notification.cpp index fe15ce2..b3e4432 100644 --- a/src/core/notification/notification.cpp +++ b/src/core/notification/notification.cpp @@ -175,31 +175,34 @@ QDataStream &operator<< ( QDataStream &stream, const Notification ¬i ) return stream; } +#define debugPrintEnum(x) case x: debug << #x ")"; break + QDebug operator <<(QDebug debug, const Snore::Notification::CloseReasons &flags) { - static QMetaEnum e = Notification::staticMetaObject.property(Notification::staticMetaObject.indexOfProperty("closeReason")).enumerator(); debug.nospace() << "CloseReasons("; - bool needSeparator = false; - int key; - for (int i = 0; i < e.keyCount(); ++i) + switch(flags) { - key = e.value(i); - if (flags.testFlag((Notification::CloseReason)key)) - { - if (needSeparator) - { - debug.nospace() << '|'; - } - else - { - needSeparator = true; - } - - debug.nospace() << e.valueToKey(key); - - } + debugPrintEnum(Notification::NONE); + debugPrintEnum(Notification::TIMED_OUT); + debugPrintEnum(Notification::DISMISSED); + debugPrintEnum(Notification::CLOSED); + default: + debug << QByteArray::number(flags,16) << ")"; + } + return debug.space(); +} + +QDebug operator<< ( QDebug debug, const Snore::Notification::Prioritys &flags) +{ + debug.nospace() << "Prioritys("; + switch(flags) + { + debugPrintEnum(Notification::LOW); + debugPrintEnum(Notification::NORMAL); + debugPrintEnum(Notification::HIGH); + default: + debug << QByteArray::number(flags,16) << ")"; } - debug << ')'; return debug.space(); } diff --git a/src/core/notification/notification.h b/src/core/notification/notification.h index 9d5a01d..e088bf8 100644 --- a/src/core/notification/notification.h +++ b/src/core/notification/notification.h @@ -43,11 +43,6 @@ class NotificationData; class SNORE_EXPORT Notification { - /* - Q_OBJECT - */ - Q_GADGET - Q_PROPERTY(CloseReasons closeReason READ closeReason) friend class NotificationData; public: /** @@ -290,6 +285,8 @@ QDataStream &operator<< ( QDataStream & stream, const Snore::Notification & noti SNORE_EXPORT QDebug operator<< ( QDebug, const Snore::Notification::CloseReasons &); +SNORE_EXPORT QDebug operator<< ( QDebug, const Snore::Notification::Prioritys &); + inline QDebug operator<< ( QDebug debug, const Snore::Notification ¬i ) { if(noti.isValid())