diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-02-08 00:16:34 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-02-08 07:48:55 (GMT) |
commit | 10628947d5ab1cfcd571ada10c0eab4b7f1f02ac (patch) | |
tree | 3918a47cf04be69930348bd98f406e41e41edf54 /examples/network/bearermonitor/sessionwidget.cpp | |
parent | c470f8d1523ec974a7f0e1cb61ef13f0e953c500 (diff) | |
download | Qt-10628947d5ab1cfcd571ada10c0eab4b7f1f02ac.zip Qt-10628947d5ab1cfcd571ada10c0eab4b7f1f02ac.tar.gz Qt-10628947d5ab1cfcd571ada10c0eab4b7f1f02ac.tar.bz2 |
Display session statistics.
Diffstat (limited to 'examples/network/bearermonitor/sessionwidget.cpp')
-rw-r--r-- | examples/network/bearermonitor/sessionwidget.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/examples/network/bearermonitor/sessionwidget.cpp b/examples/network/bearermonitor/sessionwidget.cpp index d03c5bf..46ffb20 100644 --- a/examples/network/bearermonitor/sessionwidget.cpp +++ b/examples/network/bearermonitor/sessionwidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -43,7 +43,7 @@ #include "qnetworkconfigmanager.h" SessionWidget::SessionWidget(const QNetworkConfiguration &config, QWidget *parent) -: QWidget(parent) +: QWidget(parent), statsTimer(-1) { setupUi(this); @@ -75,11 +75,25 @@ SessionWidget::~SessionWidget() delete session; } +void SessionWidget::timerEvent(QTimerEvent *e) +{ + if (e->timerId() == statsTimer) { + rxData->setText(QString::number(session->bytesReceived())); + txData->setText(QString::number(session->bytesWritten())); + activeTime->setText(QString::number(session->activeTime())); + } +} + void SessionWidget::updateSession() { updateSessionState(session->state()); updateSessionError(session->error()); + if (session->state() == QNetworkSession::Connected) + statsTimer = startTimer(1000); + else + killTimer(statsTimer); + if (session->configuration().type() == QNetworkConfiguration::InternetAccessPoint) bearer->setText(session->configuration().bearerName()); else { |