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;
}
#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() << '|';
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) << ")";
}
else
{
needSeparator = true;
}
debug.nospace() << e.valueToKey(key);
}
}
debug << ')';
return debug.space();
}

View File

@ -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 &noti )
{
if(noti.isValid())