diff options
50 files changed, 641 insertions, 1238 deletions
diff --git a/examples/maps/mainwindow.cpp b/examples/maps/mainwindow.cpp index 4ffd6930..6978ef32 100644 --- a/examples/maps/mainwindow.cpp +++ b/examples/maps/mainwindow.cpp @@ -134,7 +134,7 @@ void MainWindow::initialize() foreach (QString provider, providers) { serviceProvider = new QGeoServiceProvider(provider); if (serviceProvider->mappingManager() && - serviceProvider->searchManager() && + serviceProvider->geocodingManager() && serviceProvider->routingManager()) break; } @@ -147,7 +147,7 @@ void MainWindow::initialize() } if (!serviceProvider->mappingManager() || - !serviceProvider->searchManager() || + !serviceProvider->geocodingManager() || !serviceProvider->routingManager()) { QMessageBox::information(this, tr("Maps Demo"), tr("No geoservice found with mapping/search/routing")); @@ -161,11 +161,11 @@ void MainWindow::initialize() if (markerManager) delete markerManager; - markerManager = new MarkerManager(serviceProvider->searchManager()); + markerManager = new MarkerManager(serviceProvider->geocodingManager()); mapsWidget->setMarkerManager(markerManager); - connect(markerManager, SIGNAL(searchError(QGeoSearchReply::Error,QString)), - this, SLOT(showErrorMessage(QGeoSearchReply::Error,QString))); + connect(markerManager, SIGNAL(searchError(QGeocodeReply::Error,QString)), + this, SLOT(showErrorMessage(QGeocodeReply::Error,QString))); connect(mapsWidget, SIGNAL(markerClicked(Marker*)), this, SLOT(showMarkerDialog(Marker*))); connect(mapsWidget, SIGNAL(mapPanned()), @@ -224,14 +224,14 @@ void MainWindow::showNavigateDialog() lastNavigator->deleteLater(); Navigator *nvg = new Navigator(serviceProvider->routingManager(), - serviceProvider->searchManager(), + serviceProvider->geocodingManager(), mapsWidget, nd.destinationAddress(), req); lastNavigator = nvg; - connect(nvg, SIGNAL(searchError(QGeoSearchReply::Error,QString)), - this, SLOT(showErrorMessage(QGeoSearchReply::Error,QString))); + connect(nvg, SIGNAL(searchError(QGeocodeReply::Error,QString)), + this, SLOT(showErrorMessage(QGeocodeReply::Error,QString))); connect(nvg, SIGNAL(routingError(QGeoRouteReply::Error,QString)), this, SLOT(showErrorMessage(QGeoRouteReply::Error,QString))); @@ -260,7 +260,7 @@ void MainWindow::showSearchDialog() } } -void MainWindow::showErrorMessage(QGeoSearchReply::Error err, QString msg) +void MainWindow::showErrorMessage(QGeocodeReply::Error err, QString msg) { Q_UNUSED(err) QMessageBox::critical(this, tr("Error"), msg); diff --git a/examples/maps/mainwindow.h b/examples/maps/mainwindow.h index d1480757..dbe03380 100644 --- a/examples/maps/mainwindow.h +++ b/examples/maps/mainwindow.h @@ -76,7 +76,7 @@ private slots: void updateMyPosition(QGeoPositionInfo info); void disableTracking(); - void showErrorMessage(QGeoSearchReply::Error err, QString msg); + void showErrorMessage(QGeocodeReply::Error err, QString msg); void showErrorMessage(QGeoRouteReply::Error err, QString msg); void openNetworkSession(); diff --git a/examples/maps/marker.cpp b/examples/maps/marker.cpp index 53efc908..c755d9d2 100644 --- a/examples/maps/marker.cpp +++ b/examples/maps/marker.cpp @@ -163,13 +163,13 @@ public: QGraphicsGeoMap *map; StatusBarItem *status; - QGeoSearchManager *searchManager; + QGeocodingManager *searchManager; - QSet<QGeoSearchReply*> forwardReplies; - QSet<QGeoSearchReply*> reverseReplies; + QSet<QGeocodeReply*> forwardReplies; + QSet<QGeocodeReply*> reverseReplies; }; -MarkerManager::MarkerManager(QGeoSearchManager *searchManager, QObject *parent) : +MarkerManager::MarkerManager(QGeocodingManager *searchManager, QObject *parent) : QObject(parent), d(new MarkerManagerPrivate) { @@ -185,10 +185,10 @@ MarkerManager::MarkerManager(QGeoSearchManager *searchManager, QObject *parent) connect(d->myLocation, SIGNAL(coordinateChanged(QGeoCoordinate)), this, SLOT(myLocationChanged(QGeoCoordinate))); - connect(d->searchManager, SIGNAL(finished(QGeoSearchReply*)), - this, SLOT(replyFinished(QGeoSearchReply*))); - connect(d->searchManager, SIGNAL(finished(QGeoSearchReply*)), - this, SLOT(reverseReplyFinished(QGeoSearchReply*))); + connect(d->searchManager, SIGNAL(finished(QGeocodeReply*)), + this, SLOT(replyFinished(QGeocodeReply*))); + connect(d->searchManager, SIGNAL(finished(QGeocodeReply*)), + this, SLOT(reverseReplyFinished(QGeocodeReply*))); } MarkerManager::~MarkerManager() @@ -216,15 +216,15 @@ void MarkerManager::setMyLocation(QGeoCoordinate coord) void MarkerManager::search(QString query, qreal radius) { - QGeoSearchReply *reply; + QGeocodeReply *reply; if (radius > 0) { QGeoBoundingCircle *boundingCircle = new QGeoBoundingCircle( d->myLocation->coordinate(), radius); - reply = d->searchManager->search(query, + reply = d->searchManager->geocode(query, -1, 0, boundingCircle); } else { - reply = d->searchManager->search(query); + reply = d->searchManager->geocode(query); } d->forwardReplies.insert(reply); @@ -237,8 +237,8 @@ void MarkerManager::search(QString query, qreal radius) if (reply->isFinished()) { replyFinished(reply); } else { - connect(reply, SIGNAL(error(QGeoSearchReply::Error,QString)), - this, SIGNAL(searchError(QGeoSearchReply::Error,QString))); + connect(reply, SIGNAL(error(QGeocodeReply::Error,QString)), + this, SIGNAL(searchError(QGeocodeReply::Error,QString))); } } @@ -260,7 +260,7 @@ void MarkerManager::myLocationChanged(QGeoCoordinate location) if (d->revGeocodeRunning) { d->myLocHasMoved = true; } else { - QGeoSearchReply *reply = d->searchManager->reverseGeocode(location); + QGeocodeReply *reply = d->searchManager->reverseGeocode(location); d->reverseReplies.insert(reply); d->myLocHasMoved = false; @@ -273,7 +273,7 @@ void MarkerManager::myLocationChanged(QGeoCoordinate location) } } -void MarkerManager::reverseReplyFinished(QGeoSearchReply *reply) +void MarkerManager::reverseReplyFinished(QGeocodeReply *reply) { if (!d->reverseReplies.contains(reply)) return; @@ -291,7 +291,7 @@ void MarkerManager::reverseReplyFinished(QGeoSearchReply *reply) reply->deleteLater(); } -void MarkerManager::replyFinished(QGeoSearchReply *reply) +void MarkerManager::replyFinished(QGeocodeReply *reply) { if (!d->forwardReplies.contains(reply)) return; diff --git a/examples/maps/marker.h b/examples/maps/marker.h index c6ae4e00..b9fa7f4c 100644 --- a/examples/maps/marker.h +++ b/examples/maps/marker.h @@ -45,11 +45,11 @@ #include <QSignalMapper> #include "qgeomappixmapobject.h" -#include "qgeosearchmanager.h" +#include "qgeocodingmanager.h" #include "qgeocoordinate.h" #include "qgraphicsgeomap.h" #include "qgeoaddress.h" -#include "qgeosearchreply.h" +#include "qgeocodereply.h" class StatusBarItem; @@ -102,7 +102,7 @@ class MarkerManager : public QObject { Q_OBJECT public: - explicit MarkerManager(QGeoSearchManager *sm, QObject *parent=0); + explicit MarkerManager(QGeocodingManager *sm, QObject *parent=0); ~MarkerManager(); QGeoCoordinate myLocation() const; @@ -115,16 +115,16 @@ public slots: void removeSearchMarkers(); signals: - void searchError(QGeoSearchReply::Error error, QString errorString); + void searchError(QGeocodeReply::Error error, QString errorString); void searchFinished(); private: MarkerManagerPrivate *d; private slots: - void replyFinished(QGeoSearchReply *reply); + void replyFinished(QGeocodeReply *reply); void myLocationChanged(QGeoCoordinate location); - void reverseReplyFinished(QGeoSearchReply *reply); + void reverseReplyFinished(QGeocodeReply *reply); }; #endif // MARKER_H diff --git a/examples/maps/navigator.cpp b/examples/maps/navigator.cpp index c3b93ff0..617a9b6c 100644 --- a/examples/maps/navigator.cpp +++ b/examples/maps/navigator.cpp @@ -44,7 +44,7 @@ #include "marker.h" Navigator::Navigator(QGeoRoutingManager *routingManager, - QGeoSearchManager *searchManager, + QGeocodingManager *searchManager, MapsWidget *mapsWidget, const QString &address, const QGeoRouteRequest &requestTemplate) : address(address), @@ -85,12 +85,12 @@ void Navigator::start() startMarker->setName("Start point"); mapsWidget->map()->addMapObject(startMarker); - addressReply = searchManager->search(address); + addressReply = searchManager->geocode(address); if (addressReply->isFinished()) { on_addressSearchFinished(); } else { - connect(addressReply, SIGNAL(error(QGeoSearchReply::Error,QString)), - this, SIGNAL(searchError(QGeoSearchReply::Error,QString))); + connect(addressReply, SIGNAL(error(QGeocodeReply::Error,QString)), + this, SIGNAL(searchError(QGeocodeReply::Error,QString))); connect(addressReply, SIGNAL(finished()), this, SLOT(on_addressSearchFinished())); } diff --git a/examples/maps/navigator.h b/examples/maps/navigator.h index b48e6c25..10c7a616 100644 --- a/examples/maps/navigator.h +++ b/examples/maps/navigator.h @@ -43,11 +43,11 @@ #define NAVIGATOR_H #include <qgeoroutingmanager.h> -#include <qgeosearchmanager.h> +#include <qgeocodingmanager.h> #include <qgeoroutereply.h> #include <qgeoroutereply.h> -#include <qgeosearchreply.h> +#include <qgeocodereply.h> #include <qgeomaprouteobject.h> #include "marker.h" @@ -58,7 +58,7 @@ class Navigator : public QObject { Q_OBJECT public: - Navigator(QGeoRoutingManager *routingManager, QGeoSearchManager *searchManager, + Navigator(QGeoRoutingManager *routingManager, QGeocodingManager *searchManager, MapsWidget *mapsWidget, const QString &address, const QGeoRouteRequest &requestTemplate); ~Navigator(); @@ -68,7 +68,7 @@ public: signals: void finished(); - void searchError(QGeoSearchReply::Error error, QString errorString); + void searchError(QGeocodeReply::Error error, QString errorString); void routingError(QGeoRouteReply::Error error, QString errorString); private slots: @@ -80,10 +80,10 @@ private: QGeoRouteRequest request; QGeoRoutingManager *routingManager; - QGeoSearchManager *searchManager; + QGeocodingManager *searchManager; MapsWidget *mapsWidget; - QGeoSearchReply *addressReply; + QGeocodeReply *addressReply; QGeoRouteReply *routeReply; QGeoMapRouteObject *routeObject; diff --git a/src/imports/location/qdeclarativegeocodemodel.cpp b/src/imports/location/qdeclarativegeocodemodel.cpp index f3c826fd..c52596e6 100644 --- a/src/imports/location/qdeclarativegeocodemodel.cpp +++ b/src/imports/location/qdeclarativegeocodemodel.cpp @@ -45,7 +45,7 @@ #include <QtDeclarative/qdeclarativeinfo.h> #include <qgeoserviceprovider.h> -#include <qgeosearchmanager.h> +#include <qgeocodingmanager.h> QT_BEGIN_NAMESPACE @@ -105,8 +105,8 @@ void QDeclarativeGeocodeModel::update() if (!serviceProvider) return; - QGeoSearchManager *searchManager = serviceProvider->searchManager(); - if (!searchManager) { + QGeocodingManager *geocodingManager = serviceProvider->geocodingManager(); + if (!geocodingManager) { qmlInfo(this) << tr("Cannot geocode, search manager (/plugin) not set."); return; } @@ -120,22 +120,22 @@ void QDeclarativeGeocodeModel::update() if (coordinate_) { setStatus(QDeclarativeGeocodeModel::Loading); - reply_ = searchManager->reverseGeocode(coordinate_->coordinate(), boundingArea()); + reply_ = geocodingManager->reverseGeocode(coordinate_->coordinate(), boundingArea()); if (reply_->isFinished()) { - if (reply_->error() == QGeoSearchReply::NoError) { - searchFinished(reply_); + if (reply_->error() == QGeocodeReply::NoError) { + geocodeFinished(reply_); } else { - searchError(reply_, reply_->error(), reply_->errorString()); + geocodeError(reply_, reply_->error(), reply_->errorString()); } } } else if (address_) { setStatus(QDeclarativeGeocodeModel::Loading); - reply_ = searchManager->geocode(address_->address(), boundingArea()); + reply_ = geocodingManager->geocode(address_->address(), boundingArea()); if (reply_->isFinished()) { - if (reply_->error() == QGeoSearchReply::NoError) { - searchFinished(reply_); + if (reply_->error() == QGeocodeReply::NoError) { + geocodeFinished(reply_); } else { - searchError(reply_, reply_->error(), reply_->errorString()); + geocodeError(reply_, reply_->error(), reply_->errorString()); } } } @@ -186,15 +186,15 @@ void QDeclarativeGeocodeModel::setPlugin(QDeclarativeGeoServiceProvider *plugin) if (complete_) emit pluginChanged(); QGeoServiceProvider *serviceProvider = plugin_->sharedGeoServiceProvider(); - QGeoSearchManager *searchManager = serviceProvider->searchManager(); - if (!searchManager || serviceProvider->error() != QGeoServiceProvider::NoError) { + QGeocodingManager *geocodingManager = serviceProvider->geocodingManager(); + if (!geocodingManager || serviceProvider->error() != QGeoServiceProvider::NoError) { qmlInfo(this) << tr("Warning: Plugin does not support (reverse) geocoding."); return; } - connect(searchManager, SIGNAL(finished(QGeoSearchReply*)), - this, SLOT(searchFinished(QGeoSearchReply*))); - connect(searchManager, SIGNAL(error(QGeoSearchReply*,QGeoSearchReply::Error,QString)), - this, SLOT(searchError(QGeoSearchReply*,QGeoSearchReply::Error,QString))); + connect(geocodingManager, SIGNAL(finished(QGeocodeReply*)), + this, SLOT(geocodeFinished(QGeocodeReply*))); + connect(geocodingManager, SIGNAL(error(QGeocodeReply*,QGeocodeReply::Error,QString)), + this, SLOT(geocodeError(QGeocodeReply*,QGeocodeReply::Error,QString))); } QDeclarativeGeoServiceProvider* QDeclarativeGeocodeModel::plugin() const @@ -223,9 +223,9 @@ QObject* QDeclarativeGeocodeModel::bounds() const return boundingArea_; } -void QDeclarativeGeocodeModel::searchFinished(QGeoSearchReply *reply) +void QDeclarativeGeocodeModel::geocodeFinished(QGeocodeReply *reply) { - if (reply->error() != QGeoSearchReply::NoError) { + if (reply->error() != QGeocodeReply::NoError) { return; } int oldCount = declarativeLocations_.count(); @@ -239,8 +239,8 @@ void QDeclarativeGeocodeModel::searchFinished(QGeoSearchReply *reply) emit countChanged(); } -void QDeclarativeGeocodeModel::searchError(QGeoSearchReply *reply, - QGeoSearchReply::Error error, +void QDeclarativeGeocodeModel::geocodeError(QGeocodeReply *reply, + QGeocodeReply::Error error, const QString &errorString) { Q_UNUSED(error); diff --git a/src/imports/location/qdeclarativegeocodemodel_p.h b/src/imports/location/qdeclarativegeocodemodel_p.h index 5a649f2c..5c8da37c 100644 --- a/src/imports/location/qdeclarativegeocodemodel_p.h +++ b/src/imports/location/qdeclarativegeocodemodel_p.h @@ -45,7 +45,7 @@ #include "qdeclarativegeoserviceprovider_p.h" #include "qdeclarativegeoboundingcircle_p.h" -#include <qgeosearchreply.h> +#include <qgeocodereply.h> #include <QtDeclarative/qdeclarative.h> #include <QDeclarativeParserStatus> @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE class QGeoServiceProvider; -class QGeoSearchManager; +class QGeocodingManager; class QDeclarativeGeoLocation; class QDeclarativeGeocodeModel : public QAbstractListModel, public QDeclarativeParserStatus @@ -131,13 +131,13 @@ public Q_SLOTS: protected Q_SLOTS: void queryContentChanged(); - void searchFinished(QGeoSearchReply *reply); - void searchError(QGeoSearchReply *reply, - QGeoSearchReply::Error error, + void geocodeFinished(QGeocodeReply *reply); + void geocodeError(QGeocodeReply *reply, + QGeocodeReply::Error error, const QString &errorString); protected: - QGeoSearchManager* searchManager(); + QGeocodingManager* searchManager(); void setStatus(Status status); void setError(const QString &error); bool autoUpdate_; @@ -147,7 +147,7 @@ private: void setLocations(const QList<QGeoLocation> &locations); QGeoBoundingArea* boundingArea(); void abortRequest(); - QGeoSearchReply* reply_; + QGeocodeReply* reply_; QDeclarativeGeoServiceProvider* plugin_; QPointer<QObject> boundingArea_; diff --git a/src/imports/location/qdeclarativegeosearchmodel.cpp b/src/imports/location/qdeclarativegeosearchmodel.cpp deleted file mode 100644 index 220fffca..00000000 --- a/src/imports/location/qdeclarativegeosearchmodel.cpp +++ /dev/null @@ -1,221 +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 "qdeclarativegeosearchmodel_p.h" - -#include "qdeclarativegeoplace_p.h" -#include "qdeclarativelandmark_p.h" - -#include <qgeoserviceprovider.h> -#include <qgeosearchmanager.h> - -QT_BEGIN_NAMESPACE - -QDeclarativeGeoSearchModel::QDeclarativeGeoSearchModel(QObject* parent) - : QAbstractListModel(parent), - plugin_(0), - serviceProvider_(0), - searchManager_(0), - status_(QDeclarativeGeoSearchModel::Null) -{ - QHash<int, QByteArray> roleNames; - roleNames = QAbstractItemModel::roleNames(); - roleNames.insert(PlaceRole, "place"); - roleNames.insert(LandmarkRole, "landmark"); - setRoleNames(roleNames); -} - -QDeclarativeGeoSearchModel::~QDeclarativeGeoSearchModel() -{ - if (serviceProvider_) - delete serviceProvider_; -} - -// From QDeclarativeParserStatus -void QDeclarativeGeoSearchModel::classBegin() {} -void QDeclarativeGeoSearchModel::componentComplete() {} - -// From QAbstractListModel -int QDeclarativeGeoSearchModel::rowCount(const QModelIndex &parent) const -{ - return places_.count(); -} - -QVariant QDeclarativeGeoSearchModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid()) - return QVariant(); - - if (index.row() > places_.count()) - return QVariant(); - - QGeoPlace place = places_.at(index.row()); - - if (role == QDeclarativeGeoSearchModel::PlaceRole) { - return QVariant::fromValue(new QDeclarativeGeoPlace(place, const_cast<QDeclarativeGeoSearchModel*>(this))); - } else if (role == QDeclarativeGeoSearchModel::LandmarkRole) { - if (place.isLandmark()) - return QVariant::fromValue(QLandmark(place)); - } - - return QVariant(); -} - -QVariant QDeclarativeGeoSearchModel::headerData(int section, Qt::Orientation /*orientation*/, int role) const -{ - if (section != 0) - return QVariant(); - - if (role == QDeclarativeGeoSearchModel::PlaceRole) { - return QString("Place"); - } else if (role == QDeclarativeGeoSearchModel::LandmarkRole) { - return QString("Landmark"); - } - - return QVariant(); -} - -void QDeclarativeGeoSearchModel::setPlugin(QDeclarativeGeoServiceProvider *plugin) -{ - if (plugin_ || !plugin) - return; - - plugin_ = plugin; - - emit pluginChanged(plugin_); - - serviceProvider_ = new QGeoServiceProvider(plugin_->name(), - plugin_->parameterMap()); - - // check for error - - searchManager_ = serviceProvider_->searchManager(); - - connect(searchManager_, - SIGNAL(finished(QGeoSearchReply*)), - this, - SLOT(searchFinished(QGeoSearchReply*))); - - connect(searchManager_, - SIGNAL(error(QGeoSearchReply*, QGeoSearchReply::Error, QString)), - this, - SLOT(searchError(QGeoSearchReply*, QGeoSearchReply::Error, QString))); -} - -QDeclarativeGeoServiceProvider* QDeclarativeGeoSearchModel::plugin() const -{ - return plugin_; -} - -void QDeclarativeGeoSearchModel::searchFinished(QGeoSearchReply *reply) -{ - if (reply->error() != QGeoSearchReply::NoError) - return; - - setPlaces(reply->places()); - - setError(""); - setStatus(QDeclarativeGeoSearchModel::Ready); - - reply->deleteLater(); - - emit placesChanged(); -} - -void QDeclarativeGeoSearchModel::searchError(QGeoSearchReply *reply, - QGeoSearchReply::Error error, - const QString &errorString) -{ - setError(errorString); - setStatus(QDeclarativeGeoSearchModel::Error); - reply->deleteLater(); -} - -QDeclarativeGeoSearchModel::Status QDeclarativeGeoSearchModel::status() const -{ - return status_; -} - -void QDeclarativeGeoSearchModel::setStatus(QDeclarativeGeoSearchModel::Status status) -{ - if (status_ == status) - return; - - status_ = status; - - emit statusChanged(status_); -} - -QString QDeclarativeGeoSearchModel::error() const -{ - return error_; -} - -void QDeclarativeGeoSearchModel::setError(const QString &error) -{ - if (error_ == error) - return; - - error_ = error; - - emit errorChanged(error_); -} - -QGeoSearchManager* QDeclarativeGeoSearchModel::searchManager() -{ - return searchManager_; -} - -QList<QGeoPlace> QDeclarativeGeoSearchModel::places() const -{ - return places_; -} - -void QDeclarativeGeoSearchModel::setPlaces(const QList<QGeoPlace> &places) -{ - beginResetModel(); - places_ = places; - endResetModel(); -} - -#include "moc_qdeclarativegeosearchmodel_p.cpp" - -QT_END_NAMESPACE diff --git a/src/imports/location/qdeclarativegeosearchmodel_p.h b/src/imports/location/qdeclarativegeosearchmodel_p.h deleted file mode 100644 index 175a5721..00000000 --- a/src/imports/location/qdeclarativegeosearchmodel_p.h +++ /dev/null @@ -1,137 +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$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEGEOSEARCHMODEL_H -#define QDECLARATIVEGEOSEARCHMODEL_H - -#include "qdeclarativegeoserviceprovider_p.h" - -#include <qgeosearchreply.h> - -#include <QtDeclarative/qdeclarative.h> -#include <QDeclarativeParserStatus> -#include <QAbstractListModel> - -QT_BEGIN_NAMESPACE - -class QGeoServiceProvider; -class QGeoSearchManager; -class QDeclarativeGeoPlace; - -class QDeclarativeGeoSearchModel : public QAbstractListModel, public QDeclarativeParserStatus -{ - Q_OBJECT - Q_ENUMS(Status) - - Q_PROPERTY(QDeclarativeGeoServiceProvider *plugin READ plugin WRITE setPlugin NOTIFY pluginChanged) - Q_PROPERTY(Status status READ status NOTIFY statusChanged) - Q_PROPERTY(QString error READ error NOTIFY errorChanged) - Q_INTERFACES(QDeclarativeParserStatus) - -public: - enum Status { - Null, - Ready, - Loading, - Error - }; - - enum Roles { - PlaceRole = Qt::UserRole + 499, - LandmarkRole = Qt::UserRole + 500 - }; - - explicit QDeclarativeGeoSearchModel(QObject* parent = 0); - virtual ~QDeclarativeGeoSearchModel(); - - // From QDeclarativeParserStatus - virtual void classBegin(); - virtual void componentComplete(); - - // From QAbstractListModel - virtual int rowCount(const QModelIndex &parent) const; - virtual QVariant data(const QModelIndex &index, int role) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const; - - void setPlugin(QDeclarativeGeoServiceProvider *plugin); - QDeclarativeGeoServiceProvider* plugin() const; - - Status status() const; - - QString error() const; - -Q_SIGNALS: - void pluginChanged(QDeclarativeGeoServiceProvider *plugin); - void statusChanged(QDeclarativeGeoSearchModel::Status status); - void errorChanged(const QString &error); - void placesChanged(); - -private Q_SLOTS: - void searchFinished(QGeoSearchReply *reply); - void searchError(QGeoSearchReply *reply, - QGeoSearchReply::Error error, - const QString &errorString); - -protected: - QGeoSearchManager* searchManager(); - - QList<QGeoPlace> places() const; - - void setStatus(Status status); - - void setError(const QString &error); - -private: - void setPlaces(const QList<QGeoPlace> &places); - - QDeclarativeGeoServiceProvider* plugin_; - QGeoServiceProvider* serviceProvider_; - QGeoSearchManager* searchManager_; - - Status status_; - QString error_; - QList<QGeoPlace> places_; -}; - - -QT_END_NAMESPACE - -#endif diff --git a/src/imports/location/qdeclarativegeoserviceprovider.cpp b/src/imports/location/qdeclarativegeoserviceprovider.cpp index b2f1204e..aa7029ed 100644 --- a/src/imports/location/qdeclarativegeoserviceprovider.cpp +++ b/src/imports/location/qdeclarativegeoserviceprovider.cpp @@ -41,7 +41,7 @@ #include "qdeclarativegeoserviceprovider_p.h" #include "qgeoserviceprovider.h" -#include "qgeosearchmanager.h" +#include "qgeocodingmanager.h" #include "qgeomappingmanager.h" #include "qgeoroutingmanager.h" @@ -104,13 +104,13 @@ void QDeclarativeGeoServiceProvider::updateSupportStatus() return; } - QGeoSearchManager* searchManager = serviceProvider->searchManager(); - if (!searchManager || serviceProvider->error() != QGeoServiceProvider::NoError) { + QGeocodingManager* geocodingManager = serviceProvider->geocodingManager(); + if (!geocodingManager || serviceProvider->error() != QGeoServiceProvider::NoError) { setSupportsGeocoding(false); setSupportsReverseGeocoding(false); } else { - setSupportsGeocoding(searchManager->supportsGeocoding()); - setSupportsReverseGeocoding(searchManager->supportsReverseGeocoding()); + setSupportsGeocoding(geocodingManager->supportsGeocoding()); + setSupportsReverseGeocoding(geocodingManager->supportsReverseGeocoding()); } QGeoRoutingManager* routingManager = serviceProvider->routingManager(); diff --git a/src/imports/location/qdeclarativereversegeocodemodel.cpp b/src/imports/location/qdeclarativereversegeocodemodel.cpp deleted file mode 100644 index ecd46014..00000000 --- a/src/imports/location/qdeclarativereversegeocodemodel.cpp +++ /dev/null @@ -1,144 +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 "qdeclarativereversegeocodemodel_p.h" - -#include <qgeosearchmanager.h> - -QT_BEGIN_NAMESPACE - -QDeclarativeReverseGeocodeModel::QDeclarativeReverseGeocodeModel(QObject *parent) - : QDeclarativeGeoSearchModel(parent), - complete_(false) {} - -QDeclarativeReverseGeocodeModel::~QDeclarativeReverseGeocodeModel() {} - -void QDeclarativeReverseGeocodeModel::setCoordinate(QDeclarativeCoordinate *coordinate) -{ - if (coordinate_.coordinate() == coordinate->coordinate()) - return; - - coordinate_.setCoordinate(coordinate->coordinate()); - - emit coordinateChanged(&coordinate_); - - if (complete_) - update(); -} - -QDeclarativeCoordinate* QDeclarativeReverseGeocodeModel::coordinate() -{ - return &coordinate_; -} - -void QDeclarativeReverseGeocodeModel::componentComplete() -{ - if (!searchManager()) - return; - - complete_ = true; - update(); -} - -void QDeclarativeReverseGeocodeModel::update() -{ - if (searchManager() && coordinate_.coordinate().isValid()) { - - setStatus(QDeclarativeGeoSearchModel::Loading); - - searchManager()->reverseGeocode(coordinate_.coordinate()); - - // TODO check for finished - } -} - -QVariant QDeclarativeReverseGeocodeModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid()) - return QVariant(); - - if (index.row() > places().count()) - return QVariant(); - - QGeoPlace place = places().at(index.row()); - - if (role == Qt::DisplayRole) { - QGeoAddress address = place.address(); - - QStringList addressStrings; - if (!address.street().isEmpty()) - addressStrings << address.street(); - if (!address.city().isEmpty()) - addressStrings << address.city(); - - QStringList stateLine; - if (!address.state().isEmpty()) - stateLine << address.state(); - if (!address.postcode().isEmpty()) - stateLine << address.postcode(); - if (!address.country().isEmpty()) - stateLine << address.country(); - - QString stateString = stateLine.join(" "); - - if (!stateString.isEmpty()) - addressStrings << stateString; - - return addressStrings.join(", "); - } - - return QDeclarativeGeoSearchModel::data(index, role); -} - -QVariant QDeclarativeReverseGeocodeModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - if (section != 0) - return QVariant(); - - if (role == Qt::DisplayRole) - return QString("Address"); - - return QDeclarativeGeoSearchModel::headerData(section, orientation, role); -} - -#include "moc_qdeclarativereversegeocodemodel_p.cpp" - -QT_END_NAMESPACE diff --git a/src/imports/location/qdeclarativereversegeocodemodel_p.h b/src/imports/location/qdeclarativereversegeocodemodel_p.h deleted file mode 100644 index fd58e7b6..00000000 --- a/src/imports/location/qdeclarativereversegeocodemodel_p.h +++ /dev/null @@ -1,84 +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$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEREVERSEGEOCODEMODEL_H -#define QDECLARATIVEREVERSEGEOCODEMODEL_H - -#include "qdeclarativegeosearchmodel_p.h" - -#include "qdeclarativecoordinate_p.h" - -QT_BEGIN_NAMESPACE - -class QDeclarativeReverseGeocodeModel : public QDeclarativeGeoSearchModel -{ - - Q_OBJECT - - Q_PROPERTY(QDeclarativeCoordinate* coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged) - -public: - explicit QDeclarativeReverseGeocodeModel(QObject *parent = 0); - ~QDeclarativeReverseGeocodeModel(); - - void setCoordinate(QDeclarativeCoordinate *coordinate); - QDeclarativeCoordinate* coordinate(); - - // From QDeclarativeParserStatus - virtual void componentComplete(); - - // From QAbstractListModel - virtual QVariant data(const QModelIndex &index, int role) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const; - -Q_SIGNALS: - void coordinateChanged(QDeclarativeCoordinate *coordinate); - -private: - void update(); - - bool complete_; - QDeclarativeCoordinate coordinate_; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/location/maps/maps.pri b/src/location/maps/maps.pri index 6a5e8f1b..ffe5bd8e 100644 --- a/src/location/maps/maps.pri +++ b/src/location/maps/maps.pri @@ -4,6 +4,9 @@ INCLUDEPATH += maps include(tiled/tiled.pri) PUBLIC_HEADERS += \ + maps/qgeocodingmanager.h \ + maps/qgeocodingmanagerengine.h \ + maps/qgeocodereply.h \ maps/qgeomaneuver.h \ maps/qgeomapcircleobject.h \ maps/qgeomapcustomobject.h \ @@ -26,14 +29,14 @@ PUBLIC_HEADERS += \ maps/qgeoroutesegment.h \ maps/qgeoroutingmanager.h \ maps/qgeoroutingmanagerengine.h \ - maps/qgeosearchmanager.h \ - maps/qgeosearchmanagerengine.h \ - maps/qgeosearchreply.h \ maps/qgeoserviceprovider.h \ maps/qgeoserviceproviderfactory.h \ maps/qgraphicsgeomap.h PRIVATE_HEADERS += \ + maps/qgeocodingmanager_p.h \ + maps/qgeocodingmanagerengine_p.h \ + maps/qgeocodereply_p.h \ maps/qgeomaneuver_p.h \ maps/qgeomapcircleobject_p.h \ maps/qgeomapcustomobject_p.h \ @@ -56,14 +59,14 @@ PRIVATE_HEADERS += \ maps/qgeoroutesegment_p.h \ maps/qgeoroutingmanager_p.h \ maps/qgeoroutingmanagerengine_p.h \ - maps/qgeosearchmanager_p.h \ - maps/qgeosearchmanagerengine_p.h \ - maps/qgeosearchreply_p.h \ maps/qgeoserviceprovider_p.h \ maps/qgraphicsgeomap_p.h \ maps/qgeomapobjectengine_p.h SOURCES += \ + maps/qgeocodingmanager.cpp \ + maps/qgeocodingmanagerengine.cpp \ + maps/qgeocodereply.cpp \ maps/qgeomaneuver.cpp \ maps/qgeomapcircleobject.cpp \ maps/qgeomapcustomobject.cpp \ @@ -85,9 +88,6 @@ SOURCES += \ maps/qgeoroutesegment.cpp \ maps/qgeoroutingmanager.cpp \ maps/qgeoroutingmanagerengine.cpp \ - maps/qgeosearchmanager.cpp \ - maps/qgeosearchmanagerengine.cpp \ - maps/qgeosearchreply.cpp \ maps/qgeoserviceprovider.cpp \ maps/qgeoserviceproviderfactory.cpp \ maps/qgraphicsgeomap.cpp \ diff --git a/src/location/maps/qgeosearchreply.cpp b/src/location/maps/qgeocodereply.cpp index dd8ed226..65739aa7 100644 --- a/src/location/maps/qgeosearchreply.cpp +++ b/src/location/maps/qgeocodereply.cpp @@ -39,15 +39,15 @@ ** ****************************************************************************/ -#include "qgeosearchreply.h" -#include "qgeosearchreply_p.h" +#include "qgeocodereply.h" +#include "qgeocodereply_p.h" QT_BEGIN_NAMESPACE /*! - \class QGeoSearchReply + \class QGeocodeReply - \brief The QGeoSearchReply class manages an operation started by an - instance of QGeoSearchManager. + \brief The QGeocodeReply class manages an operation started by an + instance of QGeocodingManager. \inmodule QtLocation @@ -55,21 +55,21 @@ QT_BEGIN_NAMESPACE \ingroup maps-places - Instances of QGeoSearchReply manage the state and results of these + Instances of QGeocodeReply manage the state and results of these operations. The isFinished(), error() and errorString() methods provide information on whether the operation has completed and if it completed successfully. - The finished() and error(QGeoSearchReply::Error,QString) + The finished() and error(QGeocodeReply::Error,QString) signals can be used to monitor the progress of the operation. - It is possible that a newly created QGeoSearchReply may be in a finished + It is possible that a newly created QGeocodeReply may be in a finished state, most commonly because an error has occurred. Since such an instance will never emit the finished() or - error(QGeoSearchReply::Error,QString) signals, it is + error(QGeocodeReply::Error,QString) signals, it is important to check the result of isFinished() before making the connections - to the signals. The documentation for QGeoSearchManager demonstrates how + to the signals. The documentation for QGeocodingManager demonstrates how this might be carried out. If the operation completes successfully the results will be able to be @@ -77,14 +77,14 @@ QT_BEGIN_NAMESPACE */ /*! - \enum QGeoSearchReply::Error + \enum QGeocodeReply::Error Describes an error which prevented the completion of the operation. \value NoError No error has occurred. \value EngineNotSetError - The search manager that was used did not have a QGeoSearchManagerEngine instance associated with it. + The geocoding manager that was used did not have a QGeocodingManagerEngine instance associated with it. \value CommunicationError An error occurred while communicating with the service provider. \value ParseError @@ -99,23 +99,23 @@ QT_BEGIN_NAMESPACE */ /*! - Constructs a search reply with the specified \a parent. + Constructs a geocode reply with the specified \a parent. */ -QGeoSearchReply::QGeoSearchReply(QObject *parent) +QGeocodeReply::QGeocodeReply(QObject *parent) : QObject(parent), - d_ptr(new QGeoSearchReplyPrivate()) {} + d_ptr(new QGeocodeReplyPrivate()) {} /*! - Constructs a search reply with a given \a error and \a errorString and the specified \a parent. + Constructs a geocode reply with a given \a error and \a errorString and the specified \a parent. */ -QGeoSearchReply::QGeoSearchReply(Error error, const QString &errorString, QObject *parent) +QGeocodeReply::QGeocodeReply(Error error, const QString &errorString, QObject *parent) : QObject(parent), - d_ptr(new QGeoSearchReplyPrivate(error, errorString)) {} + d_ptr(new QGeocodeReplyPrivate(error, errorString)) {} /*! - Destroys this search reply object. + Destroys this reply object. */ -QGeoSearchReply::~QGeoSearchReply() +QGeocodeReply::~QGeocodeReply() { delete d_ptr; } @@ -126,11 +126,11 @@ QGeoSearchReply::~QGeoSearchReply() If \a finished is true, this will cause the finished() signal to be emitted. - If the operation completed successfully, QGeoSearchReply::setLocations() + If the operation completed successfully, QGeocodeReply::setLocations() should be called before this function. If an error occurred, - QGeoSearchReply::setError() should be used instead. + QGeocodeReply::setError() should be used instead. */ -void QGeoSearchReply::setFinished(bool finished) +void QGeocodeReply::setFinished(bool finished) { d_ptr->isFinished = finished; if (d_ptr->isFinished) @@ -141,7 +141,7 @@ void QGeoSearchReply::setFinished(bool finished) Return true if the operation completed successfully or encountered an error which cause the operation to come to a halt. */ -bool QGeoSearchReply::isFinished() const +bool QGeocodeReply::isFinished() const { return d_ptr->isFinished; } @@ -153,7 +153,7 @@ bool QGeoSearchReply::isFinished() const This wil also cause error() and finished() signals to be emitted, in that order. */ -void QGeoSearchReply::setError(QGeoSearchReply::Error error, const QString &errorString) +void QGeocodeReply::setError(QGeocodeReply::Error error, const QString &errorString) { d_ptr->error = error; d_ptr->errorString = errorString; @@ -164,9 +164,9 @@ void QGeoSearchReply::setError(QGeoSearchReply::Error error, const QString &erro /*! Returns the error state of this reply. - If the result is QGeoSearchReply::NoError then no error has occurred. + If the result is QGeocodeReply::NoError then no error has occurred. */ -QGeoSearchReply::Error QGeoSearchReply::error() const +QGeocodeReply::Error QGeocodeReply::error() const { return d_ptr->error; } @@ -179,9 +179,9 @@ QGeoSearchReply::Error QGeoSearchReply::error() const which case this will also return an empty string. To determine whether an error has occurred, check to see if - QGeoSearchReply::error() is equal to QGeoSearchReply::NoError. + QGeocodeReply::error() is equal to QGeocodeReply::NoError. */ -QString QGeoSearchReply::errorString() const +QString QGeocodeReply::errorString() const { return d_ptr->errorString; } @@ -189,7 +189,7 @@ QString QGeoSearchReply::errorString() const /*! Sets the viewport which contains the results to \a viewport. */ -void QGeoSearchReply::setViewport(QGeoBoundingArea *viewport) +void QGeocodeReply::setViewport(QGeoBoundingArea *viewport) { d_ptr->viewport = viewport; } @@ -198,9 +198,9 @@ void QGeoSearchReply::setViewport(QGeoBoundingArea *viewport) Returns the viewport which contains the results. This function will return 0 if no viewport bias - was specified in the QGeoSearchManager function which created this reply. + was specified in the QGeocodingManager function which created this reply. */ -QGeoBoundingArea* QGeoSearchReply::viewport() const +QGeoBoundingArea* QGeocodeReply::viewport() const { return d_ptr->viewport; } @@ -209,9 +209,9 @@ QGeoBoundingArea* QGeoSearchReply::viewport() const Returns a list of locations. The locations are the results of the operation corresponding to the - QGeoSearchManager function which created this reply. + QGeocodingManager function which created this reply. */ -QList<QGeoLocation> QGeoSearchReply::locations() const +QList<QGeoLocation> QGeocodeReply::locations() const { return d_ptr->locations; } @@ -219,7 +219,7 @@ QList<QGeoLocation> QGeoSearchReply::locations() const /*! Adds \a location to the list of locations in this reply. */ -void QGeoSearchReply::addLocation(const QGeoLocation &location) +void QGeocodeReply::addLocation(const QGeoLocation &location) { d_ptr->locations.append(location); } @@ -227,7 +227,7 @@ void QGeoSearchReply::addLocation(const QGeoLocation &location) /*! Sets the list of \a locations in the reply. */ -void QGeoSearchReply::setLocations(const QList<QGeoLocation> &locations) +void QGeocodeReply::setLocations(const QList<QGeoLocation> &locations) { d_ptr->locations = locations; } @@ -237,7 +237,7 @@ void QGeoSearchReply::setLocations(const QList<QGeoLocation> &locations) This will do nothing if the reply is finished. */ -void QGeoSearchReply::abort() +void QGeocodeReply::abort() { if (!isFinished()) setFinished(true); @@ -250,12 +250,8 @@ void QGeoSearchReply::abort() 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 - QGeoSearchManager::setAdditionalLandmarkManagers the number of results can - be as high as limit * (1 + number of additional landmark managers). */ -int QGeoSearchReply::limit() const +int QGeocodeReply::limit() const { return d_ptr->limit; } @@ -264,7 +260,7 @@ int QGeoSearchReply::limit() const Returns the offset into the entire result set at which to start fetching results. */ -int QGeoSearchReply::offset() const +int QGeocodeReply::offset() const { return d_ptr->offset; } @@ -274,7 +270,7 @@ int QGeoSearchReply::offset() const If \a limit is -1 then all available responses will be returned. */ -void QGeoSearchReply::setLimit(int limit) +void QGeocodeReply::setLimit(int limit) { d_ptr->limit = limit; } @@ -283,27 +279,27 @@ void QGeoSearchReply::setLimit(int limit) Sets the offset in the entire result set at which to start fetching result to \a offset. */ -void QGeoSearchReply::setOffset(int offset) +void QGeocodeReply::setOffset(int offset) { d_ptr->offset = offset; } /*! - \fn void QGeoSearchReply::finished() + \fn void QGeocodeReply::finished() This signal is emitted when this reply has finished processing. - If error() equals QGeoSearchReply::NoError then the processing + If error() equals QGeocodeReply::NoError then the processing finished successfully. - This signal and QGeoSearchManager::finished() will be + This signal and QGeocodingManager::finished() will be emitted at the same time. \note Do no delete this reply object in the slot connected to this signal. Use deleteLater() instead. */ /*! - \fn void QGeoSearchReply::error(QGeoSearchReply::Error error, const QString &errorString) + \fn void QGeocodeReply::error(QGeocodeReply::Error error, const QString &errorString) This signal is emitted when an error has been detected in the processing of this reply. The finished() signal will probably follow. @@ -311,7 +307,7 @@ void QGeoSearchReply::setOffset(int offset) The error will be described by the error code \a error. If \a errorString is not empty it will contain a textual description of the error. - This signal and QGeoSearchManager::error() will be emitted at the same time. + This signal and QGeocodingManager::error() will be emitted at the same time. \note Do no delete this reply object in the slot connected to this signal. Use deleteLater() instead. @@ -320,15 +316,15 @@ void QGeoSearchReply::setOffset(int offset) /******************************************************************************* *******************************************************************************/ -QGeoSearchReplyPrivate::QGeoSearchReplyPrivate() - : error(QGeoSearchReply::NoError), +QGeocodeReplyPrivate::QGeocodeReplyPrivate() + : error(QGeocodeReply::NoError), errorString(QLatin1String("")), isFinished(false), viewport(0), limit(-1), offset(0) {} -QGeoSearchReplyPrivate::QGeoSearchReplyPrivate(QGeoSearchReply::Error error, const QString &errorString) +QGeocodeReplyPrivate::QGeocodeReplyPrivate(QGeocodeReply::Error error, const QString &errorString) : error(error), errorString(errorString), isFinished(true), @@ -336,9 +332,9 @@ QGeoSearchReplyPrivate::QGeoSearchReplyPrivate(QGeoSearchReply::Error error, con limit(-1), offset(0) {} -QGeoSearchReplyPrivate::~QGeoSearchReplyPrivate() {} +QGeocodeReplyPrivate::~QGeocodeReplyPrivate() {} -#include "moc_qgeosearchreply.cpp" +#include "moc_qgeocodereply.cpp" QT_END_NAMESPACE diff --git a/src/location/maps/qgeosearchreply.h b/src/location/maps/qgeocodereply.h index fc0c4d4c..4da67d5e 100644 --- a/src/location/maps/qgeosearchreply.h +++ b/src/location/maps/qgeocodereply.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QGEOSEARCHREPLY_H -#define QGEOSEARCHREPLY_H +#ifndef QGEOCODEREPLY_H +#define QGEOCODEREPLY_H #include "qgeolocation.h" @@ -49,9 +49,9 @@ QT_BEGIN_NAMESPACE -class QGeoSearchReplyPrivate; +class QGeocodeReplyPrivate; -class Q_LOCATION_EXPORT QGeoSearchReply : public QObject +class Q_LOCATION_EXPORT QGeocodeReply : public QObject { Q_OBJECT @@ -66,8 +66,8 @@ public: UnknownError }; - QGeoSearchReply(Error error, const QString &errorString, QObject *parent = 0); - virtual ~QGeoSearchReply(); + QGeocodeReply(Error error, const QString &errorString, QObject *parent = 0); + virtual ~QGeocodeReply(); bool isFinished() const; Error error() const; @@ -83,10 +83,10 @@ public: Q_SIGNALS: void finished(); - void error(QGeoSearchReply::Error error, const QString &errorString = QString()); + void error(QGeocodeReply::Error error, const QString &errorString = QString()); protected: - QGeoSearchReply(QObject* parent = 0); + QGeocodeReply(QObject* parent = 0); void setError(Error error, const QString &errorString); void setFinished(bool finished); @@ -99,8 +99,8 @@ protected: void setOffset(int offset); private: - QGeoSearchReplyPrivate *d_ptr; - Q_DISABLE_COPY(QGeoSearchReply) + QGeocodeReplyPrivate *d_ptr; + Q_DISABLE_COPY(QGeocodeReply) }; QT_END_NAMESPACE diff --git a/src/location/maps/qgeosearchreply_p.h b/src/location/maps/qgeocodereply_p.h index 16431a6a..afcab0da 100644 --- a/src/location/maps/qgeosearchreply_p.h +++ b/src/location/maps/qgeocodereply_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QGEOSEARCHREPLY_P_H -#define QGEOSEARCHREPLY_P_H +#ifndef QGEOCODEREPLY_P_H +#define QGEOCODEREPLY_P_H // // W A R N I N G @@ -53,7 +53,7 @@ // We mean it. // -#include "qgeosearchreply.h" +#include "qgeocodereply.h" #include "qgeoboundingarea.h" @@ -63,14 +63,14 @@ QT_BEGIN_NAMESPACE class QGeoLocation; -class QGeoSearchReplyPrivate +class QGeocodeReplyPrivate { public: - QGeoSearchReplyPrivate(); - QGeoSearchReplyPrivate(QGeoSearchReply::Error error, const QString& errorString); - ~QGeoSearchReplyPrivate(); + QGeocodeReplyPrivate(); + QGeocodeReplyPrivate(QGeocodeReply::Error error, const QString& errorString); + ~QGeocodeReplyPrivate(); - QGeoSearchReply::Error error; + QGeocodeReply::Error error; QString errorString; bool isFinished; @@ -80,7 +80,7 @@ public: int limit; int offset; private: - Q_DISABLE_COPY(QGeoSearchReplyPrivate) + Q_DISABLE_COPY(QGeocodeReplyPrivate) }; QT_END_NAMESPACE diff --git a/src/location/maps/qgeosearchmanager.cpp b/src/location/maps/qgeocodingmanager.cpp index c9e6f784..26382dee 100644 --- a/src/location/maps/qgeosearchmanager.cpp +++ b/src/location/maps/qgeocodingmanager.cpp @@ -39,9 +39,9 @@ ** ****************************************************************************/ -#include "qgeosearchmanager.h" -#include "qgeosearchmanager_p.h" -#include "qgeosearchmanagerengine.h" +#include "qgeocodingmanager.h" +#include "qgeocodingmanager_p.h" +#include "qgeocodingmanagerengine.h" #include "qgeoboundingbox.h" #include "qgeoboundingcircle.h" @@ -51,10 +51,10 @@ QT_BEGIN_NAMESPACE /*! - \class QGeoSearchManager + \class QGeocodingManager - \brief The QGeoSearchManager class provides support for searching - operations related to geographic information. + \brief The QGeocodingManager class provides support for geocoding + operations. \inmodule QtLocation @@ -63,18 +63,18 @@ QT_BEGIN_NAMESPACE \ingroup maps-places The geocode(), reverseGeocode() and search() functions return - QGeoSearchReply objects, which manage these operations and report on the + QGeocodeReply objects, which manage these operations and report on the result of the operations and any errors which may have occurred. The geocode() and reverseGeocode() functions can be used to convert QGeoAddress instances to QGeoCoordinate instances and vice-versa. - The search() function allows a user to perform a free text search - for location information. If the string provided can be interpreted as + The geocode() function is also overloaded to allow a user to perform a free text + geocoding operation, 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(). + Instances of QGeocodingManager can be accessed with + QGeoServiceProvider::geocodingManager(). */ /*! @@ -82,47 +82,47 @@ QT_BEGIN_NAMESPACE implementation provided by \a engine. This constructor is used interally by QGeoServiceProviderFactory. Regular - users should acquire instances of QGeoSearchManager with - QGeoServiceProvider::searchManager(); + users should acquire instances of QGeocodingManager with + QGeoServiceProvider::geocodingManager(); */ -QGeoSearchManager::QGeoSearchManager(QGeoSearchManagerEngine *engine, QObject *parent) +QGeocodingManager::QGeocodingManager(QGeocodingManagerEngine *engine, QObject *parent) : QObject(parent), - d_ptr(new QGeoSearchManagerPrivate()) + d_ptr(new QGeocodingManagerPrivate()) { d_ptr->engine = engine; if (d_ptr->engine) { d_ptr->engine->setParent(this); connect(d_ptr->engine, - SIGNAL(finished(QGeoSearchReply*)), + SIGNAL(finished(QGeocodeReply*)), this, - SIGNAL(finished(QGeoSearchReply*))); + SIGNAL(finished(QGeocodeReply*))); connect(d_ptr->engine, - SIGNAL(error(QGeoSearchReply*, QGeoSearchReply::Error, QString)), + SIGNAL(error(QGeocodeReply*, QGeocodeReply::Error, QString)), this, - SIGNAL(error(QGeoSearchReply*, QGeoSearchReply::Error, QString))); + SIGNAL(error(QGeocodeReply*, QGeocodeReply::Error, QString))); } else { - qFatal("The search manager engine that was set for this search manager was NULL."); + qFatal("The geocoding manager engine that was set for this geocoding manager was NULL."); } } /*! Destroys this manager. */ -QGeoSearchManager::~QGeoSearchManager() +QGeocodingManager::~QGeocodingManager() { delete d_ptr; } /*! Returns the name of the engine which implements the behaviour of this - search manager. + geocoding manager. The combination of managerName() and managerVersion() should be unique amongst the plugin implementations. */ -QString QGeoSearchManager::managerName() const +QString QGeocodingManager::managerName() const { // if (!d_ptr->engine) // return QString(); @@ -132,12 +132,12 @@ QString QGeoSearchManager::managerName() const /*! Returns the version of the engine which implements the behaviour of this - search manager. + geocoding manager. The combination of managerName() and managerVersion() should be unique amongst the plugin implementations. */ -int QGeoSearchManager::managerVersion() const +int QGeocodingManager::managerVersion() const { // if (!d_ptr->engine) // return -1; @@ -149,16 +149,16 @@ int QGeoSearchManager::managerVersion() const Begins the geocoding of \a address. Geocoding is the process of finding a coordinate that corresponds to a given address. - A QGeoSearchReply object will be returned, which can be used to manage the + A QGeocodeReply object will be returned, which can be used to manage the geocoding operation and to return the results of the operation. - This manager and the returned QGeoSearchReply object will emit signals + This manager and the returned QGeocodeReply object will emit signals indicating if the operation completes or if errors occur. If supportsGeocoding() returns false an - QGeoSearchReply::UnsupportedOptionError will occur. + QGeocodeReply::UnsupportedOptionError will occur. - Once the operation has completed, QGeoSearchReply::locations() can be used to + Once the operation has completed, QGeocodeReply::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. @@ -172,14 +172,14 @@ int QGeoSearchManager::managerVersion() const service will attempt to geocode all matches for the specified data. The user is responsible for deleting the returned reply object, although - this can be done in the slot connected to QGeoSearchManager::finished(), - QGeoSearchManager::error(), QGeoSearchReply::finished() or - QGeoSearchReply::error() with deleteLater(). + this can be done in the slot connected to QGeocodingManager::finished(), + QGeocodingManager::error(), QGeocodeReply::finished() or + QGeocodeReply::error() with deleteLater(). */ -QGeoSearchReply* QGeoSearchManager::geocode(const QGeoAddress &address, QGeoBoundingArea *bounds) +QGeocodeReply* QGeocodingManager::geocode(const QGeoAddress &address, QGeoBoundingArea *bounds) { // if (!d_ptr->engine) -// return new QGeoSearchReply(QGeoSearchReply::EngineNotSetError, "The search manager was not created with a valid engine.", this); +// return new QGeocodeReply(QGeocodeReply::EngineNotSetError, "The geocoding manager was not created with a valid engine.", this); return d_ptr->engine->geocode(address, bounds); } @@ -189,16 +189,16 @@ QGeoSearchReply* QGeoSearchManager::geocode(const QGeoAddress &address, QGeoBoun Begins the reverse geocoding of \a coordinate. Reverse geocoding is the process of finding an address that corresponds to a given coordinate. - A QGeoSearchReply object will be returned, which can be used to manage the + A QGeocodeReply object will be returned, which can be used to manage the reverse geocoding operation and to return the results of the operation. - This manager and the returned QGeoSearchReply object will emit signals + This manager and the returned QGeocodeReply object will emit signals indicating if the operation completes or if errors occur. If supportsReverseGeocoding() returns false an - QGeoSearchReply::UnsupportedOptionError will occur. + QGeocodeReply::UnsupportedOptionError will occur. - At that point QGeoSearchReply::locations() can be used to retrieve the + At that point QGeocodeReply::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. @@ -217,41 +217,35 @@ QGeoSearchReply* QGeoSearchManager::geocode(const QGeoAddress &address, QGeoBoun limit the results to thos that are contained within \a bounds. The user is responsible for deleting the returned reply object, although - this can be done in the slot connected to QGeoSearchManager::finished(), - QGeoSearchManager::error(), QGeoSearchReply::finished() or - QGeoSearchReply::error() with deleteLater(). + this can be done in the slot connected to QGeocodingManager::finished(), + QGeocodingManager::error(), QGeocodeReply::finished() or + QGeocodeReply::error() with deleteLater(). */ -QGeoSearchReply* QGeoSearchManager::reverseGeocode(const QGeoCoordinate &coordinate, QGeoBoundingArea *bounds) +QGeocodeReply* QGeocodingManager::reverseGeocode(const QGeoCoordinate &coordinate, QGeoBoundingArea *bounds) { // if (!d_ptr->engine) -// return new QGeoSearchReply(QGeoSearchReply::EngineNotSetError, "The search manager was not created with a valid engine.", this); +// return new QGeocodeReply(QGeocodeReply::EngineNotSetError, "The geocoding manager was not created with a valid engine.", this); return d_ptr->engine->reverseGeocode(coordinate, bounds); } /*! - 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. + Begins geocoding for a location matching \a address. - A QGeoSearchReply object will be returned, which can be used to manage the + A QGeocodeReply object will be returned, which can be used to manage the geocoding operation and to return the results of the operation. - This manager and the returned QGeoSearchReply object will emit signals + This manager and the returned QGeocodeReply object will emit signals indicating if the operation completes or if errors occur. - If supportsGeocoding() returns false and \a searchTypes is - QGeoSearchManager::SearchGeocode an - QGeoSearchReply::UnsupportedOptionError will occur. - - Once the operation has completed, QGeoSearchReply::locations() can be used to + Once the operation has completed, QGeocodeReply::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 \a limit is -1 the entire result set will be returned, otherwise at most \a limit results will be returned. - The \a offset parameter is used to ask the search service to not return the + The \a offset parameter is used to ask the geocoding service to not return the first \a offset results. The \a limit and \a offset results are used together to implement paging. @@ -260,19 +254,19 @@ QGeoSearchReply* QGeoSearchManager::reverseGeocode(const QGeoCoordinate &coordin limit the results to thos that are contained within \a bounds. The user is responsible for deleting the returned reply object, although - this can be done in the slot connected to QGeoSearchManager::finished(), - QGeoSearchManager::error(), QGeoSearchReply::finished() or - QGeoSearchReply::error() with deleteLater(). + this can be done in the slot connected to QGeocodingManager::finished(), + QGeocodingManager::error(), QGeocodeReply::finished() or + QGeocodeReply::error() with deleteLater(). */ -QGeoSearchReply* QGeoSearchManager::search(const QString &searchString, +QGeocodeReply* QGeocodingManager::geocode(const QString &address, int limit, int offset, QGeoBoundingArea *bounds) { // if (!d_ptr->engine) -// return new QGeoSearchReply(QGeoSearchReply::EngineNotSetError, "The search manager was not created with a valid engine.", this); +// return new QGeocodeReply(QGeocodeReply::EngineNotSetError, "The geocoding manager was not created with a valid engine.", this); - QGeoSearchReply *reply = d_ptr->engine->search(searchString, + QGeocodeReply *reply = d_ptr->engine->geocode(address, limit, offset, bounds); @@ -282,7 +276,7 @@ QGeoSearchReply* QGeoSearchManager::search(const QString &searchString, /*! Returns whether this manager supports geocoding. */ -bool QGeoSearchManager::supportsGeocoding() const +bool QGeocodingManager::supportsGeocoding() const { // if (!d_ptr->engine) // return false; @@ -293,7 +287,7 @@ bool QGeoSearchManager::supportsGeocoding() const /*! Returns whether this manager supports reverse geocoding. */ -bool QGeoSearchManager::supportsReverseGeocoding() const +bool QGeocodingManager::supportsReverseGeocoding() const { return d_ptr->engine->supportsReverseGeocoding(); } @@ -301,34 +295,34 @@ bool QGeoSearchManager::supportsReverseGeocoding() const /*! Sets the locale to be used by the this manager to \a locale. - If this search manager supports returning the results + If this geocoding manager supports returning the results in different languages, they will be returned in the language of \a locale. The locale used defaults to the system locale if this is not set. */ -void QGeoSearchManager::setLocale(const QLocale &locale) +void QGeocodingManager::setLocale(const QLocale &locale) { d_ptr->engine->setLocale(locale); } /*! - Returns the locale used to hint to this search manager about what + Returns the locale used to hint to this geocoding manager about what language to use for the results. */ -QLocale QGeoSearchManager::locale() const +QLocale QGeocodingManager::locale() const { return d_ptr->engine->locale(); } /*! -\fn void QGeoSearchManager::finished(QGeoSearchReply* reply) +\fn void QGeocodingManager::finished(QGeocodeReply* reply) This signal is emitted when \a reply has finished processing. - If reply::error() equals QGeoSearchReply::NoError then the processing + If reply::error() equals QGeocodeReply::NoError then the processing finished successfully. - This signal and QGeoSearchReply::finished() will be emitted at the same + This signal and QGeocodeReply::finished() will be emitted at the same time. \note Do no delete the \a reply object in the slot connected to this @@ -336,15 +330,15 @@ QLocale QGeoSearchManager::locale() const */ /*! -\fn void QGeoSearchManager::error(QGeoSearchReply* reply, QGeoSearchReply::Error error, QString errorString) +\fn void QGeocodingManager::error(QGeocodeReply* reply, QGeocodeReply::Error error, QString errorString) This signal is emitted when an error has been detected in the processing of - \a reply. The QGeoSearchManager::finished() signal will probably follow. + \a reply. The QGeocodingManager::finished() signal will probably follow. The error will be described by the error code \a error. If \a errorString is not empty it will contain a textual description of the error. - This signal and QGeoSearchReply::error() will be emitted at the same time. + This signal and QGeocodeReply::error() will be emitted at the same time. \note Do no delete the \a reply object in the slot connected to this signal. Use deleteLater() instead. @@ -353,10 +347,10 @@ QLocale QGeoSearchManager::locale() const /******************************************************************************* *******************************************************************************/ -QGeoSearchManagerPrivate::QGeoSearchManagerPrivate() +QGeocodingManagerPrivate::QGeocodingManagerPrivate() : engine(0) {} -QGeoSearchManagerPrivate::~QGeoSearchManagerPrivate() +QGeocodingManagerPrivate::~QGeocodingManagerPrivate() { if (engine) delete engine; @@ -365,6 +359,6 @@ QGeoSearchManagerPrivate::~QGeoSearchManagerPrivate() /******************************************************************************* *******************************************************************************/ -#include "moc_qgeosearchmanager.cpp" +#include "moc_qgeocodingmanager.cpp" QT_END_NAMESPACE diff --git a/src/location/maps/qgeosearchmanager.h b/src/location/maps/qgeocodingmanager.h index 8255afa7..a981c9c6 100644 --- a/src/location/maps/qgeosearchmanager.h +++ b/src/location/maps/qgeocodingmanager.h @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#ifndef QGEOSEARCHMANAGER_H -#define QGEOSEARCHMANAGER_H +#ifndef QGEOCODINGMANAGER_H +#define QGEOCODINGMANAGER_H -#include "qgeosearchreply.h" +#include "qgeocodereply.h" #include "qgeoboundingbox.h" #include <QObject> @@ -52,30 +52,28 @@ QT_BEGIN_NAMESPACE class QLocale; -class QLandmarkManager; +class QGeocodingManagerEngine; +class QGeocodingManagerPrivate; -class QGeoSearchManagerEngine; -class QGeoSearchManagerPrivate; - -class Q_LOCATION_EXPORT QGeoSearchManager : public QObject +class Q_LOCATION_EXPORT QGeocodingManager : public QObject { Q_OBJECT public: - ~QGeoSearchManager(); + ~QGeocodingManager(); QString managerName() const; int managerVersion() const; - QGeoSearchReply* geocode(const QGeoAddress &address, + QGeocodeReply* geocode(const QGeoAddress &address, QGeoBoundingArea *bounds = 0); - QGeoSearchReply* reverseGeocode(const QGeoCoordinate &coordinate, - QGeoBoundingArea *bounds = 0); - - QGeoSearchReply* search(const QString &searchString, + QGeocodeReply* geocode(const QString &searchString, int limit = -1, int offset = 0, QGeoBoundingArea *bounds = 0); + QGeocodeReply* reverseGeocode(const QGeoCoordinate &coordinate, + QGeoBoundingArea *bounds = 0); + bool supportsGeocoding() const; bool supportsReverseGeocoding() const; @@ -83,14 +81,14 @@ public: QLocale locale() const; Q_SIGNALS: - void finished(QGeoSearchReply* reply); - void error(QGeoSearchReply* reply, QGeoSearchReply::Error error, QString errorString = QString()); + void finished(QGeocodeReply* reply); + void error(QGeocodeReply* reply, QGeocodeReply::Error error, QString errorString = QString()); private: - QGeoSearchManager(QGeoSearchManagerEngine *engine, QObject *parent = 0); + QGeocodingManager(QGeocodingManagerEngine *engine, QObject *parent = 0); - QGeoSearchManagerPrivate *d_ptr; - Q_DISABLE_COPY(QGeoSearchManager) + QGeocodingManagerPrivate *d_ptr; + Q_DISABLE_COPY(QGeocodingManager) friend class QGeoServiceProvider; }; diff --git a/src/location/maps/qgeosearchmanager_p.h b/src/location/maps/qgeocodingmanager_p.h index 451b05c7..4cf00514 100644 --- a/src/location/maps/qgeosearchmanager_p.h +++ b/src/location/maps/qgeocodingmanager_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QGEOSEARCHMANAGER_P_H -#define QGEOSEARCHMANAGER_P_H +#ifndef QGEOCODINGMANAGER_P_H +#define QGEOCODINGMANAGER_P_H // // W A R N I N G @@ -53,26 +53,26 @@ // We mean it. // -#include "qgeosearchmanager.h" +#include "qgeocodingmanager.h" -#include "qgeosearchreply.h" +#include "qgeocodereply.h" #include <QList> QT_BEGIN_NAMESPACE -class QGeoSearchManagerEngine; +class QGeocodingManagerEngine; -class QGeoSearchManagerPrivate +class QGeocodingManagerPrivate { public: - QGeoSearchManagerPrivate(); - ~QGeoSearchManagerPrivate(); + QGeocodingManagerPrivate(); + ~QGeocodingManagerPrivate(); - QGeoSearchManagerEngine *engine; + QGeocodingManagerEngine *engine; private: - Q_DISABLE_COPY(QGeoSearchManagerPrivate) + Q_DISABLE_COPY(QGeocodingManagerPrivate) }; QT_END_NAMESPACE diff --git a/src/location/maps/qgeosearchmanagerengine.cpp b/src/location/maps/qgeocodingmanagerengine.cpp index 14bee38b..cdbee203 100644 --- a/src/location/maps/qgeosearchmanagerengine.cpp +++ b/src/location/maps/qgeocodingmanagerengine.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qgeosearchmanagerengine.h" -#include "qgeosearchmanagerengine_p.h" +#include "qgeocodingmanagerengine.h" +#include "qgeocodingmanagerengine_p.h" #include "qgeoaddress.h" #include "qgeocoordinate.h" @@ -48,11 +48,11 @@ QT_BEGIN_NAMESPACE /*! - \class QGeoSearchManagerEngine + \class QGeocodingManagerEngine - \brief The QGeoSearchManagerEngine class provides an interface and + \brief The QGeocodingManagerEngine class provides an interface and convenience methods to implementers of QGeoServiceProvider plugins who want - to provide support for searching operations related to geographic data. + to provide support for geocoding operations. \inmodule QtLocation \since 1.1 @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE In the default implementation, supportsGeocoding() and supportsReverseGeocoding() returns false while geocode() and reverseGeocode() - cause QGeoSearchReply::UnsupportedOptionError to occur. + cause QGeocodeReply::UnsupportedOptionError to occur. If the service provider supports geocoding the subclass should provide an implementation of geocode() and call setSupportsGeocoding(true) at @@ -72,21 +72,21 @@ QT_BEGIN_NAMESPACE setSupportsReverseGeocoding(true) at some point in time before reverseGeoocode() is called. - A subclass of QGeoSearchManagerEngine will often make use of a subclass - fo QGeoSearchReply internally, in order to add any engine-specific + A subclass of QGeocodingManagerEngine will often make use of a subclass + fo QGeocodeReply internally, in order to add any engine-specific data (such as a QNetworkReply object for network-based services) to the - QGeoSearchReply instances used by the engine. + QGeocodeReply instances used by the engine. - \sa QGeoSearchManager + \sa QGeocodingManager */ /*! Constructs a new engine with the specified \a parent, using \a parameters to pass any implementation specific data to the engine. */ -QGeoSearchManagerEngine::QGeoSearchManagerEngine(const QMap<QString, QVariant> ¶meters, QObject *parent) +QGeocodingManagerEngine::QGeocodingManagerEngine(const QMap<QString, QVariant> ¶meters, QObject *parent) : QObject(parent), - d_ptr(new QGeoSearchManagerEnginePrivate()) + d_ptr(new QGeocodingManagerEnginePrivate()) { Q_UNUSED(parameters) } @@ -94,7 +94,7 @@ QGeoSearchManagerEngine::QGeoSearchManagerEngine(const QMap<QString, QVariant> & /*! Destroys this engine. */ -QGeoSearchManagerEngine::~QGeoSearchManagerEngine() +QGeocodingManagerEngine::~QGeocodingManagerEngine() { delete d_ptr; } @@ -106,7 +106,7 @@ QGeoSearchManagerEngine::~QGeoSearchManagerEngine() The combination of managerName() and managerVersion() should be unique amongst plugin implementations. */ -void QGeoSearchManagerEngine::setManagerName(const QString &managerName) +void QGeocodingManagerEngine::setManagerName(const QString &managerName) { d_ptr->managerName = managerName; } @@ -118,7 +118,7 @@ void QGeoSearchManagerEngine::setManagerName(const QString &managerName) The combination of managerName() and managerVersion() should be unique amongst plugin implementations. */ -QString QGeoSearchManagerEngine::managerName() const +QString QGeocodingManagerEngine::managerName() const { return d_ptr->managerName; } @@ -129,7 +129,7 @@ QString QGeoSearchManagerEngine::managerName() const The combination of managerName() and managerVersion() should be unique amongst plugin implementations. */ -void QGeoSearchManagerEngine::setManagerVersion(int managerVersion) +void QGeocodingManagerEngine::setManagerVersion(int managerVersion) { d_ptr->managerVersion = managerVersion; } @@ -140,7 +140,7 @@ void QGeoSearchManagerEngine::setManagerVersion(int managerVersion) The combination of managerName() and managerVersion() should be unique amongst plugin implementations. */ -int QGeoSearchManagerEngine::managerVersion() const +int QGeocodingManagerEngine::managerVersion() const { return d_ptr->managerVersion; } @@ -149,16 +149,16 @@ int QGeoSearchManagerEngine::managerVersion() const Begins the geocoding of \a address. Geocoding is the process of finding a coordinate that corresponds to a given address. - A QGeoSearchReply object will be returned, which can be used to manage the + A QGeocodeReply object will be returned, which can be used to manage the geocoding operation and to return the results of the operation. - This engine and the returned QGeoSearchReply object will emit signals + This engine and the returned QGeocodeReply object will emit signals indicating if the operation completes or if errors occur. If supportsGeocoding() returns false an - QGeoSearchReply::UnsupportedOptionError will occur. + QGeocodeReply::UnsupportedOptionError will occur. - Once the operation has completed, QGeoSearchReply::locations() can be used to + Once the operation has completed, QGeocodeReply::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. @@ -172,16 +172,16 @@ int QGeoSearchManagerEngine::managerVersion() const service will attempt to geocode all matches for the specified data. The user is responsible for deleting the returned reply object, although - this can be done in the slot connected to QGeoSearchManagerEngine::finished(), - QGeoSearchManagerEngine::error(), QGeoSearchReply::finished() or - QGeoSearchReply::error() with deleteLater(). + this can be done in the slot connected to QGeocodingManagerEngine::finished(), + QGeocodingManagerEngine::error(), QGeocodeReply::finished() or + QGeocodeReply::error() with deleteLater(). */ -QGeoSearchReply* QGeoSearchManagerEngine::geocode(const QGeoAddress &address, +QGeocodeReply* QGeocodingManagerEngine::geocode(const QGeoAddress &address, QGeoBoundingArea *bounds) { Q_UNUSED(address) Q_UNUSED(bounds) - return new QGeoSearchReply(QGeoSearchReply::UnsupportedOptionError, + return new QGeocodeReply(QGeocodeReply::UnsupportedOptionError, QLatin1String("Geocoding is not supported by this service provider."), this); } @@ -189,16 +189,16 @@ QGeoSearchReply* QGeoSearchManagerEngine::geocode(const QGeoAddress &address, Begins the reverse geocoding of \a coordinate. Reverse geocoding is the process of finding an address that corresponds to a given coordinate. - A QGeoSearchReply object will be returned, which can be used to manage the + A QGeocodeReply object will be returned, which can be used to manage the reverse geocoding operation and to return the results of the operation. - This engine and the returned QGeoSearchReply object will emit signals + This engine and the returned QGeocodeReply object will emit signals indicating if the operation completes or if errors occur. If supportsReverseGeocoding() returns false an - QGeoSearchReply::UnsupportedOptionError will occur. + QGeocodeReply::UnsupportedOptionError will occur. - At that point QGeoSearchReply::locations() can be used to retrieve the + At that point QGeocodeReply::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. @@ -217,36 +217,36 @@ QGeoSearchReply* QGeoSearchManagerEngine::geocode(const QGeoAddress &address, limit the results to those that are contained by \a bounds. The user is responsible for deleting the returned reply object, although - this can be done in the slot connected to QGeoSearchManagerEngine::finished(), - QGeoSearchManagerEngine::error(), QGeoSearchReply::finished() or - QGeoSearchReply::error() with deleteLater(). + this can be done in the slot connected to QGeocodingManagerEngine::finished(), + QGeocodingManagerEngine::error(), QGeocodeReply::finished() or + QGeocodeReply::error() with deleteLater(). */ -QGeoSearchReply* QGeoSearchManagerEngine::reverseGeocode(const QGeoCoordinate &coordinate, +QGeocodeReply* QGeocodingManagerEngine::reverseGeocode(const QGeoCoordinate &coordinate, QGeoBoundingArea *bounds) { Q_UNUSED(coordinate) Q_UNUSED(bounds) - return new QGeoSearchReply(QGeoSearchReply::UnsupportedOptionError, + return new QGeocodeReply(QGeocodeReply::UnsupportedOptionError, QLatin1String("Reverse geocoding is not supported by this service provider."), this); } /*! - Begins searching for a location matching \a searchString. + Begins geocoding for a location matching \a address. - A QGeoSearchReply object will be returned, which can be used to manage the + A QGeocodeReply object will be returned, which can be used to manage the geocoding operation and to return the results of the operation. - This engine and the returned QGeoSearchReply object will emit signals + This engine and the returned QGeocodeReply object will emit signals indicating if the operation completes or if errors occur. - Once the operation has completed, QGeoSearchReply::locations() can be used to + Once the operation has completed, QGeocodeReply::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 \a limit is -1 the entire result set will be returned, otherwise at most \a limit results will be returned. - The \a offset parameter is used to ask the search service to not return the + The \a offset parameter is used to ask the geocoding service to not return the first \a offset results. The \a limit and \a offset results are used together to implement paging. @@ -255,21 +255,21 @@ QGeoSearchReply* QGeoSearchManagerEngine::reverseGeocode(const QGeoCoordinate &c limit the results to those that are contained by \a bounds. The user is responsible for deleting the returned reply object, although - this can be done in the slot connected to QGeoSearchManagerEngine::finished(), - QGeoSearchManagerEngine::error(), QGeoSearchReply::finished() or - QGeoSearchReply::error() with deleteLater(). + this can be done in the slot connected to QGeocodingManagerEngine::finished(), + QGeocodingManagerEngine::error(), QGeocodeReply::finished() or + QGeocodeReply::error() with deleteLater(). */ -QGeoSearchReply* QGeoSearchManagerEngine::search(const QString &searchString, +QGeocodeReply* QGeocodingManagerEngine::geocode(const QString &address, int limit, int offset, QGeoBoundingArea *bounds) { - Q_UNUSED(searchString) + Q_UNUSED(address) Q_UNUSED(limit) Q_UNUSED(offset) Q_UNUSED(bounds) - return new QGeoSearchReply(QGeoSearchReply::UnsupportedOptionError, + return new QGeocodeReply(QGeocodeReply::UnsupportedOptionError, QLatin1String("Searching is not supported by this service provider."), this); } @@ -280,7 +280,7 @@ QGeoSearchReply* QGeoSearchManagerEngine::search(const QString &searchString, reports its capabilities correctly. If this function is not used the engine will report that it does not support geocoding. */ -void QGeoSearchManagerEngine::setSupportsGeocoding(bool supported) +void QGeocodingManagerEngine::setSupportsGeocoding(bool supported) { d_ptr->supportsGeocoding = supported; } @@ -288,7 +288,7 @@ void QGeoSearchManagerEngine::setSupportsGeocoding(bool supported) /*! Returns whether this engine supports geocoding. */ -bool QGeoSearchManagerEngine::supportsGeocoding() const +bool QGeocodingManagerEngine::supportsGeocoding() const { return d_ptr->supportsGeocoding; } @@ -300,7 +300,7 @@ bool QGeoSearchManagerEngine::supportsGeocoding() const reports its capabilities correctly. If this function is not used the engine will report that it does not support reverse geocoding. */ -void QGeoSearchManagerEngine::setSupportsReverseGeocoding(bool supported) +void QGeocodingManagerEngine::setSupportsReverseGeocoding(bool supported) { d_ptr->supportsReverseGeocoding = supported; } @@ -308,7 +308,7 @@ void QGeoSearchManagerEngine::setSupportsReverseGeocoding(bool supported) /*! Returns whether this engine supports reverse geocoding. */ -bool QGeoSearchManagerEngine::supportsReverseGeocoding() const +bool QGeocodingManagerEngine::supportsReverseGeocoding() const { return d_ptr->supportsReverseGeocoding; } @@ -316,34 +316,34 @@ bool QGeoSearchManagerEngine::supportsReverseGeocoding() const /*! Sets the locale to be used by the this manager to \a locale. - If this search manager supports returning the results + If this geocoding manager supports returning the results in different languages, they will be returned in the language of \a locale. The locale used defaults to the system locale if this is not set. */ -void QGeoSearchManagerEngine::setLocale(const QLocale &locale) +void QGeocodingManagerEngine::setLocale(const QLocale &locale) { d_ptr->locale = locale; } /*! - Returns the locale used to hint to this search manager about what + Returns the locale used to hint to this geocoding manager about what language to use for the results. */ -QLocale QGeoSearchManagerEngine::locale() const +QLocale QGeocodingManagerEngine::locale() const { return d_ptr->locale; } /*! -\fn void QGeoSearchManagerEngine::finished(QGeoSearchReply* reply) +\fn void QGeocodingManagerEngine::finished(QGeocodeReply* reply) This signal is emitted when \a reply has finished processing. - If reply::error() equals QGeoSearchReply::NoError then the processing + If reply::error() equals QGeocodeReply::NoError then the processing finished successfully. - This signal and QGeoSearchReply::finished() will be emitted at the same + This signal and QGeocodeReply::finished() will be emitted at the same time. \note Do no delete the \a reply object in the slot connected to this @@ -351,15 +351,15 @@ QLocale QGeoSearchManagerEngine::locale() const */ /*! -\fn void QGeoSearchManagerEngine::error(QGeoSearchReply* reply, QGeoSearchReply::Error error, QString errorString) +\fn void QGeocodingManagerEngine::error(QGeocodeReply* reply, QGeocodeReply::Error error, QString errorString) This signal is emitted when an error has been detected in the processing of - \a reply. The QGeoSearchManagerEngine::finished() signal will probably follow. + \a reply. The QGeocodingManagerEngine::finished() signal will probably follow. The error will be described by the error code \a error. If \a errorString is not empty it will contain a textual description of the error. - This signal and QGeoSearchReply::error() will be emitted at the same time. + This signal and QGeocodeReply::error() will be emitted at the same time. \note Do no delete the \a reply object in the slot connected to this signal. Use deleteLater() instead. @@ -368,15 +368,15 @@ QLocale QGeoSearchManagerEngine::locale() const /******************************************************************************* *******************************************************************************/ -QGeoSearchManagerEnginePrivate::QGeoSearchManagerEnginePrivate() +QGeocodingManagerEnginePrivate::QGeocodingManagerEnginePrivate() : managerVersion(-1), supportsGeocoding(false), supportsReverseGeocoding(false) {} -QGeoSearchManagerEnginePrivate::~QGeoSearchManagerEnginePrivate() +QGeocodingManagerEnginePrivate::~QGeocodingManagerEnginePrivate() { } -#include "moc_qgeosearchmanagerengine.cpp" +#include "moc_qgeocodingmanagerengine.cpp" QT_END_NAMESPACE diff --git a/src/location/maps/qgeosearchmanagerengine.h b/src/location/maps/qgeocodingmanagerengine.h index 48bd7775..44df5e1c 100644 --- a/src/location/maps/qgeosearchmanagerengine.h +++ b/src/location/maps/qgeocodingmanagerengine.h @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#ifndef QGEOSEARCHMANAGERENGINE_H -#define QGEOSEARCHMANAGERENGINE_H +#ifndef QGEOCODINGMANAGERENGINE_H +#define QGEOCODINGMANAGERENGINE_H -#include "qgeosearchmanager.h" -#include "qgeosearchreply.h" +#include "qgeocodingmanager.h" +#include "qgeocodereply.h" #include "qgeoboundingbox.h" #include <QObject> @@ -51,27 +51,28 @@ QT_BEGIN_NAMESPACE -class QGeoSearchManagerEnginePrivate; +class QGeocodingManagerEnginePrivate; -class Q_LOCATION_EXPORT QGeoSearchManagerEngine : public QObject +class Q_LOCATION_EXPORT QGeocodingManagerEngine : public QObject { Q_OBJECT public: - QGeoSearchManagerEngine(const QMap<QString, QVariant> ¶meters, QObject *parent = 0); - virtual ~QGeoSearchManagerEngine(); + QGeocodingManagerEngine(const QMap<QString, QVariant> ¶meters, QObject *parent = 0); + virtual ~QGeocodingManagerEngine(); QString managerName() const; int managerVersion() const; - virtual QGeoSearchReply* geocode(const QGeoAddress &address, + virtual QGeocodeReply* geocode(const QGeoAddress &address, QGeoBoundingArea *bounds); - virtual QGeoSearchReply* reverseGeocode(const QGeoCoordinate &coordinate, - QGeoBoundingArea *bounds); - - virtual QGeoSearchReply* search(const QString &searchString, + virtual QGeocodeReply* geocode(const QString &address, int limit, int offset, QGeoBoundingArea *bounds); + virtual QGeocodeReply* reverseGeocode(const QGeoCoordinate &coordinate, + QGeoBoundingArea *bounds); + + bool supportsGeocoding() const; bool supportsReverseGeocoding() const; @@ -80,8 +81,8 @@ public: QLocale locale() const; Q_SIGNALS: - void finished(QGeoSearchReply* reply); - void error(QGeoSearchReply* reply, QGeoSearchReply::Error error, QString errorString = QString()); + void finished(QGeocodeReply* reply); + void error(QGeocodeReply* reply, QGeocodeReply::Error error, QString errorString = QString()); protected: void setSupportsGeocoding(bool supported); @@ -91,8 +92,8 @@ private: void setManagerName(const QString &managerName); void setManagerVersion(int managerVersion); - QGeoSearchManagerEnginePrivate *d_ptr; - Q_DISABLE_COPY(QGeoSearchManagerEngine) + QGeocodingManagerEnginePrivate *d_ptr; + Q_DISABLE_COPY(QGeocodingManagerEngine) friend class QGeoServiceProvider; }; diff --git a/src/location/maps/qgeosearchmanagerengine_p.h b/src/location/maps/qgeocodingmanagerengine_p.h index 44ce49af..0f3d46c7 100644 --- a/src/location/maps/qgeosearchmanagerengine_p.h +++ b/src/location/maps/qgeocodingmanagerengine_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QGEOSEARCHMANAGERENGINE_P_H -#define QGEOSEARCHMANAGERENGINE_P_H +#ifndef QGEOCODINGMANAGERENGINE_P_H +#define QGEOCODINGMANAGERENGINE_P_H // // W A R N I N G @@ -53,18 +53,18 @@ // We mean it. // -#include "qgeosearchmanagerengine.h" +#include "qgeocodingmanagerengine.h" #include <QList> #include <QLocale> QT_BEGIN_NAMESPACE -class QGeoSearchManagerEnginePrivate +class QGeocodingManagerEnginePrivate { public: - QGeoSearchManagerEnginePrivate(); - ~QGeoSearchManagerEnginePrivate(); + QGeocodingManagerEnginePrivate(); + ~QGeocodingManagerEnginePrivate(); QString managerName; int managerVersion; @@ -75,7 +75,7 @@ public: QLocale locale; private: - Q_DISABLE_COPY(QGeoSearchManagerEnginePrivate) + Q_DISABLE_COPY(QGeocodingManagerEnginePrivate) }; QT_END_NAMESPACE diff --git a/src/location/maps/qgeoserviceprovider.cpp b/src/location/maps/qgeoserviceprovider.cpp index 360514ea..52bcec36 100644 --- a/src/location/maps/qgeoserviceprovider.cpp +++ b/src/location/maps/qgeoserviceprovider.cpp @@ -43,11 +43,11 @@ #include "qgeoserviceprovider_p.h" #include "qgeoserviceproviderfactory.h" -#include "qgeosearchmanager.h" +#include "qgeocodingmanager.h" #include "qgeomappingmanager.h" #include "qgeoroutingmanager.h" #include "qplacemanager.h" -#include "qgeosearchmanagerengine.h" +#include "qgeocodingmanagerengine.h" #include "qgeomappingmanagerengine.h" #include "qgeoroutingmanagerengine.h" #include "qplacemanagerengine.h" @@ -153,50 +153,50 @@ QGeoServiceProvider::~QGeoServiceProvider() } /*! - Returns the QGeoSearchManager made available by the service + Returns the QGeocodingManager made available by the service provider. This function will return 0 if the service provider does not provide any geocoding services. - This function will attempt to construct a QGeoSearchManager instance + This function will attempt to construct a QGeocodingManager instance when it is called for the first time. If the attempt is successful the - QGeoSearchManager will be cached, otherwise each call of this function - will attempt to construct a QGeoSearchManager instance until the + QGeocodingManager will be cached, otherwise each call of this function + will attempt to construct a QGeocodingManager instance until the construction is successful. After this function has been called, error() and errorString() will report any errors which occurred during the construction of the - QGeoSearchManager. + QGeocodingManager. */ -QGeoSearchManager* QGeoServiceProvider::searchManager() const +QGeocodingManager* QGeoServiceProvider::geocodingManager() const { - if (!d_ptr->factory || (d_ptr->searchError != QGeoServiceProvider::NoError)) + if (!d_ptr->factory || (d_ptr->geocodeError != QGeoServiceProvider::NoError)) return 0; - if (!d_ptr->searchManager) { - QGeoSearchManagerEngine *engine = d_ptr->factory->createSearchManagerEngine(d_ptr->parameterMap, - &(d_ptr->searchError), - &(d_ptr->searchErrorString)); + if (!d_ptr->geocodingManager) { + QGeocodingManagerEngine *engine = d_ptr->factory->createGeocodingManagerEngine(d_ptr->parameterMap, + &(d_ptr->geocodeError), + &(d_ptr->geocodeErrorString)); if (engine) { engine->setManagerName(d_ptr->factory->providerName()); engine->setManagerVersion(d_ptr->factory->providerVersion()); - d_ptr->searchManager = new QGeoSearchManager(engine); + d_ptr->geocodingManager = new QGeocodingManager(engine); } else { - d_ptr->searchError = QGeoServiceProvider::NotSupportedError; - d_ptr->searchErrorString = QLatin1String("The service provider does not support searchManager()."); + d_ptr->geocodeError = QGeoServiceProvider::NotSupportedError; + d_ptr->geocodeErrorString = QLatin1String("The service provider does not support geocodingManager()."); } - if (d_ptr->searchError != QGeoServiceProvider::NoError) { - if (d_ptr->searchManager) - delete d_ptr->searchManager; - d_ptr->searchManager = 0; - d_ptr->error = d_ptr->searchError; - d_ptr->errorString = d_ptr->searchErrorString; + if (d_ptr->geocodeError != QGeoServiceProvider::NoError) { + if (d_ptr->geocodingManager) + delete d_ptr->geocodingManager; + d_ptr->geocodingManager = 0; + d_ptr->error = d_ptr->geocodeError; + d_ptr->errorString = d_ptr->geocodeErrorString; } } - return d_ptr->searchManager; + return d_ptr->geocodingManager; } /*! @@ -362,11 +362,11 @@ QString QGeoServiceProvider::errorString() const QGeoServiceProviderPrivate::QGeoServiceProviderPrivate() : factory(0), - searchManager(0), + geocodingManager(0), routingManager(0), mappingManager(0), placeManager(0), - searchError(QGeoServiceProvider::NoError), + geocodeError(QGeoServiceProvider::NoError), routingError(QGeoServiceProvider::NoError), mappingError(QGeoServiceProvider::NoError), placeError(QGeoServiceProvider::NoError), @@ -374,8 +374,8 @@ QGeoServiceProviderPrivate::QGeoServiceProviderPrivate() QGeoServiceProviderPrivate::~QGeoServiceProviderPrivate() { - if (searchManager) - delete searchManager; + if (geocodingManager) + delete geocodingManager; if (routingManager) delete routingManager; diff --git a/src/location/maps/qgeoserviceprovider.h b/src/location/maps/qgeoserviceprovider.h index ebda46c7..7dcc9a90 100644 --- a/src/location/maps/qgeoserviceprovider.h +++ b/src/location/maps/qgeoserviceprovider.h @@ -54,11 +54,11 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE class QStringList; -class QGeoSearchManager; +class QGeocodingManager; class QGeoMappingManager; class QGeoRoutingManager; class QPlaceManager; -class QGeoSearchManagerEngine; +class QGeocodingManagerEngine; class QGeoMappingManagerEngine; class QGeoRoutingManagerEngine; class QPlaceManagerEngine; @@ -80,7 +80,7 @@ public: ~QGeoServiceProvider(); - QGeoSearchManager* searchManager() const; + QGeocodingManager* geocodingManager() const; QGeoMappingManager* mappingManager() const; QGeoRoutingManager* routingManager() const; QPlaceManager *placeManager() const; diff --git a/src/location/maps/qgeoserviceprovider_p.h b/src/location/maps/qgeoserviceprovider_p.h index bb194e09..0d2bb772 100644 --- a/src/location/maps/qgeoserviceprovider_p.h +++ b/src/location/maps/qgeoserviceprovider_p.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE -class QGeoSearchManager; +class QGeocodingManager; class QGeoRoutingManager; class QGeoMappingManager; @@ -77,17 +77,17 @@ public: QMap<QString, QVariant> parameterMap; - QGeoSearchManager *searchManager; + QGeocodingManager *geocodingManager; QGeoRoutingManager *routingManager; QGeoMappingManager *mappingManager; QPlaceManager *placeManager; - QGeoServiceProvider::Error searchError; + QGeoServiceProvider::Error geocodeError; QGeoServiceProvider::Error routingError; QGeoServiceProvider::Error mappingError; QGeoServiceProvider::Error placeError; - QString searchErrorString; + QString geocodeErrorString; QString routingErrorString; QString mappingErrorString; QString placeErrorString; diff --git a/src/location/maps/qgeoserviceproviderfactory.cpp b/src/location/maps/qgeoserviceproviderfactory.cpp index 196f6877..20d10834 100644 --- a/src/location/maps/qgeoserviceproviderfactory.cpp +++ b/src/location/maps/qgeoserviceproviderfactory.cpp @@ -88,8 +88,8 @@ amongst the plugins. */ /*! - Returns a new QGeoSearchManagerEngine instance, initialized with \a - parameters, which implements the location searching functionality. + Returns a new QGeocodingManagerEngine instance, initialized with \a + parameters, which implements the location geocoding functionality. If \a error is not 0 it should be set to QGeoServiceProvider::NoError on success or an appropriate QGeoServiceProvider::Error on failure. @@ -100,7 +100,7 @@ amongst the plugins. The default implementation returns 0, which causes a QGeoServiceProvider::NotSupportedError in QGeoServiceProvider. */ -QGeoSearchManagerEngine* QGeoServiceProviderFactory::createSearchManagerEngine(const QMap<QString, QVariant> ¶meters, +QGeocodingManagerEngine* QGeoServiceProviderFactory::createGeocodingManagerEngine(const QMap<QString, QVariant> ¶meters, QGeoServiceProvider::Error *error, QString *errorString) const { @@ -113,7 +113,7 @@ QGeoSearchManagerEngine* QGeoServiceProviderFactory::createSearchManagerEngine(c /*! Returns a new QGeoMappingManagerEngine instance, initialized with \a - parameters, which implements the location searching functionality. + parameters, which implements mapping functionality. If \a error is not 0 it should be set to QGeoServiceProvider::NoError on success or an appropriate QGeoServiceProvider::Error on failure. @@ -137,7 +137,7 @@ QGeoMappingManagerEngine* QGeoServiceProviderFactory::createMappingManagerEngine /*! Returns a new QGeoRoutingManagerEngine instance, initialized with \a - parameters, which implements the location searching functionality. + parameters, which implements routing 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/maps/qgeoserviceproviderfactory.h b/src/location/maps/qgeoserviceproviderfactory.h index d8a80dd4..9877b5e8 100644 --- a/src/location/maps/qgeoserviceproviderfactory.h +++ b/src/location/maps/qgeoserviceproviderfactory.h @@ -59,7 +59,7 @@ public: virtual QString providerName() const = 0; virtual int providerVersion() const = 0; - virtual QGeoSearchManagerEngine* createSearchManagerEngine(const QMap<QString, QVariant> ¶meters, + virtual QGeocodingManagerEngine* createGeocodingManagerEngine(const QMap<QString, QVariant> ¶meters, QGeoServiceProvider::Error *error, QString *errorString) const; virtual QGeoMappingManagerEngine* createMappingManagerEngine(const QMap<QString, QVariant> ¶meters, diff --git a/src/plugins/geoservices/nokia/nokia.pro b/src/plugins/geoservices/nokia/nokia.pro index 4ed75df4..807a8249 100644 --- a/src/plugins/geoservices/nokia/nokia.pro +++ b/src/plugins/geoservices/nokia/nokia.pro @@ -9,27 +9,27 @@ DESTDIR = $$QT.location.plugins/geoservices #QTDIR_build:REQUIRES += "contains(QT_CONFIG, location)" HEADERS += \ + qgeocodereply_nokia.h \ qgeocodexmlparser.h \ + qgeocodingmanagerengine_nokia.h \ qgeomappingmanagerengine_nokia.h \ qgeomapreply_nokia.h \ qgeoroutereply_nokia.h \ qgeoroutexmlparser.h \ qgeoroutingmanagerengine_nokia.h \ - qgeosearchmanagerengine_nokia.h \ - qgeosearchreply_nokia.h \ qgeoserviceproviderplugin_nokia.h \ marclanguagecodes.h \ qgeotiledmapdata_nokia.h SOURCES += \ + qgeocodereply_nokia.cpp \ qgeocodexmlparser.cpp \ + qgeocodingmanagerengine_nokia.cpp \ qgeomappingmanagerengine_nokia.cpp \ qgeomapreply_nokia.cpp \ qgeoroutereply_nokia.cpp \ qgeoroutexmlparser.cpp \ qgeoroutingmanagerengine_nokia.cpp \ - qgeosearchmanagerengine_nokia.cpp \ - qgeosearchreply_nokia.cpp \ qgeoserviceproviderplugin_nokia.cpp \ qgeotiledmapdata_nokia.cpp @@ -45,7 +45,7 @@ symbian { TARGET.UID3 = 0x2002BFCA pluginDep.sources = $${TARGET}.dll pluginDep.path = $${QT_PLUGINS_BASE_DIR}/$${PLUGIN_TYPE} - DEPLOYMENT += pluginDep + DEPLOYMENT += pluginDep LIBS += -lefsrv } diff --git a/src/plugins/geoservices/nokia/qgeosearchreply_nokia.cpp b/src/plugins/geoservices/nokia/qgeocodereply_nokia.cpp index 836e00e3..7db3120c 100644 --- a/src/plugins/geoservices/nokia/qgeosearchreply_nokia.cpp +++ b/src/plugins/geoservices/nokia/qgeocodereply_nokia.cpp @@ -46,13 +46,13 @@ ** ****************************************************************************/ -#include "qgeosearchreply_nokia.h" +#include "qgeocodereply_nokia.h" #include "qgeocodexmlparser.h" QT_BEGIN_NAMESPACE -QGeoSearchReplyNokia::QGeoSearchReplyNokia(QNetworkReply *reply, int limit, int offset, QGeoBoundingArea *viewport, QObject *parent) - : QGeoSearchReply(parent), +QGeocodeReplyNokia::QGeocodeReplyNokia(QNetworkReply *reply, int limit, int offset, QGeoBoundingArea *viewport, QObject *parent) + : QGeocodeReply(parent), m_reply(reply) { connect(m_reply, @@ -70,12 +70,12 @@ QGeoSearchReplyNokia::QGeoSearchReplyNokia(QNetworkReply *reply, int limit, int setViewport(viewport); } -QGeoSearchReplyNokia::~QGeoSearchReplyNokia() +QGeocodeReplyNokia::~QGeocodeReplyNokia() { //TODO: possible mem leak -> m_reply->deleteLater() ? } -void QGeoSearchReplyNokia::abort() +void QGeocodeReplyNokia::abort() { if (!m_reply) return; @@ -86,14 +86,14 @@ void QGeoSearchReplyNokia::abort() m_reply = 0; } -void QGeoSearchReplyNokia::networkFinished() +void QGeocodeReplyNokia::networkFinished() { if (!m_reply) return; if (m_reply->error() != QNetworkReply::NoError) { // Removed because this is already done in networkError, which previously caused _two_ errors to be raised for every error. - //setError(QGeoSearchReply::CommunicationError, m_reply->errorString()); + //setError(QGeoCodeReply::CommunicationError, m_reply->errorString()); //m_reply->deleteLater(); //m_reply = 0; return; @@ -112,21 +112,21 @@ void QGeoSearchReplyNokia::networkFinished() setLocations(locations); setFinished(true); } else { - setError(QGeoSearchReply::ParseError, parser.errorString()); + setError(QGeocodeReply::ParseError, parser.errorString()); } m_reply->deleteLater(); m_reply = 0; } -void QGeoSearchReplyNokia::networkError(QNetworkReply::NetworkError error) +void QGeocodeReplyNokia::networkError(QNetworkReply::NetworkError error) { Q_UNUSED(error) if (!m_reply) return; - setError(QGeoSearchReply::CommunicationError, m_reply->errorString()); + setError(QGeocodeReply::CommunicationError, m_reply->errorString()); m_reply->deleteLater(); m_reply = 0; diff --git a/src/plugins/geoservices/nokia/qgeosearchreply_nokia.h b/src/plugins/geoservices/nokia/qgeocodereply_nokia.h index 9c47dd6b..940341e1 100644 --- a/src/plugins/geoservices/nokia/qgeosearchreply_nokia.h +++ b/src/plugins/geoservices/nokia/qgeocodereply_nokia.h @@ -49,17 +49,17 @@ #ifndef QGEOPLACESREPLY_NOKIA_H #define QGEOPLACESREPLY_NOKIA_H -#include <qgeosearchreply.h> +#include <qgeocodereply.h> #include <QNetworkReply> QT_BEGIN_NAMESPACE -class QGeoSearchReplyNokia : public QGeoSearchReply +class QGeocodeReplyNokia : public QGeocodeReply { Q_OBJECT public: - QGeoSearchReplyNokia(QNetworkReply *reply, int limit, int offset, QGeoBoundingArea *viewport, QObject *parent = 0); - ~QGeoSearchReplyNokia(); + QGeocodeReplyNokia(QNetworkReply *reply, int limit, int offset, QGeoBoundingArea *viewport, QObject *parent = 0); + ~QGeocodeReplyNokia(); void abort(); diff --git a/src/plugins/geoservices/nokia/qgeosearchmanagerengine_nokia.cpp b/src/plugins/geoservices/nokia/qgeocodingmanagerengine_nokia.cpp index 5ddaa480..01b2b916 100644 --- a/src/plugins/geoservices/nokia/qgeosearchmanagerengine_nokia.cpp +++ b/src/plugins/geoservices/nokia/qgeocodingmanagerengine_nokia.cpp @@ -46,8 +46,8 @@ ** ****************************************************************************/ -#include "qgeosearchmanagerengine_nokia.h" -#include "qgeosearchreply_nokia.h" +#include "qgeocodingmanagerengine_nokia.h" +#include "qgeocodereply_nokia.h" #include "marclanguagecodes.h" #include <qgeoaddress.h> @@ -58,8 +58,8 @@ QT_BEGIN_NAMESPACE -QGeoSearchManagerEngineNokia::QGeoSearchManagerEngineNokia(const QMap<QString, QVariant> ¶meters, QGeoServiceProvider::Error *error, QString *errorString) - : QGeoSearchManagerEngine(parameters), +QGeocodingManagerEngineNokia::QGeocodingManagerEngineNokia(const QMap<QString, QVariant> ¶meters, QGeoServiceProvider::Error *error, QString *errorString) + : QGeocodingManagerEngine(parameters), m_host("loc.desktop.maps.svc.ovi.com"), m_token(QGeoServiceProviderFactoryNokia::defaultToken), m_referer(QGeoServiceProviderFactoryNokia::defaultReferer) @@ -109,13 +109,13 @@ QGeoSearchManagerEngineNokia::QGeoSearchManagerEngineNokia(const QMap<QString, Q *errorString = ""; } -QGeoSearchManagerEngineNokia::~QGeoSearchManagerEngineNokia() {} +QGeocodingManagerEngineNokia::~QGeocodingManagerEngineNokia() {} -QGeoSearchReply* QGeoSearchManagerEngineNokia::geocode(const QGeoAddress &address, +QGeocodeReply* QGeocodingManagerEngineNokia::geocode(const QGeoAddress &address, QGeoBoundingArea *bounds) { if (!supportsGeocoding()) { - QGeoSearchReply *reply = new QGeoSearchReply(QGeoSearchReply::UnsupportedOptionError, "Geocoding is not supported by this service provider.", this); + QGeocodeReply *reply = new QGeocodeReply(QGeocodeReply::UnsupportedOptionError, "Geocoding is not supported by this service provider.", this); emit error(reply, reply->error(), reply->errorString()); return reply; } @@ -164,14 +164,14 @@ QGeoSearchReply* QGeoSearchManagerEngineNokia::geocode(const QGeoAddress &addres // requestString += address.streetNumber(); // } - return search(requestString, bounds); + return geocode(requestString, bounds); } -QGeoSearchReply* QGeoSearchManagerEngineNokia::reverseGeocode(const QGeoCoordinate &coordinate, +QGeocodeReply* QGeocodingManagerEngineNokia::reverseGeocode(const QGeoCoordinate &coordinate, QGeoBoundingArea *bounds) { if (!supportsReverseGeocoding()) { - QGeoSearchReply *reply = new QGeoSearchReply(QGeoSearchReply::UnsupportedOptionError, "Reverse geocoding is not supported by this service provider.", this); + QGeocodeReply *reply = new QGeocodeReply(QGeocodeReply::UnsupportedOptionError, "Reverse geocoding is not supported by this service provider.", this); emit error(reply, reply->error(), reply->errorString()); return reply; } @@ -189,10 +189,10 @@ QGeoSearchReply* QGeoSearchManagerEngineNokia::reverseGeocode(const QGeoCoordina requestString += "&lg="; requestString += languageToMarc(locale().language()); - return search(requestString, bounds); + return geocode(requestString, bounds); } -QGeoSearchReply* QGeoSearchManagerEngineNokia::search(const QString &searchString, +QGeocodeReply* QGeocodingManagerEngineNokia::geocode(const QString &address, int limit, int offset, QGeoBoundingArea *bounds) @@ -208,7 +208,7 @@ QGeoSearchReply* QGeoSearchManagerEngineNokia::search(const QString &searchStrin requestString += languageToMarc(locale().language()); requestString += "&obloc="; - requestString += searchString; + requestString += address; if (limit > 0) { requestString += "&total="; @@ -220,16 +220,16 @@ QGeoSearchReply* QGeoSearchManagerEngineNokia::search(const QString &searchStrin requestString += QString::number(offset); } - return search(requestString, bounds, limit, offset); + return geocode(requestString, bounds, limit, offset); } -QGeoSearchReply* QGeoSearchManagerEngineNokia::search(QString requestString, +QGeocodeReply* QGeocodingManagerEngineNokia::geocode(QString requestString, QGeoBoundingArea *bounds, int limit, int offset) { QNetworkReply *networkReply = m_networkManager->get(QNetworkRequest(QUrl(requestString))); - QGeoSearchReplyNokia *reply = new QGeoSearchReplyNokia(networkReply, limit, offset, bounds, this); + QGeocodeReplyNokia *reply = new QGeocodeReplyNokia(networkReply, limit, offset, bounds, this); connect(reply, SIGNAL(finished()), @@ -237,14 +237,14 @@ QGeoSearchReply* QGeoSearchManagerEngineNokia::search(QString requestString, SLOT(placesFinished())); connect(reply, - SIGNAL(error(QGeoSearchReply::Error, QString)), + SIGNAL(error(QGeocodeReply::Error, QString)), this, - SLOT(placesError(QGeoSearchReply::Error, QString))); + SLOT(placesError(QGeocodeReply::Error, QString))); return reply; } -QString QGeoSearchManagerEngineNokia::trimDouble(double degree, int decimalDigits) +QString QGeocodingManagerEngineNokia::trimDouble(double degree, int decimalDigits) { QString sDegree = QString::number(degree, 'g', decimalDigits); @@ -256,14 +256,14 @@ QString QGeoSearchManagerEngineNokia::trimDouble(double degree, int decimalDigit return QString::number(degree, 'g', decimalDigits + index); } -void QGeoSearchManagerEngineNokia::placesFinished() +void QGeocodingManagerEngineNokia::placesFinished() { - QGeoSearchReply *reply = qobject_cast<QGeoSearchReply*>(sender()); + QGeocodeReply *reply = qobject_cast<QGeocodeReply*>(sender()); if (!reply) return; - if (receivers(SIGNAL(finished(QGeoSearchReply*))) == 0) { + if (receivers(SIGNAL(finished(QGeocodeReply*))) == 0) { reply->deleteLater(); return; } @@ -271,14 +271,14 @@ void QGeoSearchManagerEngineNokia::placesFinished() emit finished(reply); } -void QGeoSearchManagerEngineNokia::placesError(QGeoSearchReply::Error error, const QString &errorString) +void QGeocodingManagerEngineNokia::placesError(QGeocodeReply::Error error, const QString &errorString) { - QGeoSearchReply *reply = qobject_cast<QGeoSearchReply*>(sender()); + QGeocodeReply *reply = qobject_cast<QGeocodeReply*>(sender()); if (!reply) return; - if (receivers(SIGNAL(error(QGeoSearchReply*, QGeoSearchReply::Error, QString))) == 0) { + if (receivers(SIGNAL(error(QGeocodeReply*, QGeocodeReply::Error, QString))) == 0) { reply->deleteLater(); return; } @@ -286,7 +286,7 @@ void QGeoSearchManagerEngineNokia::placesError(QGeoSearchReply::Error error, con emit this->error(reply, error, errorString); } -QString QGeoSearchManagerEngineNokia::languageToMarc(QLocale::Language language) +QString QGeocodingManagerEngineNokia::languageToMarc(QLocale::Language language) { uint offset = 3 * (uint(language)); if (language == QLocale::C || offset + 3 > sizeof(marc_language_code_list)) diff --git a/src/plugins/geoservices/nokia/qgeosearchmanagerengine_nokia.h b/src/plugins/geoservices/nokia/qgeocodingmanagerengine_nokia.h index dbaf94b5..d62780da 100644 --- a/src/plugins/geoservices/nokia/qgeosearchmanagerengine_nokia.h +++ b/src/plugins/geoservices/nokia/qgeocodingmanagerengine_nokia.h @@ -46,13 +46,13 @@ ** ****************************************************************************/ -#ifndef QGEOSEARCHMANAGER_NOKIA_H -#define QGEOSEARCHMANAGER_NOKIA_H +#ifndef QGEOCODINGMANAGER_NOKIA_H +#define QGEOCODINGMANAGER_NOKIA_H #include "qgeoserviceproviderplugin_nokia.h" #include <qgeoserviceprovider.h> -#include <qgeosearchmanagerengine.h> +#include <qgeocodingmanagerengine.h> #include <QNetworkAccessManager> #include <QLocale> @@ -60,32 +60,32 @@ QT_BEGIN_NAMESPACE -class QGeoSearchManagerEngineNokia : public QGeoSearchManagerEngine +class QGeocodingManagerEngineNokia : public QGeocodingManagerEngine { Q_OBJECT public: - QGeoSearchManagerEngineNokia(const QMap<QString, QVariant> ¶meters, + QGeocodingManagerEngineNokia(const QMap<QString, QVariant> ¶meters, QGeoServiceProvider::Error *error, QString *errorString); - ~QGeoSearchManagerEngineNokia(); + ~QGeocodingManagerEngineNokia(); - QGeoSearchReply* geocode(const QGeoAddress &address, + QGeocodeReply* geocode(const QGeoAddress &address, QGeoBoundingArea *bounds); - QGeoSearchReply* reverseGeocode(const QGeoCoordinate &coordinate, + QGeocodeReply* reverseGeocode(const QGeoCoordinate &coordinate, QGeoBoundingArea *bounds); - QGeoSearchReply* search(const QString &searchString, + QGeocodeReply* geocode(const QString &searchString, int limit, int offset, QGeoBoundingArea *bounds); private slots: void placesFinished(); - void placesError(QGeoSearchReply::Error error, const QString &errorString); + void placesError(QGeocodeReply::Error error, const QString &errorString); private: static QString trimDouble(double degree, int decimalDigits = 10); - QGeoSearchReply* search(QString requestString, QGeoBoundingArea *bounds, int limit = -1, int offset = 0); + QGeocodeReply* geocode(QString requestString, QGeoBoundingArea *bounds, int limit = -1, int offset = 0); QString languageToMarc(QLocale::Language language); QNetworkAccessManager *m_networkManager; diff --git a/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.cpp b/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.cpp index bd79ee8d..4bd0020b 100644 --- a/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.cpp +++ b/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.cpp @@ -48,7 +48,7 @@ #include "qgeoserviceproviderplugin_nokia.h" -#include "qgeosearchmanagerengine_nokia.h" +#include "qgeocodingmanagerengine_nokia.h" #include "qgeoroutingmanagerengine_nokia.h" #include "qgeomappingmanagerengine_nokia.h" #include "qplacemanagerengine_nokia.h" @@ -72,11 +72,11 @@ int QGeoServiceProviderFactoryNokia::providerVersion() const return 1; } -QGeoSearchManagerEngine* QGeoServiceProviderFactoryNokia::createSearchManagerEngine(const QMap<QString, QVariant> ¶meters, +QGeocodingManagerEngine* QGeoServiceProviderFactoryNokia::createGeocodingManagerEngine(const QMap<QString, QVariant> ¶meters, QGeoServiceProvider::Error *error, QString *errorString) const { - return new QGeoSearchManagerEngineNokia(parameters, error, errorString); + return new QGeocodingManagerEngineNokia(parameters, error, errorString); } QGeoMappingManagerEngine* QGeoServiceProviderFactoryNokia::createMappingManagerEngine(const QMap<QString, QVariant> ¶meters, diff --git a/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.h b/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.h index 97496fdf..d483347a 100644 --- a/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.h +++ b/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.h @@ -65,7 +65,7 @@ public: QString providerName() const; int providerVersion() const; - QGeoSearchManagerEngine* createSearchManagerEngine(const QMap<QString, QVariant> ¶meters, + QGeocodingManagerEngine* createGeocodingManagerEngine(const QMap<QString, QVariant> ¶meters, QGeoServiceProvider::Error *error, QString *errorString) const; QGeoMappingManagerEngine* createMappingManagerEngine(const QMap<QString, QVariant> ¶meters, diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index ab7cdd37..da8f8011 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -7,15 +7,15 @@ TEMPLATE = subdirs CONFIG += ordered SUBDIRS += geotestplugin \ - qgeosearchmanagerplugins \ + qgeocodingmanagerplugins \ qgeoaddress \ qgeoboundingbox \ qgeoboundingcircle \ qgeocoordinate \ qgeolocation \ qgeoplace \ - qgeosearchreply \ - qgeosearchmanager \ + qgeocodereply \ + qgeocodingmanager \ qplacebusinessfeature \ qplacecategory \ qplacedescription \ diff --git a/tests/auto/geotestplugin/geotestplugin.pro b/tests/auto/geotestplugin/geotestplugin.pro index 62febab2..c46db272 100644 --- a/tests/auto/geotestplugin/geotestplugin.pro +++ b/tests/auto/geotestplugin/geotestplugin.pro @@ -10,7 +10,7 @@ include($$QT_SOURCE_TREE/src/plugins/qpluginbase.pri) # TODO not sure where to put test plugins in Qt 5 DESTDIR = $$QT.location.plugins/geoservices -HEADERS += qgeosearchmanagerengine_test.h \ +HEADERS += qgeocodingmanagerengine_test.h \ qgeoserviceproviderplugin_test.h \ qgeoroutingmanagerengine_test.h diff --git a/tests/auto/geotestplugin/qgeosearchmanagerengine_test.h b/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h index b0d04a28..6c21e4f3 100644 --- a/tests/auto/geotestplugin/qgeosearchmanagerengine_test.h +++ b/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h @@ -39,16 +39,16 @@ ** ****************************************************************************/ -#ifndef QGEOSEARCHMANAGERENGINE_TEST_H -#define QGEOSEARCHMANAGERENGINE_TEST_H +#ifndef QGEOCODINGMANAGERENGINE_TEST_H +#define QGECODINGMANAGERENGINE_TEST_H #include <qgeoserviceprovider.h> -#include <qgeosearchmanagerengine.h> +#include <qgeocodingmanagerengine.h> #include <QLocale> #include <qlandmarkmanager.h> #include <qgeoaddress.h> #include <qgeolocation.h> -#include <qgeosearchreply.h> +#include <qgeocodereply.h> #include <QTimer> #include <QTimerEvent> @@ -56,11 +56,11 @@ QT_USE_NAMESPACE -class SearchReplyTest :public QGeoSearchReply +class GeocodeReplyTest :public QGeocodeReply { Q_OBJECT public: - SearchReplyTest(QObject *parent=0):QGeoSearchReply (parent) {} + GeocodeReplyTest(QObject *parent=0):QGeocodeReply (parent) {} void callAddLocation ( const QGeoLocation & location ) {addLocation(location);} void callSetError ( Error error, const QString & errorString ) {setError(error, errorString);} @@ -76,20 +76,20 @@ Q_SIGNALS: void aborted(); }; -class QGeoSearchManagerEngineTest: public QGeoSearchManagerEngine +class QGeocodingManagerEngineTest: public QGeocodingManagerEngine { Q_OBJECT public: - QGeoSearchManagerEngineTest(const QMap<QString, QVariant> ¶meters, + QGeocodingManagerEngineTest(const QMap<QString, QVariant> ¶meters, QGeoServiceProvider::Error *error, QString *errorString) : - QGeoSearchManagerEngine(parameters), + QGeocodingManagerEngine(parameters), validateWellKnownValues_(false), finishRequestImmediately_(true), supported_(true), - searchReply_(0), + geocodeReply_(0), timerId_(0), - errorCode_(QGeoSearchReply::NoError) + errorCode_(QGeocodeReply::NoError) { Q_UNUSED(error) Q_UNUSED(errorString) @@ -105,45 +105,45 @@ public: setLocale(*(new QLocale (QLocale::German, QLocale::Germany))); } - QGeoSearchReply* geocode ( const QGeoAddress & address, QGeoBoundingArea * bounds ) + QGeocodeReply* geocode ( const QGeoAddress & address, QGeoBoundingArea * bounds ) { - searchReply_ = new SearchReplyTest(); - connect(searchReply_, SIGNAL(aborted()), this, SLOT(requestAborted())); - searchReply_->callSetViewport(bounds); + geocodeReply_ = new GeocodeReplyTest(); + connect(geocodeReply_, SIGNAL(aborted()), this, SLOT(requestAborted())); + geocodeReply_->callSetViewport(bounds); if (address.street().startsWith("error")) { errorString_ = address.street(); - errorCode_ = (QGeoSearchReply::Error)address.county().toInt(); + errorCode_ = (QGeocodeReply::Error)address.county().toInt(); } else { errorString_ = ""; - errorCode_ = QGeoSearchReply::NoError; + errorCode_ = QGeocodeReply::NoError; } // 1. Check if we are to validate values if (validateWellKnownValues_) { if (address.street() != "wellknown street") { - searchReply_->callSetError(QGeoSearchReply::EngineNotSetError, address.street()); + geocodeReply_->callSetError(QGeocodeReply::EngineNotSetError, address.street()); } else { - searchReply_->callSetError(QGeoSearchReply::NoError,address.street()); + geocodeReply_->callSetError(QGeocodeReply::NoError,address.street()); } } // 2. Set the locations into the reply - setLocations(searchReply_, address); + setLocations(geocodeReply_, address); // 3. Finish the request if (finishRequestImmediately_) { // check if we should finish with error if (errorCode_) { - searchReply_->callSetError(errorCode_, errorString_); + geocodeReply_->callSetError(errorCode_, errorString_); } else { - searchReply_->callSetFinished(true); + geocodeReply_->callSetFinished(true); } } else { // we only allow serialized requests in QML - previous must have been aborted Q_ASSERT(timerId_ == 0); timerId_ = startTimer(200); } - return static_cast<QGeoSearchReply*>(searchReply_); + return static_cast<QGeocodeReply*>(geocodeReply_); } public Q_SLOTS: @@ -154,11 +154,11 @@ public Q_SLOTS: timerId_ = 0; } errorString_ = ""; - errorCode_ = QGeoSearchReply::NoError; + errorCode_ = QGeocodeReply::NoError; } public: - void setLocations(SearchReplyTest* reply, const QString searchString, int limit ) + void setLocations(GeocodeReplyTest* reply, const QString searchString, int limit ) { for (int i = 0; i < limit; ++i) { QGeoLocation location; @@ -169,7 +169,7 @@ public: } } - void setLocations(SearchReplyTest* reply, const QGeoAddress& address) + void setLocations(GeocodeReplyTest* reply, const QGeoAddress& address) { int count = address.county().toInt(); @@ -180,7 +180,7 @@ public: } } - void setLocations(SearchReplyTest* reply, const QGeoCoordinate & coordinate) + void setLocations(GeocodeReplyTest* reply, const QGeoCoordinate & coordinate) { for (int i = 0; i < coordinate.longitude(); ++i) { QGeoLocation location; @@ -189,60 +189,60 @@ public: } } - QGeoSearchReply* reverseGeocode ( const QGeoCoordinate & coordinate, QGeoBoundingArea * bounds ) + QGeocodeReply* reverseGeocode ( const QGeoCoordinate & coordinate, QGeoBoundingArea * bounds ) { - searchReply_ = new SearchReplyTest(); - connect(searchReply_, SIGNAL(aborted()), this, SLOT(requestAborted())); + geocodeReply_ = new GeocodeReplyTest(); + connect(geocodeReply_, SIGNAL(aborted()), this, SLOT(requestAborted())); - setLocations(searchReply_, coordinate); - searchReply_->callSetViewport(bounds); + setLocations(geocodeReply_, coordinate); + geocodeReply_->callSetViewport(bounds); if (coordinate.latitude() > 70) { errorString_ = "error"; - errorCode_ = (QGeoSearchReply::Error) (coordinate.latitude() - 70); + errorCode_ = (QGeocodeReply::Error) (coordinate.latitude() - 70); } else { errorString_ = ""; - errorCode_ = QGeoSearchReply::NoError; + errorCode_ = QGeocodeReply::NoError; } if (finishRequestImmediately_) { if (errorCode_) { - searchReply_->callSetError(errorCode_, errorString_); + geocodeReply_->callSetError(errorCode_, errorString_); } else { - searchReply_->callSetError(QGeoSearchReply::NoError,coordinate.toString()); - searchReply_->callSetFinished(true); + geocodeReply_->callSetError(QGeocodeReply::NoError,coordinate.toString()); + geocodeReply_->callSetFinished(true); } } else { // we only allow serialized requests in QML - previous must have been aborted or finished Q_ASSERT(timerId_ == 0); timerId_ = startTimer(200); } - return static_cast<QGeoSearchReply*>(searchReply_); + return static_cast<QGeocodeReply*>(geocodeReply_); } protected: void timerEvent(QTimerEvent *event) { Q_ASSERT(timerId_ == event->timerId()); - Q_ASSERT(searchReply_); + Q_ASSERT(geocodeReply_); killTimer(timerId_); timerId_ = 0; if (errorCode_) { - searchReply_->callSetError(errorCode_, errorString_); - emit error(searchReply_, errorCode_, errorString_); + geocodeReply_->callSetError(errorCode_, errorString_); + emit error(geocodeReply_, errorCode_, errorString_); } else { - searchReply_->callSetError(QGeoSearchReply::NoError, "no error"); - searchReply_->callSetFinished(true); + geocodeReply_->callSetError(QGeocodeReply::NoError, "no error"); + geocodeReply_->callSetFinished(true); } - emit finished(searchReply_); + emit finished(geocodeReply_); } private: bool validateWellKnownValues_; bool finishRequestImmediately_; bool supported_; - SearchReplyTest* searchReply_; + GeocodeReplyTest* geocodeReply_; int timerId_; - QGeoSearchReply::Error errorCode_; + QGeocodeReply::Error errorCode_; QString errorString_; }; diff --git a/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.cpp b/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.cpp index 41d961d4..4bf9f2c7 100644 --- a/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.cpp +++ b/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qgeoserviceproviderplugin_test.h" -#include "qgeosearchmanagerengine_test.h" +#include "qgeocodingmanagerengine_test.h" #include "qgeoroutingmanagerengine_test.h" #include <QtPlugin> @@ -71,10 +71,10 @@ QGeoRoutingManagerEngine* QGeoServiceProviderFactoryTest::createRoutingManagerEn } -QGeoSearchManagerEngine* QGeoServiceProviderFactoryTest::createSearchManagerEngine(const QMap< +QGeocodingManagerEngine* QGeoServiceProviderFactoryTest::createGeocodingManagerEngine(const QMap< QString, QVariant> ¶meters, QGeoServiceProvider::Error *error, QString *errorString) const { - return new QGeoSearchManagerEngineTest(parameters, error, errorString); + return new QGeocodingManagerEngineTest(parameters, error, errorString); } diff --git a/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h b/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h index 6c4d90ba..2ebac422 100644 --- a/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h +++ b/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h @@ -65,7 +65,7 @@ public: QGeoRoutingManagerEngine* createRoutingManagerEngine ( const QMap<QString, QVariant> & parameters, QGeoServiceProvider::Error * error, QString * errorString ) const; - QGeoSearchManagerEngine* createSearchManagerEngine( + QGeocodingManagerEngine* createGeocodingManagerEngine( const QMap<QString, QVariant> ¶meters, QGeoServiceProvider::Error *error, QString *errorString) const; diff --git a/tests/auto/qgeosearchreply/qgeosearchreply.pro b/tests/auto/qgeocodereply/qgeocodereply.pro index c51de38a..a36435af 100644 --- a/tests/auto/qgeosearchreply/qgeosearchreply.pro +++ b/tests/auto/qgeocodereply/qgeocodereply.pro @@ -1,10 +1,10 @@ TEMPLATE = app CONFIG += testcase -TARGET = tst_qgeosearchreply +TARGET = tst_qgeocodereply HEADERS += ../qgeocoordinate/qlocationtestutils_p.h \ - tst_qgeosearchreply.h -SOURCES += tst_qgeosearchreply.cpp \ + tst_qgeocodereply.h +SOURCES += tst_qgeocodereply.cpp \ ../qgeocoordinate/qlocationtestutils.cpp QT += location testlib diff --git a/tests/auto/qgeosearchreply/tst_qgeosearchreply.cpp b/tests/auto/qgeocodereply/tst_qgeocodereply.cpp index 0ec9c28f..1c052fed 100644 --- a/tests/auto/qgeosearchreply/tst_qgeosearchreply.cpp +++ b/tests/auto/qgeocodereply/tst_qgeocodereply.cpp @@ -39,43 +39,43 @@ ** ****************************************************************************/ -#include "tst_qgeosearchreply.h" +#include "tst_qgeocodereply.h" QT_USE_NAMESPACE -void tst_QGeoSearchReply::initTestCase() +void tst_QGeocodeReply::initTestCase() { - reply = new SubSearchReply(); + reply = new SubGeocodeReply(); } -void tst_QGeoSearchReply::cleanupTestCase() +void tst_QGeocodeReply::cleanupTestCase() { delete reply; delete qgeolocation; } -void tst_QGeoSearchReply::init() +void tst_QGeocodeReply::init() { - qRegisterMetaType<QGeoSearchReply::Error>("Error"); - signalerror = new QSignalSpy(reply, SIGNAL(error(QGeoSearchReply::Error,const QString))); + qRegisterMetaType<QGeocodeReply::Error>("Error"); + signalerror = new QSignalSpy(reply, SIGNAL(error(QGeocodeReply::Error,const QString))); signalfinished = new QSignalSpy(reply, SIGNAL(finished())); } -void tst_QGeoSearchReply::cleanup() +void tst_QGeocodeReply::cleanup() { delete signalerror; delete signalfinished; } -void tst_QGeoSearchReply::constructor() +void tst_QGeocodeReply::constructor() { QVERIFY(!reply->isFinished()); QCOMPARE(reply->limit(),-1); QCOMPARE(reply->offset(),0); - QCOMPARE(reply->error(),QGeoSearchReply::NoError); + QCOMPARE(reply->error(),QGeocodeReply::NoError); QVERIFY( signalerror->isValid() ); QVERIFY( signalfinished->isValid() ); @@ -84,58 +84,58 @@ void tst_QGeoSearchReply::constructor() QCOMPARE(signalfinished->count(),0); } -void tst_QGeoSearchReply::constructor_error() +void tst_QGeocodeReply::constructor_error() { - QFETCH(QGeoSearchReply::Error,error); + QFETCH(QGeocodeReply::Error,error); QFETCH(QString,msg); QVERIFY( signalerror->isValid() ); QVERIFY( signalfinished->isValid() ); - QGeoSearchReply *qgeosearchreplycopy = new QGeoSearchReply (error,msg,0); + QGeocodeReply *qgeocodereplycopy = new QGeocodeReply (error,msg,0); QCOMPARE(signalerror->count(),0); QCOMPARE(signalfinished->count(),0); - QCOMPARE (qgeosearchreplycopy->error(),error); - QCOMPARE (qgeosearchreplycopy->errorString(),msg); + QCOMPARE (qgeocodereplycopy->error(),error); + QCOMPARE (qgeocodereplycopy->errorString(),msg); - delete qgeosearchreplycopy; + delete qgeocodereplycopy; } -void tst_QGeoSearchReply::constructor_error_data() +void tst_QGeocodeReply::constructor_error_data() { - QTest::addColumn<QGeoSearchReply::Error>("error"); + QTest::addColumn<QGeocodeReply::Error>("error"); QTest::addColumn<QString>("msg"); - QTest::newRow("error1") << QGeoSearchReply::NoError << "No error."; - QTest::newRow("error2") << QGeoSearchReply::EngineNotSetError << "Engine Not Set Error."; - QTest::newRow("error3") << QGeoSearchReply::CommunicationError << "Communication Error."; - QTest::newRow("error4") << QGeoSearchReply::ParseError << "Parse Error."; - QTest::newRow("error5") << QGeoSearchReply::UnsupportedOptionError << "Unsupported Option Error."; - QTest::newRow("error6") << QGeoSearchReply::UnknownError << "Unknown Error."; + QTest::newRow("error1") << QGeocodeReply::NoError << "No error."; + QTest::newRow("error2") << QGeocodeReply::EngineNotSetError << "Engine Not Set Error."; + QTest::newRow("error3") << QGeocodeReply::CommunicationError << "Communication Error."; + QTest::newRow("error4") << QGeocodeReply::ParseError << "Parse Error."; + QTest::newRow("error5") << QGeocodeReply::UnsupportedOptionError << "Unsupported Option Error."; + QTest::newRow("error6") << QGeocodeReply::UnknownError << "Unknown Error."; } -void tst_QGeoSearchReply::destructor() +void tst_QGeocodeReply::destructor() { - QGeoSearchReply *qgeosearchreplycopy; - QFETCH(QGeoSearchReply::Error,error); + QGeocodeReply *qgeocodereplycopy; + QFETCH(QGeocodeReply::Error,error); QFETCH(QString,msg); QLocationTestUtils::uheap_mark(); - qgeosearchreplycopy = new QGeoSearchReply (error,msg,0); - delete qgeosearchreplycopy; + qgeocodereplycopy = new QGeocodeReply (error,msg,0); + delete qgeocodereplycopy; QLocationTestUtils::uheap_mark_end(); } -void tst_QGeoSearchReply::destructor_data() +void tst_QGeocodeReply::destructor_data() { - tst_QGeoSearchReply::constructor_error_data(); + tst_QGeocodeReply::constructor_error_data(); } -void tst_QGeoSearchReply::abort() +void tst_QGeocodeReply::abort() { QVERIFY( signalerror->isValid() ); QVERIFY( signalfinished->isValid() ); @@ -157,9 +157,9 @@ void tst_QGeoSearchReply::abort() QCOMPARE (signalfinished->count(),2); } -void tst_QGeoSearchReply::error() +void tst_QGeocodeReply::error() { - QFETCH(QGeoSearchReply::Error,error); + QFETCH(QGeocodeReply::Error,error); QFETCH(QString,msg); QVERIFY( signalerror->isValid() ); @@ -176,20 +176,20 @@ void tst_QGeoSearchReply::error() } -void tst_QGeoSearchReply::error_data() +void tst_QGeocodeReply::error_data() { - QTest::addColumn<QGeoSearchReply::Error>("error"); + QTest::addColumn<QGeocodeReply::Error>("error"); QTest::addColumn<QString>("msg"); - QTest::newRow("error1") << QGeoSearchReply::NoError << "No error."; - QTest::newRow("error2") << QGeoSearchReply::EngineNotSetError << "Engine Not Set Error."; - QTest::newRow("error3") << QGeoSearchReply::CommunicationError << "Communication Error."; - QTest::newRow("error4") << QGeoSearchReply::ParseError << "Parse Error."; - QTest::newRow("error5") << QGeoSearchReply::UnsupportedOptionError << "Unsupported Option Error."; - QTest::newRow("error6") << QGeoSearchReply::UnknownError << "Unknown Error."; + QTest::newRow("error1") << QGeocodeReply::NoError << "No error."; + QTest::newRow("error2") << QGeocodeReply::EngineNotSetError << "Engine Not Set Error."; + QTest::newRow("error3") << QGeocodeReply::CommunicationError << "Communication Error."; + QTest::newRow("error4") << QGeocodeReply::ParseError << "Parse Error."; + QTest::newRow("error5") << QGeocodeReply::UnsupportedOptionError << "Unsupported Option Error."; + QTest::newRow("error6") << QGeocodeReply::UnknownError << "Unknown Error."; } -void tst_QGeoSearchReply::finished() +void tst_QGeocodeReply::finished() { QVERIFY( signalerror->isValid() ); QVERIFY( signalfinished->isValid() ); @@ -217,21 +217,21 @@ void tst_QGeoSearchReply::finished() -void tst_QGeoSearchReply::limit() +void tst_QGeocodeReply::limit() { int limit =30; reply->callSetLimit(limit); QCOMPARE(reply->limit(),limit); } -void tst_QGeoSearchReply::offset() +void tst_QGeocodeReply::offset() { int offset = 2; reply->callSetOffset(offset); QCOMPARE(reply->offset(),offset); } -void tst_QGeoSearchReply::locations() +void tst_QGeocodeReply::locations() { QList <QGeoLocation> geolocations; geolocations = reply->locations(); @@ -274,7 +274,7 @@ void tst_QGeoSearchReply::locations() delete qgeolocationcopy; } -void tst_QGeoSearchReply::viewport() +void tst_QGeocodeReply::viewport() { QGeoCoordinate *qgeocoordinate = new QGeoCoordinate (12.12 , 54.43); @@ -288,4 +288,4 @@ void tst_QGeoSearchReply::viewport() delete qgeoboundingbox; } -QTEST_MAIN(tst_QGeoSearchReply); +QTEST_MAIN(tst_QGeocodeReply); diff --git a/tests/auto/qgeosearchreply/tst_qgeosearchreply.h b/tests/auto/qgeocodereply/tst_qgeocodereply.h index 3a8f8711..94213594 100644 --- a/tests/auto/qgeosearchreply/tst_qgeosearchreply.h +++ b/tests/auto/qgeocodereply/tst_qgeocodereply.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef TST_QGEOSEARCHREPLY_H -#define TST_QGEOSEARCHREPLY_H +#ifndef TST_QGEOCODEREPLY_H +#define TST_QGEOCODEREPLY_H #include <QtCore/QString> #include <QtTest/QtTest> @@ -50,18 +50,18 @@ #include "../qgeocoordinate/qlocationtestutils_p.h" -#include <qgeosearchreply.h> +#include <qgeocodereply.h> #include <qgeolocation.h> #include <qgeoaddress.h> #include <qgeocoordinate.h> #include <qgeoboundingbox.h> QT_USE_NAMESPACE -class SubSearchReply : public QGeoSearchReply +class SubGeocodeReply : public QGeocodeReply { Q_OBJECT public: - SubSearchReply():QGeoSearchReply() {} + SubGeocodeReply():QGeocodeReply() {} void callAddLocation ( const QGeoLocation & location ) {addLocation(location);} void callSetError ( Error error, const QString & errorString ) {setError(error, errorString);} @@ -73,7 +73,7 @@ public: }; -class tst_QGeoSearchReply :public QObject +class tst_QGeocodeReply :public QObject { Q_OBJECT @@ -83,7 +83,7 @@ public slots: void init(); void cleanup(); - //Start Unit Test for QGeoSearchReply + //Start Unit Test for QGeoCodeReply private slots: void constructor(); void constructor_error(); @@ -99,20 +99,20 @@ private slots: void locations(); void viewport(); - //End Unit Test for QGeoSearchReply + //End Unit Test for QGeoCodeReply private: QSignalSpy *signalerror; QSignalSpy *signalfinished; - SubSearchReply* reply; + SubGeocodeReply* reply; QGeoLocation *qgeolocation; QGeoBoundingBox *qgeoboundingbox; }; Q_DECLARE_METATYPE( QList<double>); -Q_DECLARE_METATYPE( QGeoSearchReply::Error); +Q_DECLARE_METATYPE( QGeocodeReply::Error); -#endif // TST_QGEOSEARCHREPLY_H +#endif // TST_QGEOCODEREPLY_H diff --git a/tests/auto/qgeosearchmanager/qgeosearchmanager.pro b/tests/auto/qgeocodingmanager/qgeocodingmanager.pro index fd864c65..dc65c884 100644 --- a/tests/auto/qgeosearchmanager/qgeosearchmanager.pro +++ b/tests/auto/qgeocodingmanager/qgeocodingmanager.pro @@ -1,9 +1,9 @@ load(qttest_p4) HEADERS += ../qgeocoordinate/qlocationtestutils_p.h \ - tst_qgeosearchmanager.h + tst_qgeocodingmanager.h -SOURCES += tst_qgeosearchmanager.cpp \ +SOURCES += tst_qgeocodingmanager.cpp \ ../qgeocoordinate/qlocationtestutils.cpp QT += location diff --git a/tests/auto/qgeosearchmanager/tst_qgeosearchmanager.cpp b/tests/auto/qgeocodingmanager/tst_qgeocodingmanager.cpp index 385ed66f..a58f1c73 100644 --- a/tests/auto/qgeosearchmanager/tst_qgeosearchmanager.cpp +++ b/tests/auto/qgeocodingmanager/tst_qgeocodingmanager.cpp @@ -41,89 +41,89 @@ //TESTED_COMPONENT=src/location -#include "tst_qgeosearchmanager.h" +#include "tst_qgeocodingmanager.h" QT_USE_NAMESPACE -void tst_QGeoSearchManager::initTestCase() +void tst_QGeocodingManager::initTestCase() { - tst_QGeoSearchManager::loadSearchManager(); + tst_QGeocodingManager::loadGeocodingManager(); } -void tst_QGeoSearchManager::cleanupTestCase() +void tst_QGeocodingManager::cleanupTestCase() { delete qgeoserviceprovider; } -void tst_QGeoSearchManager::init() +void tst_QGeocodingManager::init() { - qRegisterMetaType<QGeoSearchReply::Error>("Error"); - qRegisterMetaType<QGeoSearchReply*>(); + qRegisterMetaType<QGeocodeReply::Error>("Error"); + qRegisterMetaType<QGeocodeReply*>(); - signalerror = new QSignalSpy(qgeosearchmanager, SIGNAL(error(QGeoSearchReply*,QGeoSearchReply::Error,QString))); - signalfinished = new QSignalSpy(qgeosearchmanager, SIGNAL(finished(QGeoSearchReply*))); + signalerror = new QSignalSpy(qgeocodingmanager, SIGNAL(error(QGeocodeReply*,QGeocodeReply::Error,QString))); + signalfinished = new QSignalSpy(qgeocodingmanager, SIGNAL(finished(QGeocodeReply*))); QVERIFY( signalerror->isValid() ); QVERIFY( signalfinished->isValid() ); } -void tst_QGeoSearchManager::cleanup() +void tst_QGeocodingManager::cleanup() { delete signalerror; delete signalfinished; } -void tst_QGeoSearchManager::loadSearchManager() +void tst_QGeocodingManager::loadGeocodingManager() { QStringList providers = QGeoServiceProvider::availableServiceProviders(); - QVERIFY(providers.contains("static.geosearch.test.plugin")); + QVERIFY(providers.contains("static.geocode.test.plugin")); - qgeoserviceprovider = new QGeoServiceProvider("static.geosearch.test.plugin"); + qgeoserviceprovider = new QGeoServiceProvider("static.geocode.test.plugin"); QVERIFY(qgeoserviceprovider); QCOMPARE(qgeoserviceprovider->error(), QGeoServiceProvider::NoError); - qgeosearchmanager = qgeoserviceprovider->searchManager(); - QVERIFY(qgeosearchmanager); + qgeocodingmanager = qgeoserviceprovider->geocodingManager(); + QVERIFY(qgeocodingmanager); } -void tst_QGeoSearchManager::supports() +void tst_QGeocodingManager::supports() { - QVERIFY(qgeosearchmanager->supportsGeocoding()); - QVERIFY(qgeosearchmanager->supportsReverseGeocoding()); + QVERIFY(qgeocodingmanager->supportsGeocoding()); + QVERIFY(qgeocodingmanager->supportsReverseGeocoding()); } -void tst_QGeoSearchManager::locale() +void tst_QGeocodingManager::locale() { QLocale *german = new QLocale (QLocale::German, QLocale::Germany); QLocale *english = new QLocale (QLocale::C, QLocale::AnyCountry); //Default Locale from the Search Engine - QCOMPARE(qgeosearchmanager->locale(),*german); + QCOMPARE(qgeocodingmanager->locale(),*german); - qgeosearchmanager->setLocale(*english); + qgeocodingmanager->setLocale(*english); - QCOMPARE(qgeosearchmanager->locale(),*english); + QCOMPARE(qgeocodingmanager->locale(),*english); - QVERIFY(qgeosearchmanager->locale() != *german); + QVERIFY(qgeocodingmanager->locale() != *german); delete german; delete english; } -void tst_QGeoSearchManager::name() +void tst_QGeocodingManager::name() { - QString name = "static.geosearch.test.plugin"; - QCOMPARE(qgeosearchmanager->managerName(),name); + QString name = "static.geocode.test.plugin"; + QCOMPARE(qgeocodingmanager->managerName(),name); } -void tst_QGeoSearchManager::version() +void tst_QGeocodingManager::version() { int version=3; - QCOMPARE(qgeosearchmanager->managerVersion(),version); + QCOMPARE(qgeocodingmanager->managerVersion(),version); } -void tst_QGeoSearchManager::search() +void tst_QGeocodingManager::search() { QCOMPARE(signalerror->count(),0); QCOMPARE(signalfinished->count(),0); @@ -133,7 +133,7 @@ void tst_QGeoSearchManager::search() int offset = 2; QGeoBoundingBox *bounds = new QGeoBoundingBox (); - QGeoSearchReply * reply = qgeosearchmanager->search(search, limit,offset,bounds); + QGeocodeReply * reply = qgeocodingmanager->geocode(search, limit,offset,bounds); QCOMPARE(reply->errorString(),search); QCOMPARE(signalfinished->count(),1); @@ -144,7 +144,7 @@ void tst_QGeoSearchManager::search() } -void tst_QGeoSearchManager::geocode() +void tst_QGeocodingManager::geocode() { QCOMPARE(signalerror->count(),0); QCOMPARE(signalfinished->count(),0); @@ -155,7 +155,7 @@ void tst_QGeoSearchManager::geocode() QGeoBoundingBox *bounds = new QGeoBoundingBox (); - QGeoSearchReply *reply = qgeosearchmanager->geocode(*address,bounds); + QGeocodeReply *reply = qgeocodingmanager->geocode(*address,bounds); QCOMPARE(reply->errorString(),city); QCOMPARE(signalfinished->count(),1); @@ -166,7 +166,7 @@ void tst_QGeoSearchManager::geocode() delete reply; } -void tst_QGeoSearchManager::reverseGeocode() +void tst_QGeocodingManager::reverseGeocode() { QCOMPARE(signalerror->count(),0); QCOMPARE(signalfinished->count(),0); @@ -174,7 +174,7 @@ void tst_QGeoSearchManager::reverseGeocode() QGeoCoordinate *coordinate = new QGeoCoordinate (34.34 , 56.65); QGeoBoundingBox *bounds = new QGeoBoundingBox (); - QGeoSearchReply *reply = qgeosearchmanager->reverseGeocode(*coordinate,bounds); + QGeocodeReply *reply = qgeocodingmanager->reverseGeocode(*coordinate,bounds); QCOMPARE(reply->errorString(),coordinate->toString()); QCOMPARE(signalfinished->count(),1); @@ -188,5 +188,5 @@ void tst_QGeoSearchManager::reverseGeocode() } -QTEST_MAIN(tst_QGeoSearchManager) +QTEST_MAIN(tst_QGeocodingManager) diff --git a/tests/auto/qgeosearchmanager/tst_qgeosearchmanager.h b/tests/auto/qgeocodingmanager/tst_qgeocodingmanager.h index fc863d72..e546a5ab 100644 --- a/tests/auto/qgeosearchmanager/tst_qgeosearchmanager.h +++ b/tests/auto/qgeocodingmanager/tst_qgeocodingmanager.h @@ -41,17 +41,17 @@ //TESTED_COMPONENT=src/location -#ifndef TST_QGEOSEARCHMANAGER_H -#define TST_QGEOSEARCHMANAGER_H +#ifndef TST_QGEOCODINGMANAGER_H +#define TST_QGEOCODINGMANAGER_H #include <QLocale> #include <QtTest/QtTest> #include <QSignalSpy> #include <qgeoserviceprovider.h> -#include <qgeosearchmanager.h> +#include <qgeocodingmanager.h> #include <qlandmarkmanager.h> -#include <qgeosearchreply.h> +#include <qgeocodereply.h> #include <qgeoboundingbox.h> #include <qgeoaddress.h> #include <qgeocoordinate.h> @@ -67,7 +67,7 @@ public: QString name; }; -class tst_QGeoSearchManager: public QObject +class tst_QGeocodingManager: public QObject { Q_OBJECT @@ -86,14 +86,14 @@ private Q_SLOTS: private: QGeoServiceProvider *qgeoserviceprovider; - QGeoSearchManager *qgeosearchmanager; + QGeocodingManager *qgeocodingmanager; QSignalSpy *signalerror; QSignalSpy *signalfinished; - void loadSearchManager(); + void loadGeocodingManager(); }; -Q_DECLARE_METATYPE( QGeoSearchReply*); -Q_DECLARE_METATYPE( QGeoSearchReply::Error); +Q_DECLARE_METATYPE( QGeocodeReply*); +Q_DECLARE_METATYPE( QGeocodeReply::Error); #endif diff --git a/tests/auto/qgeosearchmanagerplugins/qgeosearchmanagerengine_test.h b/tests/auto/qgeocodingmanagerplugins/qgeocodingmanagerengine_test.h index 32bf572a..171c2b12 100644 --- a/tests/auto/qgeosearchmanagerplugins/qgeosearchmanagerengine_test.h +++ b/tests/auto/qgeocodingmanagerplugins/qgeocodingmanagerengine_test.h @@ -39,26 +39,26 @@ ** ****************************************************************************/ -#ifndef QGEOSEARCHMANAGERENGINE_TEST_H -#define QGEOSEARCHMANAGERENGINE_TEST_H +#ifndef QGEOCODINGMANAGERENGINE_TEST_H +#define QGEOCODINGMANAGERENGINE_TEST_H #include <qgeoserviceprovider.h> -#include <qgeosearchmanagerengine.h> +#include <qgeocodingmanagerengine.h> #include <QLocale> #include <qlandmarkmanager.h> #include <qgeoaddress.h> #include <qgeolocation.h> -#include <qgeosearchreply.h> +#include <qgeocodereply.h> QT_USE_NAMESPACE -class SearchReplyTest :public QGeoSearchReply +class GeocodeReplyTest :public QGeocodeReply { Q_OBJECT public: - SearchReplyTest(QObject *parent=0):QGeoSearchReply (parent) {} + GeocodeReplyTest(QObject *parent=0):QGeocodeReply (parent) {} void callAddLocation ( const QGeoLocation & location ) {addLocation(location);} void callSetError ( Error error, const QString & errorString ) {setError(error, errorString);} @@ -70,14 +70,14 @@ public: }; -class QGeoSearchManagerEngineTest: public QGeoSearchManagerEngine +class QGeocodingManagerEngineTest: public QGeocodingManagerEngine { Q_OBJECT public: - QGeoSearchManagerEngineTest(const QMap<QString, QVariant> ¶meters, + QGeocodingManagerEngineTest(const QMap<QString, QVariant> ¶meters, QGeoServiceProvider::Error *error, QString *errorString) : - QGeoSearchManagerEngine(parameters) + QGeocodingManagerEngine(parameters) { Q_UNUSED(error) Q_UNUSED(errorString) @@ -86,38 +86,38 @@ public: setLocale(*(new QLocale (QLocale::German, QLocale::Germany))); } - QGeoSearchReply* search ( const QString & searchString, int limit, int offset, QGeoBoundingArea * bounds ) + QGeocodeReply* geocode ( const QString & searchString, int limit, int offset, QGeoBoundingArea * bounds ) { - SearchReplyTest *searchreply = new SearchReplyTest(); - searchreply->callSetLimit(limit); - searchreply->callSetOffset(offset); - searchreply->callSetViewport(bounds); - searchreply->callSetError(QGeoSearchReply::NoError,searchString); - searchreply->callSetFinished(true); - emit(this->finished(searchreply)); - - return static_cast<QGeoSearchReply*>(searchreply); + GeocodeReplyTest *geocodereply = new GeocodeReplyTest(); + geocodereply->callSetLimit(limit); + geocodereply->callSetOffset(offset); + geocodereply->callSetViewport(bounds); + geocodereply->callSetError(QGeocodeReply::NoError,searchString); + geocodereply->callSetFinished(true); + emit(this->finished(geocodereply)); + + return static_cast<QGeocodeReply*>(geocodereply); } - QGeoSearchReply* geocode ( const QGeoAddress & address, QGeoBoundingArea * bounds ) + QGeocodeReply* geocode ( const QGeoAddress & address, QGeoBoundingArea * bounds ) { - SearchReplyTest *searchreply = new SearchReplyTest(); - searchreply->callSetViewport(bounds); - searchreply->callSetError(QGeoSearchReply::NoError,address.city()); - searchreply->callSetFinished(true); - emit(this->finished(searchreply)); + GeocodeReplyTest *geocodereply = new GeocodeReplyTest(); + geocodereply->callSetViewport(bounds); + geocodereply->callSetError(QGeocodeReply::NoError,address.city()); + geocodereply->callSetFinished(true); + emit(this->finished(geocodereply)); - return static_cast<QGeoSearchReply*>(searchreply); + return static_cast<QGeocodeReply*>(geocodereply); } - QGeoSearchReply* reverseGeocode ( const QGeoCoordinate & coordinate, QGeoBoundingArea * bounds ) + QGeocodeReply* reverseGeocode ( const QGeoCoordinate & coordinate, QGeoBoundingArea * bounds ) { - SearchReplyTest *searchreply = new SearchReplyTest(); - searchreply->callSetViewport(bounds); - searchreply->callSetError(QGeoSearchReply::NoError,coordinate.toString()); - searchreply->callSetFinished(true); - emit(this->finished(searchreply)); - return static_cast<QGeoSearchReply*>(searchreply); + GeocodeReplyTest *geocodereply = new GeocodeReplyTest(); + geocodereply->callSetViewport(bounds); + geocodereply->callSetError(QGeocodeReply::NoError,coordinate.toString()); + geocodereply->callSetFinished(true); + emit(this->finished(geocodereply)); + return static_cast<QGeocodeReply*>(geocodereply); } }; diff --git a/tests/auto/qgeosearchmanagerplugins/qgeosearchmanagerplugins.pro b/tests/auto/qgeocodingmanagerplugins/qgeocodingmanagerplugins.pro index 5785b0f4..54897097 100644 --- a/tests/auto/qgeosearchmanagerplugins/qgeosearchmanagerplugins.pro +++ b/tests/auto/qgeocodingmanagerplugins/qgeocodingmanagerplugins.pro @@ -2,7 +2,7 @@ load(qt_module) TEMPLATE = lib CONFIG += plugin testplugin -TARGET = qtgeoservices_searchplugin +TARGET = qtgeoservices_geocodingplugin PLUGIN_TYPE=geoservices QT += location @@ -10,7 +10,7 @@ include($$QT_SOURCE_TREE/src/plugins/qpluginbase.pri) # TODO not sure where to put test plugins in Qt 5 DESTDIR = $$QT.location.plugins/geoservices -HEADERS += qgeosearchmanagerengine_test.h \ +HEADERS += qgeocodingmanagerengine_test.h \ qgeoserviceproviderplugin_test.h SOURCES += qgeoserviceproviderplugin_test.cpp diff --git a/tests/auto/qgeosearchmanagerplugins/qgeoserviceproviderplugin_test.cpp b/tests/auto/qgeocodingmanagerplugins/qgeoserviceproviderplugin_test.cpp index 039eaea5..5039da7c 100644 --- a/tests/auto/qgeosearchmanagerplugins/qgeoserviceproviderplugin_test.cpp +++ b/tests/auto/qgeocodingmanagerplugins/qgeoserviceproviderplugin_test.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qgeoserviceproviderplugin_test.h" -#include "qgeosearchmanagerengine_test.h" +#include "qgeocodingmanagerengine_test.h" #include <QtPlugin> @@ -54,7 +54,7 @@ QGeoServiceProviderFactoryTest::~QGeoServiceProviderFactoryTest() QString QGeoServiceProviderFactoryTest::providerName() const { - return "static.geosearch.test.plugin"; + return "static.geocode.test.plugin"; } int QGeoServiceProviderFactoryTest::providerVersion() const @@ -62,10 +62,10 @@ int QGeoServiceProviderFactoryTest::providerVersion() const return 3; } -QGeoSearchManagerEngine* QGeoServiceProviderFactoryTest::createSearchManagerEngine(const QMap< +QGeocodingManagerEngine* QGeoServiceProviderFactoryTest::createGeocodingManagerEngine(const QMap< QString, QVariant> ¶meters, QGeoServiceProvider::Error *error, QString *errorString) const { - return new QGeoSearchManagerEngineTest(parameters, error, errorString); + return new QGeocodingManagerEngineTest(parameters, error, errorString); } -Q_EXPORT_PLUGIN2(qtgeoservices_staticsearchplugin, QGeoServiceProviderFactoryTest) +Q_EXPORT_PLUGIN2(qtgeoservices_staticgeocodingplugin, QGeoServiceProviderFactoryTest) diff --git a/tests/auto/qgeosearchmanagerplugins/qgeoserviceproviderplugin_test.h b/tests/auto/qgeocodingmanagerplugins/qgeoserviceproviderplugin_test.h index d1f28840..b597359d 100644 --- a/tests/auto/qgeosearchmanagerplugins/qgeoserviceproviderplugin_test.h +++ b/tests/auto/qgeocodingmanagerplugins/qgeoserviceproviderplugin_test.h @@ -58,7 +58,7 @@ public: QString providerName() const; int providerVersion() const; - QGeoSearchManagerEngine* createSearchManagerEngine(const QMap<QString, QVariant> ¶meters, + QGeocodingManagerEngine* createGeocodingManagerEngine(const QMap<QString, QVariant> ¶meters, QGeoServiceProvider::Error *error, QString *errorString) const; }; |