Remove usage of bearer management from lightmaps example
Because bearer management is going away Change-Id: I82f2e67a052fdcdf0dde337f9f69b414681511c4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
This commit is contained in:
parent
1576f81baa
commit
57a6c60fb9
@ -81,52 +81,9 @@ MapZoom::MapZoom()
|
|||||||
menu->addAction(nightModeAction);
|
menu->addAction(nightModeAction);
|
||||||
menu->addAction(osmAction);
|
menu->addAction(osmAction);
|
||||||
|
|
||||||
QNetworkConfigurationManager manager;
|
|
||||||
if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) {
|
|
||||||
// Get saved network configuration
|
|
||||||
QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
|
|
||||||
settings.beginGroup(QLatin1String("QtNetwork"));
|
|
||||||
const QString id =
|
|
||||||
settings.value(QLatin1String("DefaultNetworkConfiguration")).toString();
|
|
||||||
settings.endGroup();
|
|
||||||
|
|
||||||
// If the saved network configuration is not currently discovered use the system
|
|
||||||
// default
|
|
||||||
QNetworkConfiguration config = manager.configurationFromIdentifier(id);
|
|
||||||
if ((config.state() & QNetworkConfiguration::Discovered) !=
|
|
||||||
QNetworkConfiguration::Discovered) {
|
|
||||||
config = manager.defaultConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
networkSession = new QNetworkSession(config, this);
|
|
||||||
connect(networkSession, SIGNAL(opened()), this, SLOT(sessionOpened()));
|
|
||||||
|
|
||||||
networkSession->open();
|
|
||||||
} else {
|
|
||||||
networkSession = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
setWindowTitle(tr("Light Maps"));
|
setWindowTitle(tr("Light Maps"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapZoom::sessionOpened()
|
|
||||||
{
|
|
||||||
// Save the used configuration
|
|
||||||
QNetworkConfiguration config = networkSession->configuration();
|
|
||||||
QString id;
|
|
||||||
if (config.type() == QNetworkConfiguration::UserChoice) {
|
|
||||||
id = networkSession->sessionProperty(
|
|
||||||
QLatin1String("UserChoiceConfiguration")).toString();
|
|
||||||
} else {
|
|
||||||
id = config.identifier();
|
|
||||||
}
|
|
||||||
|
|
||||||
QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
|
|
||||||
settings.beginGroup(QLatin1String("QtNetwork"));
|
|
||||||
settings.setValue(QLatin1String("DefaultNetworkConfiguration"), id);
|
|
||||||
settings.endGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapZoom::chooseOslo()
|
void MapZoom::chooseOslo()
|
||||||
{
|
{
|
||||||
map->setCenter(59.9138204, 10.7387413);
|
map->setCenter(59.9138204, 10.7387413);
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
|
||||||
class QNetworkSession;
|
|
||||||
class LightMaps;
|
class LightMaps;
|
||||||
|
|
||||||
class MapZoom : public QMainWindow
|
class MapZoom : public QMainWindow
|
||||||
@ -64,7 +63,6 @@ public:
|
|||||||
MapZoom();
|
MapZoom();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void sessionOpened();
|
|
||||||
void chooseOslo();
|
void chooseOslo();
|
||||||
void chooseBerlin();
|
void chooseBerlin();
|
||||||
void chooseJakarta();
|
void chooseJakarta();
|
||||||
@ -72,7 +70,6 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
LightMaps *map;
|
LightMaps *map;
|
||||||
QNetworkSession *networkSession;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
x
Reference in New Issue
Block a user