diff options
author | Alex Merry <dev@randomguy3.me.uk> | 2011-10-30 09:32:18 +0100 |
---|---|---|
committer | Alex Merry <dev@randomguy3.me.uk> | 2011-10-30 09:32:18 +0100 |
commit | d1dcef6bf53f3a00a17be0d067f14ddbe5d16b32 (patch) | |
tree | 9e07c4d96cfee2c62d76aa9258a635244a9624d6 | |
parent | 3a853f050b5e253323eba30090803665f738afd8 (diff) |
Suppress excessive property update warnings
-rw-r--r-- | mpris2/interfacetest.cpp | 10 | ||||
-rw-r--r-- | mpris2/interfacetest.h | 7 |
2 files changed, 11 insertions, 6 deletions
diff --git a/mpris2/interfacetest.cpp b/mpris2/interfacetest.cpp index 4df0d59..12dfca9 100644 --- a/mpris2/interfacetest.cpp +++ b/mpris2/interfacetest.cpp @@ -132,8 +132,6 @@ bool InterfaceTest::checkPropValid(const QString& propName, QVariant::Type expTy } else if (oldProps.contains(propName)) { // FIXME: QVariant equality only works for builtin types if (props[propName] != oldProps[propName]) { - qDebug() << "Old value:" << oldProps[propName]; - qDebug() << "New value:" << props[propName]; outOfDateProperties.insert(propName, props[propName]); props[propName] = oldProps[propName]; } @@ -211,7 +209,13 @@ void InterfaceTest::delayedIncrementalCheck() { QVariantMap::const_iterator i = outOfDateProperties.constBegin(); while (i != outOfDateProperties.constEnd()) { - emit interfaceWarning(Property, i.key(), "Property was not updated via PropertiesChanged signal"); + int warningsSoFar = propertyUpdateWarningCount.value(i.key()); + if (warningsSoFar < 4) { + emit interfaceWarning(Property, i.key(), "Property was not updated via PropertiesChanged signal"); + } else if (warningsSoFar == 4) { + emit interfaceWarning(Property, i.key(), "Property was not updated via PropertiesChanged signal [further warnings for this property suppressed]"); + } + propertyUpdateWarningCount.insert(i.key(), warningsSoFar + 1); props[i.key()] = i.value(); ++i; } diff --git a/mpris2/interfacetest.h b/mpris2/interfacetest.h index 0d2da75..c400fec 100644 --- a/mpris2/interfacetest.h +++ b/mpris2/interfacetest.h @@ -129,9 +129,10 @@ namespace Mpris2 QVariantMap props; private: - QDBusInterface* propsIface; - QVariantMap outOfDateProperties; // prop name -> new value - QTimer* delayedCheckTimer; + QDBusInterface* propsIface; + QVariantMap outOfDateProperties; // prop name -> new value + QTimer* delayedCheckTimer; + QMap<QString,uint> propertyUpdateWarningCount; }; } |