summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/location/CMakeLists.txt6
-rw-r--r--src/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp44
-rw-r--r--src/location/declarativeplaces/qdeclarativeplaceeditorialmodel.cpp10
-rw-r--r--src/location/declarativeplaces/qdeclarativeplaceimagemodel.cpp10
-rw-r--r--src/location/declarativeplaces/qdeclarativereviewmodel.cpp16
-rw-r--r--src/location/places/qplacecontent.cpp156
-rw-r--r--src/location/places/qplacecontent.h85
-rw-r--r--src/location/places/qplacecontent_p.h49
-rw-r--r--src/location/places/qplaceeditorial.cpp87
-rw-r--r--src/location/places/qplaceeditorial.h37
-rw-r--r--src/location/places/qplaceeditorial_p.h75
-rw-r--r--src/location/places/qplaceimage.cpp81
-rw-r--r--src/location/places/qplaceimage.h42
-rw-r--r--src/location/places/qplaceimage_p.h76
-rw-r--r--src/location/places/qplacereview.cpp147
-rw-r--r--src/location/places/qplacereview.h57
-rw-r--r--src/location/places/qplacereview_p.h78
-rw-r--r--src/plugins/geoservices/nokia/placesv2/jsonparserhelpers.cpp74
-rw-r--r--src/plugins/geoservices/nokia/placesv2/jsonparserhelpers.h10
-rw-r--r--src/plugins/geoservices/nokia/placesv2/qplacedetailsreplyimpl.cpp3
20 files changed, 338 insertions, 805 deletions
diff --git a/src/location/CMakeLists.txt b/src/location/CMakeLists.txt
index 072468f7..2cd289da 100644
--- a/src/location/CMakeLists.txt
+++ b/src/location/CMakeLists.txt
@@ -67,17 +67,17 @@ qt_internal_add_module(Location
places/qplaceattribute_p.h places/qplacematchrequest.h
places/qplacecontentreply.h places/qplacereview.h
places/qplacecategory.h places/qplacesearchrequest.h
- places/qplacecategory_p.h places/qplaceeditorial_p.h
+ places/qplacecategory_p.h
places/qplaceproposedsearchresult.h places/qplacemanagerengine.h
places/qplacecontentrequest.h places/qplacemanagerengine_p.h
places/qplace.h places/qplacecontentrequest_p.h
places/qplaceeditorial.h places/qplaceattribute.h
- places/qplacedetailsreply.h places/qplaceimage_p.h
+ places/qplacedetailsreply.h
places/qplaceratings_p.h places/unsupportedreplies_p.h
places/qplacereply.h places/qplace_p.h places/qplaceresult_p.h
places/qplacemanager.h places/qplacereply_p.h
places/qplacesearchresult_p.h places/qplaceresult.h
- places/qplacereview_p.h places/qplacematchreply.h
+ places/qplacematchreply.h
places/qplacecontent.h places/qplacesearchreply.h
places/qplacesupplier_p.h places/qplaceratings.h
places/qplaceimage.h places/qplacesearchresult.h
diff --git a/src/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp b/src/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp
index df619742..6f7d7bd4 100644
--- a/src/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp
+++ b/src/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp
@@ -153,10 +153,14 @@ void QDeclarativePlaceContentModel::initializeCollection(int totalCount, const Q
continue;
m_content.insert(i.key(), content);
- if (!m_suppliers.contains(content.supplier().supplierId()))
- m_suppliers.insert(content.supplier().supplierId(), content.supplier());
- if (!m_users.contains(content.user().userId()))
- m_users.insert(content.user().userId(), content.user());
+ const auto supplier = content.value(QPlaceContent::ContentSupplier)
+ .value<QPlaceSupplier>();
+ if (!m_suppliers.contains(supplier.supplierId()))
+ m_suppliers.insert(supplier.supplierId(), supplier);
+ const auto user = content.value(QPlaceContent::ContentUser)
+ .value<QPlaceUser>();
+ if (!m_users.contains(user.userId()))
+ m_users.insert(user.userId(), user);
}
m_contentCount = totalCount;
@@ -193,11 +197,13 @@ QVariant QDeclarativePlaceContentModel::data(const QModelIndex &index, int role)
switch (role) {
case SupplierRole:
- return QVariant::fromValue(m_suppliers.value(content.supplier().supplierId()));
+ return QVariant::fromValue(m_suppliers.value(content.value(QPlaceContent::ContentSupplier)
+ .value<QPlaceSupplier>().supplierId()));
case PlaceUserRole:
- return QVariant::fromValue(m_users.value(content.user().userId()));
+ return QVariant::fromValue(m_users.value(content.value(QPlaceContent::ContentUser)
+ .value<QPlaceUser>().userId()));
case AttributionRole:
- return content.attribution();
+ return content.value(QPlaceContent::ContentAttribution);
default:
return QVariant();
}
@@ -333,10 +339,14 @@ void QDeclarativePlaceContentModel::fetchFinished()
const QPlaceContent &content = contents.value(i);
m_content.insert(i, content);
- if (!m_suppliers.contains(content.supplier().supplierId()))
- m_suppliers.insert(content.supplier().supplierId(), content.supplier());
- if (!m_users.contains(content.user().userId()))
- m_users.insert(content.user().userId(), content.user());
+ const auto supplier = content.value(QPlaceContent::ContentSupplier)
+ .value<QPlaceSupplier>();
+ if (!m_suppliers.contains(supplier.supplierId()))
+ m_suppliers.insert(supplier.supplierId(), supplier);
+ const auto user = content.value(QPlaceContent::ContentUser)
+ .value<QPlaceUser>();
+ if (!m_users.contains(user.userId()))
+ m_users.insert(user.userId(), user);
}
endInsertRows();
startIndex = -1;
@@ -356,10 +366,14 @@ void QDeclarativePlaceContentModel::fetchFinished()
for (int i = startIndex; i <= currentIndex; ++i) {
const QPlaceContent &content = contents.value(i);
m_content.insert(i, content);
- if (!m_suppliers.contains(content.supplier().supplierId()))
- m_suppliers.insert(content.supplier().supplierId(), content.supplier());
- if (!m_users.contains(content.user().userId()))
- m_users.insert(content.user().userId(), content.user());
+ const auto supplier = content.value(QPlaceContent::ContentSupplier)
+ .value<QPlaceSupplier>();
+ if (!m_suppliers.contains(supplier.supplierId()))
+ m_suppliers.insert(supplier.supplierId(), supplier);
+ const auto user = content.value(QPlaceContent::ContentUser)
+ .value<QPlaceUser>();
+ if (!m_users.contains(user.userId()))
+ m_users.insert(user.userId(), user);
}
emit dataChanged(index(startIndex),index(currentIndex));
startIndex = -1;
diff --git a/src/location/declarativeplaces/qdeclarativeplaceeditorialmodel.cpp b/src/location/declarativeplaces/qdeclarativeplaceeditorialmodel.cpp
index 5e280ab5..3dffeec5 100644
--- a/src/location/declarativeplaces/qdeclarativeplaceeditorialmodel.cpp
+++ b/src/location/declarativeplaces/qdeclarativeplaceeditorialmodel.cpp
@@ -40,7 +40,7 @@
#include "qdeclarativeplaceeditorialmodel_p.h"
#include <QtCore/QUrl>
-#include <QtLocation/QPlaceEditorial>
+#include <QtLocation/QPlaceContent>
QT_BEGIN_NAMESPACE
@@ -146,15 +146,15 @@ QVariant QDeclarativePlaceEditorialModel::data(const QModelIndex &index, int rol
if (index.row() >= rowCount(index.parent()) || index.row() < 0)
return QVariant();
- const QPlaceEditorial &description = m_content.value(index.row());
+ const QPlaceContent &content = m_content.value(index.row());
switch (role) {
case TextRole:
- return description.text();
+ return content.value(QPlaceContent::EditorialText);
case TitleRole:
- return description.title();
+ return content.value(QPlaceContent::EditorialTitle);
case LanguageRole:
- return description.language();
+ return content.value(QPlaceContent::EditorialLanguage);
}
return QDeclarativePlaceContentModel::data(index, role);
diff --git a/src/location/declarativeplaces/qdeclarativeplaceimagemodel.cpp b/src/location/declarativeplaces/qdeclarativeplaceimagemodel.cpp
index 54698928..b32a1292 100644
--- a/src/location/declarativeplaces/qdeclarativeplaceimagemodel.cpp
+++ b/src/location/declarativeplaces/qdeclarativeplaceimagemodel.cpp
@@ -40,7 +40,7 @@
#include "qdeclarativeplaceimagemodel_p.h"
#include <QtCore/QUrl>
-#include <QtLocation/QPlaceImage>
+#include <QtLocation/QPlaceContent>
QT_BEGIN_NAMESPACE
@@ -145,15 +145,15 @@ QVariant QDeclarativePlaceImageModel::data(const QModelIndex &index, int role) c
if (index.row() >= rowCount(index.parent()) || index.row() < 0)
return QVariant();
- const QPlaceImage &image = m_content.value(index.row());
+ const QPlaceContent &image = m_content.value(index.row());
switch (role) {
case UrlRole:
- return image.url();
+ return image.value(QPlaceContent::ImageUrl);
case ImageIdRole:
- return image.imageId();
+ return image.value(QPlaceContent::ImageId);
case MimeTypeRole:
- return image.mimeType();
+ return image.value(QPlaceContent::ImageMimeType);
}
return QDeclarativePlaceContentModel::data(index, role);
diff --git a/src/location/declarativeplaces/qdeclarativereviewmodel.cpp b/src/location/declarativeplaces/qdeclarativereviewmodel.cpp
index e8c597ac..2c4997ce 100644
--- a/src/location/declarativeplaces/qdeclarativereviewmodel.cpp
+++ b/src/location/declarativeplaces/qdeclarativereviewmodel.cpp
@@ -40,7 +40,7 @@
#include "qdeclarativereviewmodel_p.h"
#include <QtCore/QDateTime>
-#include <QtLocation/QPlaceReview>
+#include <QtLocation/QPlaceContent>
QT_BEGIN_NAMESPACE
@@ -149,21 +149,21 @@ QVariant QDeclarativeReviewModel::data(const QModelIndex &index, int role) const
if (index.row() >= rowCount(index.parent()) || index.row() < 0)
return QVariant();
- const QPlaceReview &review = m_content.value(index.row());
+ const QPlaceContent &content = m_content.value(index.row());
switch (role) {
case DateTimeRole:
- return review.dateTime();
+ return content.value(QPlaceContent::ReviewDateTime);
case TextRole:
- return review.text();
+ return content.value(QPlaceContent::ReviewText);
case LanguageRole:
- return review.language();
+ return content.value(QPlaceContent::ReviewLanguage);
case RatingRole:
- return review.rating();
+ return content.value(QPlaceContent::ReviewRating);
case ReviewIdRole:
- return review.reviewId();
+ return content.value(QPlaceContent::ReviewId);
case TitleRole:
- return review.title();
+ return content.value(QPlaceContent::ReviewTitle);
}
return QDeclarativePlaceContentModel::data(index, role);
diff --git a/src/location/places/qplacecontent.cpp b/src/location/places/qplacecontent.cpp
index 3999e0d7..512fcabf 100644
--- a/src/location/places/qplacecontent.cpp
+++ b/src/location/places/qplacecontent.cpp
@@ -40,32 +40,25 @@
#include "qplacecontent.h"
#include "qplacecontent_p.h"
-#include <QtCore/QUrl>
-
QT_USE_NAMESPACE
-template<> QPlaceContentPrivate *QSharedDataPointer<QPlaceContentPrivate>::clone()
-{
- return d->clone();
-}
-
inline QPlaceContentPrivate *QPlaceContent::d_func()
{
- return static_cast<QPlaceContentPrivate *>(d_ptr.data());
+ return d_ptr.data();
}
inline const QPlaceContentPrivate *QPlaceContent::d_func() const
{
- return static_cast<const QPlaceContentPrivate *>(d_ptr.constData());
+ return d_ptr.constData();
}
bool QPlaceContentPrivate::compare(const QPlaceContentPrivate *other) const
{
- return supplier == other->supplier
- && user == other->user
- && attribution == other->attribution;
+ return data == other->data;
}
+QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QPlaceContentPrivate)
+
/*!
\class QPlaceContent
\inmodule QtLocation
@@ -130,39 +123,79 @@ bool QPlaceContentPrivate::compare(const QPlaceContentPrivate *other) const
*/
/*!
+ \enum QPlaceContent::DataTag
+
+ Defines the value entry of the content object
+
+ \value ContentSupplier
+ The supplier who contributed this content
+ \value ContentUser
+ The user who contributed this content
+ \value ContentAttribution
+ Returns a rich text attribution string
+ \note Some providers may require that the attribution
+ of a particular content item always be displayed
+ when the content item is shown.
+ \value ImageId
+ The image's identifier
+ \value ImageUrl
+ The image's url
+ \value ImageMimeType
+ The image's MIME type
+ \value EditorialTitle
+ The title of the editorial
+ \value EditorialText
+ A textual description of the place. Depending upon the provider, the
+ text could be either rich (HTML based) text or plain text.
+ \value EditorialLanguage
+ The language of the editorial. Typically this would be a language code
+ in the 2 letter ISO 639-1 format.
+ \value ReviewId
+ The identifier of the review
+ \value ReviewDateTime
+ The date and time that the review was submitted
+ \value ReviewTitle
+ The title of the review
+ \value ReviewText
+ The text of the review. Depending on the provider, the text could be
+ rich (HTML based) or plain text.
+ \value ReviewLanguage
+ The language of the review. Typically this would be a language code
+ in the 2 letter ISO 639-1 format.
+ \value ReviewRating
+ This review's rating of the place
+ \value CustomDataTag
+*/
+
+/*!
Constructs an default content object which has no type.
*/
-QPlaceContent::QPlaceContent()
- : d_ptr(nullptr)
-{
-}
+QPlaceContent::QPlaceContent(Type type)
+ : d_ptr(new QPlaceContentPrivate(type))
+{}
/*!
Constructs a new copy of \a other.
*/
-QPlaceContent::QPlaceContent(const QPlaceContent &other)
- : d_ptr(other.d_ptr)
-{
-}
+QPlaceContent::QPlaceContent(const QPlaceContent &other) noexcept = default;
/*!
Assigns the \a other content object to this and returns a reference
to this content object.
*/
-QPlaceContent &QPlaceContent::operator=(const QPlaceContent &other)
-{
- if (this == &other)
- return *this;
-
- d_ptr = other.d_ptr;
- return *this;
-}
+QPlaceContent &QPlaceContent::operator=(const QPlaceContent &other) noexcept = default;
/*!
Destroys the content object.
*/
-QPlaceContent::~QPlaceContent()
+QPlaceContent::~QPlaceContent() = default;
+
+/*!
+ \internal
+*/
+void QPlaceContent::detach()
{
+ d_ptr.detach();
}
/*!
@@ -188,7 +221,7 @@ bool QPlaceContent::operator==(const QPlaceContent &other) const
if (type() != other.type())
return false;
- return d_ptr->compare(other.d_ptr);
+ return d_ptr->compare(other.d_ptr.constData());
}
/*!
@@ -201,70 +234,31 @@ bool QPlaceContent::operator!=(const QPlaceContent &other) const
}
/*!
- Returns the supplier who contributed this content.
-*/
-QPlaceSupplier QPlaceContent::supplier() const
-{
- Q_D(const QPlaceContent);
-
- return d->supplier;
-}
-
-/*!
- Sets the \a supplier of the content.
-*/
-void QPlaceContent::setSupplier(const QPlaceSupplier &supplier)
-{
- Q_D(QPlaceContent);
-
- d->supplier = supplier;
-}
-
-/*!
- Returns the user who contributed this content.
+ Returns the list of data tags for which values are stored in this
+ content objects.
*/
-QPlaceUser QPlaceContent::user() const
+QList<QPlaceContent::DataTag> QPlaceContent::dataTags() const
{
Q_D(const QPlaceContent);
- return d->user;
+ return d->data.keys();
}
/*!
- Sets the \a user who contributed this content.
+ Returns the value stored for the data \a tag, or an invalid QVariant
+ if there is no data for that tag.
*/
-void QPlaceContent::setUser(const QPlaceUser &user)
-{
- Q_D(QPlaceContent);
- d->user = user;
-}
-
-/*!
- Returns a rich text attribution string.
-
- \b {Note}: Some providers may require that the attribution
- of a particular content item always be displayed
- when the content item is shown.
-*/
-QString QPlaceContent::attribution() const
+QVariant QPlaceContent::value(QPlaceContent::DataTag tag) const
{
Q_D(const QPlaceContent);
- return d->attribution;
+ return d->data.value(tag);
}
/*!
- Sets a rich text \a attribution string for this content item.
+ Sets the value stored for the data \a tag to \a value.
*/
-void QPlaceContent::setAttribution(const QString &attribution)
+void QPlaceContent::setValue(QPlaceContent::DataTag tag, const QVariant &value)
{
+ detach();
Q_D(QPlaceContent);
- d->attribution = attribution;
-}
-
-/*!
- \internal
- Constructs a new content object from the given pointer \a d.
-*/
-QPlaceContent::QPlaceContent(QPlaceContentPrivate *d)
- : d_ptr(d)
-{
+ d->data[tag] = value;
}
diff --git a/src/location/places/qplacecontent.h b/src/location/places/qplacecontent.h
index f1a6ea7f..a955e024 100644
--- a/src/location/places/qplacecontent.h
+++ b/src/location/places/qplacecontent.h
@@ -41,23 +41,19 @@
#include <QtLocation/qlocationglobal.h>
+#include <QtCore/QExplicitlySharedDataPointer>
#include <QtCore/QMap>
#include <QtCore/QMetaType>
-#include <QtCore/QSharedDataPointer>
+#include <QtCore/QVariant>
-QT_BEGIN_NAMESPACE
-
-#define Q_DECLARE_CONTENT_D_FUNC(Class) \
- inline Class##Private *d_func(); \
- inline const Class##Private *d_func() const;\
- friend class Class##Private;
+#include <QtLocation/QPlaceUser>
+#include <QtLocation/QPlaceSupplier>
-#define Q_DECLARE_CONTENT_COPY_CTOR(Class) \
- Class(const QPlaceContent &other);
+QT_BEGIN_NAMESPACE
-class QPlaceUser;
-class QPlaceSupplier;
class QPlaceContentPrivate;
+QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlaceContentPrivate, Q_LOCATION_EXPORT)
+
class Q_LOCATION_EXPORT QPlaceContent
{
public:
@@ -71,34 +67,69 @@ public:
CustomType = 0x0100
};
- QPlaceContent();
- QPlaceContent(const QPlaceContent &other);
- virtual ~QPlaceContent();
+ enum DataTag {
+ ContentSupplier,
+ ContentUser,
+ ContentAttribution,
+ ImageId,
+ ImageUrl,
+ ImageMimeType,
+ EditorialTitle,
+ EditorialText,
+ EditorialLanguage,
+ ReviewId,
+ ReviewDateTime,
+ ReviewTitle,
+ ReviewText,
+ ReviewLanguage,
+ ReviewRating,
+ CustomDataTag = 1000
+ };
+
+ QPlaceContent(Type type = NoType);
+ ~QPlaceContent();
+
+ QPlaceContent(const QPlaceContent &other) noexcept;
+ QPlaceContent &operator=(const QPlaceContent &other) noexcept;
- QPlaceContent &operator=(const QPlaceContent &other);
+ QPlaceContent(QPlaceContent &&other) noexcept = default;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QPlaceContent)
+ void swap(QPlaceContent &other) noexcept
+ { d_ptr.swap(other.d_ptr); }
+ void detach();
bool operator==(const QPlaceContent &other) const;
bool operator!=(const QPlaceContent &other) const;
QPlaceContent::Type type() const;
- QPlaceSupplier supplier() const;
- void setSupplier(const QPlaceSupplier &supplier);
-
- QPlaceUser user() const;
- void setUser(const QPlaceUser &user);
-
- QString attribution() const;
- void setAttribution(const QString &attribution);
+ QList<DataTag> dataTags() const;
+ QVariant value(DataTag tag) const;
+ void setValue(DataTag tag, const QVariant &);
+
+#if QT_DEPRECATED_SINCE(6, 0)
+ QT_DEPRECATED_VERSION_X_6_0("Use value()") QPlaceSupplier supplier() const
+ { return value(QPlaceContent::ContentSupplier).value<QPlaceSupplier>(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use setValue()") void setSupplier(const QPlaceSupplier &supplier)
+ { setValue(QPlaceContent::ContentSupplier, QVariant::fromValue(supplier)); }
+
+ QT_DEPRECATED_VERSION_X_6_0("Use value()") QPlaceUser user() const
+ { return value(QPlaceContent::ContentUser).value<QPlaceUser>(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use setValue()") void setUser(const QPlaceUser &user)
+ { setValue(QPlaceContent::ContentUser, QVariant::fromValue(user)); }
+
+ QT_DEPRECATED_VERSION_X_6_0("Use value()") QString attribution() const
+ { return value(QPlaceContent::ContentAttribution).value<QString>(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use setValue()") void setAttribution(const QString &attribution)
+ { setValue(QPlaceContent::ContentAttribution, QVariant::fromValue(attribution)); }
+#endif
protected:
- explicit QPlaceContent(QPlaceContentPrivate *d);
- QSharedDataPointer<QPlaceContentPrivate> d_ptr;
-
-private:
inline QPlaceContentPrivate *d_func();
inline const QPlaceContentPrivate *d_func() const;
+private:
+ QExplicitlySharedDataPointer<QPlaceContentPrivate> d_ptr;
friend class QPlaceContentPrivate;
};
diff --git a/src/location/places/qplacecontent_p.h b/src/location/places/qplacecontent_p.h
index e0f2df8c..8aedfaac 100644
--- a/src/location/places/qplacecontent_p.h
+++ b/src/location/places/qplacecontent_p.h
@@ -57,48 +57,29 @@
#include <QtCore/QSharedData>
#include <QtCore/QString>
-#include <QtCore/QUrl>
+#include <QtCore/QVariant>
QT_BEGIN_NAMESPACE
-
-#define Q_IMPLEMENT_CONTENT_D_FUNC(Class) \
- Class##Private *Class::d_func() { return reinterpret_cast<Class##Private *>(d_ptr.data()); } \
- const Class##Private *Class::d_func() const { return reinterpret_cast<const Class##Private *>(d_ptr.constData()); } \
-
-#define Q_IMPLEMENT_CONTENT_COPY_CTOR(Class) \
- Class::Class(const QPlaceContent &other) : QPlaceContent() { Class##Private::copyIfPossible(d_ptr, other); }
-
-#define Q_DEFINE_CONTENT_PRIVATE_HELPER(Class, ContentType) \
- QPlaceContentPrivate *clone() const override { return new Class##Private(*this); } \
- QPlaceContent::Type type() const override {return ContentType;} \
- static void copyIfPossible(QSharedDataPointer<QPlaceContentPrivate> &d_ptr, const QPlaceContent &other) \
- { \
- if (other.type() == ContentType) \
- d_ptr = extract_d(other); \
- else \
- d_ptr = new Class##Private; \
- }
-
class QPlaceContentPrivate : public QSharedData
{
public:
- QPlaceContentPrivate(){}
- virtual ~QPlaceContentPrivate(){}
-
- virtual bool compare(const QPlaceContentPrivate *other) const;
- virtual QPlaceContentPrivate *clone() const = 0;
- virtual QPlaceContent::Type type() const = 0;
-
- /* Helper functions for C++ protection rules */
- static const QSharedDataPointer<QPlaceContentPrivate> &extract_d(const QPlaceContent &other) {return other.d_ptr;}
-
- QPlaceSupplier supplier;
- QPlaceUser user;
- QString attribution;
+ QPlaceContentPrivate(QPlaceContent::Type type)
+ : m_type(type)
+ {}
+ bool compare(const QPlaceContentPrivate *other) const;
+ QPlaceContent::Type type() const { return m_type; }
+
+ QMap<QPlaceContent::DataTag, QVariant> data;
+ const QPlaceContent::Type m_type = QPlaceContent::NoType;
};
-template<> QPlaceContentPrivate *QSharedDataPointer<QPlaceContentPrivate>::clone();
+#define Q_IMPLEMENT_CONTENT_COPY_CTOR(ContentClass, ContentType) \
+ContentClass::ContentClass(const QPlaceContent &other) \
+ : QPlaceContent(other.type() == ContentType ? other : QPlaceContent(ContentType)) \
+{ \
+} \
+
QT_END_NAMESPACE
diff --git a/src/location/places/qplaceeditorial.cpp b/src/location/places/qplaceeditorial.cpp
index bcf27353..103d76ed 100644
--- a/src/location/places/qplaceeditorial.cpp
+++ b/src/location/places/qplaceeditorial.cpp
@@ -38,19 +38,10 @@
****************************************************************************/
#include "qplaceeditorial.h"
-#include "qplaceeditorial_p.h"
+#include "qplacecontent_p.h"
QT_USE_NAMESPACE
-bool QPlaceEditorialPrivate::compare(const QPlaceContentPrivate *other) const
-{
- const QPlaceEditorialPrivate *od = static_cast<const QPlaceEditorialPrivate *>(other);
- return QPlaceContentPrivate::compare(other)
- && text == od->text
- && contentTitle == od->contentTitle
- && language == od->language;
-}
-
/*!
\class QPlaceEditorial
\inmodule QtLocation
@@ -69,84 +60,20 @@ bool QPlaceEditorialPrivate::compare(const QPlaceContentPrivate *other) const
\sa QPlaceContent
*/
+#if QT_DEPRECATED_SINCE(6, 0)
/*!
Constructs a new editorial object.
*/
QPlaceEditorial::QPlaceEditorial()
-: QPlaceContent(new QPlaceEditorialPrivate)
-{
-}
-
-/*!
- Destructor.
-*/
-QPlaceEditorial::~QPlaceEditorial()
+ : QPlaceContent(QPlaceContent::EditorialType)
{
}
/*!
\fn QPlaceEditorial::QPlaceEditorial(const QPlaceContent &other)
- Constructs a copy of \a other if possible, otherwise constructs a default editorial object.
-*/
-Q_IMPLEMENT_CONTENT_COPY_CTOR(QPlaceEditorial)
-
-Q_IMPLEMENT_CONTENT_D_FUNC(QPlaceEditorial)
-
-/*!
- Returns a textual description of the place.
-
- Depending upon the provider, the
- editorial text could be either rich(HTML based) text or plain text.
-*/
-QString QPlaceEditorial::text() const
-{
- Q_D(const QPlaceEditorial);
- return d->text;
-}
-
-/*!
- Sets the \a text of the editorial.
+ Constructs a copy of \a other if possible, otherwise constructs a default
+ editorial object.
*/
-void QPlaceEditorial::setText(const QString &text)
-{
- Q_D(QPlaceEditorial);
- d->text = text;
-}
+Q_IMPLEMENT_CONTENT_COPY_CTOR(QPlaceEditorial, QPlaceContent::EditorialType)
-/*!
- Returns the title of the editorial.
-*/
-QString QPlaceEditorial::title() const
-{
- Q_D(const QPlaceEditorial);
- return d->contentTitle;
-}
-
-/*!
- Sets the \a title of the editorial.
-*/
-void QPlaceEditorial::setTitle(const QString &title)
-{
- Q_D(QPlaceEditorial);
- d->contentTitle = title;
-}
-
-/*!
- Returns the language of the editorial. Typically this would be a language code
- in the 2 letter ISO 639-1 format.
-*/
-QString QPlaceEditorial::language() const
-{
- Q_D(const QPlaceEditorial);
- return d->language;
-}
-
-/*!
- Sets the \a language of the editorial. Typically this would be a language code
- in the 2 letter ISO 639-1 format.
-*/
-void QPlaceEditorial::setLanguage(const QString &language)
-{
- Q_D(QPlaceEditorial);
- d->language = language;
-}
+#endif // QT_DEPRECATED_SINCE(6, 0)
diff --git a/src/location/places/qplaceeditorial.h b/src/location/places/qplaceeditorial.h
index 6310d1ad..6c543619 100644
--- a/src/location/places/qplaceeditorial.h
+++ b/src/location/places/qplaceeditorial.h
@@ -42,32 +42,31 @@
#include <QtLocation/QPlaceContent>
-QT_BEGIN_NAMESPACE
+#include <QtCore/QVariant>
-class QPlaceEditorialPrivate;
+QT_BEGIN_NAMESPACE
+#if QT_DEPRECATED_SINCE(6, 0)
class Q_LOCATION_EXPORT QPlaceEditorial : public QPlaceContent
{
public:
- QPlaceEditorial();
-#ifdef Q_QDOC
- QPlaceEditorial(const QPlaceContent &other);
-#else
- Q_DECLARE_CONTENT_COPY_CTOR(QPlaceEditorial)
-#endif
+ QT_DEPRECATED_VERSION_X_6_0("Use QPlaceContent") QPlaceEditorial();
+ QT_DEPRECATED_VERSION_X_6_0("Use QPlaceContent") QPlaceEditorial(const QPlaceContent &other);
- virtual ~QPlaceEditorial();
-
- QString text() const;
- void setText(const QString &text);
- QString title() const;
- void setTitle(const QString &data);
- QString language() const;
- void setLanguage(const QString &data);
-
-private:
- Q_DECLARE_CONTENT_D_FUNC(QPlaceEditorial)
+ QT_DEPRECATED_VERSION_X_6_0("Use value()") QString text() const
+ { return value(QPlaceContent::EditorialText).value<QString>(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use setValue()") void setText(const QString &text)
+ { setValue(QPlaceContent::EditorialText, QVariant::fromValue(text)); }
+ QT_DEPRECATED_VERSION_X_6_0("Use value()") QString title() const
+ { return value(QPlaceContent::EditorialTitle).value<QString>(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use setValue()") void setTitle(const QString &title)
+ { setValue(QPlaceContent::EditorialTitle, QVariant::fromValue(title)); }
+ QT_DEPRECATED_VERSION_X_6_0("Use value()") QString language() const
+ { return value(QPlaceContent::EditorialLanguage).value<QString>(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use setValue()") void setLanguage(const QString &language)
+ { setValue(QPlaceContent::EditorialLanguage, QVariant::fromValue(language)); }
};
+#endif
QT_END_NAMESPACE
diff --git a/src/location/places/qplaceeditorial_p.h b/src/location/places/qplaceeditorial_p.h
deleted file mode 100644
index afcab4d9..00000000
--- a/src/location/places/qplaceeditorial_p.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2022 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtLocation module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPLACEDESCRIPTION_P_H
-#define QPLACEDESCRIPTION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/QUrl>
-#include <QtLocation/QPlaceSupplier>
-
-#include "qplacecontent_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QPlaceEditorialPrivate : public QPlaceContentPrivate
-{
-public:
- bool compare(const QPlaceContentPrivate *other) const override;
-
- Q_DEFINE_CONTENT_PRIVATE_HELPER(QPlaceEditorial, QPlaceContent::EditorialType)
-
- QString text;
- QString contentTitle;
- QString language;
-};
-
-QT_END_NAMESPACE
-
-#endif // QPLACEDESCRIPTION_P_H
diff --git a/src/location/places/qplaceimage.cpp b/src/location/places/qplaceimage.cpp
index fc87bfef..67e64efb 100644
--- a/src/location/places/qplaceimage.cpp
+++ b/src/location/places/qplaceimage.cpp
@@ -38,17 +38,10 @@
****************************************************************************/
#include "qplaceimage.h"
-#include "qplaceimage_p.h"
+#include "qplacecontent_p.h"
QT_USE_NAMESPACE
-bool QPlaceImagePrivate::compare(const QPlaceContentPrivate *other) const
-{
- const QPlaceImagePrivate *od = static_cast<const QPlaceImagePrivate *>(other);
- return QPlaceContentPrivate::compare(other)
- && url == od->url && id == od->id && mimeType == od->mimeType;
-}
-
/*!
\class QPlaceImage
\inmodule QtLocation
@@ -67,80 +60,22 @@ bool QPlaceImagePrivate::compare(const QPlaceContentPrivate *other) const
\sa QPlaceContent
*/
+#if QT_DEPRECATED_SINCE(6, 0)
+
/*!
Constructs an new QPlaceImage.
*/
QPlaceImage::QPlaceImage()
- : QPlaceContent(new QPlaceImagePrivate)
-{
-}
-
-/*!
- Destructor.
-*/
-QPlaceImage::~QPlaceImage()
+ : QPlaceContent(QPlaceContent::ImageType)
{
}
/*!
\fn QPlaceImage::QPlaceImage(const QPlaceContent &other)
- Constructs a copy of \a other if possible, otherwise constructs a default image.
-*/
-
-Q_IMPLEMENT_CONTENT_COPY_CTOR(QPlaceImage)
-
-Q_IMPLEMENT_CONTENT_D_FUNC(QPlaceImage)
-
-/*!
- Returns the image's url.
+ Constructs a copy of \a other if possible, otherwise constructs a default
+ image object.
*/
-QUrl QPlaceImage::url() const
-{
- Q_D(const QPlaceImage);
- return d->url;
-}
+Q_IMPLEMENT_CONTENT_COPY_CTOR(QPlaceImage, QPlaceContent::ImageType)
-/*!
- Sets the image's \a url.
-*/
-void QPlaceImage::setUrl(const QUrl &url)
-{
- Q_D(QPlaceImage);
- d->url = url;
-}
-/*!
- Returns the image's identifier.
-*/
-QString QPlaceImage::imageId() const
-{
- Q_D(const QPlaceImage);
- return d->id;
-}
-
-/*!
- Sets image's \a identifier.
-*/
-void QPlaceImage::setImageId(const QString &identifier)
-{
- Q_D(QPlaceImage);
- d->id = identifier;
-}
-
-/*!
- Returns the image's MIME type.
-*/
-QString QPlaceImage::mimeType() const
-{
- Q_D(const QPlaceImage);
- return d->mimeType;
-}
-
-/*!
- Sets image's MIME \a type.
-*/
-void QPlaceImage::setMimeType(const QString &type)
-{
- Q_D(QPlaceImage);
- d->mimeType = type;
-}
+#endif // QT_DEPRECATED_SINCE(6, 0)
diff --git a/src/location/places/qplaceimage.h b/src/location/places/qplaceimage.h
index a7a7b4e6..b4e1f267 100644
--- a/src/location/places/qplaceimage.h
+++ b/src/location/places/qplaceimage.h
@@ -40,39 +40,37 @@
#ifndef QPLACEIMAGE_H
#define QPLACEIMAGE_H
-#include <QtCore/QSharedDataPointer>
-#include <QtCore/QString>
#include <QtLocation/QPlaceContent>
-QT_BEGIN_NAMESPACE
+#include <QtCore/QString>
+#include <QtCore/QUrl>
+#include <QtCore/QVariant>
-class QPlaceImagePrivate;
-class QUrl;
+QT_BEGIN_NAMESPACE
+#if QT_DEPRECATED_SINCE(6, 0)
class Q_LOCATION_EXPORT QPlaceImage : public QPlaceContent
{
public:
- QPlaceImage();
-#ifdef Q_QDOC
- QPlaceImage(const QPlaceContent &other);
-#else
- Q_DECLARE_CONTENT_COPY_CTOR(QPlaceImage)
-#endif
-
- virtual ~QPlaceImage();
+ QT_DEPRECATED_VERSION_X_6_0("Use QPlaceContent") QPlaceImage();
+ QT_DEPRECATED_VERSION_X_6_0("Use QPlaceContent") QPlaceImage(const QPlaceContent &other);
- QUrl url() const;
- void setUrl(const QUrl &url);
+ QT_DEPRECATED_VERSION_X_6_0("Use value()") QUrl url() const
+ { return value(QPlaceContent::ImageUrl).value<QUrl>(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use setValue()") void setUrl(const QUrl &url)
+ { setValue(QPlaceContent::ImageUrl, QVariant::fromValue(url)); }
- QString imageId() const;
- void setImageId(const QString &identifier);
+ QT_DEPRECATED_VERSION_X_6_0("Use value()") QString imageId() const
+ { return value(QPlaceContent::ImageId).value<QString>(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use setValue()") void setImageId(const QString &identifier)
+ { setValue(QPlaceContent::ImageId, QVariant::fromValue(identifier)); }
- QString mimeType() const;
- void setMimeType(const QString &data);
-
-private:
- Q_DECLARE_CONTENT_D_FUNC(QPlaceImage)
+ QT_DEPRECATED_VERSION_X_6_0("Use value()") QString mimeType() const
+ { return value(QPlaceContent::ImageMimeType).value<QString>(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use setValue()") void setMimeType(const QString &type)
+ { setValue(QPlaceContent::ImageMimeType, QVariant::fromValue(type)); }
};
+#endif
QT_END_NAMESPACE
diff --git a/src/location/places/qplaceimage_p.h b/src/location/places/qplaceimage_p.h
deleted file mode 100644
index c790ee76..00000000
--- a/src/location/places/qplaceimage_p.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2022 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtLocation module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPLACEIMAGE_P_H
-#define QPLACEIMAGE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/QSharedData>
-#include <QtCore/QUrl>
-
-#include "qplaceimage.h"
-#include "qplacecontent_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QPlaceImagePrivate : public QPlaceContentPrivate
-{
-public:
- bool compare(const QPlaceContentPrivate *other) const override;
-
- Q_DEFINE_CONTENT_PRIVATE_HELPER(QPlaceImage, QPlaceContent::ImageType)
-
- QUrl url;
- QString id;
- QString mimeType;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/location/places/qplacereview.cpp b/src/location/places/qplacereview.cpp
index 83dc298c..87972488 100644
--- a/src/location/places/qplacereview.cpp
+++ b/src/location/places/qplacereview.cpp
@@ -38,22 +38,10 @@
****************************************************************************/
#include "qplacereview.h"
-#include "qplacereview_p.h"
+#include "qplacecontent_p.h"
QT_BEGIN_NAMESPACE
-bool QPlaceReviewPrivate::compare(const QPlaceContentPrivate *other) const
-{
- const QPlaceReviewPrivate *od = static_cast<const QPlaceReviewPrivate *>(other);
- return QPlaceContentPrivate::compare(other) &&
- dateTime == od->dateTime &&
- text == od->text &&
- language == od->language &&
- rating == od->rating &&
- reviewId == od->reviewId &&
- title == od->title;
-}
-
/*!
\class QPlaceReview
\inmodule QtLocation
@@ -73,140 +61,23 @@ bool QPlaceReviewPrivate::compare(const QPlaceContentPrivate *other) const
\sa QPlaceContent, QPlaceEditorial
*/
+#if QT_DEPRECATED_SINCE(6, 0)
+
/*!
Constructs a new review object.
*/
QPlaceReview::QPlaceReview()
- : QPlaceContent(new QPlaceReviewPrivate)
+ : QPlaceContent(QPlaceContent::ReviewType)
{
}
/*!
\fn QPlaceReview::QPlaceReview(const QPlaceContent &other)
- Constructs a copy of \a other, otherwise constructs a default review object.
-*/
-Q_IMPLEMENT_CONTENT_COPY_CTOR(QPlaceReview)
-
-
-/*!
- Destroys the review.
-*/
-QPlaceReview::~QPlaceReview()
-{
-}
-
-Q_IMPLEMENT_CONTENT_D_FUNC(QPlaceReview)
-
-/*!
- Returns the date and time that the review was submitted.
-*/
-QDateTime QPlaceReview::dateTime() const
-{
- Q_D(const QPlaceReview);
- return d->dateTime;
-}
-
-/*!
- Sets the date and time that the review was submitted to \a dateTime.
+ Constructs a copy of \a other if possible, otherwise constructs a default
+ review object.
*/
-void QPlaceReview::setDateTime(const QDateTime &dateTime)
-{
- Q_D(QPlaceReview);
- d->dateTime = dateTime;
-}
-
-/*!
- Returns a textual description of the place.
-
- Depending on the provider the text could be rich (HTML based) or plain text.
-*/
-QString QPlaceReview::text() const
-{
- Q_D(const QPlaceReview);
- return d->text;
-}
-
-/*!
- Sets \a text of the review.
-*/
-void QPlaceReview::setText(const QString &text)
-{
- Q_D(QPlaceReview);
- d->text = text;
-}
-
-/*!
- Returns the language of the review. Typically this would be a language code
- in the 2 letter ISO 639-1 format.
-*/
-QString QPlaceReview::language() const
-{
- Q_D(const QPlaceReview);
- return d->language;
-}
-
-/*!
- Sets the \a language of the review. Typically this would be a language code
- in the 2 letter ISO 639-1 format.
-*/
-void QPlaceReview::setLanguage(const QString &language)
-{
- Q_D(QPlaceReview);
- d->language = language;
-}
-
-/*!
- Returns this review's rating of the place.
-*/
-qreal QPlaceReview::rating() const
-{
- Q_D(const QPlaceReview);
- return d->rating;
-}
-
-/*!
- Sets the review's \a rating of the place.
-*/
-void QPlaceReview::setRating(qreal rating)
-{
- Q_D(QPlaceReview);
- d->rating = rating;
-}
-
-/*!
- Returns the review's identifier.
-*/
-QString QPlaceReview::reviewId() const
-{
- Q_D(const QPlaceReview);
- return d->reviewId;
-}
-
-/*!
- Sets the \a identifier of the review.
-*/
-void QPlaceReview::setReviewId(const QString &identifier)
-{
- Q_D(QPlaceReview);
- d->reviewId = identifier;
-}
-
-/*!
- Returns the title of the review.
-*/
-QString QPlaceReview::title() const
-{
- Q_D(const QPlaceReview);
- return d->title;
-}
-
-/*!
- Sets the \a title of the review.
-*/
-void QPlaceReview::setTitle(const QString &title)
-{
- Q_D(QPlaceReview);
- d->title = title;
-}
+Q_IMPLEMENT_CONTENT_COPY_CTOR(QPlaceReview, QPlaceContent::ReviewType)
QT_END_NAMESPACE
+
+#endif // QT_DEPRECATED_SINCE(6, 0)
diff --git a/src/location/places/qplacereview.h b/src/location/places/qplacereview.h
index 01c9a713..6f418969 100644
--- a/src/location/places/qplacereview.h
+++ b/src/location/places/qplacereview.h
@@ -42,39 +42,44 @@
#include <QtLocation/QPlaceContent>
-QT_BEGIN_NAMESPACE
+#include <QtCore/QDateTime>
+#include <QtCore/QVariant>
-class QDateTime;
-class QPlaceReviewPrivate;
+QT_BEGIN_NAMESPACE
+#if QT_DEPRECATED_SINCE(6, 0)
class Q_LOCATION_EXPORT QPlaceReview : public QPlaceContent
{
public:
- QPlaceReview();
-#ifdef Q_QDOC
- QPlaceReview(const QPlaceContent &other);
-#else
- Q_DECLARE_CONTENT_COPY_CTOR(QPlaceReview)
-#endif
- virtual ~QPlaceReview();
+ QT_DEPRECATED_VERSION_X_6_0("Use QPlaceContent") QPlaceReview();
+ QT_DEPRECATED_VERSION_X_6_0("Use QPlaceContent") QPlaceReview(const QPlaceContent &other);
- QDateTime dateTime() const;
- void setDateTime(const QDateTime &dt);
- QString text() const;
- void setText(const QString &text);
- QString language() const;
- void setLanguage(const QString &data);
-
- qreal rating() const;
- void setRating(qreal data);
- QString reviewId() const;
- void setReviewId(const QString &identifier);
- QString title() const;
- void setTitle(const QString &data);
-
-private:
- Q_DECLARE_CONTENT_D_FUNC(QPlaceReview)
+ QT_DEPRECATED_VERSION_X_6_0("Use value()") QDateTime dateTime() const
+ { return value(QPlaceContent::ReviewDateTime).value<QDateTime>(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use setValue()") void setDateTime(const QDateTime &dateTime)
+ { setValue(QPlaceContent::ReviewDateTime, QVariant::fromValue(dateTime)); }
+ QT_DEPRECATED_VERSION_X_6_0("Use value()") QString text() const
+ { return value(QPlaceContent::ReviewText).value<QString>(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use setValue()") void setText(const QString &text)
+ { setValue(QPlaceContent::ReviewText, QVariant::fromValue(text)); }
+ QT_DEPRECATED_VERSION_X_6_0("Use value()") QString language() const
+ { return value(QPlaceContent::ReviewLanguage).value<QString>(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use setValue()") void setLanguage(const QString &language)
+ { setValue(QPlaceContent::ReviewLanguage, QVariant::fromValue(language)); }
+ QT_DEPRECATED_VERSION_X_6_0("Use value()") qreal rating() const
+ { return value(QPlaceContent::ReviewRating).value<qreal>(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use setValue()") void setRating(qreal rating)
+ { setValue(QPlaceContent::ReviewRating, QVariant::fromValue(rating)); }
+ QT_DEPRECATED_VERSION_X_6_0("Use value()") QString reviewId() const
+ { return value(QPlaceContent::ReviewId).value<QString>(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use setValue()") void setReviewId(const QString &identifier)
+ { setValue(QPlaceContent::ReviewId, QVariant::fromValue(identifier)); }
+ QT_DEPRECATED_VERSION_X_6_0("Use value()") QString title() const
+ { return value(QPlaceContent::ReviewTitle).value<QString>(); }
+ QT_DEPRECATED_VERSION_X_6_0("Use setValue()") void setTitle(const QString &title)
+ { setValue(QPlaceContent::ReviewTitle, QVariant::fromValue(title)); }
};
+#endif
QT_END_NAMESPACE
diff --git a/src/location/places/qplacereview_p.h b/src/location/places/qplacereview_p.h
deleted file mode 100644
index 8fc4a9ba..00000000
--- a/src/location/places/qplacereview_p.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2022 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtLocation module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPLACEREVIEW_P_H
-#define QPLACEREVIEW_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/QUrl>
-#include <QtCore/QDateTime>
-
-#include "qplacecontent_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QPlaceReviewPrivate : public QPlaceContentPrivate
-{
-public:
- bool compare(const QPlaceContentPrivate *other) const override;
-
- Q_DEFINE_CONTENT_PRIVATE_HELPER(QPlaceReview, QPlaceContent::ReviewType);
-
- QDateTime dateTime;
- QString text;
- QString language;
- qreal rating = 0;
- QString reviewId;
- QString title;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/geoservices/nokia/placesv2/jsonparserhelpers.cpp b/src/plugins/geoservices/nokia/placesv2/jsonparserhelpers.cpp
index cc3851de..8e6858fe 100644
--- a/src/plugins/geoservices/nokia/placesv2/jsonparserhelpers.cpp
+++ b/src/plugins/geoservices/nokia/placesv2/jsonparserhelpers.cpp
@@ -48,10 +48,8 @@
#include <QtPositioning/QGeoCoordinate>
#include <QtLocation/QPlaceContentRequest>
#include <QtLocation/QPlaceIcon>
-#include <QtLocation/QPlaceImage>
-#include <QtLocation/QPlaceReview>
#include <QtLocation/QPlaceSupplier>
-#include <QtLocation/QPlaceEditorial>
+#include <QtLocation/QPlaceContent>
#include <QtLocation/QPlaceUser>
#include <QtLocation/QPlaceContactDetail>
#include <QtLocation/QPlaceCategory>
@@ -125,51 +123,61 @@ QList<QPlaceContactDetail> parseContactDetails(const QJsonArray &contacts)
return contactDetails;
}
-QPlaceImage parseImage(const QJsonObject &imageObject,
- const QPlaceManagerEngineNokiaV2 *engine)
+QPlaceContent parseImage(const QJsonObject &imageObject,
+ const QPlaceManagerEngineNokiaV2 *engine)
{
Q_ASSERT(engine);
- QPlaceImage image;
+ QPlaceContent image(QPlaceContent::ImageType);
- image.setAttribution(imageObject.value(QStringLiteral("attribution")).toString());
- image.setUrl(imageObject.value(QStringLiteral("src")).toString());
- image.setSupplier(parseSupplier(imageObject.value(QStringLiteral("supplier")).toObject(),
- engine));
+ image.setValue(QPlaceContent::ContentAttribution, imageObject.value(
+ QStringLiteral("attribution")).toString());
+ image.setValue(QPlaceContent::ImageUrl, imageObject.value(
+ QStringLiteral("src")).toString());
+ image.setValue(QPlaceContent::ContentSupplier, QVariant::fromValue(parseSupplier(
+ imageObject.value(QStringLiteral("supplier")).toObject(), engine)));
return image;
}
-QPlaceReview parseReview(const QJsonObject &reviewObject,
- const QPlaceManagerEngineNokiaV2 *engine)
+QPlaceContent parseReview(const QJsonObject &reviewObject,
+ const QPlaceManagerEngineNokiaV2 *engine)
{
Q_ASSERT(engine);
- QPlaceReview review;
+ QPlaceContent review(QPlaceContent::ReviewType);
- review.setDateTime(QDateTime::fromString(reviewObject.value(QStringLiteral("date")).toString()));
+ review.setValue(QPlaceContent::ReviewDateTime, QDateTime::fromString(
+ reviewObject.value(QStringLiteral("date")).toString()));
- if (reviewObject.contains(QStringLiteral("title")))
- review.setTitle(reviewObject.value(QStringLiteral("title")).toString());
+ if (reviewObject.contains(QStringLiteral("title"))) {
+ review.setValue(QPlaceContent::ReviewTitle, reviewObject.value(
+ QStringLiteral("title")).toString());
+ }
- if (reviewObject.contains(QStringLiteral("rating")))
- review.setRating(reviewObject.value(QStringLiteral("rating")).toDouble());
+ if (reviewObject.contains(QStringLiteral("rating"))) {
+ review.setValue(QPlaceContent::ReviewRating, reviewObject.value(
+ QStringLiteral("rating")).toDouble());
+ }
- review.setText(reviewObject.value(QStringLiteral("description")).toString());
+ review.setValue(QPlaceContent::ReviewText, reviewObject.value(
+ QStringLiteral("description")).toString());
QJsonObject userObject = reviewObject.value(QStringLiteral("user")).toObject();
QPlaceUser user;
user.setUserId(userObject.value(QStringLiteral("id")).toString());
user.setName(userObject.value(QStringLiteral("title")).toString());
- review.setUser(user);
+ review.setValue(QPlaceContent::ContentUser, QVariant::fromValue(user));
- review.setAttribution(reviewObject.value(QStringLiteral("attribution")).toString());
+ review.setValue(QPlaceContent::ContentAttribution, reviewObject.value(
+ QStringLiteral("attribution")).toString());
- review.setLanguage(reviewObject.value(QStringLiteral("language")).toString());
+ review.setValue(QPlaceContent::ReviewLanguage, reviewObject.value(
+ QStringLiteral("language")).toString());
- review.setSupplier(parseSupplier(reviewObject.value(QStringLiteral("supplier")).toObject(),
- engine));
+ review.setValue(QPlaceContent::ContentSupplier, QVariant::fromValue(parseSupplier(
+ reviewObject.value(QStringLiteral("supplier")).toObject(), engine)));
//if (reviewObject.contains(QStringLiteral("via"))) {
// QJsonObject viaObject = reviewObject.value(QStringLiteral("via")).toObject();
@@ -178,23 +186,25 @@ QPlaceReview parseReview(const QJsonObject &reviewObject,
return review;
}
-QPlaceEditorial parseEditorial(const QJsonObject &editorialObject,
- const QPlaceManagerEngineNokiaV2 *engine)
+QPlaceContent parseEditorial(const QJsonObject &editorialObject,
+ const QPlaceManagerEngineNokiaV2 *engine)
{
Q_ASSERT(engine);
- QPlaceEditorial editorial;
+ QPlaceContent editorial(QPlaceContent::EditorialType);
- editorial.setAttribution(editorialObject.value(QStringLiteral("attribution")).toString());
+ editorial.setValue(QPlaceContent::ContentAttribution, editorialObject.value(QStringLiteral("attribution")).toString());
//if (editorialObject.contains(QStringLiteral("via"))) {
// QJsonObject viaObject = editorialObject.value(QStringLiteral("via")).toObject();
//}
- editorial.setSupplier(parseSupplier(editorialObject.value(QStringLiteral("supplier")).toObject(),
- engine));
- editorial.setLanguage(editorialObject.value(QStringLiteral("language")).toString());
- editorial.setText(editorialObject.value(QStringLiteral("description")).toString());
+ editorial.setValue(QPlaceContent::ContentSupplier, QVariant::fromValue(parseSupplier(
+ editorialObject.value(QStringLiteral("supplier")).toObject(), engine)));
+ editorial.setValue(QPlaceContent::EditorialLanguage, editorialObject.value(
+ QStringLiteral("language")).toString());
+ editorial.setValue(QPlaceContent::EditorialText, editorialObject.value(
+ QStringLiteral("description")).toString());
return editorial;
}
diff --git a/src/plugins/geoservices/nokia/placesv2/jsonparserhelpers.h b/src/plugins/geoservices/nokia/placesv2/jsonparserhelpers.h
index 8f2e93f6..b6d0bb87 100644
--- a/src/plugins/geoservices/nokia/placesv2/jsonparserhelpers.h
+++ b/src/plugins/geoservices/nokia/placesv2/jsonparserhelpers.h
@@ -64,12 +64,12 @@ QList<QPlaceCategory> parseCategories(const QJsonArray &categoryArray,
const QPlaceManagerEngineNokiaV2 *engine);
QList<QPlaceContactDetail> parseContactDetails(const QJsonArray &contacts);
-QPlaceImage parseImage(const QJsonObject &imageObject,
- const QPlaceManagerEngineNokiaV2 *engine);
-QPlaceReview parseReview(const QJsonObject &reviewObject,
+QPlaceContent parseImage(const QJsonObject &imageObject,
const QPlaceManagerEngineNokiaV2 *engine);
-QPlaceEditorial parseEditorial(const QJsonObject &editorialObject,
- const QPlaceManagerEngineNokiaV2 *engine);
+QPlaceContent parseReview(const QJsonObject &reviewObject,
+ const QPlaceManagerEngineNokiaV2 *engine);
+QPlaceContent parseEditorial(const QJsonObject &editorialObject,
+ const QPlaceManagerEngineNokiaV2 *engine);
void parseCollection(QPlaceContent::Type type, const QJsonObject &object,
QPlaceContent::Collection *collection, int *totalCount,
diff --git a/src/plugins/geoservices/nokia/placesv2/qplacedetailsreplyimpl.cpp b/src/plugins/geoservices/nokia/placesv2/qplacedetailsreplyimpl.cpp
index 844a6235..72d60679 100644
--- a/src/plugins/geoservices/nokia/placesv2/qplacedetailsreplyimpl.cpp
+++ b/src/plugins/geoservices/nokia/placesv2/qplacedetailsreplyimpl.cpp
@@ -57,10 +57,7 @@
#include <QtLocation/QPlaceManager>
#include <QtLocation/QPlaceSupplier>
#include <QtLocation/QPlaceIcon>
-#include <QtLocation/QPlaceImage>
-#include <QtLocation/QPlaceEditorial>
#include <QtLocation/QPlaceRatings>
-#include <QtLocation/QPlaceReview>
#include <QtLocation/QPlaceUser>
QT_BEGIN_NAMESPACE