summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--demos/mapsdemo/marker.cpp23
-rw-r--r--demos/mapsdemo/navigator.cpp10
-rw-r--r--examples/declarative/mapviewer/mapviewer.qml6
-rw-r--r--examples/declarative/qmlplaces/PlaceDelegate.qml4
-rw-r--r--src/imports/location/declarativeplaces/declarativeplaces.pri2
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativeplace.cpp32
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativeplace_p.h26
-rw-r--r--src/imports/location/location.cpp4
-rw-r--r--src/imports/location/location.pro2
-rw-r--r--src/imports/location/qdeclarativegeocodemodel.cpp59
-rw-r--r--src/imports/location/qdeclarativegeocodemodel_p.h14
-rw-r--r--src/imports/location/qdeclarativegeolocation.cpp (renamed from src/imports/location/declarativeplaces/qdeclarativelocation.cpp)122
-rw-r--r--src/imports/location/qdeclarativegeolocation_p.h (renamed from src/imports/location/declarativeplaces/qdeclarativelocation_p.h)40
-rw-r--r--src/location/location.pro3
-rw-r--r--src/location/maps/qgeosearchmanager.cpp121
-rw-r--r--src/location/maps/qgeosearchmanagerengine.cpp53
-rw-r--r--src/location/maps/qgeosearchreply.cpp26
-rw-r--r--src/location/maps/qgeosearchreply.h8
-rw-r--r--src/location/maps/qgeosearchreply_p.h4
-rw-r--r--src/location/maps/qgeoserviceproviderfactory.cpp9
-rw-r--r--src/location/places/places.pri3
-rw-r--r--src/location/qgeolocation.cpp (renamed from src/location/places/qplacelocation.cpp)95
-rw-r--r--src/location/qgeolocation.h (renamed from src/location/places/qplacelocation.h)36
-rw-r--r--src/location/qgeolocation_p.h (renamed from src/location/places/qplacelocation_p.h)24
-rw-r--r--src/location/qgeoplace.cpp8
-rw-r--r--src/location/qgeoplace.h10
-rw-r--r--src/location/qgeoplace_p.h4
-rw-r--r--src/plugins/geoservices/nokia/qgeocodexmlparser.cpp28
-rw-r--r--src/plugins/geoservices/nokia/qgeocodexmlparser.h10
-rw-r--r--src/plugins/geoservices/nokia/qgeosearchreply_nokia.cpp10
-rw-r--r--src/plugins/places/nokia/qplacejsondetailsparser.cpp16
-rw-r--r--src/plugins/places/nokia/qplacejsondetailsparser.h4
-rw-r--r--src/plugins/places/nokia/qplacejsonsearchparser.cpp10
-rw-r--r--src/plugins/places/nokia/qplacejsonsearchparser.h2
-rw-r--r--tests/auto/auto.pro4
-rw-r--r--tests/auto/declarative/declarative.pro (renamed from tests/auto/declarative/qmlmapsandnav.pro)0
-rw-r--r--tests/auto/declarative/tst_map_geocoding.qml72
-rw-r--r--tests/auto/geotestplugin/qgeosearchmanagerengine_test.h36
-rw-r--r--tests/auto/qgeolocation/qgeolocation.pro4
-rw-r--r--tests/auto/qgeolocation/tst_qgeolocation.cpp367
-rw-r--r--tests/auto/qgeolocation/tst_qgeolocation.h (renamed from tests/auto/qgeolocation/tst_qgeoplace.h)38
-rw-r--r--tests/auto/qgeolocation/tst_qgeoplace.cpp223
-rw-r--r--tests/auto/qgeoplace/tst_qgeoplace.cpp18
-rw-r--r--tests/auto/qgeosearchmanagerplugins/qgeosearchmanagerengine_test.h6
-rw-r--r--tests/auto/qgeosearchreply/tst_qgeosearchreply.cpp44
-rw-r--r--tests/auto/qgeosearchreply/tst_qgeosearchreply.h10
-rw-r--r--tests/auto/qplacelocation/qplacelocation.pro7
-rw-r--r--tests/auto/qplacelocation/tst_qplacelocation.cpp158
48 files changed, 834 insertions, 981 deletions
diff --git a/demos/mapsdemo/marker.cpp b/demos/mapsdemo/marker.cpp
index 0cc9017d..029a857d 100644
--- a/demos/mapsdemo/marker.cpp
+++ b/demos/mapsdemo/marker.cpp
@@ -278,9 +278,9 @@ void MarkerManager::reverseReplyFinished(QGeoSearchReply *reply)
if (!d->reverseReplies.contains(reply))
return;
- if (reply->places().size() > 0) {
- QGeoPlace place = reply->places().first();
- d->myLocation->setAddress(place.address());
+ if (reply->locations().isEmpty() > 0) {
+ QGeoLocation location = reply->locations().first();
+ d->myLocation->setAddress(location.address());
}
d->revGeocodeRunning = false;
@@ -297,18 +297,13 @@ void MarkerManager::replyFinished(QGeoSearchReply *reply)
return;
// generate the markers and add them to the map
- foreach (QGeoPlace place, reply->places()) {
+ foreach (const QGeoLocation &location, reply->locations()) {
Marker *m = new Marker(Marker::SearchMarker);
- m->setCoordinate(place.coordinate());
+ m->setCoordinate(location.coordinate());
- if (place.isLandmark()) {
- QLandmark lm(place);
- m->setName(lm.name());
- } else {
- m->setName(QString("%1, %2").arg(place.address().street())
- .arg(place.address().city()));
- }
- m->setAddress(place.address());
+ m->setName(QString("%1, %2").arg(location.address().street())
+ .arg(location.address().city()));
+ m->setAddress(location.address());
m->setMoveable(false);
d->searchMarkers.append(m);
@@ -316,7 +311,7 @@ void MarkerManager::replyFinished(QGeoSearchReply *reply)
if (d->map) {
d->map->addMapObject(m);
// also zoom out until marker is visible
- while (!d->map->viewport().contains(place.coordinate()))
+ while (!d->map->viewport().contains(location.coordinate()))
d->map->setZoomLevel(d->map->zoomLevel()-1);
}
}
diff --git a/demos/mapsdemo/navigator.cpp b/demos/mapsdemo/navigator.cpp
index d255c74f..0563f27c 100644
--- a/demos/mapsdemo/navigator.cpp
+++ b/demos/mapsdemo/navigator.cpp
@@ -98,15 +98,15 @@ void Navigator::start()
void Navigator::on_addressSearchFinished()
{
- if (addressReply->places().size() <= 0) {
+ if (addressReply->locations().isEmpty() <= 0) {
addressReply->deleteLater();
return;
}
- QGeoPlace place = addressReply->places().at(0);
+ QGeoLocation location = addressReply->locations().at(0);
QList<QGeoCoordinate> waypoints = request.waypoints();
- waypoints.append(place.coordinate());
+ waypoints.append(location.coordinate());
request.setWaypoints(waypoints);
routeReply = routingManager->calculateRoute(request);
@@ -120,8 +120,8 @@ void Navigator::on_addressSearchFinished()
}
endMarker = new Marker(Marker::EndMarker);
- endMarker->setCoordinate(place.coordinate());
- endMarker->setAddress(place.address());
+ endMarker->setCoordinate(location.coordinate());
+ endMarker->setAddress(location.address());
endMarker->setName("Destination");
mapsWidget->map()->addMapObject(endMarker);
diff --git a/examples/declarative/mapviewer/mapviewer.qml b/examples/declarative/mapviewer/mapviewer.qml
index 4e768e87..fbd22981 100644
--- a/examples/declarative/mapviewer/mapviewer.qml
+++ b/examples/declarative/mapviewer/mapviewer.qml
@@ -275,9 +275,9 @@ FocusScope {
GeocodeModel {
id: geocodeModel
plugin : Plugin { name : "nokia"}
- onPlacesChanged: {
+ onLocationsChanged: {
if (geocodeModel.count > 0) {
- console.log('setting the coordinate as places changed in model.')
+ console.log('setting the coordinate as locations changed in model.')
map.center = geocodeModel.get(0).coordinate
}
}
@@ -312,7 +312,7 @@ FocusScope {
MapCircle {
radius: 10000
color: "red"
- center: place.coordinate
+ center: location.coordinate
}
}
}
diff --git a/examples/declarative/qmlplaces/PlaceDelegate.qml b/examples/declarative/qmlplaces/PlaceDelegate.qml
index 625ea8fc..7921dc0b 100644
--- a/examples/declarative/qmlplaces/PlaceDelegate.qml
+++ b/examples/declarative/qmlplaces/PlaceDelegate.qml
@@ -20,8 +20,8 @@ Rectangle {
clip: true
Text { text: '<b>Name: </b> ' + place.name; font.pixelSize: 16 }
Text { text: '<b>Street: </b> ' + place.location.address.street; font.pixelSize: 16 }
- Text { text: '<b>Latitude: </b> ' + place.location.displayPosition.latitude; font.pixelSize: 16 }
- Text { text: '<b>Longitude: </b> ' + place.location.displayPosition.longitude; font.pixelSize: 16 }
+ Text { text: '<b>Latitude: </b> ' + place.location.coordinate.latitude; font.pixelSize: 16 }
+ Text { text: '<b>Longitude: </b> ' + place.location.coordinate.longitude; font.pixelSize: 16 }
Text { text: '<b>Categories: </b> ' + categoryNames(place.categories); font.pixelSize: 16 }
Text { text: '<b>Media count: </b> ' + place.media.data.length; font.pixelSize: 16 }
//Text { text: '<b>All media count: </b> ' + place.mediaCount; font.pixelSize: 16 }
diff --git a/src/imports/location/declarativeplaces/declarativeplaces.pri b/src/imports/location/declarativeplaces/declarativeplaces.pri
index a24e8072..f39b09c9 100644
--- a/src/imports/location/declarativeplaces/declarativeplaces.pri
+++ b/src/imports/location/declarativeplaces/declarativeplaces.pri
@@ -13,7 +13,6 @@ SOURCES += \
declarativeplaces/qdeclarativecategory.cpp \
declarativeplaces/qdeclarativecontact.cpp \
declarativeplaces/qdeclarativedescription.cpp \
- declarativeplaces/qdeclarativelocation.cpp \
declarativeplaces/qdeclarativemediaobject.cpp \
declarativeplaces/qdeclarativemediapaginationlist.cpp \
declarativeplaces/qdeclarativeperiod.cpp \
@@ -39,7 +38,6 @@ HEADERS += \
declarativeplaces/qdeclarativecategory_p.h \
declarativeplaces/qdeclarativecontact_p.h \
declarativeplaces/qdeclarativedescription_p.h \
- declarativeplaces/qdeclarativelocation_p.h \
declarativeplaces/qdeclarativemediaobject_p.h \
declarativeplaces/qdeclarativemediapaginationlist_p.h \
declarativeplaces/qdeclarativeperiod_p.h \
diff --git a/src/imports/location/declarativeplaces/qdeclarativeplace.cpp b/src/imports/location/declarativeplaces/qdeclarativeplace.cpp
index 95e0fec4..d43c4dd4 100644
--- a/src/imports/location/declarativeplaces/qdeclarativeplace.cpp
+++ b/src/imports/location/declarativeplaces/qdeclarativeplace.cpp
@@ -146,7 +146,7 @@ QVariantHash QDeclarativePlace::additionalData() const
This property holds location of the place.
*/
-void QDeclarativePlace::setLocation(QDeclarativeLocation *location)
+void QDeclarativePlace::setLocation(QDeclarativeGeoLocation *location)
{
if (m_src.location() != location->location()) {
m_location.setLocation(location->location());
@@ -155,7 +155,7 @@ void QDeclarativePlace::setLocation(QDeclarativeLocation *location)
}
}
-QDeclarativeLocation *QDeclarativePlace::location()
+QDeclarativeGeoLocation *QDeclarativePlace::location()
{
return &m_location;
}
@@ -633,13 +633,13 @@ void QDeclarativePlace::synchronizeDescriptions()
}
/*!
- \qmlproperty QDeclarativeListProperty<QDeclarativeLocation> Place::alternativeLocations
+ \qmlproperty QDeclarativeListProperty<QDeclarativeGeoLocation> Place::alternativeLocations
This property alternative locations list.
*/
-QDeclarativeListProperty<QDeclarativeLocation> QDeclarativePlace::alternativeLocations()
+QDeclarativeListProperty<QDeclarativeGeoLocation> QDeclarativePlace::alternativeLocations()
{
- return QDeclarativeListProperty<QDeclarativeLocation>(this,
+ return QDeclarativeListProperty<QDeclarativeGeoLocation>(this,
0, // opaque data parameter
alternativeLocations_append,
alternativeLocations_count,
@@ -647,41 +647,41 @@ QDeclarativeListProperty<QDeclarativeLocation> QDeclarativePlace::alternativeLoc
alternativeLocations_clear);
}
-void QDeclarativePlace::alternativeLocations_append(QDeclarativeListProperty<QDeclarativeLocation> *prop,
- QDeclarativeLocation *value)
+void QDeclarativePlace::alternativeLocations_append(QDeclarativeListProperty<QDeclarativeGeoLocation> *prop,
+ QDeclarativeGeoLocation *value)
{
QDeclarativePlace* object = static_cast<QDeclarativePlace*>(prop->object);
- QDeclarativeLocation *altValue = new QDeclarativeLocation(object);
+ QDeclarativeGeoLocation *altValue = new QDeclarativeGeoLocation(object);
altValue->setLocation(value->location());
object->m_alternativeLocations.append(altValue);
- QList<QPlaceLocation> list = object->m_src.alternativeLocations();
+ QList<QGeoLocation> list = object->m_src.alternativeLocations();
list.append(value->location());
object->m_src.setAlternativeLocations(list);
emit object->alternativeLocationsChanged();
}
-int QDeclarativePlace::alternativeLocations_count(QDeclarativeListProperty<QDeclarativeLocation> *prop)
+int QDeclarativePlace::alternativeLocations_count(QDeclarativeListProperty<QDeclarativeGeoLocation> *prop)
{
return static_cast<QDeclarativePlace*>(prop->object)->m_alternativeLocations.count();
}
-QDeclarativeLocation* QDeclarativePlace::alternativeLocations_at(QDeclarativeListProperty<QDeclarativeLocation> *prop,
+QDeclarativeGeoLocation* QDeclarativePlace::alternativeLocations_at(QDeclarativeListProperty<QDeclarativeGeoLocation> *prop,
int index)
{
QDeclarativePlace* object = static_cast<QDeclarativePlace*>(prop->object);
- QDeclarativeLocation *res = NULL;
+ QDeclarativeGeoLocation *res = NULL;
if (object->m_alternativeLocations.count() > index && index > -1) {
res = object->m_alternativeLocations[index];
}
return res;
}
-void QDeclarativePlace::alternativeLocations_clear(QDeclarativeListProperty<QDeclarativeLocation> *prop)
+void QDeclarativePlace::alternativeLocations_clear(QDeclarativeListProperty<QDeclarativeGeoLocation> *prop)
{
QDeclarativePlace* object = static_cast<QDeclarativePlace*>(prop->object);
qDeleteAll(object->m_alternativeLocations);
object->m_alternativeLocations.clear();
- object->m_src.setAlternativeLocations(QList<QPlaceLocation>());
+ object->m_src.setAlternativeLocations(QList<QGeoLocation>());
emit object->alternativeLocationsChanged();
}
@@ -689,8 +689,8 @@ void QDeclarativePlace::synchronizeAlternativeLocations()
{
qDeleteAll(m_alternativeLocations);
m_alternativeLocations.clear();
- foreach (QPlaceLocation value, m_src.alternativeLocations()) {
- QDeclarativeLocation* declarativeValue = new QDeclarativeLocation(value, this);
+ foreach (QGeoLocation value, m_src.alternativeLocations()) {
+ QDeclarativeGeoLocation* declarativeValue = new QDeclarativeGeoLocation(value, this);
m_alternativeLocations.append(declarativeValue);
}
}
diff --git a/src/imports/location/declarativeplaces/qdeclarativeplace_p.h b/src/imports/location/declarativeplaces/qdeclarativeplace_p.h
index 98ad1219..55a8269b 100644
--- a/src/imports/location/declarativeplaces/qdeclarativeplace_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativeplace_p.h
@@ -4,7 +4,7 @@
#include <QObject>
#include <QDeclarativeListProperty>
#include <qgeoplace.h>
-#include "qdeclarativelocation_p.h"
+#include "qdeclarativegeolocation_p.h"
#include "qdeclarativebusinessinformation_p.h"
#include "qdeclarativecategory_p.h"
#include "qdeclarativesupplier_p.h"
@@ -27,8 +27,8 @@ class QDeclarativePlace : public QObject
Q_PROPERTY(QDeclarativeListProperty<QDeclarativeCategory> categories READ categories NOTIFY categoriesChanged)
Q_PROPERTY(QDeclarativeListProperty<QDeclarativeContact> contacts READ contacts NOTIFY contactsChanged)
Q_PROPERTY(QDeclarativeListProperty<QDeclarativeDescription> descriptions READ descriptions NOTIFY descriptionsChanged)
- Q_PROPERTY(QDeclarativeLocation* location READ location WRITE setLocation NOTIFY locationChanged);
- Q_PROPERTY(QDeclarativeListProperty<QDeclarativeLocation> alternativeLocations READ alternativeLocations NOTIFY alternativeLocationsChanged)
+ Q_PROPERTY(QDeclarativeGeoLocation* location READ location WRITE setLocation NOTIFY locationChanged);
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeGeoLocation> alternativeLocations READ alternativeLocations NOTIFY alternativeLocationsChanged)
Q_PROPERTY(QDeclarativeBusinessInformation* businessInformation READ businessInformation WRITE setBusinessInformation NOTIFY businessInformationChanged);
Q_PROPERTY(QDeclarativeRating* rating READ rating WRITE setRating NOTIFY ratingChanged);
Q_PROPERTY(QDeclarativeListProperty<QDeclarativeSupplier> suppliers READ suppliers NOTIFY suppliersChanged)
@@ -78,14 +78,14 @@ public:
static int descriptions_count(QDeclarativeListProperty<QDeclarativeDescription> *prop);
static QDeclarativeDescription* descriptions_at(QDeclarativeListProperty<QDeclarativeDescription> *prop, int index);
static void descriptions_clear(QDeclarativeListProperty<QDeclarativeDescription> *prop);
- QDeclarativeLocation *location();
- void setLocation(QDeclarativeLocation *location);
- QDeclarativeListProperty<QDeclarativeLocation> alternativeLocations();
- static void alternativeLocations_append(QDeclarativeListProperty<QDeclarativeLocation> *prop,
- QDeclarativeLocation* value);
- static int alternativeLocations_count(QDeclarativeListProperty<QDeclarativeLocation> *prop);
- static QDeclarativeLocation* alternativeLocations_at(QDeclarativeListProperty<QDeclarativeLocation> *prop, int index);
- static void alternativeLocations_clear(QDeclarativeListProperty<QDeclarativeLocation> *prop);
+ QDeclarativeGeoLocation *location();
+ void setLocation(QDeclarativeGeoLocation *location);
+ QDeclarativeListProperty<QDeclarativeGeoLocation> alternativeLocations();
+ static void alternativeLocations_append(QDeclarativeListProperty<QDeclarativeGeoLocation> *prop,
+ QDeclarativeGeoLocation* value);
+ static int alternativeLocations_count(QDeclarativeListProperty<QDeclarativeGeoLocation> *prop);
+ static QDeclarativeGeoLocation* alternativeLocations_at(QDeclarativeListProperty<QDeclarativeGeoLocation> *prop, int index);
+ static void alternativeLocations_clear(QDeclarativeListProperty<QDeclarativeGeoLocation> *prop);
QDeclarativeRating *rating();
void setRating(QDeclarativeRating *rating);
QDeclarativeListProperty<QDeclarativeSupplier> suppliers();
@@ -150,8 +150,8 @@ private:
QList<QDeclarativeCategory*> m_categories;
QList<QDeclarativeContact*> m_contacts;
QList<QDeclarativeDescription*> m_descriptions;
- QDeclarativeLocation m_location;
- QList<QDeclarativeLocation*> m_alternativeLocations;
+ QDeclarativeGeoLocation m_location;
+ QList<QDeclarativeGeoLocation*> m_alternativeLocations;
QDeclarativeRating m_rating;
QList<QDeclarativeSupplier*> m_suppliers;
QDeclarativeMediaPaginationList m_mediaList;
diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp
index 0e37ec59..48b36b5e 100644
--- a/src/imports/location/location.cpp
+++ b/src/imports/location/location.cpp
@@ -80,7 +80,7 @@
#include "qdeclarativecategory_p.h"
#include "qdeclarativecontact_p.h"
#include "qdeclarativedescription_p.h"
-#include "qdeclarativelocation_p.h"
+#include "qdeclarativegeolocation_p.h"
#include "qdeclarativemediaobject_p.h"
#include "qdeclarativemediapaginationlist_p.h"
#include "qdeclarativeplace_p.h"
@@ -202,7 +202,7 @@ public:
qmlRegisterType<QDeclarativeCategory>(uri, 5, 0, "Category");
qmlRegisterType<QDeclarativeContact>(uri, 5, 0, "Contact");
qmlRegisterType<QDeclarativeDescription>(uri, 5, 0, "Description");
- qmlRegisterType<QDeclarativeLocation>(uri, 5, 0, "Location");
+ qmlRegisterType<QDeclarativeGeoLocation>(uri, 5, 0, "Location");
qmlRegisterType<QDeclarativeMediaObject>(uri, 5, 0, "MediaObject");
qmlRegisterType<QDeclarativeMediaPaginationList>(uri, 5, 0, "MediaPaginationList");
qmlRegisterType<QDeclarativePeriod>(uri, 5, 0, "Period");
diff --git a/src/imports/location/location.pro b/src/imports/location/location.pro
index 14a8e2ea..6431899a 100644
--- a/src/imports/location/location.pro
+++ b/src/imports/location/location.pro
@@ -31,6 +31,7 @@ HEADERS += qdeclarativeposition_p.h \
qdeclarativelandmarkcategory_p.h \
qdeclarativelandmarkfilters_p.h \
qdeclarativecoordinate_p.h \
+ qdeclarativegeolocation_p.h \
qdeclarativegeomapobjectborder_p.h \
qdeclarativegeomapcircleobject_p.h \
qdeclarativegeomapgroupobject_p.h \
@@ -64,6 +65,7 @@ SOURCES += qdeclarativeposition.cpp \
qdeclarativelandmarkcategory.cpp \
qdeclarativelandmarkfilters.cpp \
qdeclarativecoordinate.cpp \
+ qdeclarativegeolocation.cpp \
qdeclarativegeomapobjectborder.cpp \
qdeclarativegeomapcircleobject.cpp \
qdeclarativegeomapgroupobject.cpp \
diff --git a/src/imports/location/qdeclarativegeocodemodel.cpp b/src/imports/location/qdeclarativegeocodemodel.cpp
index 5cb579e8..8a8ac9d6 100644
--- a/src/imports/location/qdeclarativegeocodemodel.cpp
+++ b/src/imports/location/qdeclarativegeocodemodel.cpp
@@ -41,7 +41,7 @@
#include "qdeclarativegeocodemodel_p.h"
-#include "qdeclarativegeoplace_p.h"
+#include "qdeclarativegeolocation_p.h"
#include <QtDeclarative/qdeclarativeinfo.h>
#include <qgeoserviceprovider.h>
@@ -64,18 +64,16 @@ QDeclarativeGeocodeModel::QDeclarativeGeocodeModel(QObject* parent)
{
QHash<int, QByteArray> roleNames;
roleNames = QAbstractItemModel::roleNames();
- roleNames.insert(PlaceRole, "place");
+ roleNames.insert(LocationRole, "location");
setRoleNames(roleNames);
}
QDeclarativeGeocodeModel::~QDeclarativeGeocodeModel()
{
- if (serviceProvider_)
- delete serviceProvider_;
- qDeleteAll(declarativePlaces_);
- declarativePlaces_.clear();
- if (reply_)
- delete reply_;
+ delete serviceProvider_;
+ qDeleteAll(declarativeLocations_);
+ declarativeLocations_.clear();
+ delete reply_;
}
// From QDeclarativeParserStatus
@@ -158,19 +156,19 @@ void QDeclarativeGeocodeModel::queryContentChanged()
int QDeclarativeGeocodeModel::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
- return declarativePlaces_.count();
+ return declarativeLocations_.count();
}
QVariant QDeclarativeGeocodeModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
- if (index.row() >= declarativePlaces_.count())
+ if (index.row() >= declarativeLocations_.count())
return QVariant();
- if (role == QDeclarativeGeocodeModel::PlaceRole) {
- QObject* placeObject = declarativePlaces_.at(index.row());
- Q_ASSERT(placeObject);
- return QVariant::fromValue(placeObject);
+ if (role == QDeclarativeGeocodeModel::LocationRole) {
+ QObject* locationObject = declarativeLocations_.at(index.row());
+ Q_ASSERT(locationObject);
+ return QVariant::fromValue(locationObject);
}
return QVariant();
}
@@ -232,14 +230,14 @@ void QDeclarativeGeocodeModel::searchFinished(QGeoSearchReply *reply)
if (reply->error() != QGeoSearchReply::NoError) {
return;
}
- int oldCount = declarativePlaces_.count();
- setPlaces(reply->places());
+ int oldCount = declarativeLocations_.count();
+ setLocations(reply->locations());
setError("");
setStatus(QDeclarativeGeocodeModel::Ready);
reply->deleteLater();
reply_ = 0;
- emit placesChanged();
- if (oldCount != declarativePlaces_.count())
+ emit locationsChanged();
+ if (oldCount != declarativeLocations_.count())
emit countChanged();
}
@@ -280,35 +278,38 @@ void QDeclarativeGeocodeModel::setError(const QString &error)
emit errorChanged();
}
-void QDeclarativeGeocodeModel::setPlaces(const QList<QGeoPlace> &places)
+void QDeclarativeGeocodeModel::setLocations(const QList<QGeoLocation> &locations)
{
beginResetModel();
- qDeleteAll(declarativePlaces_);
- declarativePlaces_.clear();
- for (int i = 0; i < places.count(); ++i) {
- QDeclarativeGeoPlace* place = new QDeclarativeGeoPlace(places.at(i), this);
- declarativePlaces_.append(place);
+ qDeleteAll(declarativeLocations_);
+ declarativeLocations_.clear();
+ for (int i = 0; i < locations.count(); ++i) {
+ QDeclarativeGeoLocation* location = new QDeclarativeGeoLocation(locations.at(i), this);
+ declarativeLocations_.append(location);
}
endResetModel();
}
int QDeclarativeGeocodeModel::count() const
{
- return declarativePlaces_.count();
+ return declarativeLocations_.count();
}
-Q_INVOKABLE QDeclarativeGeoPlace* QDeclarativeGeocodeModel::get(int index)
+Q_INVOKABLE QDeclarativeGeoLocation* QDeclarativeGeocodeModel::get(int index)
{
- if (index < 0 || index >= declarativePlaces_.count()) {
+ if (index < 0 || index >= declarativeLocations_.count()) {
qmlInfo(this) << tr("Error, too big or small index in get(): ") << index;
return 0;
}
- return declarativePlaces_.at(index);
+ return declarativeLocations_.at(index);
}
Q_INVOKABLE void QDeclarativeGeocodeModel::clear()
{
- setPlaces(QList<QGeoPlace>());
+ bool hasChanged = !declarativeLocations_.isEmpty();
+ setLocations(QList<QGeoLocation>());
+ if (hasChanged)
+ emit countChanged();
}
Q_INVOKABLE void QDeclarativeGeocodeModel::reset()
diff --git a/src/imports/location/qdeclarativegeocodemodel_p.h b/src/imports/location/qdeclarativegeocodemodel_p.h
index 09f4f53b..48b84dec 100644
--- a/src/imports/location/qdeclarativegeocodemodel_p.h
+++ b/src/imports/location/qdeclarativegeocodemodel_p.h
@@ -49,7 +49,7 @@
#include <QtDeclarative/qdeclarative.h>
#include <QDeclarativeParserStatus>
-#include "qdeclarativegeoplace_p.h"
+#include "qdeclarativegeolocation_p.h"
#include <QAbstractListModel>
#include <QPointer>
@@ -57,7 +57,7 @@ QTM_BEGIN_NAMESPACE
class QGeoServiceProvider;
class QGeoSearchManager;
-class QDeclarativeGeoPlace;
+class QDeclarativeGeoLocation;
class QDeclarativeGeocodeModel : public QAbstractListModel, public QDeclarativeParserStatus
{
@@ -82,7 +82,7 @@ public:
};
enum Roles {
- PlaceRole = Qt::UserRole + 499
+ LocationRole = Qt::UserRole + 1
};
explicit QDeclarativeGeocodeModel(QObject* parent = 0);
@@ -109,7 +109,7 @@ public:
void setAutoUpdate(bool update);
int count() const;
- Q_INVOKABLE QDeclarativeGeoPlace* get(int index);
+ Q_INVOKABLE QDeclarativeGeoLocation* get(int index);
QVariant query() const;
void setQuery(const QVariant& query);
@@ -121,7 +121,7 @@ Q_SIGNALS:
void pluginChanged();
void statusChanged();
void errorChanged();
- void placesChanged();
+ void locationsChanged();
void autoUpdateChanged();
void boundsChanged();
void queryChanged();
@@ -144,7 +144,7 @@ protected:
bool complete_;
private:
- void setPlaces(const QList<QGeoPlace> &places);
+ void setLocations(const QList<QGeoLocation> &locations);
QGeoBoundingArea* boundingArea();
void abortRequest();
QGeoSearchReply* reply_;
@@ -156,7 +156,7 @@ private:
QGeoBoundingBox boundingBox_;
QGeoBoundingCircle boundingCircle_;
- QList<QDeclarativeGeoPlace*> declarativePlaces_;
+ QList<QDeclarativeGeoLocation*> declarativeLocations_;
Status status_;
QString error_;
diff --git a/src/imports/location/declarativeplaces/qdeclarativelocation.cpp b/src/imports/location/qdeclarativegeolocation.cpp
index cd2790ab..c8db0a2d 100644
--- a/src/imports/location/declarativeplaces/qdeclarativelocation.cpp
+++ b/src/imports/location/qdeclarativegeolocation.cpp
@@ -1,4 +1,4 @@
-#include "qdeclarativelocation_p.h"
+#include "qdeclarativegeolocation_p.h"
QTM_USE_NAMESPACE
@@ -14,25 +14,31 @@ QTM_USE_NAMESPACE
\ingroup qml-places
*/
-QDeclarativeLocation::QDeclarativeLocation(QObject* parent)
+QDeclarativeGeoLocation::QDeclarativeGeoLocation(QObject* parent)
: QObject(parent)
{
}
-QDeclarativeLocation::QDeclarativeLocation(const QPlaceLocation &src,
+QDeclarativeGeoLocation::QDeclarativeGeoLocation(const QGeoLocation &src,
QObject *parent)
: QObject(parent),
- m_src(src)
+ m_src(src),
+ m_address(src.address()),
+ m_coordinate(src.coordinate()),
+ m_boundingBox(src.viewport())
{
+ for (int i = 0; i < src.navigationPositions().count(); ++i) {
+ m_navigationPositions.append(new QDeclarativeCoordinate(src.navigationPositions().at(i)));
+ }
}
-QDeclarativeLocation::~QDeclarativeLocation()
+QDeclarativeGeoLocation::~QDeclarativeGeoLocation()
{
}
-void QDeclarativeLocation::setLocation(const QPlaceLocation &src)
+void QDeclarativeGeoLocation::setLocation(const QGeoLocation &src)
{
- QPlaceLocation previous = m_src;
+ QGeoLocation previous = m_src;
m_src = src;
if (previous.additionalData() != m_src.additionalData()) {
@@ -46,9 +52,9 @@ void QDeclarativeLocation::setLocation(const QPlaceLocation &src)
m_address.setAddress(m_src.address());
emit addressChanged();
}
- if (previous.displayPosition() != m_src.displayPosition()) {
- m_displayPosition.setCoordinate(m_src.displayPosition());
- emit displayPositionChanged();
+ if (previous.coordinate() != m_src.coordinate()) {
+ m_coordinate.setCoordinate(m_src.coordinate());
+ emit coordinateChanged();
}
if (previous.navigationPositions() != m_src.navigationPositions()) {
synchronizeNavigationPositions();
@@ -63,12 +69,12 @@ void QDeclarativeLocation::setLocation(const QPlaceLocation &src)
if (previous.locationScore() != m_src.locationScore()) {
emit locationScoreChanged();
}
- if (previous.mapView() != m_src.mapView()) {
- emit mapViewChanged();
+ if (previous.viewport() != m_src.viewport()) {
+ emit viewport();
}
}
-QPlaceLocation QDeclarativeLocation::location() const
+QGeoLocation QDeclarativeGeoLocation::location() const
{
return m_src;
}
@@ -79,7 +85,7 @@ QPlaceLocation QDeclarativeLocation::location() const
This property holds additional data for location. Those are pairs of strings (key/value).
*/
-void QDeclarativeLocation::setAdditionalData(const QVariantHash &additionalData)
+void QDeclarativeGeoLocation::setAdditionalData(const QVariantHash &additionalData)
{
if (m_src.additionalData() != additionalData) {
m_src.setAdditionalData(additionalData);
@@ -87,7 +93,7 @@ void QDeclarativeLocation::setAdditionalData(const QVariantHash &additionalData)
}
}
-QVariantHash QDeclarativeLocation::additionalData() const
+QVariantHash QDeclarativeGeoLocation::additionalData() const
{
return m_src.additionalData();
}
@@ -97,7 +103,7 @@ QVariantHash QDeclarativeLocation::additionalData() const
This property holds address of the location.
*/
-void QDeclarativeLocation::setAddress(QDeclarativeGeoAddress *address)
+void QDeclarativeGeoLocation::setAddress(QDeclarativeGeoAddress *address)
{
if (m_src.address() != address->address()) {
m_address.setAddress(address->address());
@@ -106,28 +112,28 @@ void QDeclarativeLocation::setAddress(QDeclarativeGeoAddress *address)
}
}
-QDeclarativeGeoAddress *QDeclarativeLocation::address()
+QDeclarativeGeoAddress *QDeclarativeGeoLocation::address()
{
return &m_address;
}
/*!
- \qmlproperty string Location::displayPosition
+ \qmlproperty string Location::coordinate
This property holds display coordinates of the location.
*/
-void QDeclarativeLocation::setDisplayPosition(QDeclarativeCoordinate *displayPosition)
+void QDeclarativeGeoLocation::setCoordinate(QDeclarativeCoordinate *coordinate)
{
- if (m_src.displayPosition() != displayPosition->coordinate()) {
- m_displayPosition.setCoordinate(displayPosition->coordinate());
- m_src.setDisplayPosition(displayPosition->coordinate());
- emit displayPositionChanged();
+ if (m_src.coordinate() != coordinate->coordinate()) {
+ m_coordinate.setCoordinate(coordinate->coordinate());
+ m_src.setCoordinate(coordinate->coordinate());
+ emit coordinateChanged();
}
}
-QDeclarativeCoordinate *QDeclarativeLocation::displayPosition()
+QDeclarativeCoordinate *QDeclarativeGeoLocation::coordinate()
{
- return &m_displayPosition;
+ return &m_coordinate;
}
/*!
@@ -135,7 +141,7 @@ QDeclarativeCoordinate *QDeclarativeLocation::displayPosition()
This property holds label.
*/
-void QDeclarativeLocation::setLabel(const QString &label)
+void QDeclarativeGeoLocation::setLabel(const QString &label)
{
if (m_src.label() != label) {
m_src.setLabel(label);
@@ -143,7 +149,7 @@ void QDeclarativeLocation::setLabel(const QString &label)
}
}
-QString QDeclarativeLocation::label() const
+QString QDeclarativeGeoLocation::label() const
{
return m_src.label();
}
@@ -153,7 +159,7 @@ QString QDeclarativeLocation::label() const
This property holds location id.
*/
-void QDeclarativeLocation::setLocationId(const QString &locationId)
+void QDeclarativeGeoLocation::setLocationId(const QString &locationId)
{
if (m_src.locationId() != locationId) {
m_src.setLocationId(locationId);
@@ -161,7 +167,7 @@ void QDeclarativeLocation::setLocationId(const QString &locationId)
}
}
-QString QDeclarativeLocation::locationId() const
+QString QDeclarativeGeoLocation::locationId() const
{
return m_src.locationId();
}
@@ -171,7 +177,7 @@ QString QDeclarativeLocation::locationId() const
This property holds location score.
*/
-void QDeclarativeLocation::setLocationScore(const int &locationScore)
+void QDeclarativeGeoLocation::setLocationScore(const int &locationScore)
{
if (m_src.locationScore() != locationScore) {
m_src.setLocationScore(locationScore);
@@ -179,26 +185,26 @@ void QDeclarativeLocation::setLocationScore(const int &locationScore)
}
}
-int QDeclarativeLocation::locationScore() const
+int QDeclarativeGeoLocation::locationScore() const
{
return m_src.locationScore();
}
/*!
- \qmlproperty string Location::mapView
+ \qmlproperty string Location::viewport
This property holds bouding box of area on map ocupied by location.
*/
-void QDeclarativeLocation::setMapView(QDeclarativeGeoBoundingBox *mapView)
+void QDeclarativeGeoLocation::setViewport(QDeclarativeGeoBoundingBox *viewport)
{
- if (m_src.mapView() != mapView->box()) {
- m_boundingBox.setBox(mapView->box());
- m_src.setMapView(mapView->box());
- emit mapViewChanged();
+ if (m_src.viewport() != viewport->box()) {
+ m_boundingBox.setBox(viewport->box());
+ m_src.setViewport(viewport->box());
+ emit viewportChanged();
}
}
-QDeclarativeGeoBoundingBox *QDeclarativeLocation::mapView()
+QDeclarativeGeoBoundingBox *QDeclarativeGeoLocation::viewport()
{
return &m_boundingBox;
}
@@ -208,7 +214,7 @@ QDeclarativeGeoBoundingBox *QDeclarativeLocation::mapView()
This property alternative values for label property.
*/
-QDeclarativeListProperty<QDeclarativeAlternativeValue> QDeclarativeLocation::alternativeLabels()
+QDeclarativeListProperty<QDeclarativeAlternativeValue> QDeclarativeGeoLocation::alternativeLabels()
{
return QDeclarativeListProperty<QDeclarativeAlternativeValue>(this,
0, // opaque data parameter
@@ -218,10 +224,10 @@ QDeclarativeListProperty<QDeclarativeAlternativeValue> QDeclarativeLocation::alt
alternativeValue_clear);
}
-void QDeclarativeLocation::alternativeValue_append(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop,
+void QDeclarativeGeoLocation::alternativeValue_append(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop,
QDeclarativeAlternativeValue *value)
{
- QDeclarativeLocation* object = static_cast<QDeclarativeLocation*>(prop->object);
+ QDeclarativeGeoLocation* object = static_cast<QDeclarativeGeoLocation*>(prop->object);
QDeclarativeAlternativeValue *altValue = new QDeclarativeAlternativeValue(object);
altValue->setValueObject(value->valueObject());
object->m_alternativeValues.append(altValue);
@@ -231,15 +237,15 @@ void QDeclarativeLocation::alternativeValue_append(QDeclarativeListProperty<QDec
emit object->alternativeLabelsChanged();
}
-int QDeclarativeLocation::alternativeValue_count(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop)
+int QDeclarativeGeoLocation::alternativeValue_count(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop)
{
- return static_cast<QDeclarativeLocation*>(prop->object)->m_alternativeValues.count();
+ return static_cast<QDeclarativeGeoLocation*>(prop->object)->m_alternativeValues.count();
}
-QDeclarativeAlternativeValue* QDeclarativeLocation::alternativeValue_at(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop,
+QDeclarativeAlternativeValue* QDeclarativeGeoLocation::alternativeValue_at(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop,
int index)
{
- QDeclarativeLocation* object = static_cast<QDeclarativeLocation*>(prop->object);
+ QDeclarativeGeoLocation* object = static_cast<QDeclarativeGeoLocation*>(prop->object);
QDeclarativeAlternativeValue *res = NULL;
if (object->m_alternativeValues.count() > index && index > -1) {
res = object->m_alternativeValues[index];
@@ -247,9 +253,9 @@ QDeclarativeAlternativeValue* QDeclarativeLocation::alternativeValue_at(QDeclara
return res;
}
-void QDeclarativeLocation::alternativeValue_clear(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop)
+void QDeclarativeGeoLocation::alternativeValue_clear(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop)
{
- QDeclarativeLocation* object = static_cast<QDeclarativeLocation*>(prop->object);
+ QDeclarativeGeoLocation* object = static_cast<QDeclarativeGeoLocation*>(prop->object);
qDeleteAll(object->m_alternativeValues);
object->m_alternativeValues.clear();
object->m_src.setAlternativeLabels(QList<QPlaceAlternativeValue>());
@@ -261,7 +267,7 @@ void QDeclarativeLocation::alternativeValue_clear(QDeclarativeListProperty<QDecl
This property navigation coordinates for location.
*/
-QDeclarativeListProperty<QDeclarativeCoordinate> QDeclarativeLocation::navigationPositions()
+QDeclarativeListProperty<QDeclarativeCoordinate> QDeclarativeGeoLocation::navigationPositions()
{
return QDeclarativeListProperty<QDeclarativeCoordinate>(this,
0, // opaque data parameter
@@ -271,10 +277,10 @@ QDeclarativeListProperty<QDeclarativeCoordinate> QDeclarativeLocation::navigatio
navigationPosition_clear);
}
-void QDeclarativeLocation::navigationPosition_append(QDeclarativeListProperty<QDeclarativeCoordinate> *prop,
+void QDeclarativeGeoLocation::navigationPosition_append(QDeclarativeListProperty<QDeclarativeCoordinate> *prop,
QDeclarativeCoordinate *value)
{
- QDeclarativeLocation* object = static_cast<QDeclarativeLocation*>(prop->object);
+ QDeclarativeGeoLocation* object = static_cast<QDeclarativeGeoLocation*>(prop->object);
QDeclarativeCoordinate *altValue = new QDeclarativeCoordinate(object);
altValue->setCoordinate(value->coordinate());
object->m_navigationPositions.append(altValue);
@@ -284,15 +290,15 @@ void QDeclarativeLocation::navigationPosition_append(QDeclarativeListProperty<QD
emit object->navigationPositionsChanged();
}
-int QDeclarativeLocation::navigationPosition_count(QDeclarativeListProperty<QDeclarativeCoordinate> *prop)
+int QDeclarativeGeoLocation::navigationPosition_count(QDeclarativeListProperty<QDeclarativeCoordinate> *prop)
{
- return static_cast<QDeclarativeLocation*>(prop->object)->m_navigationPositions.count();
+ return static_cast<QDeclarativeGeoLocation*>(prop->object)->m_navigationPositions.count();
}
-QDeclarativeCoordinate* QDeclarativeLocation::navigationPosition_at(QDeclarativeListProperty<QDeclarativeCoordinate> *prop,
+QDeclarativeCoordinate* QDeclarativeGeoLocation::navigationPosition_at(QDeclarativeListProperty<QDeclarativeCoordinate> *prop,
int index)
{
- QDeclarativeLocation* object = static_cast<QDeclarativeLocation*>(prop->object);
+ QDeclarativeGeoLocation* object = static_cast<QDeclarativeGeoLocation*>(prop->object);
QDeclarativeCoordinate *res = NULL;
if (object->m_navigationPositions.count() > index && index > -1) {
res = object->m_navigationPositions[index];
@@ -300,16 +306,16 @@ QDeclarativeCoordinate* QDeclarativeLocation::navigationPosition_at(QDeclarative
return res;
}
-void QDeclarativeLocation::navigationPosition_clear(QDeclarativeListProperty<QDeclarativeCoordinate> *prop)
+void QDeclarativeGeoLocation::navigationPosition_clear(QDeclarativeListProperty<QDeclarativeCoordinate> *prop)
{
- QDeclarativeLocation* object = static_cast<QDeclarativeLocation*>(prop->object);
+ QDeclarativeGeoLocation* object = static_cast<QDeclarativeGeoLocation*>(prop->object);
qDeleteAll(object->m_navigationPositions);
object->m_navigationPositions.clear();
object->m_src.setNavigationPositions(QList<QGeoCoordinate>());
emit object->navigationPositionsChanged();
}
-void QDeclarativeLocation::synchronizeAlternativeValues()
+void QDeclarativeGeoLocation::synchronizeAlternativeValues()
{
qDeleteAll(m_alternativeValues);
m_alternativeValues.clear();
@@ -319,7 +325,7 @@ void QDeclarativeLocation::synchronizeAlternativeValues()
}
}
-void QDeclarativeLocation::synchronizeNavigationPositions()
+void QDeclarativeGeoLocation::synchronizeNavigationPositions()
{
qDeleteAll(m_navigationPositions);
m_navigationPositions.clear();
diff --git a/src/imports/location/declarativeplaces/qdeclarativelocation_p.h b/src/imports/location/qdeclarativegeolocation_p.h
index 7d8e047a..6a75cbd5 100644
--- a/src/imports/location/declarativeplaces/qdeclarativelocation_p.h
+++ b/src/imports/location/qdeclarativegeolocation_p.h
@@ -1,9 +1,9 @@
-#ifndef QDECLARATIVELOCATION_P_H
-#define QDECLARATIVELOCATION_P_H
+#ifndef QDECLARATIVEGEOLOCATION_P_H
+#define QDECLARATIVEGEOLOCATION_P_H
#include <QObject>
#include <QDeclarativeListProperty>
-#include <qplacelocation.h>
+#include <qgeolocation.h>
#include "qdeclarativecoordinate_p.h"
#include "qdeclarativegeoboundingbox_p.h"
#include "qdeclarativegeoaddress_p.h"
@@ -11,27 +11,27 @@
QTM_BEGIN_NAMESPACE
-class QDeclarativeLocation : public QObject
+class QDeclarativeGeoLocation : public QObject
{
Q_OBJECT
Q_PROPERTY(QVariantHash additionalData READ additionalData WRITE setAdditionalData NOTIFY additionalDataChanged);
Q_PROPERTY(QDeclarativeListProperty<QDeclarativeAlternativeValue> alternativeLabels READ alternativeLabels NOTIFY alternativeLabelsChanged)
Q_PROPERTY(QDeclarativeGeoAddress* address READ address WRITE setAddress NOTIFY addressChanged);
- Q_PROPERTY(QDeclarativeCoordinate* displayPosition READ displayPosition WRITE setDisplayPosition NOTIFY displayPositionChanged);
+ Q_PROPERTY(QDeclarativeCoordinate* coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged);
Q_PROPERTY(QDeclarativeListProperty<QDeclarativeCoordinate> navigationPositions READ navigationPositions NOTIFY navigationPositionsChanged)
Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged);
Q_PROPERTY(QString locationId READ locationId WRITE setLocationId NOTIFY locationIdChanged);
Q_PROPERTY(int locationScore READ locationScore WRITE setLocationScore NOTIFY locationScoreChanged);
- Q_PROPERTY(QDeclarativeGeoBoundingBox* mapView READ mapView WRITE setMapView NOTIFY mapViewChanged);
+ Q_PROPERTY(QDeclarativeGeoBoundingBox* viewport READ viewport WRITE setViewport NOTIFY viewportChanged);
public:
- explicit QDeclarativeLocation(QObject* parent = 0);
- explicit QDeclarativeLocation(const QPlaceLocation &src, QObject* parent = 0);
- ~QDeclarativeLocation();
+ explicit QDeclarativeGeoLocation(QObject* parent = 0);
+ explicit QDeclarativeGeoLocation(const QGeoLocation &src, QObject* parent = 0);
+ ~QDeclarativeGeoLocation();
- QPlaceLocation location() const;
- void setLocation(const QPlaceLocation &src);
+ QGeoLocation location() const;
+ void setLocation(const QGeoLocation &src);
QVariantHash additionalData() const;
void setAdditionalData(const QVariantHash &data);
@@ -43,8 +43,8 @@ public:
static void alternativeValue_clear(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop);
QDeclarativeGeoAddress *address();
void setAddress(QDeclarativeGeoAddress *address);
- QDeclarativeCoordinate *displayPosition();
- void setDisplayPosition(QDeclarativeCoordinate *position);
+ QDeclarativeCoordinate *coordinate();
+ void setCoordinate(QDeclarativeCoordinate *coordinate);
QDeclarativeListProperty<QDeclarativeCoordinate> navigationPositions();
static void navigationPosition_append(QDeclarativeListProperty<QDeclarativeCoordinate> *prop,
QDeclarativeCoordinate* value);
@@ -57,19 +57,19 @@ public:
void setLocationId(const QString &locationId);
int locationScore() const;
void setLocationScore(const int &score);
- QDeclarativeGeoBoundingBox *mapView();
- void setMapView(QDeclarativeGeoBoundingBox *boundingBox);
+ QDeclarativeGeoBoundingBox *viewport();
+ void setViewport(QDeclarativeGeoBoundingBox *boundingBox);
signals:
void additionalDataChanged();
void alternativeLabelsChanged();
void addressChanged();
- void displayPositionChanged();
+ void coordinateChanged();
void navigationPositionsChanged();
void labelChanged();
void locationIdChanged();
void locationScoreChanged();
- void mapViewChanged();
+ void viewportChanged();
private:
void synchronizeAlternativeValues();
@@ -78,14 +78,14 @@ private:
private:
QList<QDeclarativeAlternativeValue*> m_alternativeValues;
QDeclarativeGeoAddress m_address;
- QDeclarativeCoordinate m_displayPosition;
+ QDeclarativeCoordinate m_coordinate;
QDeclarativeGeoBoundingBox m_boundingBox;
QList<QDeclarativeCoordinate*> m_navigationPositions;
- QPlaceLocation m_src;
+ QGeoLocation m_src;
};
QTM_END_NAMESPACE
-QML_DECLARE_TYPE(QTM_PREPEND_NAMESPACE(QDeclarativeLocation));
+QML_DECLARE_TYPE(QTM_PREPEND_NAMESPACE(QDeclarativeGeoLocation));
#endif // QDECLARATIVELOCATION_P_H
diff --git a/src/location/location.pro b/src/location/location.pro
index 77191c23..16e2e4ab 100644
--- a/src/location/location.pro
+++ b/src/location/location.pro
@@ -31,6 +31,7 @@ PUBLIC_HEADERS += \
qgeoboundingbox.h \
qgeoboundingcircle.h \
qgeocoordinate.h \
+ qgeolocation.h \
qgeoplace.h \
qgeopositioninfo.h \
qgeopositioninfosource.h \
@@ -43,6 +44,7 @@ PRIVATE_HEADERS += \
qgeoaddress_p.h \
qgeoboundingbox_p.h \
qgeoboundingcircle_p.h \
+ qgeolocation_p.h \
qgeoplace_p.h \
qlocationutils_p.h \
qnmeapositioninfosource_p.h \
@@ -132,6 +134,7 @@ SOURCES += \
qgeoboundingbox.cpp \
qgeoboundingcircle.cpp \
qgeocoordinate.cpp \
+ qgeolocation.cpp \
qgeoplace.cpp \
qgeopositioninfo.cpp \
qgeopositioninfosource.cpp \
diff --git a/src/location/maps/qgeosearchmanager.cpp b/src/location/maps/qgeosearchmanager.cpp
index 3e48d4a4..7f84a476 100644
--- a/src/location/maps/qgeosearchmanager.cpp
+++ b/src/location/maps/qgeosearchmanager.cpp
@@ -70,95 +70,11 @@ QTM_BEGIN_NAMESPACE
QGeoAddress instances to QGeoCoordinate instances and vice-versa.
The search() function allows a user to perform a free text search
- for place information. If the string provided can be interpreted as
- an address it can be geocoded to coordinate information, and the string
- can also be used to search a landmarks database, depending on the level
- of support supplied by the service provider.
-
- The defaultLandmarkManager() function will return a QLandmarkManager
- instance if access to the service providers landmark database is
- available outside of the search() method.
-
- A user can supply other QLandmarkManager instances to be searched during
- the execution of search() with setAdditionalLandmarkManagers(). This
- means that a personal database store can be combined with a public source
- of database information with very little effort.
-
- \note At present the additional landmark managers only search for the
- search string in the name of the landmarks.
+ for location information. If the string provided can be interpreted as
+ an address it can be geocoded to coordinate information.
Instances of QGeoSearchManager can be accessed with
QGeoServiceProvider::searchManager().
-
- A small example of the usage of QGeoSearchManager and the handling of
- QLandmark results follows:
-
- \code
-class MySearchHandler : public QObject
-{
- Q_OBJECT
-public:
- MySearchHandler(QGeoSearchManager *searchManager, QString searchString)
- {
- QGeoSearchReply *reply = searchManager->search(searchString);
-
- if (reply->isFinished()) {
- if (reply->error() == QGeoSearchReply::NoError) {
- searchResults(reply);
- else
- searchError(reply, reply->error(), reply->errorString());
- return;
- }
-
- connect(searchManager,
- SIGNAL(finished(QGeoSearchReply*)),
- this,
- SLOT(searchResults(QGeoSearchReply*)));
-
- connect(searchManager,
- SIGNAL(error(QGeoSearchReply*,QGeoSearchReply::Error,QString)),
- this
- SLOT(searchError(QGeoSearchReply*,QGeoSearchReply::Error,QString)));
- }
-
-private slots:
- void searchResults(QGeoSearchReply *reply)
- {
- // The QLandmark results can be created from the simpler
- // QGeoPlace results if that is required.
- QList<QLandmark> landmarks;
- for (int i = 0; i < reply->places().size(); ++i) {
- if (reply->places().at(i).isLandmark())
- landmarks.append(QLandmark(reply->places().at(i)));
- }
-
- // ... now we have to make use of the places and landmarks ...
- reply->deleteLater();
- }
-
- void searchError(QGeoSearchReply *reply, QGeoSearchReply::Error error, const QString &errorString)
- {
- // ... inform the user that an error has occurred ...
- reply->deleteLater();
- }
-};
- \endcode
-*/
-
-/*!
-\enum QGeoSearchManager::SearchType
-
-Describes the type of search that should be performed by search().
-
-\value SearchNone
- Do not use the search string.
-\value SearchGeocode
- Use the search string as a textual address in a geocoding operation.
-\value SearchLandmarks
- Use the search string for free-text search against the available landmark
- information sources.
-\value SearchAll
- All available information sources should be used as part of the search.
*/
/*!
@@ -242,8 +158,8 @@ int QGeoSearchManager::managerVersion() const
If supportsGeocoding() returns false an
QGeoSearchReply::UnsupportedOptionError will occur.
- Once the operation has completed, QGeoSearchReply::places() can be used to
- retrieve the results, which will consist of a list of QGeoPlace objects.
+ Once the operation has completed, QGeoSearchReply::locations() can be used to
+ retrieve the results, which will consist of a list of QGeoLocation objects.
These object represent a combination of coordinate and address data.
The address data returned in the results may be different from \a address.
@@ -282,8 +198,8 @@ QGeoSearchReply* QGeoSearchManager::geocode(const QGeoAddress &address, QGeoBoun
If supportsReverseGeocoding() returns false an
QGeoSearchReply::UnsupportedOptionError will occur.
- At that point QGeoSearchReply::places() can be used to retrieve the
- results, which will consist of a list of QGeoPlace objects. These object
+ At that point QGeoSearchReply::locations() can be used to retrieve the
+ results, which will consist of a list of QGeoLocation objects. These object
represent a combination of coordinate and address data.
The coordinate data returned in the results may be different from \a
@@ -314,7 +230,7 @@ QGeoSearchReply* QGeoSearchManager::reverseGeocode(const QGeoCoordinate &coordin
}
/*!
- Begins searching for a place matching \a searchString. The value of
+ Begins searching for a location matching \a searchString. The value of
\a searchTypes will determine whether the search is for addresses only,
for landmarks only or for both.
@@ -328,24 +244,10 @@ QGeoSearchReply* QGeoSearchManager::reverseGeocode(const QGeoCoordinate &coordin
QGeoSearchManager::SearchGeocode an
QGeoSearchReply::UnsupportedOptionError will occur.
- Once the operation has completed, QGeoSearchReply::places() can be used to
- retrieve the results, which will consist of a list of QGeoPlace objects.
+ Once the operation has completed, QGeoSearchReply::locations() can be used to
+ retrieve the results, which will consist of a list of QGeoLocation objects.
These object represent a combination of coordinate and address data.
- If any of the QGeoPlace instances in the results have landmark associated
- data, QGeoPlace::isLandmark() will return true and
- QLandmark::QLandmark(const QGeoPlace &place) can be used to convert the
- QGeoPlace instance into a QLandmark instance.
-
- If \a searchTypes is QGeoSearchManager::SearchLandmarks or
- QGeoSearchManager::SearchAll, a free text landmark search will be
- performed. The results will be a combination of the backend specific
- landmark search and the same free text search applied to each of the
- QLandmarkManager instances in additionalLandmarkManagers().
-
- \note At present the additional landmark managers only search for the
- search string in the name of the landmarks.
-
If \a limit is -1 the entire result set will be returned, otherwise at most
\a limit results will be returned.
@@ -354,11 +256,6 @@ QGeoSearchReply* QGeoSearchManager::reverseGeocode(const QGeoCoordinate &coordin
The \a limit and \a offset results are used together to implement paging.
- If additional landmark managers have been setup the number of results
- returned will be at most (1 + number of additional landmark managers) *
- \a limit. This happens because the results are requested from all sources, combined, and returned once
- all sources have responded.
-
If \a bounds is non-null and a valid QGeoBoundingArea it will be used to
limit the results to thos that are contained within \a bounds.
diff --git a/src/location/maps/qgeosearchmanagerengine.cpp b/src/location/maps/qgeosearchmanagerengine.cpp
index c5ad5557..93327901 100644
--- a/src/location/maps/qgeosearchmanagerengine.cpp
+++ b/src/location/maps/qgeosearchmanagerengine.cpp
@@ -72,19 +72,6 @@ QTM_BEGIN_NAMESPACE
setSupportsReverseGeocoding(true) at some point in time before
reverseGeoocode() is called.
- The search() function will make use of the QLandmarkManager instances
- returned by additionalLandmarkManagers(). If a QLandmarkManager is used
- internally to query the service providers landmark data the
- QLandmarkManager can be made available to the users with
- setDefaultLandmarkManager().
-
- The subclass should call setSupportedSearchTypes() at some point in time
- before search() is called.
-
- If the service supports searching for places the subclass should provide
- an implementetation of search() and call setSupportedSearchTypes() at
- some point in time before search() is called.
-
A subclass of QGeoSearchManagerEngine will often make use of a subclass
fo QGeoSearchReply internally, in order to add any engine-specific
data (such as a QNetworkReply object for network-based services) to the
@@ -171,8 +158,8 @@ int QGeoSearchManagerEngine::managerVersion() const
If supportsGeocoding() returns false an
QGeoSearchReply::UnsupportedOptionError will occur.
- Once the operation has completed, QGeoSearchReply::places() can be used to
- retrieve the results, which will consist of a list of QGeoPlace objects.
+ Once the operation has completed, QGeoSearchReply::locations() can be used to
+ retrieve the results, which will consist of a list of QGeoLocation objects.
These object represent a combination of coordinate and address data.
The address data returned in the results may be different from \a address.
@@ -211,8 +198,8 @@ QGeoSearchReply* QGeoSearchManagerEngine::geocode(const QGeoAddress &address,
If supportsReverseGeocoding() returns false an
QGeoSearchReply::UnsupportedOptionError will occur.
- At that point QGeoSearchReply::places() can be used to retrieve the
- results, which will consist of a list of QGeoPlace objects. These object
+ At that point QGeoSearchReply::locations() can be used to retrieve the
+ results, which will consist of a list of QGeoLocation objects. These object
represent a combination of coordinate and address data.
The coordinate data returned in the results may be different from \a
@@ -244,9 +231,7 @@ QGeoSearchReply* QGeoSearchManagerEngine::reverseGeocode(const QGeoCoordinate &c
}
/*!
- Begins searching for a place matching \a searchString. The value of
- \a searchTypes will determine whether the search is for addresses only,
- for landmarks only or for both.
+ Begins searching for a location matching \a searchString.
A QGeoSearchReply object will be returned, which can be used to manage the
geocoding operation and to return the results of the operation.
@@ -254,28 +239,10 @@ QGeoSearchReply* QGeoSearchManagerEngine::reverseGeocode(const QGeoCoordinate &c
This engine and the returned QGeoSearchReply object will emit signals
indicating if the operation completes or if errors occur.
- If supportsGeocoding() returns false and \a searchTypes is
- QGeoSearchManagerEngine::SearchGeocode an
- QGeoSearchReply::UnsupportedOptionError will occur.
-
- Once the operation has completed, QGeoSearchReply::places() can be used to
- retrieve the results, which will consist of a list of QGeoPlace objects.
+ Once the operation has completed, QGeoSearchReply::locations() can be used to
+ retrieve the results, which will consist of a list of QGeoLocation objects.
These object represent a combination of coordinate and address data.
- If any of the QGeoPlace instances in the results have landmark associated
- data, QGeoPlace::isLandmark() will return true and
- QLandmark::QLandmark(const QGeoPlace &place) can be used to convert the
- QGeoPlace instance into a QLandmark instance.
-
- If \a searchTypes is QGeoSearchManagerEngine::SearchLandmarks or
- QGeoSearchManagerEngine::SearchAll, a free text landmark search will be
- performed. The results will be a combination of the backend specific
- landmark search and the same free text search applied to each of the
- QLandmarkManager instances in additionalLandmarkManagers().
-
- \note At present the additional landmark managers only search for the
- search string in the name of the landmarks.
-
If \a limit is -1 the entire result set will be returned, otherwise at most
\a limit results will be returned.
@@ -284,12 +251,6 @@ QGeoSearchReply* QGeoSearchManagerEngine::reverseGeocode(const QGeoCoordinate &c
The \a limit and \a offset results are used together to implement paging.
- If additional landmark managers have been setup the number of results
- returned will be at most (1 + number of additional landmark managers) *
- \a limit. This happens because the results are requested from all sources, combined, and returned once
- all sources have responded.
-
-
If \a bounds is non-null and a valid QGeoBoundingArea it will be used to
limit the results to those that are contained by \a bounds.
diff --git a/src/location/maps/qgeosearchreply.cpp b/src/location/maps/qgeosearchreply.cpp
index 371123b1..c2f5146b 100644
--- a/src/location/maps/qgeosearchreply.cpp
+++ b/src/location/maps/qgeosearchreply.cpp
@@ -73,7 +73,7 @@ QTM_BEGIN_NAMESPACE
this might be carried out.
If the operation completes successfully the results will be able to be
- accessed with places().
+ accessed with locations().
*/
/*!
@@ -126,7 +126,7 @@ QGeoSearchReply::~QGeoSearchReply()
If \a finished is true, this will cause the finished() signal to be
emitted.
- If the operation completed successfully, QGeoSearchReply::setPlaces()
+ If the operation completed successfully, QGeoSearchReply::setLocations()
should be called before this function. If an error occurred,
QGeoSearchReply::setError() should be used instead.
*/
@@ -206,30 +206,30 @@ QGeoBoundingArea* QGeoSearchReply::viewport() const
}
/*!
- Returns a list of places.
+ Returns a list of locations.
- The places are the results of the operation corresponding to the
+ The locations are the results of the operation corresponding to the
QGeoSearchManager function which created this reply.
*/
-QList<QGeoPlace> QGeoSearchReply::places() const
+QList<QGeoLocation> QGeoSearchReply::locations() const
{
- return d_ptr->places;
+ return d_ptr->locations;
}
/*!
- Adds \a place to the list of places in this reply.
+ Adds \a location to the list of locations in this reply.
*/
-void QGeoSearchReply::addPlace(const QGeoPlace &place)
+void QGeoSearchReply::addLocation(const QGeoLocation &location)
{
- d_ptr->places.append(place);
+ d_ptr->locations.append(location);
}
/*!
- Sets the list of \a places in the reply.
+ Sets the list of \a locations in the reply.
*/
-void QGeoSearchReply::setPlaces(const QList<QGeoPlace> &places)
+void QGeoSearchReply::setLocations(const QList<QGeoLocation> &locations)
{
- d_ptr->places = places;
+ d_ptr->locations = locations;
}
/*!
@@ -248,7 +248,7 @@ void QGeoSearchReply::abort()
If no limit was set this function will return -1.
- This may be more than places().length() if the number of responses
+ This may be more than locations().length() if the number of responses
was less than the number requested.
If QGeoSearchManager::search() is used along with
diff --git a/src/location/maps/qgeosearchreply.h b/src/location/maps/qgeosearchreply.h
index 0bf53864..536f6a4c 100644
--- a/src/location/maps/qgeosearchreply.h
+++ b/src/location/maps/qgeosearchreply.h
@@ -42,7 +42,7 @@
#ifndef QGEOSEARCHREPLY_H
#define QGEOSEARCHREPLY_H
-#include "qgeoplace.h"
+#include "qgeolocation.h"
#include <QObject>
#include <QList>
@@ -74,7 +74,7 @@ public:
QString errorString() const;
QGeoBoundingArea* viewport() const;
- QList<QGeoPlace> places() const;
+ QList<QGeoLocation>locations() const;
int limit() const;
int offset() const;
@@ -92,8 +92,8 @@ protected:
void setFinished(bool finished);
void setViewport(QGeoBoundingArea *viewport);
- void addPlace(const QGeoPlace &place);
- void setPlaces(const QList<QGeoPlace> &places);
+ void addLocation(const QGeoLocation &location);
+ void setLocations(const QList<QGeoLocation> &locations);
void setLimit(int limit);
void setOffset(int offset);
diff --git a/src/location/maps/qgeosearchreply_p.h b/src/location/maps/qgeosearchreply_p.h
index 50bf9d6d..fc2072fe 100644
--- a/src/location/maps/qgeosearchreply_p.h
+++ b/src/location/maps/qgeosearchreply_p.h
@@ -61,7 +61,7 @@
QTM_BEGIN_NAMESPACE
-class QGeoPlace;
+class QGeoLocation;
class QGeoSearchReplyPrivate
{
@@ -75,7 +75,7 @@ public:
bool isFinished;
QGeoBoundingArea* viewport;
- QList<QGeoPlace> places;
+ QList<QGeoLocation> locations;
int limit;
int offset;
diff --git a/src/location/maps/qgeoserviceproviderfactory.cpp b/src/location/maps/qgeoserviceproviderfactory.cpp
index 83827517..a2e7f03b 100644
--- a/src/location/maps/qgeoserviceproviderfactory.cpp
+++ b/src/location/maps/qgeoserviceproviderfactory.cpp
@@ -89,8 +89,7 @@ amongst the plugins.
/*!
Returns a new QGeoSearchManagerEngine instance, initialized with \a
- parameters, which implements as much of the places searching functionality
- as the service provider supports.
+ parameters, which implements the location searching functionality.
If \a error is not 0 it should be set to QGeoServiceProvider::NoError on
success or an appropriate QGeoServiceProvider::Error on failure.
@@ -114,8 +113,7 @@ QGeoSearchManagerEngine* QGeoServiceProviderFactory::createSearchManagerEngine(c
/*!
Returns a new QGeoMappingManagerEngine instance, initialized with \a
- parameters, which implements as much of the places searching functionality
- as the service provider supports.
+ parameters, which implements the location searching functionality.
If \a error is not 0 it should be set to QGeoServiceProvider::NoError on
success or an appropriate QGeoServiceProvider::Error on failure.
@@ -139,8 +137,7 @@ QGeoMappingManagerEngine* QGeoServiceProviderFactory::createMappingManagerEngine
/*!
Returns a new QGeoRoutingManagerEngine instance, initialized with \a
- parameters, which implements as much of the places searching functionality
- as the service provider supports.
+ parameters, which implements the location searching functionality.
If \a error is not 0 it should be set to QGeoServiceProvider::NoError on
success or an appropriate QGeoServiceProvider::Error on failure.
diff --git a/src/location/places/places.pri b/src/location/places/places.pri
index e6269add..20088fc4 100644
--- a/src/location/places/places.pri
+++ b/src/location/places/places.pri
@@ -9,7 +9,6 @@ PUBLIC_HEADERS += \
places/qplacecategory.h \
places/qplacecontact.h \
places/qplacedescription.h \
- places/qplacelocation.h \
places/qplacemediaobject.h \
places/qplacepaginationlist.h \
places/qplaceperiod.h \
@@ -41,7 +40,6 @@ PRIVATE_HEADERS += \
places/qplacecategory_p.h \
places/qplacecontact_p.h \
places/qplacedescription_p.h \
- places/qplacelocation_p.h \
places/qplacemediaobject_p.h \
places/qplaceperiod_p.h \
places/qplacerating_p.h \
@@ -60,7 +58,6 @@ SOURCES += \
places/qplacecategory.cpp \
places/qplacecontact.cpp \
places/qplacedescription.cpp \
- places/qplacelocation.cpp \
places/qplacemediaobject.cpp \
places/qplaceperiod.cpp \
places/qplacerating.cpp \
diff --git a/src/location/places/qplacelocation.cpp b/src/location/qgeolocation.cpp
index b526afa3..1bab1192 100644
--- a/src/location/places/qplacelocation.cpp
+++ b/src/location/qgeolocation.cpp
@@ -39,79 +39,78 @@
**
****************************************************************************/
-#include "qplacelocation.h"
-#include "qplacelocation_p.h"
+#include "qgeolocation.h"
+#include "qgeolocation_p.h"
QTM_USE_NAMESPACE
-QPlaceLocationPrivate::QPlaceLocationPrivate()
+QGeoLocationPrivate::QGeoLocationPrivate()
: QSharedData(),
locationScore(0)
{
}
-QPlaceLocationPrivate::QPlaceLocationPrivate(const QPlaceLocationPrivate &other)
+QGeoLocationPrivate::QGeoLocationPrivate(const QGeoLocationPrivate &other)
: QSharedData()
{
this->additionalData = other.additionalData;
this->address = other.address;
this->alternativeLabels = other.alternativeLabels;
- this->displayPosition = other.displayPosition;
+ this->coordinate = other.coordinate;
this->navigationPositions = other.navigationPositions;
this->label = other.label;
this->locationId = other.locationId;
this->locationScore = other.locationScore;
- this->mapView = other.mapView;
+ this->viewport = other.viewport;
}
-QPlaceLocationPrivate::~QPlaceLocationPrivate()
+QGeoLocationPrivate::~QGeoLocationPrivate()
{
}
-bool QPlaceLocationPrivate::operator==(const QPlaceLocationPrivate &other) const
+bool QGeoLocationPrivate::operator==(const QGeoLocationPrivate &other) const
{
- return (
- this->additionalData == other.additionalData
+ return (this->additionalData == other.additionalData
&& this->address == other.address
&& this->alternativeLabels == other.alternativeLabels
- && this->displayPosition == other.displayPosition
+ && this->coordinate == other.coordinate
&& this->navigationPositions == other.navigationPositions
&& this->label == other.label
&& this->locationId == other.locationId
&& this->locationScore == other.locationScore
- && this->mapView == other.mapView
- );
+ && this->viewport == other.viewport);
+
}
/*!
- \class QPlaceLocation
+ \class QGeoLocation
\inmodule QPlaces
- \brief The QPlaceLocation class represents a location object.
+ \brief The QGeoLocation class represents a location object.
- Each QPlaceLocation represents a location object with a number of attributes
- such as label, display position etc. Each QPlaceLocation is associated with place.
+ Each QGeoLocation represents a location object with a number of attributes
+ such as label, display position etc. Each QGeoLocation is associated with place.
Location objects are read-only, e.g. user of API might get location object
associated to specific place but can not edit its content. User might also create new
location object and add it to place.
- QPlaceLocation is an in memory representation of a location object.
+ QGeoLocation is an in memory representation of a location object.
*/
/*!
Default constructor. Constructs an new location object.
*/
-QPlaceLocation::QPlaceLocation()
- : d(new QPlaceLocationPrivate)
+QGeoLocation::QGeoLocation()
+ : d(new QGeoLocationPrivate)
{
}
/*!
Constructs a copy of \a other
*/
-QPlaceLocation::QPlaceLocation(const QPlaceLocation &other)
+QGeoLocation::QGeoLocation(const QGeoLocation &other)
:d(other.d)
{
}
@@ -119,16 +118,16 @@ QPlaceLocation::QPlaceLocation(const QPlaceLocation &other)
/*!
Destructor.
*/
-QPlaceLocation::~QPlaceLocation()
+QGeoLocation::~QGeoLocation()
{
}
-QPlaceLocation &QPlaceLocation::operator =(const QPlaceLocation &other) {
+QGeoLocation &QGeoLocation::operator =(const QGeoLocation &other) {
d = other.d;
return *this;
}
-bool QPlaceLocation::operator==(const QPlaceLocation &other) const
+bool QGeoLocation::operator==(const QGeoLocation &other) const
{
return (*(d.constData()) == *(other.d.constData()));
}
@@ -136,7 +135,7 @@ bool QPlaceLocation::operator==(const QPlaceLocation &other) const
/*!
Returns additional data.
*/
-QVariantHash QPlaceLocation::additionalData() const
+QVariantHash QGeoLocation::additionalData() const
{
return d->additionalData;
}
@@ -144,7 +143,7 @@ QVariantHash QPlaceLocation::additionalData() const
/*!
Sets additional data.
*/
-void QPlaceLocation::setAdditionalData(const QVariantHash &data)
+void QGeoLocation::setAdditionalData(const QVariantHash &data)
{
d->additionalData = data;
}
@@ -152,7 +151,7 @@ void QPlaceLocation::setAdditionalData(const QVariantHash &data)
/*!
Returns address.
*/
-QGeoAddress QPlaceLocation::address() const
+QGeoAddress QGeoLocation::address() const
{
return d->address;
}
@@ -160,7 +159,7 @@ QGeoAddress QPlaceLocation::address() const
/*!
Sets address.
*/
-void QPlaceLocation::setAddress(const QGeoAddress &address)
+void QGeoLocation::setAddress(const QGeoAddress &address)
{
d->address = address;
}
@@ -168,7 +167,7 @@ void QPlaceLocation::setAddress(const QGeoAddress &address)
/*!
Returns alternative labels.
*/
-QList<QPlaceAlternativeValue> QPlaceLocation::alternativeLabels() const
+QList<QPlaceAlternativeValue> QGeoLocation::alternativeLabels() const
{
return d->alternativeLabels;
}
@@ -176,31 +175,31 @@ QList<QPlaceAlternativeValue> QPlaceLocation::alternativeLabels() const
/*!
Sets alternative labels.
*/
-void QPlaceLocation::setAlternativeLabels(const QList<QPlaceAlternativeValue> &labels)
+void QGeoLocation::setAlternativeLabels(const QList<QPlaceAlternativeValue> &labels)
{
d->alternativeLabels = labels;
}
/*!
- Returns display position.
+ Returns the location's coordinate.
*/
-QGeoCoordinate QPlaceLocation::displayPosition() const
+QGeoCoordinate QGeoLocation::coordinate() const
{
- return d->displayPosition;
+ return d->coordinate;
}
/*!
- Sets display position.
+ Sets the location's \a coordinate.
*/
-void QPlaceLocation::setDisplayPosition(const QGeoCoordinate &position)
+void QGeoLocation::setCoordinate(const QGeoCoordinate &coordinate)
{
- d->displayPosition = position;
+ d->coordinate = coordinate;
}
/*!
Returns navigation positions.
*/
-QList<QGeoCoordinate> QPlaceLocation::navigationPositions() const
+QList<QGeoCoordinate> QGeoLocation::navigationPositions() const
{
return d->navigationPositions;
}
@@ -208,7 +207,7 @@ QList<QGeoCoordinate> QPlaceLocation::navigationPositions() const
/*!
Sets navigation positions.
*/
-void QPlaceLocation::setNavigationPositions(const QList<QGeoCoordinate> &positions)
+void QGeoLocation::setNavigationPositions(const QList<QGeoCoordinate> &positions)
{
d->navigationPositions = positions;
}
@@ -216,7 +215,7 @@ void QPlaceLocation::setNavigationPositions(const QList<QGeoCoordinate> &positio
/*!
Returns label.
*/
-QString QPlaceLocation::label() const
+QString QGeoLocation::label() const
{
return d->label;
}
@@ -224,7 +223,7 @@ QString QPlaceLocation::label() const
/*!
Sets label.
*/
-void QPlaceLocation::setLabel(const QString &label)
+void QGeoLocation::setLabel(const QString &label)
{
d->label = label;
}
@@ -232,7 +231,7 @@ void QPlaceLocation::setLabel(const QString &label)
/*!
Returns location id.
*/
-QString QPlaceLocation::locationId() const
+QString QGeoLocation::locationId() const
{
return d->locationId;
}
@@ -240,7 +239,7 @@ QString QPlaceLocation::locationId() const
/*!
Sets location id.
*/
-void QPlaceLocation::setLocationId(const QString &locationId)
+void QGeoLocation::setLocationId(const QString &locationId)
{
d->locationId = locationId;
}
@@ -248,7 +247,7 @@ void QPlaceLocation::setLocationId(const QString &locationId)
/*!
Returns location score.
*/
-int QPlaceLocation::locationScore() const
+qreal QGeoLocation::locationScore() const
{
return d->locationScore;
}
@@ -256,7 +255,7 @@ int QPlaceLocation::locationScore() const
/*!
Sets location score.
*/
-void QPlaceLocation::setLocationScore(const int &score)
+void QGeoLocation::setLocationScore(const qreal &score)
{
d->locationScore = score;
}
@@ -264,15 +263,15 @@ void QPlaceLocation::setLocationScore(const int &score)
/*!
Returns view port.
*/
-QGeoBoundingBox QPlaceLocation::mapView() const
+QGeoBoundingBox QGeoLocation::viewport() const
{
- return d->mapView;
+ return d->viewport;
}
/*!
Sets view port.
*/
-void QPlaceLocation::setMapView(const QGeoBoundingBox &coordinate)
+void QGeoLocation::setViewport(const QGeoBoundingBox &viewport)
{
- d->mapView = coordinate;
+ d->viewport = viewport;
}
diff --git a/src/location/places/qplacelocation.h b/src/location/qgeolocation.h
index 53b500cc..141da311 100644
--- a/src/location/places/qplacelocation.h
+++ b/src/location/qgeolocation.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QPLACELOCATION_H
-#define QPLACELOCATION_H
+#ifndef QGEOLOCATION_H
+#define QGEOLOCATION_H
#include <QSharedDataPointer>
#include <QString>
@@ -54,20 +54,20 @@
QTM_BEGIN_NAMESPACE
-class QPlaceLocationPrivate;
+class QGeoLocationPrivate;
-class Q_LOCATION_EXPORT QPlaceLocation
+class Q_LOCATION_EXPORT QGeoLocation
{
public:
- QPlaceLocation();
- QPlaceLocation(const QPlaceLocation &other);
+ QGeoLocation();
+ QGeoLocation(const QGeoLocation &other);
- virtual ~QPlaceLocation();
+ virtual ~QGeoLocation();
- QPlaceLocation &operator=(const QPlaceLocation &other);
+ QGeoLocation &operator=(const QGeoLocation &other);
- bool operator==(const QPlaceLocation &other) const;
- bool operator!=(const QPlaceLocation &other) const {
+ bool operator==(const QGeoLocation &other) const;
+ bool operator!=(const QGeoLocation &other) const {
return !(other == *this);
}
@@ -77,23 +77,23 @@ public:
void setAddress(const QGeoAddress &address);
QList<QPlaceAlternativeValue> alternativeLabels() const;
void setAlternativeLabels(const QList<QPlaceAlternativeValue> &labels);
- QGeoCoordinate displayPosition() const;
- void setDisplayPosition(const QGeoCoordinate &position);
+ QGeoCoordinate coordinate() const;
+ void setCoordinate(const QGeoCoordinate &position);
QList<QGeoCoordinate> navigationPositions() const;
void setNavigationPositions(const QList<QGeoCoordinate> &positions);
QString label() const;
void setLabel(const QString &label);
QString locationId() const;
void setLocationId(const QString &locationId);
- int locationScore() const;
- void setLocationScore(const int &score);
- QGeoBoundingBox mapView() const;
- void setMapView(const QGeoBoundingBox &coordinate);
+ qreal locationScore() const;
+ void setLocationScore(const qreal &score);
+ QGeoBoundingBox viewport() const;
+ void setViewport(const QGeoBoundingBox &coordinate);
private:
- QSharedDataPointer<QPlaceLocationPrivate> d;
+ QSharedDataPointer<QGeoLocationPrivate> d;
};
QTM_END_NAMESPACE
-#endif // QPLACELOCATION_H
+#endif
diff --git a/src/location/places/qplacelocation_p.h b/src/location/qgeolocation_p.h
index 3f2e5d8c..120f1600 100644
--- a/src/location/places/qplacelocation_p.h
+++ b/src/location/qgeolocation_p.h
@@ -39,36 +39,36 @@
**
****************************************************************************/
-#ifndef QPLACELOCATION_P_H
-#define QPLACELOCATION_P_H
+#ifndef QGEOLOCATION_P_H
+#define QGEOLOCATION_P_H
#include <QSharedData>
-#include "qplacelocation.h"
+#include "qgeolocation.h"
QTM_BEGIN_NAMESPACE
-class QPlaceLocationPrivate : public QSharedData
+class QGeoLocationPrivate : public QSharedData
{
public:
- QPlaceLocationPrivate();
- QPlaceLocationPrivate(const QPlaceLocationPrivate &other);
+ QGeoLocationPrivate();
+ QGeoLocationPrivate(const QGeoLocationPrivate &other);
- ~QPlaceLocationPrivate();
+ ~QGeoLocationPrivate();
- bool operator==(const QPlaceLocationPrivate &other) const;
+ bool operator==(const QGeoLocationPrivate &other) const;
QVariantHash additionalData;
QGeoAddress address;
QList<QPlaceAlternativeValue> alternativeLabels;
- QGeoCoordinate displayPosition;
+ QGeoCoordinate coordinate;
QList<QGeoCoordinate> navigationPositions;
QString label;
QString locationId;
- int locationScore;
- QGeoBoundingBox mapView;
+ qreal locationScore;
+ QGeoBoundingBox viewport;
};
QTM_END_NAMESPACE
-#endif // QPLACELOCATION_P_H
+#endif
diff --git a/src/location/qgeoplace.cpp b/src/location/qgeoplace.cpp
index 5d926b2a..7fbd01ee 100644
--- a/src/location/qgeoplace.cpp
+++ b/src/location/qgeoplace.cpp
@@ -352,7 +352,7 @@ void QGeoPlace::setDescriptions(const QList<QPlaceDescription> &descriptions)
/*!
Returns location.
*/
-QPlaceLocation QGeoPlace::location() const
+QGeoLocation QGeoPlace::location() const
{
Q_D(const QGeoPlace);
return d->location;
@@ -361,7 +361,7 @@ QPlaceLocation QGeoPlace::location() const
/*!
Sets location.
*/
-void QGeoPlace::setLocation(const QPlaceLocation &location)
+void QGeoPlace::setLocation(const QGeoLocation &location)
{
Q_D(QGeoPlace);
d->location = location;
@@ -370,7 +370,7 @@ void QGeoPlace::setLocation(const QPlaceLocation &location)
/*!
Returns alternative locations.
*/
-QList<QPlaceLocation> QGeoPlace::alternativeLocations() const
+QList<QGeoLocation> QGeoPlace::alternativeLocations() const
{
Q_D(const QGeoPlace);
return d->alternativeLocations;
@@ -379,7 +379,7 @@ QList<QPlaceLocation> QGeoPlace::alternativeLocations() const
/*!
Sets alternative locations.
*/
-void QGeoPlace::setAlternativeLocations(const QList<QPlaceLocation> &locations)
+void QGeoPlace::setAlternativeLocations(const QList<QGeoLocation> &locations)
{
Q_D(QGeoPlace);
d->alternativeLocations = locations;
diff --git a/src/location/qgeoplace.h b/src/location/qgeoplace.h
index 655fcbbd..ad0d02dc 100644
--- a/src/location/qgeoplace.h
+++ b/src/location/qgeoplace.h
@@ -49,12 +49,12 @@
#include "qgeoaddress.h"
#include "qgeoboundingbox.h"
#include "qgeocoordinate.h"
+#include "qgeolocation.h"
#include "qplacealternativevalue.h"
#include "qplacebusinessinformation.h"
#include "qplacecategory.h"
#include "qplacecontact.h"
#include "qplacedescription.h"
-#include "qplacelocation.h"
#include "qplacerating.h"
#include "qplacepaginationlist.h"
#include "qplacemediaobject.h"
@@ -105,10 +105,10 @@ public:
void setContacts(const QList<QPlaceContact> &contacts);
QList<QPlaceDescription> descriptions() const;
void setDescriptions(const QList<QPlaceDescription> &descriptions);
- QPlaceLocation location() const;
- void setLocation(const QPlaceLocation &location);
- QList<QPlaceLocation> alternativeLocations() const;
- void setAlternativeLocations(const QList<QPlaceLocation> &locations);
+ QGeoLocation location() const;
+ void setLocation(const QGeoLocation &location);
+ QList<QGeoLocation> alternativeLocations() const;
+ void setAlternativeLocations(const QList<QGeoLocation> &locations);
QPlaceRating rating() const;
void setRating(const QPlaceRating &rating);
QList<QPlaceSupplier> suppliers() const;
diff --git a/src/location/qgeoplace_p.h b/src/location/qgeoplace_p.h
index 614a1eb7..1e3a7cd7 100644
--- a/src/location/qgeoplace_p.h
+++ b/src/location/qgeoplace_p.h
@@ -92,8 +92,8 @@ public:
QList<QPlaceCategory> categories;
QList<QPlaceContact> contacts;
QList<QPlaceDescription> descriptions;
- QPlaceLocation location;
- QList<QPlaceLocation> alternativeLocations;
+ QGeoLocation location;
+ QList<QGeoLocation> alternativeLocations;
QPlaceRating rating;
QList<QPlaceSupplier> suppliers;
QStringList feeds;
diff --git a/src/plugins/geoservices/nokia/qgeocodexmlparser.cpp b/src/plugins/geoservices/nokia/qgeocodexmlparser.cpp
index 900ee479..484d879f 100644
--- a/src/plugins/geoservices/nokia/qgeocodexmlparser.cpp
+++ b/src/plugins/geoservices/nokia/qgeocodexmlparser.cpp
@@ -78,7 +78,7 @@ bool QGeoCodeXmlParser::parse(QIODevice* source)
return true;
}
-QList<QGeoPlace> QGeoCodeXmlParser::results() const
+QList<QGeoLocation> QGeoCodeXmlParser::results() const
{
return m_results;
}
@@ -130,12 +130,12 @@ bool QGeoCodeXmlParser::parseRootElement()
while (m_reader->readNextStartElement()) {
if (m_reader->name() == "place") {
- QGeoPlace place;
+ QGeoLocation location;
- if (!parsePlace(&place))
+ if (!parsePlace(&location))
return false;
- m_results.append(place);
+ m_results.append(location);
} else {
m_reader->raiseError(QString("The element \"places\" did not expect a child element named \"%1\".").arg(m_reader->name().toString()));
return false;
@@ -158,7 +158,10 @@ bool QGeoCodeXmlParser::parseRootElement()
return true;
}
-bool QGeoCodeXmlParser::parsePlace(QGeoPlace *place)
+
+//Note: the term Place here is semi-confusing since
+// the xml 'place' is actually a location ie coord + address
+bool QGeoCodeXmlParser::parsePlace(QGeoLocation *location)
{
/*
<xsd:complexType name="Place">
@@ -209,7 +212,7 @@ bool QGeoCodeXmlParser::parsePlace(QGeoPlace *place)
return false;
}
- if (!parseLocation(place))
+ if (!parseLocation(location))
return false;
parsedLocation = true;
@@ -223,9 +226,9 @@ bool QGeoCodeXmlParser::parsePlace(QGeoPlace *place)
if (!parseAddress(&address))
return false;
else
- place->setAddress(address);
+ location->setAddress(address);
- place->setAddress(address);
+ location->setAddress(address);
parsedAddress = true;
} else if (name == "alternatives") {
@@ -254,7 +257,10 @@ bool QGeoCodeXmlParser::parsePlace(QGeoPlace *place)
return true;
}
-bool QGeoCodeXmlParser::parseLocation(QGeoPlace *place)
+//Note: the term Place here is semi-confusing since
+// the xml 'location' is actually a parital location i.e coord
+// as opposed to coord + address
+bool QGeoCodeXmlParser::parseLocation(QGeoLocation *location)
{
/*
<xsd:complexType name="Location">
@@ -289,7 +295,7 @@ bool QGeoCodeXmlParser::parseLocation(QGeoPlace *place)
if (!parseCoordinate(&coord, "position"))
return false;
- place->setCoordinate(coord);
+ location->setCoordinate(coord);
parsedPosition = true;
} else if (name == "boundingBox") {
@@ -303,7 +309,7 @@ bool QGeoCodeXmlParser::parseLocation(QGeoPlace *place)
if (!parseBoundingBox(&bounds))
return false;
- place->setViewport(bounds);
+ location->setViewport(bounds);
parsedBounds = true;
} else {
diff --git a/src/plugins/geoservices/nokia/qgeocodexmlparser.h b/src/plugins/geoservices/nokia/qgeocodexmlparser.h
index c866d93f..a8946d9b 100644
--- a/src/plugins/geoservices/nokia/qgeocodexmlparser.h
+++ b/src/plugins/geoservices/nokia/qgeocodexmlparser.h
@@ -57,7 +57,7 @@ class QIODevice;
#include <qgeocoordinate.h>
#include <qgeoboundingbox.h>
-#include <qgeoplace.h>
+#include <qgeolocation.h>
#include <qgeoaddress.h>
QTM_USE_NAMESPACE
@@ -70,20 +70,20 @@ public:
bool parse(QIODevice* source);
- QList<QGeoPlace> results() const;
+ QList<QGeoLocation> results() const;
QString errorString() const;
private:
bool parseRootElement();
- bool parsePlace(QGeoPlace *place);
- bool parseLocation(QGeoPlace *place);
+ bool parsePlace(QGeoLocation *location);
+ bool parseLocation(QGeoLocation *location);
bool parseAddress(QGeoAddress *address);
bool parseBoundingBox(QGeoBoundingBox *bounds);
bool parseCoordinate(QGeoCoordinate *coordinate, const QString &elementName);
QXmlStreamReader *m_reader;
- QList<QGeoPlace> m_results;
+ QList<QGeoLocation> m_results;
QString m_errorString;
};
diff --git a/src/plugins/geoservices/nokia/qgeosearchreply_nokia.cpp b/src/plugins/geoservices/nokia/qgeosearchreply_nokia.cpp
index fd43c5bc..10a3c2e8 100644
--- a/src/plugins/geoservices/nokia/qgeosearchreply_nokia.cpp
+++ b/src/plugins/geoservices/nokia/qgeosearchreply_nokia.cpp
@@ -99,15 +99,15 @@ void QGeoSearchReplyNokia::networkFinished()
QGeoCodeXmlParser parser;
if (parser.parse(m_reply)) {
- QList<QGeoPlace> places = parser.results();
+ QList<QGeoLocation> locations = parser.results();
QGeoBoundingArea *bounds = viewport();
if (bounds) {
- for (int i = places.size() - 1; i >= 0; --i) {
- if (!bounds->contains(places[i].coordinate()))
- places.removeAt(i);
+ for (int i = locations.size() - 1; i >= 0; --i) {
+ if (!bounds->contains(locations[i].coordinate()))
+ locations.removeAt(i);
}
}
- setPlaces(places);
+ setLocations(locations);
setFinished(true);
} else {
setError(QGeoSearchReply::ParseError, parser.errorString());
diff --git a/src/plugins/places/nokia/qplacejsondetailsparser.cpp b/src/plugins/places/nokia/qplacejsondetailsparser.cpp
index b1415bb9..daa1cb0a 100644
--- a/src/plugins/places/nokia/qplacejsondetailsparser.cpp
+++ b/src/plugins/places/nokia/qplacejsondetailsparser.cpp
@@ -60,7 +60,7 @@
#include <qplacedescription.h>
#include <qplacerating.h>
#include <qplacebusinessinformation.h>
-#include <qplacelocation.h>
+#include <qgeolocation.h>
#include <qplacealternativevalue.h>
#include <qplacemediaobject.h>
#include <qplaceperiod.h>
@@ -372,7 +372,7 @@ QPlaceRating *QPlaceJSonDetailsParser::processRating(const QScriptValue &ratingE
return rating;
}
-void QPlaceJSonDetailsParser::processAddress(const QScriptValue &address, QPlaceLocation *location)
+void QPlaceJSonDetailsParser::processAddress(const QScriptValue &address, QGeoLocation *location)
{
QGeoAddress newAddress;
QScriptValue value = address.property(place_address_street);
@@ -417,14 +417,14 @@ void QPlaceJSonDetailsParser::processAddress(const QScriptValue &address, QPlace
void QPlaceJSonDetailsParser::processLocations(const QScriptValue &locations, QGeoPlace*targetPlace)
{
if (locations.isArray()) {
- QList<QPlaceLocation> list;
+ QList<QGeoLocation> list;
bool isFirst = true;
QScriptValueIterator it(locations);
while (it.hasNext()) {
it.next();
// array contains count as last element
if (it.name() != "length") {
- QPlaceLocation loc = processLocation(it.value());
+ QGeoLocation loc = processLocation(it.value());
if (isFirst) {
targetPlace->setLocation(loc);
isFirst = false;
@@ -435,14 +435,14 @@ void QPlaceJSonDetailsParser::processLocations(const QScriptValue &locations, QG
}
targetPlace->setAlternativeLocations(list);
} else {
- QPlaceLocation loc = processLocation(locations);
+ QGeoLocation loc = processLocation(locations);
targetPlace->setLocation(loc);
}
}
-QPlaceLocation QPlaceJSonDetailsParser::processLocation(const QScriptValue &location)
+QGeoLocation QPlaceJSonDetailsParser::processLocation(const QScriptValue &location)
{
- QPlaceLocation newLocation;
+ QGeoLocation newLocation;
QScriptValue property = location.property(place_geoCoordinates_element);
if (property.isValid()) {
QGeoCoordinate pos;
@@ -462,7 +462,7 @@ QPlaceLocation QPlaceJSonDetailsParser::processLocation(const QScriptValue &loca
pos.setLatitude(latitude);
}
}
- newLocation.setDisplayPosition(pos);
+ newLocation.setCoordinate(pos);
}
property = location.property(place_address_element);
if (property.isValid()) {
diff --git a/src/plugins/places/nokia/qplacejsondetailsparser.h b/src/plugins/places/nokia/qplacejsondetailsparser.h
index 7f1ad467..4c2e7fb9 100644
--- a/src/plugins/places/nokia/qplacejsondetailsparser.h
+++ b/src/plugins/places/nokia/qplacejsondetailsparser.h
@@ -79,9 +79,9 @@ private:
static QPlaceCategory processCategory(const QScriptValue &category);
static void processRatings(const QScriptValue &ratings, QGeoPlace *targetPlace);
static QPlaceRating *processRating(const QScriptValue &rating);
- static void processAddress(const QScriptValue &address, QPlaceLocation *location);
+ static void processAddress(const QScriptValue &address, QGeoLocation *location);
static void processLocations(const QScriptValue &locations, QGeoPlace *targetPlace);
- static QPlaceLocation processLocation(const QScriptValue &location);
+ static QGeoLocation processLocation(const QScriptValue &location);
static void processTags(const QScriptValue &locations, QGeoPlace *targetPlace);
static void processNames(const QScriptValue &locations, QGeoPlace *targetPlace);
static QPlaceAlternativeValue *processName(const QScriptValue &nameValue);
diff --git a/src/plugins/places/nokia/qplacejsonsearchparser.cpp b/src/plugins/places/nokia/qplacejsonsearchparser.cpp
index 3b210390..4064ea1a 100644
--- a/src/plugins/places/nokia/qplacejsonsearchparser.cpp
+++ b/src/plugins/places/nokia/qplacejsonsearchparser.cpp
@@ -54,9 +54,9 @@
#include <qgeocoordinate.h>
#include <qgeoaddress.h>
+#include <qgeolocation.h>
#include <qgeoplace.h>
#include <qplacecontact.h>
-#include <qplacelocation.h>
#include <qplacerating.h>
#include <qplacecategory.h>
#include <qplacesupplier.h>
@@ -281,7 +281,7 @@ void QPlaceJSonSearchParser::processRating(const QScriptValue &properties, QGeoP
}
}
-void QPlaceJSonSearchParser::processAddress(const QScriptValue &properties, QPlaceLocation *location)
+void QPlaceJSonSearchParser::processAddress(const QScriptValue &properties, QGeoLocation *location)
{
QGeoAddress newAddress;
QScriptValue value = properties.property(search_properties_address_country);
@@ -327,7 +327,7 @@ void QPlaceJSonSearchParser::processAddress(const QScriptValue &properties, QPla
void QPlaceJSonSearchParser::processLocation(const QScriptValue &properties, QGeoPlace *place)
{
- QPlaceLocation location;
+ QGeoLocation location;
bool latOK(false);
bool lonOK(false);
@@ -347,7 +347,7 @@ void QPlaceJSonSearchParser::processLocation(const QScriptValue &properties, QGe
QGeoCoordinate pos;
pos.setLatitude(latitude);
pos.setLongitude(longitude);
- location.setDisplayPosition(pos);
+ location.setCoordinate(pos);
}
// bounding box
@@ -387,7 +387,7 @@ void QPlaceJSonSearchParser::processLocation(const QScriptValue &properties, QGe
QGeoBoundingBox boundingBox;
boundingBox.setTopLeft(topLeft);
boundingBox.setBottomRight(bottomRight);
- location.setMapView(boundingBox);
+ location.setViewport(boundingBox);
}
processAddress(properties, &location);
diff --git a/src/plugins/places/nokia/qplacejsonsearchparser.h b/src/plugins/places/nokia/qplacejsonsearchparser.h
index e641c90c..f14f664c 100644
--- a/src/plugins/places/nokia/qplacejsonsearchparser.h
+++ b/src/plugins/places/nokia/qplacejsonsearchparser.h
@@ -78,7 +78,7 @@ private:
void processContacts(const QScriptValue &properties, QGeoPlace *place);
void processCategories(const QScriptValue &categories, QGeoPlace *place);
void processRating(const QScriptValue &properties, QGeoPlace *place);
- void processAddress(const QScriptValue &properties, QPlaceLocation *location);
+ void processAddress(const QScriptValue &properties, QGeoLocation *location);
void processLocation(const QScriptValue &properties, QGeoPlace *place);
private:
QList<QPlaceSearchResult> searchResultsList;
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index f9512df9..0bb331c8 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -20,7 +20,6 @@ SUBDIRS += geotestplugin \
qplacecategory \
qplacecontact \
qplacedescription \
- qplacelocation \
qplacemediaobject \
qplaceperiod \
qplacequery \
@@ -28,4 +27,5 @@ SUBDIRS += geotestplugin \
qplacereview \
qplacesearchquery \
qplacesupplier \
- qplaceweekdayhours
+ qplaceweekdayhours \
+ declarative
diff --git a/tests/auto/declarative/qmlmapsandnav.pro b/tests/auto/declarative/declarative.pro
index 0df01a8e..0df01a8e 100644
--- a/tests/auto/declarative/qmlmapsandnav.pro
+++ b/tests/auto/declarative/declarative.pro
diff --git a/tests/auto/declarative/tst_map_geocoding.qml b/tests/auto/declarative/tst_map_geocoding.qml
index 87b24a74..939982e0 100644
--- a/tests/auto/declarative/tst_map_geocoding.qml
+++ b/tests/auto/declarative/tst_map_geocoding.qml
@@ -209,40 +209,40 @@ Item {
}
GeocodeModel {id: testModel; plugin: testPlugin}
- SignalSpy {id: placesSpy; target: testModel; signalName: "placesChanged"}
+ SignalSpy {id: locationsSpy; target: testModel; signalName: "locationsChanged"}
SignalSpy {id: countSpy; target: testModel; signalName: "countChanged"}
SignalSpy {id: testQuerySpy; target: testModel; signalName: "queryChanged"}
SignalSpy {id: testStatusSpy; target: testModel; signalName: "statusChanged"}
GeocodeModel {id: slackModel; plugin: slackPlugin; }
- SignalSpy {id: placesSlackSpy; target: slackModel; signalName: "placesChanged"}
+ SignalSpy {id: locationsSlackSpy; target: slackModel; signalName: "locationsChanged"}
SignalSpy {id: countSlackSpy; target: slackModel; signalName: "countChanged"}
SignalSpy {id: querySlackSpy; target: slackModel; signalName: "queryChanged"}
SignalSpy {id: errorSlackSpy; target: slackModel; signalName: "errorChanged"}
SignalSpy {id: pluginSlackSpy; target: slackModel; signalName: "pluginChanged"}
GeocodeModel {id: immediateModel; plugin: immediatePlugin}
- SignalSpy {id: placesImmediateSpy; target: immediateModel; signalName: "placesChanged"}
+ SignalSpy {id: locationsImmediateSpy; target: immediateModel; signalName: "locationsChanged"}
SignalSpy {id: countImmediateSpy; target: immediateModel; signalName: "countChanged"}
SignalSpy {id: queryImmediateSpy; target: immediateModel; signalName: "queryChanged"}
SignalSpy {id: statusImmediateSpy; target: immediateModel; signalName: "statusChanged"}
SignalSpy {id: errorImmediateSpy; target: immediateModel; signalName: "errorChanged"}
GeocodeModel {id: automaticModel; plugin: slackPlugin; query: automaticAddress1; autoUpdate: true}
- SignalSpy {id: automaticPlacesSpy; target: automaticModel; signalName: "placesChanged"}
+ SignalSpy {id: automaticLocationsSpy; target: automaticModel; signalName: "locationsChanged"}
TestCase {
name: "Map GeocodeModel basic (reverse) geocoding"
function clear_slack_model() {
slackModel.clear()
- placesSlackSpy.clear()
+ locationsSlackSpy.clear()
countSlackSpy.clear()
querySlackSpy.clear()
errorSlackSpy.clear()
}
function clear_immediate_model() {
immediateModel.clear()
- placesImmediateSpy.clear()
+ locationsImmediateSpy.clear()
countImmediateSpy.clear()
queryImmediateSpy.clear()
errorImmediateSpy.clear()
@@ -266,12 +266,12 @@ Item {
slackModel.update()
wait (100)
compare (countSlackSpy.count, 0)
- compare (placesSlackSpy.count, 0)
+ compare (locationsSlackSpy.count, 0)
compare (slackModel.count, 0)
slackModel.reset()
wait (200)
compare (countSlackSpy.count, 0)
- compare (placesSlackSpy.count, 0)
+ compare (locationsSlackSpy.count, 0)
compare (slackModel.count, 0)
// Check that results are cleared
slackModel.update()
@@ -362,17 +362,17 @@ Item {
}
function test_basic_geocode() {
testQuerySpy.clear()
- placesSpy.clear()
+ locationsSpy.clear()
testStatusSpy.clear()
testModel.clear()
countSpy.clear()
- compare (placesSpy.count, 0)
+ compare (locationsSpy.count, 0)
compare (testModel.error, "")
compare (testModel.count, 0)
testModel.query = address1
compare (testQuerySpy.count, 1)
testModel.update()
- tryCompare (placesSpy, "count", 1) // 5 sec
+ tryCompare (locationsSpy, "count", 1) // 5 sec
compare (testModel.error, "")
compare (testModel.count, 2)
compare (testQuerySpy.count, 1)
@@ -384,23 +384,23 @@ Item {
function test_geocode_auto_updates() {
compare (automaticModel.count, 4) // should be something already
- compare (automaticPlacesSpy.count, 1)
+ compare (automaticLocationsSpy.count, 1)
// change query and its contents and verify that autoupdate occurs
automaticAddress1.county = 6
wait (300)
- compare (automaticPlacesSpy.count, 2)
+ compare (automaticLocationsSpy.count, 2)
compare (automaticModel.count, 6)
automaticAddress1.street = "The Avenue"
wait (300)
- compare (automaticPlacesSpy.count, 3)
+ compare (automaticLocationsSpy.count, 3)
compare (automaticModel.count, 6)
automaticModel.query = automaticCoordinate1
wait (300)
- compare (automaticPlacesSpy.count, 4)
+ compare (automaticLocationsSpy.count, 4)
compare (automaticModel.count, 3)
automaticCoordinate1.longitude = 7
wait (300)
- compare (automaticPlacesSpy.count, 5)
+ compare (automaticLocationsSpy.count, 5)
compare (automaticModel.count, 7)
}
@@ -409,47 +409,47 @@ Item {
slackModel.clear()
querySlackSpy.clear()
countSlackSpy.clear()
- placesSlackSpy.clear()
+ locationsSlackSpy.clear()
slackModel.query = slackAddress1
slackAddress1.county = "7"
compare (querySlackSpy.count, 1)
slackModel.update()
wait (100)
compare (countSlackSpy.count, 0)
- compare (placesSlackSpy.count, 0)
+ compare (locationsSlackSpy.count, 0)
compare (slackModel.count, 0)
wait (200)
compare (countSlackSpy.count, 1)
- compare (placesSlackSpy.count, 1)
+ compare (locationsSlackSpy.count, 1)
compare (slackModel.count, 7) // slackAddress1.county)
// Frequent updates, previous requests are aborted
slackModel.clear()
- placesSlackSpy.clear()
+ locationsSlackSpy.clear()
countSlackSpy.clear()
slackModel.update()
wait (100)
- compare(placesSlackSpy.count, 0)
+ compare(locationsSlackSpy.count, 0)
compare(countSlackSpy.count, 0)
slackModel.update()
wait (100)
- compare(placesSlackSpy.count, 0)
+ compare(locationsSlackSpy.count, 0)
compare(countSlackSpy.count, 0)
slackModel.update()
wait (100)
- compare(placesSlackSpy.count, 0)
+ compare(locationsSlackSpy.count, 0)
compare(countSlackSpy.count, 0)
slackModel.update()
wait (100)
- compare(placesSlackSpy.count, 0)
+ compare(locationsSlackSpy.count, 0)
compare(countSlackSpy.count, 0)
wait (200)
- compare (placesSlackSpy.count, 1)
+ compare (locationsSlackSpy.count, 1)
compare(countSlackSpy.count, 1)
compare(slackModel.count, 7) // slackAddress1.county
}
function test_basic_reverse_geocode() {
testQuerySpy.clear()
- placesSpy.clear()
+ locationsSpy.clear()
testStatusSpy.clear()
countSpy.clear()
testModel.clear()
@@ -459,7 +459,7 @@ Item {
testModel.query = rcoordinate1
compare (testQuerySpy.count, 1)
testModel.update()
- tryCompare (placesSpy, "count", 1) // 5 sec
+ tryCompare (locationsSpy, "count", 1) // 5 sec
tryCompare(countSpy, "count", 1)
compare (testModel.error, "")
compare (testModel.count, 2)
@@ -471,40 +471,40 @@ Item {
slackModel.clear()
querySlackSpy.clear()
countSlackSpy.clear()
- placesSlackSpy.clear()
+ locationsSlackSpy.clear()
slackModel.query = slackCoordinate1
compare (querySlackSpy.count, 1)
slackModel.update()
wait (100)
compare (countSlackSpy.count, 0)
- compare (placesSlackSpy.count, 0)
+ compare (locationsSlackSpy.count, 0)
compare (slackModel.count, 0)
wait (200)
compare (countSlackSpy.count, 1)
- compare (placesSlackSpy.count, 1)
+ compare (locationsSlackSpy.count, 1)
compare (slackModel.count, 3) // slackCoordinate1.longitude
// Frequent updates, previous requests are aborted
slackModel.clear()
- placesSlackSpy.clear()
+ locationsSlackSpy.clear()
countSlackSpy.clear()
slackModel.update()
wait (100)
- compare(placesSlackSpy.count, 0)
+ compare(locationsSlackSpy.count, 0)
compare(countSlackSpy.count, 0)
slackModel.update()
wait (100)
- compare(placesSlackSpy.count, 0)
+ compare(locationsSlackSpy.count, 0)
compare(countSlackSpy.count, 0)
slackModel.update()
wait (100)
- compare(placesSlackSpy.count, 0)
+ compare(locationsSlackSpy.count, 0)
compare(countSlackSpy.count, 0)
slackModel.update()
wait (100)
- compare(placesSlackSpy.count, 0)
+ compare(locationsSlackSpy.count, 0)
compare(countSlackSpy.count, 0)
wait (200)
- compare (placesSlackSpy.count, 1)
+ compare (locationsSlackSpy.count, 1)
compare(countSlackSpy.count, 1)
compare(slackModel.count, 3) // slackCoordinate1.longitude
}
diff --git a/tests/auto/geotestplugin/qgeosearchmanagerengine_test.h b/tests/auto/geotestplugin/qgeosearchmanagerengine_test.h
index a9705b1c..e5b21757 100644
--- a/tests/auto/geotestplugin/qgeosearchmanagerengine_test.h
+++ b/tests/auto/geotestplugin/qgeosearchmanagerengine_test.h
@@ -47,7 +47,7 @@
#include <QLocale>
#include <qlandmarkmanager.h>
#include <qgeoaddress.h>
-#include <qgeoplace.h>
+#include <qgeolocation.h>
#include <qgeosearchreply.h>
#include <QTimer>
@@ -62,12 +62,12 @@ class SearchReplyTest :public QGeoSearchReply
public:
SearchReplyTest(QObject *parent=0):QGeoSearchReply (parent) {}
- void callAddPlace ( const QGeoPlace & place ) {addPlace(place);}
+ void callAddLocation ( const QGeoLocation & location ) {addLocation(location);}
void callSetError ( Error error, const QString & errorString ) {setError(error, errorString);}
void callSetFinished ( bool finished ) {setFinished(finished);}
void callSetLimit ( int limit ) {setLimit(limit);}
void callSetOffset ( int offset ) {setOffset(offset);}
- void callSetPlaces ( const QList<QGeoPlace> & places ) {setPlaces(places);}
+ void callSetLocations ( const QList<QGeoLocation> & locations ) {setLocations(locations);}
void callSetViewport ( QGeoBoundingArea * viewport ) {setViewport(viewport);}
void abort() {
emit aborted();
@@ -127,8 +127,8 @@ public:
}
}
- // 2. Set the places into the reply
- setPlaces(searchReply_, address);
+ // 2. Set the locations into the reply
+ setLocations(searchReply_, address);
// 3. Finish the request
if (finishRequestImmediately_) {
@@ -158,34 +158,34 @@ public Q_SLOTS:
}
public:
- void setPlaces(SearchReplyTest* reply, const QString searchString, int limit )
+ void setLocations(SearchReplyTest* reply, const QString searchString, int limit )
{
for (int i = 0; i < limit; ++i) {
- QGeoPlace place;
+ QGeoLocation location;
QGeoAddress address;
address.setStreet(searchString);
- place.setAddress(address);
- reply->callAddPlace(place);
+ location.setAddress(address);
+ reply->callAddLocation(location);
}
}
- void setPlaces(SearchReplyTest* reply, const QGeoAddress& address)
+ void setLocations(SearchReplyTest* reply, const QGeoAddress& address)
{
int count = address.county().toInt();
for (int i = 0; i < count; ++i) {
- QGeoPlace place;
- place.setAddress(address);
- reply->callAddPlace(place);
+ QGeoLocation location;
+ location.setAddress(address);
+ reply->callAddLocation(location);
}
}
- void setPlaces(SearchReplyTest* reply, const QGeoCoordinate & coordinate)
+ void setLocations(SearchReplyTest* reply, const QGeoCoordinate & coordinate)
{
for (int i = 0; i < coordinate.longitude(); ++i) {
- QGeoPlace place;
- place.setCoordinate(coordinate);
- reply->callAddPlace(place);
+ QGeoLocation location;
+ location.setCoordinate(coordinate);
+ reply->callAddLocation(location);
}
}
@@ -194,7 +194,7 @@ public:
searchReply_ = new SearchReplyTest();
connect(searchReply_, SIGNAL(aborted()), this, SLOT(requestAborted()));
- setPlaces(searchReply_, coordinate);
+ setLocations(searchReply_, coordinate);
searchReply_->callSetViewport(bounds);
if (coordinate.latitude() > 70) {
diff --git a/tests/auto/qgeolocation/qgeolocation.pro b/tests/auto/qgeolocation/qgeolocation.pro
index 3db543e7..49ef1674 100644
--- a/tests/auto/qgeolocation/qgeolocation.pro
+++ b/tests/auto/qgeolocation/qgeolocation.pro
@@ -1,8 +1,8 @@
load(qttest_p4)
HEADERS += ../qgeocoordinate/qlocationtestutils_p.h \
- tst_qgeoplace.h
-SOURCES += tst_qgeoplace.cpp \
+ tst_qgeolocation.h
+SOURCES += tst_qgeolocation.cpp \
../qgeocoordinate/qlocationtestutils.cpp
QT += location
diff --git a/tests/auto/qgeolocation/tst_qgeolocation.cpp b/tests/auto/qgeolocation/tst_qgeolocation.cpp
new file mode 100644
index 00000000..dc6f1469
--- /dev/null
+++ b/tests/auto/qgeolocation/tst_qgeolocation.cpp
@@ -0,0 +1,367 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "tst_qgeolocation.h"
+
+QTM_USE_NAMESPACE
+
+tst_QGeoLocation::tst_QGeoLocation()
+ : m_locationScore(0)
+{
+}
+
+void tst_QGeoLocation::initTestCase()
+{
+
+}
+
+void tst_QGeoLocation::cleanupTestCase()
+{
+
+}
+
+void tst_QGeoLocation::init()
+{
+}
+
+void tst_QGeoLocation::cleanup()
+{
+}
+
+void tst_QGeoLocation::constructor()
+{
+ QCOMPARE(m_location.address(), m_address);
+ QCOMPARE(m_location.coordinate(), m_coordinate);
+ QCOMPARE(m_location.viewport(), m_viewport);
+ QCOMPARE(m_location.additionalData().count(), 0);
+ QCOMPARE(m_location.additionalData(), m_additionalData );
+ QCOMPARE(m_location.alternativeLabels().count(), 0);
+ QCOMPARE(m_location.alternativeLabels(), m_alternativeLabels);
+ QCOMPARE(m_location.label(), m_label);
+ QCOMPARE(m_location.locationId(), m_locationId);
+ QCOMPARE(m_location.locationScore(), m_locationScore);
+}
+
+void tst_QGeoLocation::copy_constructor()
+{
+ QGeoLocation *qgeolocationcopy = new QGeoLocation (m_location);
+ QCOMPARE(m_location, *qgeolocationcopy);
+ delete qgeolocationcopy;
+}
+
+void tst_QGeoLocation::destructor()
+{
+ QGeoLocation *qgeolocationcopy;
+
+ QLocationTestUtils::uheap_mark();
+ qgeolocationcopy = new QGeoLocation();
+ delete qgeolocationcopy;
+ QLocationTestUtils::uheap_mark_end();
+
+ QLocationTestUtils::uheap_mark();
+ qgeolocationcopy = new QGeoLocation(m_location);
+ delete qgeolocationcopy;
+ QLocationTestUtils::uheap_mark_end();
+}
+
+void tst_QGeoLocation::address()
+{
+ m_address.setCity("Berlin");
+ m_address.setCountry("Germany");
+ m_address.setCountryCode("DEU");
+ m_address.setDistrict("Mitte");
+ m_address.setPostcode("10115");
+ m_address.setStreet("Invalidenstrasse");
+
+ m_location.setAddress(m_address);
+
+ QCOMPARE(m_location.address(),m_address);
+
+ m_address.setPostcode("10125");
+ QVERIFY(m_location.address() != m_address);
+}
+
+void tst_QGeoLocation::coordinate()
+{
+ m_coordinate.setLatitude(13.3851);
+ m_coordinate.setLongitude(52.5312);
+ m_coordinate.setAltitude(134.23);
+
+ m_location.setCoordinate(m_coordinate);
+
+ QCOMPARE(m_location.coordinate(), m_coordinate);
+
+ m_coordinate.setAltitude(0);
+ QVERIFY(m_location.coordinate() != m_coordinate);
+}
+
+void tst_QGeoLocation::viewport()
+{
+ m_coordinate.setLatitude(13.3851);
+ m_coordinate.setLongitude(52.5312);
+
+ QGeoBoundingBox qgeoboundingboxcopy(m_coordinate, 0.4, 0.4);
+ m_location.setViewport(qgeoboundingboxcopy);
+
+ QCOMPARE(m_location.viewport(),qgeoboundingboxcopy);
+
+ qgeoboundingboxcopy.setHeight(1);
+
+ QVERIFY(m_location.viewport() != qgeoboundingboxcopy);
+}
+
+void tst_QGeoLocation::additionalData()
+{
+ m_additionalData.insert("key1", "value1");
+ m_additionalData.insert("key2", "value2");
+
+ m_location.setAdditionalData(m_additionalData);
+ QCOMPARE(m_location.additionalData().count(), 2);
+ QCOMPARE(m_location.additionalData(), m_additionalData);
+
+ m_additionalData.insert("key3", "value3");
+ QVERIFY(m_location.additionalData() != m_additionalData);
+}
+
+void tst_QGeoLocation::alternativeLabels()
+{
+ QPlaceAlternativeValue altValue;
+ m_alternativeLabels.append(altValue);
+
+ altValue.setKey("testData");
+ altValue.setValue("value");
+ m_alternativeLabels.append(altValue);
+
+ m_location.setAlternativeLabels(m_alternativeLabels);
+ QCOMPARE(m_location.alternativeLabels(), m_alternativeLabels);
+
+ altValue.setKey("newKey");
+ m_alternativeLabels.append(altValue);
+ QVERIFY(m_location.alternativeLabels() != m_alternativeLabels);
+}
+
+void tst_QGeoLocation::navigationPositions()
+{
+ QGeoCoordinate coordinate1, coordinate2;
+ coordinate1.setLatitude(10);
+ coordinate1.setLongitude(10);
+ coordinate2.setLatitude(2);
+ coordinate2.setLongitude(2);
+ m_navigationPositions.append(coordinate1);
+ m_navigationPositions.append(coordinate2);
+
+ m_location.setNavigationPositions(m_navigationPositions);
+ QCOMPARE(m_location.navigationPositions(), m_navigationPositions);
+
+ m_navigationPositions.append(coordinate1);
+ QVERIFY(m_location.navigationPositions() != m_navigationPositions);
+}
+
+void tst_QGeoLocation::label()
+{
+ m_label = "testText";
+ m_location.setLabel(m_label);
+ QCOMPARE(m_location.label(), m_label);
+
+ m_label = "differentText";
+ QVERIFY(m_location.label() != m_label);
+}
+
+void tst_QGeoLocation::locationId()
+{
+ m_locationId = "id";
+ m_location.setLocationId(m_locationId);
+
+ m_locationId = "new id";
+ m_location.setLocationId(m_locationId);
+}
+
+void tst_QGeoLocation::locationScore()
+{
+ m_locationScore = 4.5;
+ m_location.setLocationScore(m_locationScore);
+ QCOMPARE(m_location.locationScore(), m_locationScore);
+
+ m_locationScore = 2;
+ QVERIFY(m_location.locationScore() != m_locationScore);
+}
+
+void tst_QGeoLocation::operators()
+{
+ QGeoAddress qgeoaddresscopy;
+ qgeoaddresscopy.setCity("Berlin");
+ qgeoaddresscopy.setCountry("Germany");
+ qgeoaddresscopy.setCountryCode("DEU");
+
+ QGeoCoordinate qgeocoordinatecopy (32.324 , 41.324 , 24.55);
+
+ m_address.setCity("Madrid");
+ m_address.setCountry("Spain");
+ m_address.setCountryCode("SPA");
+
+ m_coordinate.setLatitude(21.3434);
+ m_coordinate.setLongitude(38.43443);
+ m_coordinate.setAltitude(634.21);
+
+ m_location.setAddress(m_address);
+ m_location.setCoordinate(m_coordinate);
+
+ //Create a copy and see that they are the same
+ QGeoLocation qgeolocationcopy(m_location);
+ QVERIFY(m_location == qgeolocationcopy);
+ QVERIFY(!(m_location != qgeolocationcopy));
+
+ //Modify one and test if they are different
+ qgeolocationcopy.setAddress(qgeoaddresscopy);
+ QVERIFY(!(m_location == qgeolocationcopy));
+ QVERIFY(m_location != qgeolocationcopy);
+ qgeolocationcopy.setCoordinate(qgeocoordinatecopy);
+ QVERIFY(!(m_location == qgeolocationcopy));
+ QVERIFY(m_location != qgeolocationcopy);
+
+ //delete qgeolocationcopy;
+ //Asign and test that they are the same
+ qgeolocationcopy = m_location;
+ QVERIFY(m_location ==qgeolocationcopy);
+ QVERIFY(!(m_location != qgeolocationcopy));
+}
+
+void tst_QGeoLocation::comparison()
+{
+ QFETCH(QString, dataField);
+
+ QGeoLocation location;
+
+ //set address
+ QGeoAddress address;
+ address.setStreet("21 jump st");
+ address.setCountry("USA");
+ location.setAddress(address);
+
+ //set coordinate
+ location.setCoordinate(QGeoCoordinate(5,10));
+
+ //set viewport
+ location.setViewport(QGeoBoundingBox(QGeoCoordinate(5,5),0.4,0.4));
+
+ //set additionalData
+ QVariantHash additionalData;
+ additionalData.insert("key", "value");
+ location.setAdditionalData(additionalData);
+
+ //set alternative labels
+ QPlaceAlternativeValue altValue;
+ QList<QPlaceAlternativeValue> alternativeLabels;
+
+ altValue.setKey("testData");
+ altValue.setValue("value");
+ alternativeLabels.append(altValue);
+
+ //set navigation positions
+ QList<QGeoCoordinate> navPos;
+ navPos.append(QGeoCoordinate(10,2));
+ location.setNavigationPositions(navPos);
+
+ //set label
+ location.setLabel("label");
+
+ //set locationId
+ location.setLocationId("id");
+
+ //set locationScore
+ location.setLocationScore(2.5);
+
+ QGeoLocation otherLocation(location);
+
+ if (dataField == "no change") {
+ QCOMPARE(location, otherLocation);
+ } else {
+ if (dataField == "address") {
+ QGeoAddress otherAddress;
+ otherAddress.setStreet("42 evergreen tce");
+ otherAddress.setCountry("USA");
+ otherLocation.setAddress(otherAddress);
+ } else if (dataField == "coordinate") {
+ otherLocation.setCoordinate(QGeoCoordinate(12,13));
+ } else if (dataField == "viewport"){
+ otherLocation.setViewport(QGeoBoundingBox(QGeoCoordinate(1,2), 0.5,0.5));
+ } else if (dataField == "additionalData") {
+ additionalData.insert("key", "otherValue");
+ otherLocation.setAdditionalData(additionalData);
+ } else if (dataField == "alternativeLabels") {
+ altValue.setKey("otherKey");
+ alternativeLabels.clear();
+ alternativeLabels.append(altValue);
+ otherLocation.setAlternativeLabels(alternativeLabels);
+ } else if (dataField == "navigationPositions") {
+ navPos.clear();
+ navPos.append(QGeoCoordinate(-5, -5));
+ otherLocation.setNavigationPositions(navPos);
+ } else if (dataField == "label") {
+ otherLocation.setLabel("otherLabel");
+ } else if (dataField == "locationId") {
+ otherLocation.setLocationId("otherId");
+ } else if (dataField == "locationScore") {
+ otherLocation.setLocationScore(1);
+ }else {
+ qFatal("Unknown data field to test");
+ }
+
+ QVERIFY(location != otherLocation);
+ }
+}
+
+void tst_QGeoLocation::comparison_data()
+{
+ QTest::addColumn<QString> ("dataField");
+ QTest::newRow("no change") << "no change";
+ QTest::newRow("address") << "address";
+ QTest::newRow("coordinate") << "coordinate";
+ QTest::newRow("additionalData") << "additionalData";
+ QTest::newRow("alternativeLabels") << "alternativeLabels";
+ QTest::newRow("navigationPositions") << "navigationPositions";
+ QTest::newRow("label") << "label";
+ QTest::newRow("locationId") << "locationId";
+ QTest::newRow("locationScore") << "locationScore";
+}
+
+QTEST_MAIN(tst_QGeoLocation);
+
diff --git a/tests/auto/qgeolocation/tst_qgeoplace.h b/tests/auto/qgeolocation/tst_qgeolocation.h
index bec1886b..34cfac83 100644
--- a/tests/auto/qgeolocation/tst_qgeoplace.h
+++ b/tests/auto/qgeolocation/tst_qgeolocation.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef TST_QGEOPLACE_H
-#define TST_QGEOPLACE_H
+#ifndef TST_QGEOLOCATION_H
+#define TST_QGEOLOCATION_H
#include <QtCore/QString>
#include <QtTest/QtTest>
@@ -50,17 +50,17 @@
#include "../qgeocoordinate/qlocationtestutils_p.h"
#include <qgeoaddress.h>
#include <qgeocoordinate.h>
-#include <qgeoplace.h>
+#include <qgeolocation.h>
#include <qgeoboundingbox.h>
QTM_USE_NAMESPACE
-class tst_QGeoPlace : public QObject
+class tst_QGeoLocation : public QObject
{
Q_OBJECT
public:
- tst_QGeoPlace();
+ tst_QGeoLocation();
private Q_SLOTS:
void initTestCase();
@@ -68,25 +68,37 @@ private Q_SLOTS:
void init();
void cleanup();
- //Start Unit Tests for qgeoplace.h
+ //Start Unit Tests for qgeolocation.h
void constructor();
void copy_constructor();
void destructor();
void address();
void coordinate();
void viewport();
- void isLandmark();
+ void additionalData();
+ void alternativeLabels();
+ void navigationPositions();
+ void label();
+ void locationId();
+ void locationScore();
void operators();
- //End Unit Tests for qgeoplace.h
-
+ void comparison();
+ void comparison_data();
+ //End Unit Tests for qgeolocation.h
private:
+ QGeoLocation m_location;
- QGeoAddress *qgeoaddress;
- QGeoCoordinate *qgeocoordinate;
- QGeoPlace *qgeoplace;
- QGeoBoundingBox *qgeoboundingbox;
+ QGeoAddress m_address;
+ QGeoCoordinate m_coordinate;
+ QGeoBoundingBox m_viewport;
+ QVariantHash m_additionalData;
+ QList<QPlaceAlternativeValue> m_alternativeLabels;
+ QList<QGeoCoordinate> m_navigationPositions;
+ QString m_label;
+ QString m_locationId;
+ qreal m_locationScore;
};
Q_DECLARE_METATYPE( QGeoCoordinate::CoordinateFormat);
diff --git a/tests/auto/qgeolocation/tst_qgeoplace.cpp b/tests/auto/qgeolocation/tst_qgeoplace.cpp
deleted file mode 100644
index 7ca72b84..00000000
--- a/tests/auto/qgeolocation/tst_qgeoplace.cpp
+++ /dev/null
@@ -1,223 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "tst_qgeoplace.h"
-
-QTM_USE_NAMESPACE
-
-tst_QGeoPlace::tst_QGeoPlace()
-{
-}
-
-void tst_QGeoPlace::initTestCase()
-{
-
-}
-
-void tst_QGeoPlace::cleanupTestCase()
-{
-
-}
-
-void tst_QGeoPlace::init()
-{
- qgeoaddress = new QGeoAddress();
- qgeocoordinate = new QGeoCoordinate();
- qgeoplace = new QGeoPlace();
- qgeoboundingbox = new QGeoBoundingBox();
-
-}
-
-void tst_QGeoPlace::cleanup()
-{
- delete qgeoaddress;
- delete qgeocoordinate;
- delete qgeoplace;
- delete qgeoboundingbox;
-}
-
-void tst_QGeoPlace::constructor()
-{
- QCOMPARE(qgeoplace->address(), *qgeoaddress);
- QCOMPARE(qgeoplace->coordinate(), *qgeocoordinate);
- QCOMPARE(qgeoplace->viewport(), *qgeoboundingbox);
-}
-
-void tst_QGeoPlace::copy_constructor()
-{
- QGeoPlace *qgeoplacecopy = new QGeoPlace (*qgeoplace);
- QCOMPARE(*qgeoplace, *qgeoplacecopy);
- delete qgeoplacecopy;
-}
-
-void tst_QGeoPlace::destructor()
-{
- QGeoPlace *qgeoplacecopy;
-
- QLocationTestUtils::uheap_mark();
- qgeoplacecopy = new QGeoPlace();
- delete qgeoplacecopy;
- QLocationTestUtils::uheap_mark_end();
-
- QLocationTestUtils::uheap_mark();
- qgeoplacecopy = new QGeoPlace(*qgeoplace);
- delete qgeoplacecopy;
- QLocationTestUtils::uheap_mark_end();
-}
-
-void tst_QGeoPlace::address()
-{
- qgeoaddress->setCity("Berlin");
- qgeoaddress->setCountry("Germany");
- qgeoaddress->setCountryCode("DEU");
- qgeoaddress->setDistrict("Mitte");
- qgeoaddress->setPostcode("10115");
- qgeoaddress->setStreet("Invalidenstrasse");
-
- qgeoplace->setAddress(*qgeoaddress);
-
- QCOMPARE(qgeoplace->address(),*qgeoaddress);
-
- qgeoaddress->setPostcode("10125");
- QVERIFY(qgeoplace->address() != *qgeoaddress);
-}
-
-void tst_QGeoPlace::coordinate()
-{
- qgeocoordinate->setLatitude(13.3851);
- qgeocoordinate->setLongitude(52.5312);
- qgeocoordinate->setAltitude(134.23);
-
- qgeoplace->setCoordinate(*qgeocoordinate);
-
- QCOMPARE(qgeoplace->coordinate(),*qgeocoordinate);
-
- qgeocoordinate->setAltitude(0);
- QVERIFY(qgeoplace->coordinate() != *qgeocoordinate);
-}
-
-void tst_QGeoPlace::viewport()
-{
- qgeocoordinate->setLatitude(13.3851);
- qgeocoordinate->setLongitude(52.5312);
-
- QGeoBoundingBox *qgeoboundingboxcopy= new QGeoBoundingBox(*qgeocoordinate,0.4,0.4);
-
- qgeoplace->setViewport(*qgeoboundingboxcopy);
-
- QCOMPARE(qgeoplace->viewport(),*qgeoboundingboxcopy);
-
- qgeoboundingboxcopy->setHeight(1);
-
- QVERIFY(qgeoplace->viewport() != *qgeoboundingboxcopy);
-
- delete qgeoboundingboxcopy;
-}
-
-void tst_QGeoPlace::isLandmark()
-{
- QVERIFY(!qgeoplace->isLandmark());
-
- qgeoplace->setAddress(*qgeoaddress);
- QVERIFY(!qgeoplace->isLandmark());
-
- qgeoplace->setCoordinate(*qgeocoordinate);
- QVERIFY(!qgeoplace->isLandmark());
-
- //qgeoaddress->setCity("Berlin");
- qgeoaddress->setCountryCode("DEU");
- qgeocoordinate->setLatitude(13.4109);
- qgeocoordinate->setLongitude(52.5221);
-
- qgeoplace->setAddress(*qgeoaddress);
- qgeoplace->setCoordinate(*qgeocoordinate);
-// Not passing
-// QVERIFY(qgeoplace->isLandmark());
-
-}
-
-void tst_QGeoPlace::operators()
-{
- QGeoAddress *qgeoaddresscopy = new QGeoAddress();
- qgeoaddresscopy->setCity("Berlin");
- qgeoaddresscopy->setCountry("Germany");
- qgeoaddresscopy->setCountryCode("DEU");
-
- QGeoCoordinate *qgeocoordinatecopy = new QGeoCoordinate (32.324 , 41.324 , 24.55);
-
- qgeoaddress->setCity("Madrid");
- qgeoaddress->setCountry("Spain");
- qgeoaddress->setCountryCode("SPA");
-
- qgeocoordinate->setLatitude(21.3434);
- qgeocoordinate->setLongitude(38.43443);
- qgeocoordinate->setAltitude(634.21);
-
- qgeoplace->setAddress(*qgeoaddress);
- qgeoplace->setCoordinate(*qgeocoordinate);
-
- //Create a copy and see that they are the same
- QGeoPlace *qgeoplacecopy = new QGeoPlace (*qgeoplace);
- QVERIFY(qgeoplace->operator ==(*qgeoplacecopy));
- QVERIFY(!qgeoplace->operator !=(*qgeoplacecopy));
-
- //Modify one and test if they are different
- qgeoplacecopy->setAddress(*qgeoaddresscopy);
- QVERIFY(!qgeoplace->operator ==(*qgeoplacecopy));
- QVERIFY(qgeoplace->operator !=(*qgeoplacecopy));
- qgeoplacecopy->setCoordinate(*qgeocoordinatecopy);
- QVERIFY(!qgeoplace->operator ==(*qgeoplacecopy));
- QVERIFY(qgeoplace->operator !=(*qgeoplacecopy));
-
- //delete qgeoplacecopy;
- //Asign and test that they are the same
- *qgeoplacecopy = qgeoplacecopy->operator =(*qgeoplace);
- QVERIFY(qgeoplace->operator ==(*qgeoplacecopy));
- QVERIFY(!qgeoplace->operator !=(*qgeoplacecopy));
-
- delete qgeocoordinatecopy;
- delete qgeoaddresscopy;
- delete qgeoplacecopy;
-
-}
-
-QTEST_MAIN(tst_QGeoPlace);
-
diff --git a/tests/auto/qgeoplace/tst_qgeoplace.cpp b/tests/auto/qgeoplace/tst_qgeoplace.cpp
index 939e707a..df9b3b2f 100644
--- a/tests/auto/qgeoplace/tst_qgeoplace.cpp
+++ b/tests/auto/qgeoplace/tst_qgeoplace.cpp
@@ -48,10 +48,10 @@ void tst_QGeoPlace::constructorTest()
QPlaceBusinessInformation obj;
obj.setOpeningNote("10");
testObj.setBusinessInformation(obj);
- QPlaceLocation sup;
+ QGeoLocation sup;
sup.setLabel("testName1");
sup.setLocationId("testId");
- QList<QPlaceLocation> list;
+ QList<QGeoLocation> list;
list.append(sup);
sup.setLocationId("testName2");
list.append(sup);
@@ -153,8 +153,8 @@ void tst_QGeoPlace::ratingTest()
void tst_QGeoPlace::locationTest()
{
QGeoPlace testObj;
- QVERIFY2(testObj.location() == QPlaceLocation(), "Wrong default value");
- QPlaceLocation obj;
+ QVERIFY2(testObj.location() == QGeoLocation(), "Wrong default value");
+ QGeoLocation obj;
obj.setLocationScore(10);
testObj.setLocation(obj);
QVERIFY2(testObj.location() == obj, "Wrong value returned");
@@ -254,10 +254,10 @@ void tst_QGeoPlace::alternativeLocationsTest()
{
QGeoPlace testObj;
QVERIFY2(testObj.alternativeLocations().count() == 0, "Wrong default value");
- QPlaceLocation sup;
+ QGeoLocation sup;
sup.setLabel("testName1");
sup.setLocationId("testId");
- QList<QPlaceLocation> list;
+ QList<QGeoLocation> list;
list.append(sup);
sup.setLocationId("testName2");
list.append(sup);
@@ -309,10 +309,10 @@ void tst_QGeoPlace::operatorsTest()
QPlaceBusinessInformation obj;
obj.setOpeningNote("10");
testObj.setBusinessInformation(obj);
- QPlaceLocation sup;
+ QGeoLocation sup;
sup.setLabel("testName1");
sup.setLocationId("testId");
- QList<QPlaceLocation> list;
+ QList<QGeoLocation> list;
list.append(sup);
sup.setLocationId("testName2");
list.append(sup);
@@ -320,7 +320,7 @@ void tst_QGeoPlace::operatorsTest()
QStringList tags;
tags << "1" << "2" << "3";
testObj.setTags(tags);
- QPlaceLocation loc;
+ QGeoLocation loc;
loc.setLocationScore(10);
testObj.setLocation(loc);
diff --git a/tests/auto/qgeosearchmanagerplugins/qgeosearchmanagerengine_test.h b/tests/auto/qgeosearchmanagerplugins/qgeosearchmanagerengine_test.h
index dc0c0d53..82ee6984 100644
--- a/tests/auto/qgeosearchmanagerplugins/qgeosearchmanagerengine_test.h
+++ b/tests/auto/qgeosearchmanagerplugins/qgeosearchmanagerengine_test.h
@@ -47,7 +47,7 @@
#include <QLocale>
#include <qlandmarkmanager.h>
#include <qgeoaddress.h>
-#include <qgeoplace.h>
+#include <qgeolocation.h>
#include <qgeosearchreply.h>
@@ -60,12 +60,12 @@ class SearchReplyTest :public QGeoSearchReply
public:
SearchReplyTest(QObject *parent=0):QGeoSearchReply (parent) {}
- void callAddPlace ( const QGeoPlace & place ) {addPlace(place);}
+ void callAddLocation ( const QGeoLocation & location ) {addLocation(location);}
void callSetError ( Error error, const QString & errorString ) {setError(error, errorString);}
void callSetFinished ( bool finished ) {setFinished(finished);}
void callSetLimit ( int limit ) {setLimit(limit);}
void callSetOffset ( int offset ) {setOffset(offset);}
- void callSetPlaces ( const QList<QGeoPlace> & places ) {setPlaces(places);}
+ void callSetLocations ( const QList<QGeoLocation> & locations ) {setLocations(locations);}
void callSetViewport ( QGeoBoundingArea * viewport ) {setViewport(viewport);}
};
diff --git a/tests/auto/qgeosearchreply/tst_qgeosearchreply.cpp b/tests/auto/qgeosearchreply/tst_qgeosearchreply.cpp
index 9224e497..009bd27e 100644
--- a/tests/auto/qgeosearchreply/tst_qgeosearchreply.cpp
+++ b/tests/auto/qgeosearchreply/tst_qgeosearchreply.cpp
@@ -53,7 +53,7 @@ void tst_QGeoSearchReply::cleanupTestCase()
{
delete reply;
- delete qgeoplace;
+ delete qgeolocation;
}
void tst_QGeoSearchReply::init()
@@ -231,47 +231,47 @@ void tst_QGeoSearchReply::offset()
QCOMPARE(reply->offset(),offset);
}
-void tst_QGeoSearchReply::places()
+void tst_QGeoSearchReply::locations()
{
- QList <QGeoPlace> geoplaces;
- geoplaces = reply->places();
+ QList <QGeoLocation> geolocations;
+ geolocations = reply->locations();
- QCOMPARE(geoplaces.size(),0);
+ QCOMPARE(geolocations.size(),0);
QGeoAddress *qgeoaddress = new QGeoAddress ();
qgeoaddress->setCity("Berlin");
QGeoCoordinate *qgeocoordinate = new QGeoCoordinate (12.12 , 54.43);
- qgeoplace = new QGeoPlace ();
- qgeoplace->setAddress(*qgeoaddress);
- qgeoplace->setCoordinate(*qgeocoordinate);
+ qgeolocation = new QGeoLocation ();
+ qgeolocation->setAddress(*qgeoaddress);
+ qgeolocation->setCoordinate(*qgeocoordinate);
- reply->callAddPlace(*qgeoplace);
+ reply->callAddLocation(*qgeolocation);
- geoplaces = reply->places();
- QCOMPARE(geoplaces.size(),1);
- QCOMPARE(geoplaces.at(0),*qgeoplace);
+ geolocations = reply->locations();
+ QCOMPARE(geolocations.size(),1);
+ QCOMPARE(geolocations.at(0),*qgeolocation);
- QGeoPlace *qgeoplacecopy = new QGeoPlace (*qgeoplace);
+ QGeoLocation *qgeolocationcopy = new QGeoLocation (*qgeolocation);
- QList <QGeoPlace> qgeoplaces;
- qgeoplaces.append(*qgeoplace);
- qgeoplaces.append(*qgeoplacecopy);
+ QList <QGeoLocation> qgeolocations;
+ qgeolocations.append(*qgeolocation);
+ qgeolocations.append(*qgeolocationcopy);
- reply->callSetPlaces(qgeoplaces);
+ reply->callSetLocations(qgeolocations);
- geoplaces = reply->places();
+ geolocations = reply->locations();
- QCOMPARE(geoplaces.size(),qgeoplaces.size());
- for (int i = 0 ; i < geoplaces.size(); i++)
+ QCOMPARE(geolocations.size(),qgeolocations.size());
+ for (int i = 0 ; i < geolocations.size(); i++)
{
- QCOMPARE(geoplaces.at(i),qgeoplaces.at(i));
+ QCOMPARE(geolocations.at(i),qgeolocations.at(i));
}
delete qgeoaddress;
delete qgeocoordinate;
- delete qgeoplacecopy;
+ delete qgeolocationcopy;
}
void tst_QGeoSearchReply::viewport()
diff --git a/tests/auto/qgeosearchreply/tst_qgeosearchreply.h b/tests/auto/qgeosearchreply/tst_qgeosearchreply.h
index dfc8cb84..ec411915 100644
--- a/tests/auto/qgeosearchreply/tst_qgeosearchreply.h
+++ b/tests/auto/qgeosearchreply/tst_qgeosearchreply.h
@@ -51,7 +51,7 @@
#include "../qgeocoordinate/qlocationtestutils_p.h"
#include <qgeosearchreply.h>
-#include <qgeoplace.h>
+#include <qgeolocation.h>
#include <qgeoaddress.h>
#include <qgeocoordinate.h>
#include <qgeoboundingbox.h>
@@ -63,12 +63,12 @@ class SubSearchReply : public QGeoSearchReply
public:
SubSearchReply():QGeoSearchReply() {}
- void callAddPlace ( const QGeoPlace & place ) {addPlace(place);}
+ void callAddLocation ( const QGeoLocation & location ) {addLocation(location);}
void callSetError ( Error error, const QString & errorString ) {setError(error, errorString);}
void callSetFinished ( bool finished ) {setFinished(finished);}
void callSetLimit ( int limit ) {setLimit(limit);}
void callSetOffset ( int offset ) {setOffset(offset);}
- void callSetPlaces ( const QList<QGeoPlace> & places ) {setPlaces(places);}
+ void callSetLocations ( const QList<QGeoLocation> & locations ) {setLocations(locations);}
void callSetViewport ( QGeoBoundingArea * viewport ) {setViewport(viewport);}
};
@@ -96,7 +96,7 @@ private slots:
void finished();
void limit();
void offset();
- void places();
+ void locations();
void viewport();
//End Unit Test for QGeoSearchReply
@@ -107,7 +107,7 @@ private:
QSignalSpy *signalerror;
QSignalSpy *signalfinished;
SubSearchReply* reply;
- QGeoPlace *qgeoplace;
+ QGeoLocation *qgeolocation;
QGeoBoundingBox *qgeoboundingbox;
};
diff --git a/tests/auto/qplacelocation/qplacelocation.pro b/tests/auto/qplacelocation/qplacelocation.pro
deleted file mode 100644
index c54aeee5..00000000
--- a/tests/auto/qplacelocation/qplacelocation.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = app
-CONFIG += testcase
-TARGET = tst_qplacelocation
-
-SOURCES += tst_qplacelocation.cpp
-
-QT += location testlib
diff --git a/tests/auto/qplacelocation/tst_qplacelocation.cpp b/tests/auto/qplacelocation/tst_qplacelocation.cpp
deleted file mode 100644
index 887d0f39..00000000
--- a/tests/auto/qplacelocation/tst_qplacelocation.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-#include <QtCore/QString>
-#include <QtTest/QtTest>
-
-#include <qplacelocation.h>
-
-QTM_USE_NAMESPACE
-
-class tst_QPlaceLocation : public QObject
-{
- Q_OBJECT
-
-public:
- tst_QPlaceLocation();
-
-private Q_SLOTS:
- void constructorTest();
- void additionalDataTest();
- void alternativeLabelsTest();
- void addressTest();
- void displayPositionTest();
- void navigationPositionsTest();
- void labelTest();
- void locationIdTest();
- void locationScoreTest();
- void mapViewTest();
- void operatorsTest();
-};
-
-tst_QPlaceLocation::tst_QPlaceLocation()
-{
-}
-
-void tst_QPlaceLocation::constructorTest()
-{
- QPlaceLocation testObj;
- testObj.setLabel("testId");
- QPlaceLocation *testObjPtr = new QPlaceLocation(testObj);
- QVERIFY2(testObjPtr != NULL, "Copy constructor - null");
- QVERIFY2(*testObjPtr == testObj, "Copy constructor - compare");
- delete testObjPtr;
-}
-
-void tst_QPlaceLocation::additionalDataTest()
-{
- QPlaceLocation testObj;
- QVERIFY2(testObj.additionalData().count() == 0, "Wrong default value");
- QVariantHash list;
- list.insert("key1", "value1");
- list.insert("key2", "value2");
- testObj.setAdditionalData(list);
- QVERIFY2(testObj.additionalData().count() == 2, "Wrong value returned");
- QVERIFY2(testObj.additionalData()["key1"] == "value1", "Wrong value[1] returned");
-}
-
-void tst_QPlaceLocation::alternativeLabelsTest()
-{
- QPlaceLocation testObj;
- QVERIFY2(testObj.alternativeLabels().count() == 0, "Wrong default value");
- QList<QPlaceAlternativeValue> list;
- QPlaceAlternativeValue altValue;
- list.append(altValue);
- altValue.setKey("testData");
- list.append(altValue);
- testObj.setAlternativeLabels(list);
- QVERIFY2(testObj.alternativeLabels().count() == 2, "Wrong value returned");
- QVERIFY2(testObj.alternativeLabels()[0].key() == QString(), "Wrong key[0] returned");
- QVERIFY2(testObj.alternativeLabels()[1].key() == "testData", "Wrong key[1] returned");
-}
-
-void tst_QPlaceLocation::addressTest()
-{
- QPlaceLocation testObj;
- QVERIFY2(testObj.address() == QGeoAddress(), "Wrong default value");
- QGeoAddress address;
- address.setCountry("testValue");
- testObj.setAddress(address);
- QVERIFY2(testObj.address() == address, "Wrong value returned");
-}
-
-void tst_QPlaceLocation::displayPositionTest()
-{
- QPlaceLocation testObj;
- QVERIFY2(testObj.displayPosition() == QGeoCoordinate(), "Wrong default value");
- QGeoCoordinate address;
- address.setLatitude(10);
- testObj.setDisplayPosition(address);
- QVERIFY2(testObj.displayPosition() == address, "Wrong value returned");
-}
-
-void tst_QPlaceLocation::navigationPositionsTest()
-{
- QPlaceLocation testObj;
- QVERIFY2(testObj.navigationPositions().count() == 0, "Wrong default value");
- QGeoCoordinate coordinate1, coordinate2;
- coordinate1.setLatitude(10);
- coordinate1.setLongitude(10);
- coordinate2.setLatitude(2);
- coordinate2.setLongitude(2);
- QList<QGeoCoordinate> path;
- path.append(coordinate1);
- path.append(coordinate2);
- testObj.setNavigationPositions(path);
- QVERIFY2(testObj.navigationPositions() == path, "Wrong value returned");
- QVERIFY2(testObj.navigationPositions().count() == 2, "Wrong value returned");
-}
-
-void tst_QPlaceLocation::labelTest()
-{
- QPlaceLocation testObj;
- QVERIFY2(testObj.label() == QString(), "Wrong default value");
- testObj.setLabel("testText");
- QVERIFY2(testObj.label() == "testText", "Wrong value returned");
-}
-
-void tst_QPlaceLocation::locationIdTest()
-{
- QPlaceLocation testObj;
- QVERIFY2(testObj.locationId() == QString(), "Wrong default value");
- testObj.setLocationId("testText");
- QVERIFY2(testObj.locationId() == "testText", "Wrong value returned");
-}
-
-void tst_QPlaceLocation::locationScoreTest()
-{
- QPlaceLocation testObj;
- QVERIFY2(testObj.locationScore() == 0, "Wrong default value");
- testObj.setLocationScore(5);
- QVERIFY2(testObj.locationScore() == 5, "Wrong value returned");
-}
-
-void tst_QPlaceLocation::mapViewTest()
-{
- QPlaceLocation testObj;
- QVERIFY2(testObj.mapView().isValid() == false, "Wrong default value");
- QGeoCoordinate coordinate;
- coordinate.setLatitude(30);
- coordinate.setLongitude(20);
- QGeoBoundingBox box;
- box.setTopLeft(coordinate);
- box.setBottomRight(coordinate);
- testObj.setMapView(box);
- QVERIFY2(testObj.mapView() == box, "Wrong value returned");
-}
-
-void tst_QPlaceLocation::operatorsTest()
-{
- QPlaceLocation testObj;
- testObj.setLabel("testValue");
- QPlaceLocation testObj2;
- testObj2 = testObj;
- QVERIFY2(testObj == testObj2, "Not copied correctly");
- testObj2.setLocationId("testValue2");
- QVERIFY2(testObj != testObj2, "Object should be different");
-}
-
-QTEST_APPLESS_MAIN(tst_QPlaceLocation);
-
-#include "tst_qplacelocation.moc"