aboutsummaryrefslogtreecommitdiff
path: root/src/base/QXmppLogger.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-09-10 13:41:58 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-09-10 13:41:58 +0200
commit973a7a6a0b905f75e10955dca3c6af37f93e853a (patch)
tree099129c0a319b5d897391b5e6de88a233e5565b2 /src/base/QXmppLogger.cpp
parentfcf89b7834cd253eb5993f03d891d0b6ab1a9953 (diff)
downloadqxmpp-973a7a6a0b905f75e10955dca3c6af37f93e853a.tar.gz
more plumbing for stat counters
Diffstat (limited to 'src/base/QXmppLogger.cpp')
-rw-r--r--src/base/QXmppLogger.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/base/QXmppLogger.cpp b/src/base/QXmppLogger.cpp
index def06292..2bce8690 100644
--- a/src/base/QXmppLogger.cpp
+++ b/src/base/QXmppLogger.cpp
@@ -60,6 +60,14 @@ static QString formatted(QXmppLogger::MessageType type, const QString& text)
text;
}
+static void relaySignals(QXmppLoggable *from, QXmppLoggable *to)
+{
+ QObject::connect(from, SIGNAL(incrementCounter(QString)),
+ to, SIGNAL(incrementCounter(QString)));
+ QObject::connect(from, SIGNAL(logMessage(QXmppLogger::MessageType,QString)),
+ to, SIGNAL(logMessage(QXmppLogger::MessageType,QString)));
+}
+
/// Constructs a new QXmppLoggable.
///
/// \param parent
@@ -69,8 +77,7 @@ QXmppLoggable::QXmppLoggable(QObject *parent)
{
QXmppLoggable *logParent = qobject_cast<QXmppLoggable*>(parent);
if (logParent) {
- connect(this, SIGNAL(logMessage(QXmppLogger::MessageType,QString)),
- logParent, SIGNAL(logMessage(QXmppLogger::MessageType,QString)));
+ relaySignals(this, logParent);
}
}
@@ -82,9 +89,10 @@ void QXmppLoggable::childEvent(QChildEvent *event)
return;
if (event->added()) {
- connect(child, SIGNAL(logMessage(QXmppLogger::MessageType,QString)),
- this, SIGNAL(logMessage(QXmppLogger::MessageType,QString)));
+ relaySignals(child, this);
} else if (event->removed()) {
+ disconnect(child, SIGNAL(incrementCounter(QString)),
+ this, SIGNAL(incrementCounter(QString)));
disconnect(child, SIGNAL(logMessage(QXmppLogger::MessageType,QString)),
this, SIGNAL(logMessage(QXmppLogger::MessageType,QString)));
}
@@ -180,6 +188,15 @@ void QXmppLogger::setMessageTypes(QXmppLogger::MessageTypes types)
d->messageTypes = types;
}
+/// Increments the given \a counter.
+///
+/// NOTE: the base implementation does nothing.
+
+void QXmppLogger::incrementCounter(const QString &counter)
+{
+ Q_UNUSED(counter);
+}
+
/// Add a logging message.
///
/// \param type