diff options
author | abcd <qt-info@nokia.com> | 2011-10-02 21:35:31 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-03 05:02:20 +0200 |
commit | 1707481d2f541c3895c8e881b7653c0072d43082 (patch) | |
tree | 22f283d7628eaf7ed4a16811525265546953e043 /src/location/places/qplacesearchrequest.cpp | |
parent | 84fb545d2e5ed16c61ea584b4ece91fd064cf54a (diff) | |
download | qtlocation-1707481d2f541c3895c8e881b7653c0072d43082.tar.gz |
Add Relevancy Hint to SearchRequest
Change-Id: I455f771f64fb89e0587aaeb0d03cc7b899158038
Reviewed-on: http://codereview.qt-project.org/5531
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Aaron McCarthy <aaron.mccarthy@nokia.com>
Reviewed-by: abcd <qt_abcd1@ovi.com>
Diffstat (limited to 'src/location/places/qplacesearchrequest.cpp')
-rw-r--r-- | src/location/places/qplacesearchrequest.cpp | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/src/location/places/qplacesearchrequest.cpp b/src/location/places/qplacesearchrequest.cpp index e4090694..741f70cd 100644 --- a/src/location/places/qplacesearchrequest.cpp +++ b/src/location/places/qplacesearchrequest.cpp @@ -61,10 +61,12 @@ public: QGeoBoundingArea *searchArea; int dymNumber; QPlaceManager::VisibilityScopes scope; + QPlaceSearchRequest::RelevanceHint relevanceHint; }; QPlaceSearchRequestPrivate::QPlaceSearchRequestPrivate() -: QPlaceRequestPrivate(), searchArea(0), dymNumber(0), scope(QPlaceManager::NoScope) +: QPlaceRequestPrivate(), searchArea(0), dymNumber(0), scope(QPlaceManager::NoScope), + relevanceHint(QPlaceSearchRequest::NoHint) { } @@ -79,6 +81,7 @@ QPlaceSearchRequestPrivate::QPlaceSearchRequestPrivate(const QPlaceSearchRequest this->searchArea = 0; this->dymNumber = other.dymNumber; this->scope = other.scope; + this->relevanceHint = other.relevanceHint; } QPlaceSearchRequestPrivate::~QPlaceSearchRequestPrivate() @@ -107,6 +110,7 @@ bool QPlaceSearchRequestPrivate::compare(const QPlaceRequestPrivate *other) cons && this->dymNumber == od->dymNumber && searchAreaMatch && this->scope == od->scope + && this->relevanceHint == od->relevanceHint ); } @@ -119,6 +123,7 @@ void QPlaceSearchRequestPrivate::clear() searchArea = 0; dymNumber = 0; scope = QPlaceManager::NoScope; + relevanceHint = QPlaceSearchRequest::NoHint; } /*! @@ -270,4 +275,42 @@ void QPlaceSearchRequest::setVisibilityScope(QPlaceManager::VisibilityScopes sco d->scope = scope; } +/*! + Returns the relevance hint of the request. The hint is given to the provider + to help but not dictate the ranking of results. eg providng a distance hint + may give closer places a higher ranking but it doesn't necessarily mean + that he results will be ordered strictly according to distance. +*/ +QPlaceSearchRequest::RelevanceHint QPlaceSearchRequest::relevanceHint() const +{ + Q_D(const QPlaceSearchRequest); + return d->relevanceHint; +} + +/*! + Sets the relevance \a hint to be used when searching for a place. +*/ +void QPlaceSearchRequest::setRelevanceHint(QPlaceSearchRequest::RelevanceHint hint) +{ + Q_D(QPlaceSearchRequest); + d->relevanceHint = hint; +} + +/*! + Clears the parameters of the search request. +*/ +void QPlaceSearchRequest::clear() +{ + Q_D(QPlaceSearchRequest); + + QPlaceRequest::clear(); + d->searchTerm.clear(); + d->categories.clear(); + if (d->searchArea) + delete d->searchArea; + d->searchArea = 0; + d->dymNumber = 0; + d->scope = QPlaceManager::NoScope; +} + QT_END_NAMESPACE |