summaryrefslogtreecommitdiffstats
path: root/demos/embedded/weatherinfo
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2010-05-18 07:31:42 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2010-05-18 07:52:31 (GMT)
commit8665f4ba8cbf63740cfb379c8f98d8d68d089bf5 (patch)
treeb27ad3143e99e57d75fd2f1a6981c177175780c5 /demos/embedded/weatherinfo
parentcd68abc3df40d8c6b03d9f0f1c8fc78f2e984ffe (diff)
downloadQt-8665f4ba8cbf63740cfb379c8f98d8d68d089bf5.zip
Qt-8665f4ba8cbf63740cfb379c8f98d8d68d089bf5.tar.gz
Qt-8665f4ba8cbf63740cfb379c8f98d8d68d089bf5.tar.bz2
Fix weatherinfo and flightinfo to only request WLAN connection once
New bearer implementation will only keep connection alive as long as the QNetworkAccessManager instance is alive, so changed the demos to have single manager instance instead of recreating it for each request. Task-number: QTBUG-10151 Reviewed-by: Janne Anttila
Diffstat (limited to 'demos/embedded/weatherinfo')
-rw-r--r--demos/embedded/weatherinfo/weatherinfo.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/demos/embedded/weatherinfo/weatherinfo.cpp b/demos/embedded/weatherinfo/weatherinfo.cpp
index 42b685e..3e0226a 100644
--- a/demos/embedded/weatherinfo/weatherinfo.cpp
+++ b/demos/embedded/weatherinfo/weatherinfo.cpp
@@ -44,10 +44,6 @@
#include <QtNetwork>
#include <QtSvg>
-#if defined (Q_OS_SYMBIAN)
-#include "sym_iap_util.h"
-#endif
-
class WeatherInfo: public QMainWindow
{
Q_OBJECT
@@ -67,6 +63,7 @@ private:
QList<QGraphicsTextItem*> m_rangeItems;
QTimeLine m_timeLine;
QHash<QString, QString> m_icons;
+ QNetworkAccessManager m_manager;
public:
WeatherInfo(QWidget *parent = 0): QMainWindow(parent) {
@@ -98,14 +95,14 @@ public:
}
setContextMenuPolicy(Qt::ActionsContextMenu);
+ connect(&m_manager, SIGNAL(finished(QNetworkReply*)),
+ this, SLOT(handleNetworkData(QNetworkReply*)));
+
QTimer::singleShot(0, this, SLOT(delayedInit()));
}
private slots:
void delayedInit() {
-#if defined(Q_OS_SYMBIAN)
- qt_SetDefaultIap();
-#endif
request("Oslo");
}
@@ -122,7 +119,6 @@ private slots:
if (!networkReply->error())
digest(QString::fromUtf8(networkReply->readAll()));
networkReply->deleteLater();
- networkReply->manager()->deleteLater();
}
void animate(int frame) {
@@ -185,10 +181,7 @@ private:
url.addEncodedQueryItem("hl", "en");
url.addEncodedQueryItem("weather", QUrl::toPercentEncoding(location));
- QNetworkAccessManager *manager = new QNetworkAccessManager(this);
- connect(manager, SIGNAL(finished(QNetworkReply*)),
- this, SLOT(handleNetworkData(QNetworkReply*)));
- manager->get(QNetworkRequest(url));
+ m_manager.get(QNetworkRequest(url));
city = QString();
setWindowTitle("Loading...");