1 | /**************************************************************************** |
---|---|
2 | ** |
3 | ** Copyright (C) 2015 The Qt Company Ltd. |
4 | ** Contact: http://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtLocation module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL3$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see http://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at http://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or later as published by the Free |
28 | ** Software Foundation and appearing in the file LICENSE.GPL included in |
29 | ** the packaging of this file. Please review the following information to |
30 | ** ensure the GNU General Public License version 2.0 requirements will be |
31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. |
32 | ** |
33 | ** $QT_END_LICENSE$ |
34 | ** |
35 | ****************************************************************************/ |
36 | |
37 | #include <QtLocation/QPlaceSearchRequest> |
38 | #include <QtLocation/QPlaceSearchReply> |
39 | #include <QtLocation/QPlaceProposedSearchResult> |
40 | #include <QtLocation/private/qplacereply_p.h> |
41 | |
42 | QT_BEGIN_NAMESPACE |
43 | |
44 | class QPlaceSearchReplyPrivate : public QPlaceReplyPrivate |
45 | { |
46 | public: |
47 | QPlaceSearchReplyPrivate(){} |
48 | QList<QPlaceSearchResult> results; |
49 | QPlaceSearchRequest searchRequest; |
50 | QPlaceSearchRequest previousPageRequest; |
51 | QPlaceSearchRequest nextPageRequest; |
52 | }; |
53 | |
54 | /*! |
55 | \class QPlaceSearchReply |
56 | \inmodule QtLocation |
57 | \ingroup QtLocation-places |
58 | \ingroup QtLocation-places-replies |
59 | \since 5.6 |
60 | |
61 | \brief The QPlaceSearchReply class manages a place search operation started by an |
62 | instance of QPlaceManager. |
63 | |
64 | See \l {Discovery/Search} for an example on how to use a search reply. |
65 | \sa QPlaceSearchRequest, QPlaceManager |
66 | */ |
67 | |
68 | /*! |
69 | Constructs a search reply with a given \a parent. |
70 | */ |
71 | QPlaceSearchReply::QPlaceSearchReply(QObject *parent) |
72 | : QPlaceReply(new QPlaceSearchReplyPrivate, parent) |
73 | { |
74 | } |
75 | |
76 | /*! |
77 | Destroys the search reply. |
78 | */ |
79 | QPlaceSearchReply::~QPlaceSearchReply() |
80 | { |
81 | } |
82 | |
83 | /*! |
84 | Returns the type of reply. |
85 | */ |
86 | QPlaceReply::Type QPlaceSearchReply::type() const |
87 | { |
88 | return QPlaceReply::SearchReply; |
89 | } |
90 | |
91 | /*! |
92 | Returns a list of search results; |
93 | */ |
94 | QList<QPlaceSearchResult> QPlaceSearchReply::results() const |
95 | { |
96 | Q_D(const QPlaceSearchReply); |
97 | return d->results; |
98 | } |
99 | |
100 | /*! |
101 | Sets the list of search \a results. |
102 | */ |
103 | void QPlaceSearchReply::setResults(const QList<QPlaceSearchResult> &results) |
104 | { |
105 | Q_D(QPlaceSearchReply); |
106 | d->results = results; |
107 | } |
108 | |
109 | /*! |
110 | Returns the search request that was used to generate this reply. |
111 | */ |
112 | QPlaceSearchRequest QPlaceSearchReply::request() const |
113 | { |
114 | Q_D(const QPlaceSearchReply); |
115 | return d->searchRequest; |
116 | } |
117 | |
118 | /*! |
119 | Returns a place search request which can be used to request the previous page of search |
120 | results. An empty place search request is returned if there is no previous page of results. |
121 | |
122 | \sa nextPageRequest(), setPreviousPageRequest() |
123 | */ |
124 | QPlaceSearchRequest QPlaceSearchReply::previousPageRequest() const |
125 | { |
126 | Q_D(const QPlaceSearchReply); |
127 | return d->previousPageRequest; |
128 | } |
129 | |
130 | /*! |
131 | Returns a place search request which can be used to request the next page of search results. An |
132 | empty place search request is returned if there is no next page of results. |
133 | |
134 | \sa previousPageRequest(), setNextPageRequest() |
135 | */ |
136 | QPlaceSearchRequest QPlaceSearchReply::nextPageRequest() const |
137 | { |
138 | Q_D(const QPlaceSearchReply); |
139 | return d->nextPageRequest; |
140 | } |
141 | |
142 | /*! |
143 | Sets the search \a request used to generate this reply. |
144 | */ |
145 | void QPlaceSearchReply::setRequest(const QPlaceSearchRequest &request) |
146 | { |
147 | Q_D(QPlaceSearchReply); |
148 | d->searchRequest = request; |
149 | } |
150 | |
151 | /*! |
152 | Sets the previous page of search results request to \a previous. |
153 | |
154 | \sa previousPageRequest() |
155 | */ |
156 | void QPlaceSearchReply::setPreviousPageRequest(const QPlaceSearchRequest &previous) |
157 | { |
158 | Q_D(QPlaceSearchReply); |
159 | d->previousPageRequest = previous; |
160 | } |
161 | |
162 | /*! |
163 | Sets the next page of search results request to \a next. |
164 | |
165 | \sa nextPageRequest() |
166 | */ |
167 | void QPlaceSearchReply::setNextPageRequest(const QPlaceSearchRequest &next) |
168 | { |
169 | Q_D(QPlaceSearchReply); |
170 | d->nextPageRequest = next; |
171 | } |
172 | |
173 | QT_END_NAMESPACE |
174 |