diff options
author | Lorn Potter <lorn.potter@nokia.com> | 2010-08-03 19:14:44 (GMT) |
---|---|---|
committer | Lorn Potter <lorn.potter@nokia.com> | 2010-08-03 19:14:44 (GMT) |
commit | be83848d31513dfbfffb1e0c43d32b7c27dcefce (patch) | |
tree | c8b965626afcb18cfaca0f26e39596ac4dd6f0a8 /examples/network | |
parent | 7a2d31989f0f50a34550be846a6f632c2f9e3f59 (diff) | |
parent | 11ad3b195d98b0a2234105da24d1faffd7ef95d6 (diff) | |
download | Qt-be83848d31513dfbfffb1e0c43d32b7c27dcefce.zip Qt-be83848d31513dfbfffb1e0c43d32b7c27dcefce.tar.gz Qt-be83848d31513dfbfffb1e0c43d32b7c27dcefce.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Conflicts:
src/plugins/bearer/connman/qconnmanengine.cpp
Diffstat (limited to 'examples/network')
-rw-r--r-- | examples/network/bearercloud/cloud.cpp | 34 | ||||
-rw-r--r-- | examples/network/bearermonitor/sessionwidget.cpp | 4 |
2 files changed, 23 insertions, 15 deletions
diff --git a/examples/network/bearercloud/cloud.cpp b/examples/network/bearercloud/cloud.cpp index 980efbf..8deaab3 100644 --- a/examples/network/bearercloud/cloud.cpp +++ b/examples/network/bearercloud/cloud.cpp @@ -53,7 +53,7 @@ #include <math.h> -static QMap<QString, QSvgRenderer *> svgCache; +static QMap<QNetworkConfiguration::BearerType, QSvgRenderer *> svgCache; //! [0] Cloud::Cloud(const QNetworkConfiguration &config, QGraphicsItem *parent) @@ -261,9 +261,9 @@ void Cloud::stateChanged(QNetworkSession::State state) tooltip += tr("<br>Id: %1").arg(configuration.identifier()); #endif - const QString bearerName = configuration.bearerName(); - if (!bearerName.isEmpty()) - tooltip += tr("<br>Bearer: %1").arg(bearerName); + const QString bearerTypeName = configuration.bearerTypeName(); + if (!bearerTypeName.isEmpty()) + tooltip += tr("<br>Bearer: %1").arg(bearerTypeName); QString s = tr("<br>State: %1 (%2)"); switch (state) { @@ -313,17 +313,25 @@ void Cloud::stateChanged(QNetworkSession::State state) //! [1] void Cloud::newConfigurationActivated() { - const QString bearerName = configuration.bearerName(); - if (!svgCache.contains(bearerName)) { - if (bearerName == QLatin1String("WLAN")) - svgCache.insert(bearerName, new QSvgRenderer(QLatin1String(":wlan.svg"))); - else if (bearerName == QLatin1String("Ethernet")) - svgCache.insert(bearerName, new QSvgRenderer(QLatin1String(":lan.svg"))); - else - svgCache.insert(bearerName, new QSvgRenderer(QLatin1String(":unknown.svg"))); + QNetworkConfiguration::BearerType bearerType = configuration.bearerType(); + if (!svgCache.contains(bearerType)) { + QSvgRenderer *renderer = 0; + switch (bearerType) { + case QNetworkConfiguration::BearerWLAN: + renderer = new QSvgRenderer(QLatin1String(":wlan.svg")); + break; + case QNetworkConfiguration::BearerEthernet: + renderer = new QSvgRenderer(QLatin1String(":lan.svg")); + break; + default: + renderer = new QSvgRenderer(QLatin1String(":unknown.svg")); + } + + if (renderer) + svgCache.insert(bearerType, renderer); } - icon->setSharedRenderer(svgCache[bearerName]); + icon->setSharedRenderer(svgCache[bearerType]); if (configuration.name().isEmpty()) { text->setPlainText(tr("HIDDEN NETWORK")); diff --git a/examples/network/bearermonitor/sessionwidget.cpp b/examples/network/bearermonitor/sessionwidget.cpp index 8b5693a..ecc2a93 100644 --- a/examples/network/bearermonitor/sessionwidget.cpp +++ b/examples/network/bearermonitor/sessionwidget.cpp @@ -111,11 +111,11 @@ void SessionWidget::updateSession() killTimer(statsTimer); if (session->configuration().type() == QNetworkConfiguration::InternetAccessPoint) - bearer->setText(session->configuration().bearerName()); + bearer->setText(session->configuration().bearerTypeName()); else { QNetworkConfigurationManager mgr; QNetworkConfiguration c = mgr.configurationFromIdentifier(session->sessionProperty("ActiveConfiguration").toString()); - bearer->setText(c.bearerName()); + bearer->setText(c.bearerTypeName()); } #ifndef QT_NO_NETWORKINTERFACE |