summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@theqtcompany.com>2015-12-04 13:03:09 +0100
committerAlex Blasche <alexander.blasche@theqtcompany.com>2015-12-07 07:19:51 +0000
commit3faac8cc62a9101902baebbda348e7da9921cce4 (patch)
treee236dfb5ab1a95626bc5c5cd9fae22a4e7b467f5
parenteea315187d1add70aaf69745c031b8d6342b2303 (diff)
downloadqtlocation-3faac8cc62a9101902baebbda348e7da9921cce4.tar.gz
Fix broken weatherinfo example
openweathermap.org requires an appid these days. The free plan permits usage for commercial and non-commercial cases. Task-number: QTBUG-49772 Change-Id: I28be90709b4879df515346e03372d494d94a4f01 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
-rw-r--r--examples/positioning/weatherinfo/appmodel.cpp5
-rw-r--r--src/positioning/doc/src/examples/weatherinfo.qdoc2
2 files changed, 7 insertions, 0 deletions
diff --git a/examples/positioning/weatherinfo/appmodel.cpp b/examples/positioning/weatherinfo/appmodel.cpp
index a773cfca..4d8806b8 100644
--- a/examples/positioning/weatherinfo/appmodel.cpp
+++ b/examples/positioning/weatherinfo/appmodel.cpp
@@ -154,6 +154,7 @@ public:
int minMsBeforeNewRequest;
QTimer delayedCityRequestTimer;
QTimer requestNewWeatherTimer;
+ QString app_ident;
AppModelPrivate() :
src(NULL),
@@ -170,6 +171,7 @@ public:
requestNewWeatherTimer.setSingleShot(false);
requestNewWeatherTimer.setInterval(20*60*1000); // 20 min
throttle.invalidate();
+ app_ident = QStringLiteral("36496bad1955bf3365448965a42b9eac");
}
};
@@ -304,6 +306,7 @@ void AppModel::queryCity()
query.addQueryItem("lat", latitude);
query.addQueryItem("lon", longitude);
query.addQueryItem("mode", "json");
+ query.addQueryItem("APPID", d->app_ident);
url.setQuery(query);
qCDebug(requestsLog) << "submitting request";
@@ -385,6 +388,7 @@ void AppModel::refreshWeather()
query.addQueryItem("q", d->city);
query.addQueryItem("mode", "json");
+ query.addQueryItem("APPID", d->app_ident);
url.setQuery(query);
QNetworkReply *rep = d->nam->get(QNetworkRequest(url));
@@ -443,6 +447,7 @@ void AppModel::handleWeatherNetworkData(QObject *replyObj)
query.addQueryItem("q", d->city);
query.addQueryItem("mode", "json");
query.addQueryItem("cnt", "5");
+ query.addQueryItem("APPID", d->app_ident);
url.setQuery(query);
QNetworkReply *rep = d->nam->get(QNetworkRequest(url));
diff --git a/src/positioning/doc/src/examples/weatherinfo.qdoc b/src/positioning/doc/src/examples/weatherinfo.qdoc
index e32127d4..3db6fcbf 100644
--- a/src/positioning/doc/src/examples/weatherinfo.qdoc
+++ b/src/positioning/doc/src/examples/weatherinfo.qdoc
@@ -45,6 +45,8 @@
\include examples-run.qdocinc
+ The example uses weather data provided by \l http://www.openweathermap.org.
+
The key part of this example is the application's data model, contained
in the WeatherData and AppModel classes. WeatherData represents the weather
information taken from the HTTP service. It is a simple data class, but we