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 "qplacereview.h"
38#include "qplacereview_p.h"
39
40QT_BEGIN_NAMESPACE
41
42QPlaceReviewPrivate::QPlaceReviewPrivate()
43: QPlaceContentPrivate(), rating(0)
44{
45}
46
47QPlaceReviewPrivate::QPlaceReviewPrivate(const QPlaceReviewPrivate &other)
48 : QPlaceContentPrivate(other)
49{
50 dateTime = other.dateTime;
51 text = other.text;
52 language = other.language;
53 rating = other.rating;
54 reviewId = other.reviewId;
55 title = other.title;
56}
57
58QPlaceReviewPrivate::~QPlaceReviewPrivate()
59{
60}
61
62bool QPlaceReviewPrivate::compare(const QPlaceContentPrivate *other) const
63{
64 const QPlaceReviewPrivate *od = static_cast<const QPlaceReviewPrivate *>(other);
65 return QPlaceContentPrivate::compare(other) &&
66 dateTime == od->dateTime &&
67 text == od->text &&
68 language == od->language &&
69 rating == od->rating &&
70 reviewId == od->reviewId &&
71 title == od->title;
72}
73
74/*!
75 \class QPlaceReview
76 \inmodule QtLocation
77 \ingroup QtLocation-places
78 \ingroup QtLocation-places-data
79 \since 5.6
80
81 \brief The QPlaceReview class represents a review of a place.
82
83 Each QPlaceReview has a number of properties such as
84 a title, text, date of submission and rating; in addition to those properties
85 inherited from QPlaceContent.
86
87 Note: The Places API only supports reviews as 'retrieve-only' objects. Submitting reviews
88 to a provider is not a supported use case.
89
90 \sa QPlaceContent, QPlaceEditorial
91*/
92
93/*!
94 Constructs a new review object.
95*/
96QPlaceReview::QPlaceReview()
97 : QPlaceContent(new QPlaceReviewPrivate)
98{
99}
100
101/*!
102 \fn QPlaceReview::QPlaceReview(const QPlaceContent &other)
103 Constructs a copy of \a other, otherwise constructs a default review object.
104*/
105Q_IMPLEMENT_CONTENT_COPY_CTOR(QPlaceReview)
106
107
108/*!
109 Destroys the review.
110*/
111QPlaceReview::~QPlaceReview()
112{
113}
114
115Q_IMPLEMENT_CONTENT_D_FUNC(QPlaceReview)
116
117/*!
118 Returns the date and time that the review was submitted.
119*/
120QDateTime QPlaceReview::dateTime() const
121{
122 Q_D(const QPlaceReview);
123 return d->dateTime;
124}
125
126/*!
127 Sets the date and time that the review was submitted to \a dateTime.
128*/
129void QPlaceReview::setDateTime(const QDateTime &dateTime)
130{
131 Q_D(QPlaceReview);
132 d->dateTime = dateTime;
133}
134
135/*!
136 Returns a textual description of the place.
137
138 Depending on the provider the text could be rich (HTML based) or plain text.
139*/
140QString QPlaceReview::text() const
141{
142 Q_D(const QPlaceReview);
143 return d->text;
144}
145
146/*!
147 Sets \a text of the review.
148*/
149void QPlaceReview::setText(const QString &text)
150{
151 Q_D(QPlaceReview);
152 d->text = text;
153}
154
155/*!
156 Returns the language of the review. Typically this would be a language code
157 in the 2 letter ISO 639-1 format.
158*/
159QString QPlaceReview::language() const
160{
161 Q_D(const QPlaceReview);
162 return d->language;
163}
164
165/*!
166 Sets the \a language of the review. Typically this would be a language code
167 in the 2 letter ISO 639-1 format.
168*/
169void QPlaceReview::setLanguage(const QString &language)
170{
171 Q_D(QPlaceReview);
172 d->language = language;
173}
174
175/*!
176 Returns this review's rating of the place.
177*/
178qreal QPlaceReview::rating() const
179{
180 Q_D(const QPlaceReview);
181 return d->rating;
182}
183
184/*!
185 Sets the review's \a rating of the place.
186*/
187void QPlaceReview::setRating(qreal rating)
188{
189 Q_D(QPlaceReview);
190 d->rating = rating;
191}
192
193/*!
194 Returns the review's identifier.
195*/
196QString QPlaceReview::reviewId() const
197{
198 Q_D(const QPlaceReview);
199 return d->reviewId;
200}
201
202/*!
203 Sets the \a identifier of the review.
204*/
205void QPlaceReview::setReviewId(const QString &identifier)
206{
207 Q_D(QPlaceReview);
208 d->reviewId = identifier;
209}
210
211/*!
212 Returns the title of the review.
213*/
214QString QPlaceReview::title() const
215{
216 Q_D(const QPlaceReview);
217 return d->title;
218}
219
220/*!
221 Sets the \a title of the review.
222*/
223void QPlaceReview::setTitle(const QString &title)
224{
225 Q_D(QPlaceReview);
226 d->title = title;
227}
228
229QT_END_NAMESPACE
230

source code of qtlocation/src/location/places/qplacereview.cpp