From c1ddaf4d21429b3dc5b18467a3e4f13904e363ba Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Wed, 26 Jun 2013 17:37:48 +0200 Subject: QNetworkConfiguration: add public member bearerTypeFamily() ... to let the user know whether he is on e.g. Wifi, 2G, 3G or 4G. In most cases, this is what the user wants to know anyhow, while e.g. BearerEVDO or BearerCDMA2000 go into too much detail. Task-number: QTBUG-31828 Change-Id: I244a4473feb40e106cbc08e09afdee07d4ecc8d7 Reviewed-by: Thiago Macieira Reviewed-by: Lorn Potter --- tests/manual/qnetworkconfiguration/main.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/manual') diff --git a/tests/manual/qnetworkconfiguration/main.cpp b/tests/manual/qnetworkconfiguration/main.cpp index 8bf5983796..c611cfc9e2 100644 --- a/tests/manual/qnetworkconfiguration/main.cpp +++ b/tests/manual/qnetworkconfiguration/main.cpp @@ -51,6 +51,7 @@ class tst_qnetworkconfiguration : public QObject private slots: void bearerType(); + void bearerTypeFamily(); }; void tst_qnetworkconfiguration::bearerType() @@ -111,6 +112,28 @@ void tst_qnetworkconfiguration::bearerType() } } +void tst_qnetworkconfiguration::bearerTypeFamily() +{ + QNetworkConfigurationManager m; + foreach (const QNetworkConfiguration &config, + m.allConfigurations(QNetworkConfiguration::Active)) { + QString family; + switch (config.bearerTypeFamily()) { + case QNetworkConfiguration::Bearer3G: + family = QLatin1String("Bearer3G"); + break; + case QNetworkConfiguration::Bearer4G: + family = QLatin1String("Bearer4G"); + break; + default: + family = config.bearerTypeName(); + } + qDebug() << config.name() << "has bearer type" + << config.bearerTypeName() << "of bearer type family" + << family; + } +} + QTEST_MAIN(tst_qnetworkconfiguration) #include "main.moc" -- cgit v1.2.3