summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@digia.com>2013-03-21 15:45:30 +0100
committerTim Jenssen <tim.jenssen@digia.com>2013-03-21 16:38:30 +0100
commitc146cf3f785c7450383bffdde910fe43dd16e449 (patch)
tree872749a4989bbf7ecfd5e0a1ef07c26786c352cd /tests
parentf2521981f09a066bd9d3c1a0864483e0e6d823d7 (diff)
use humanReadableSize method from ifw lib
Change-Id: I9c084e3dd57848852810dfbcce8245bf66646867 Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/downloadspeed/main.cpp25
1 files changed, 4 insertions, 21 deletions
diff --git a/tests/downloadspeed/main.cpp b/tests/downloadspeed/main.cpp
index 6611ec17a..5a5b685aa 100644
--- a/tests/downloadspeed/main.cpp
+++ b/tests/downloadspeed/main.cpp
@@ -42,6 +42,8 @@
#include <kdupdaterfiledownloader.h>
#include <kdupdaterfiledownloaderfactory.h>
+#include <fileutils.h>
+
#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>
#include <QtCore/QObject>
@@ -49,26 +51,6 @@
#include <QtNetwork/QNetworkProxy>
-static QString humanReadableSize(quint64 intSize)
-{
- QString unit;
- double size;
-
- if (intSize < 1024 * 1024) {
- size = 1. + intSize / 1024.;
- unit = QObject::tr("kB");
- } else if (intSize < 1024 * 1024 * 1024) {
- size = 1. + intSize / 1024. / 1024.;
- unit = QObject::tr("MB");
- } else {
- size = 1. + intSize / 1024. / 1024. / 1024.;
- unit = QObject::tr("GB");
- }
-
- size = qRound(size * 10) / 10.0;
- return QString::fromLatin1("%L1 %2").arg(size, 0, 'g', 4).arg(unit);
-}
-
// -- Receiver
class Receiver : public QObject
@@ -100,7 +82,8 @@ public slots:
void downloadSpeed(qint64 speed)
{
- qDebug() << "Download speed:" << humanReadableSize(speed) + QLatin1String("/sec");
+ qDebug() << "Download speed:" <<
+ QInstaller::humanReadableSize(speed) + QLatin1String("/sec");
}
void downloadProgress(double progress)