This commit is contained in:
Patrick von Reth 2014-01-28 10:44:05 +01:00
parent 8e987c1cf8
commit 14e70eceee
2 changed files with 25 additions and 25 deletions

View File

@ -175,31 +175,34 @@ QDataStream &operator<< ( QDataStream &stream, const Notification &noti )
return stream; return stream;
} }
#define debugPrintEnum(x) case x: debug << #x ")"; break
QDebug operator <<(QDebug debug, const Snore::Notification::CloseReasons &flags) QDebug operator <<(QDebug debug, const Snore::Notification::CloseReasons &flags)
{ {
static QMetaEnum e = Notification::staticMetaObject.property(Notification::staticMetaObject.indexOfProperty("closeReason")).enumerator();
debug.nospace() << "CloseReasons("; debug.nospace() << "CloseReasons(";
bool needSeparator = false; switch(flags)
int key;
for (int i = 0; i < e.keyCount(); ++i)
{ {
key = e.value(i); debugPrintEnum(Notification::NONE);
if (flags.testFlag((Notification::CloseReason)key)) debugPrintEnum(Notification::TIMED_OUT);
{ debugPrintEnum(Notification::DISMISSED);
if (needSeparator) debugPrintEnum(Notification::CLOSED);
{ default:
debug.nospace() << '|'; debug << QByteArray::number(flags,16) << ")";
} }
else return debug.space();
{ }
needSeparator = true;
} QDebug operator<< ( QDebug debug, const Snore::Notification::Prioritys &flags)
{
debug.nospace() << e.valueToKey(key); debug.nospace() << "Prioritys(";
switch(flags)
} {
debugPrintEnum(Notification::LOW);
debugPrintEnum(Notification::NORMAL);
debugPrintEnum(Notification::HIGH);
default:
debug << QByteArray::number(flags,16) << ")";
} }
debug << ')';
return debug.space(); return debug.space();
} }

View File

@ -43,11 +43,6 @@ class NotificationData;
class SNORE_EXPORT Notification class SNORE_EXPORT Notification
{ {
/*
Q_OBJECT
*/
Q_GADGET
Q_PROPERTY(CloseReasons closeReason READ closeReason)
friend class NotificationData; friend class NotificationData;
public: 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::CloseReasons &);
SNORE_EXPORT QDebug operator<< ( QDebug, const Snore::Notification::Prioritys &);
inline QDebug operator<< ( QDebug debug, const Snore::Notification &noti ) inline QDebug operator<< ( QDebug debug, const Snore::Notification &noti )
{ {
if(noti.isValid()) if(noti.isValid())