summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--tests/auto/geotestplugin/qplacemanagerengine_test.h112
-rw-r--r--tests/auto/nokia_services/places_semiauto/tst_places.cpp36
-rw-r--r--tests/auto/qplace/tst_qplace.cpp118
-rw-r--r--tests/auto/qplaceeditorial/tst_qplaceeditorial.cpp53
-rw-r--r--tests/auto/qplaceimage/tst_qplaceimage.cpp53
-rw-r--r--tests/auto/qplacereview/tst_qplacereview.cpp56
26 files changed, 491 insertions, 1080 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
diff --git a/tests/auto/geotestplugin/qplacemanagerengine_test.h b/tests/auto/geotestplugin/qplacemanagerengine_test.h
index 04ef0735..d09b3aa6 100644
--- a/tests/auto/geotestplugin/qplacemanagerengine_test.h
+++ b/tests/auto/geotestplugin/qplacemanagerengine_test.h
@@ -43,16 +43,13 @@
#include <QtLocation/QPlaceManagerEngine>
#include <QtLocation/QPlaceReply>
#include <QtLocation/QPlaceDetailsReply>
-#include <QtLocation/QPlaceEditorial>
#include <QtLocation/QPlaceIdReply>
-#include <QtLocation/QPlaceImage>
#include <QtLocation/QPlaceSearchSuggestionReply>
#include <QtLocation/QPlaceSearchReply>
#include <QtLocation/QPlaceSearchRequest>
#include <QtLocation/QPlaceResult>
#include <QtLocation/QPlaceCategory>
#include <QtLocation/QPlace>
-#include <QtLocation/QPlaceReview>
#include <QtLocation/private/qplace_p.h>
#include <QtTest/QTest>
@@ -306,45 +303,64 @@ public:
m_placeRecommendations.insert(place.placeId(), recommendations);
QJsonArray revArray = p.value(QStringLiteral("reviews")).toArray();
- QList<QPlaceReview> reviews;
+ QList<QPlaceContent> reviews;
for (int j = 0; j < revArray.count(); ++j) {
QJsonObject ro = revArray.at(j).toObject();
- QPlaceReview review;
- if (ro.contains(QStringLiteral("title")))
- review.setTitle(ro.value(QStringLiteral("title")).toString());
- if (ro.contains(QStringLiteral("text")))
- review.setText(ro.value(QStringLiteral("text")).toString());
-
- if (ro.contains(QStringLiteral("language")))
- review.setLanguage(ro.value("language").toString());
-
- if (ro.contains(QStringLiteral("rating")))
- review.setRating(ro.value("rating").toDouble());
-
- if (ro.contains(QStringLiteral("dateTime")))
- review.setDateTime(QDateTime::fromString(
- ro.value(QStringLiteral("dateTime")).toString(),
- QStringLiteral("hh:mm dd-MM-yyyy")));
- if (ro.contains(QStringLiteral("reviewId")))
- review.setReviewId(ro.value("reviewId").toString());
+ QPlaceContent review(QPlaceContent::ReviewType);
+ if (ro.contains(QStringLiteral("title"))) {
+ review.setValue(QPlaceContent::ReviewTitle,
+ ro.value(QStringLiteral("title")).toString());
+ }
+ if (ro.contains(QStringLiteral("text"))) {
+ review.setValue(QPlaceContent::ReviewText,
+ ro.value(QStringLiteral("text")).toString());
+ }
+
+ if (ro.contains(QStringLiteral("language"))) {
+ review.setValue(QPlaceContent::ReviewLanguage,
+ ro.value("language").toString());
+ }
+
+ if (ro.contains(QStringLiteral("rating"))) {
+ review.setValue(QPlaceContent::ReviewRating,
+ ro.value("rating").toDouble());
+ }
+
+ if (ro.contains(QStringLiteral("dateTime"))) {
+ const QString dtString =
+ ro.value(QStringLiteral("dateTime")).toString();
+ review.setValue(QPlaceContent::ReviewDateTime,
+ QDateTime::fromString(dtString,
+ QStringLiteral("hh:mm dd-MM-yyyy")));
+ }
+ if (ro.contains(QStringLiteral("reviewId"))) {
+ review.setValue(QPlaceContent::ReviewId,
+ ro.value("reviewId").toString());
+ }
reviews << review;
}
m_placeReviews.insert(place.placeId(), reviews);
QJsonArray imgArray = p.value(QStringLiteral("images")).toArray();
- QList<QPlaceImage> images;
+ QList<QPlaceContent> images;
for (int j = 0; j < imgArray.count(); ++j) {
QJsonObject imgo = imgArray.at(j).toObject();
- QPlaceImage image;
- if (imgo.contains(QStringLiteral("url")))
- image.setUrl(imgo.value(QStringLiteral("url")).toString());
-
- if (imgo.contains("imageId"))
- image.setImageId(imgo.value(QStringLiteral("imageId")).toString());
-
- if (imgo.contains("mimeType"))
- image.setMimeType(imgo.value(QStringLiteral("mimeType")).toString());
+ QPlaceContent image(QPlaceContent::ImageType);
+ if (imgo.contains(QStringLiteral("url"))) {
+ image.setValue(QPlaceContent::ImageUrl,
+ imgo.value(QStringLiteral("url")).toString());
+ }
+
+ if (imgo.contains("imageId")) {
+ image.setValue(QPlaceContent::ImageId,
+ imgo.value(QStringLiteral("imageId")).toString());
+ }
+
+ if (imgo.contains("mimeType")) {
+ image.setValue(QPlaceContent::ImageMimeType,
+ imgo.value(QStringLiteral("mimeType")).toString());
+ }
images << image;
}
@@ -352,18 +368,24 @@ public:
m_placeImages.insert(place.placeId(), images);
QJsonArray edArray = p.value(QStringLiteral("editorials")).toArray();
- QList<QPlaceEditorial> editorials;
+ QList<QPlaceContent> editorials;
for (int j = 0; j < edArray.count(); ++j) {
QJsonObject edo = edArray.at(j).toObject();
- QPlaceEditorial editorial;
- if (edo.contains(QStringLiteral("title")))
- editorial.setTitle(edo.value(QStringLiteral("title")).toString());
-
- if (edo.contains(QStringLiteral("text")))
- editorial.setText(edo.value(QStringLiteral("text")).toString());
-
- if (edo.contains(QStringLiteral("language")))
- editorial.setLanguage(edo.value(QStringLiteral("language")).toString());
+ QPlaceContent editorial(QPlaceContent::EditorialType);
+ if (edo.contains(QStringLiteral("title"))) {
+ editorial.setValue(QPlaceContent::EditorialTitle,
+ edo.value(QStringLiteral("title")).toString());
+ }
+
+ if (edo.contains(QStringLiteral("text"))) {
+ editorial.setValue(QPlaceContent::EditorialText,
+ edo.value(QStringLiteral("text")).toString());
+ }
+
+ if (edo.contains(QStringLiteral("language"))) {
+ editorial.setValue(QPlaceContent::EditorialLanguage,
+ edo.value(QStringLiteral("language")).toString());
+ }
editorials << editorial;
}
@@ -718,9 +740,9 @@ private:
QHash<QString, QPlaceCategory> m_categories;
QHash<QString, QStringList> m_childCategories;
QHash<QString, QStringList> m_placeRecommendations;
- QHash<QString, QList<QPlaceReview> > m_placeReviews;
- QHash<QString, QList<QPlaceImage> > m_placeImages;
- QHash<QString, QList<QPlaceEditorial> > m_placeEditorials;
+ QHash<QString, QList<QPlaceContent>> m_placeReviews;
+ QHash<QString, QList<QPlaceContent>> m_placeImages;
+ QHash<QString, QList<QPlaceContent>> m_placeEditorials;
};
#endif
diff --git a/tests/auto/nokia_services/places_semiauto/tst_places.cpp b/tests/auto/nokia_services/places_semiauto/tst_places.cpp
index 7b9fd160..0cf879bd 100644
--- a/tests/auto/nokia_services/places_semiauto/tst_places.cpp
+++ b/tests/auto/nokia_services/places_semiauto/tst_places.cpp
@@ -43,13 +43,10 @@
#include <QtLocation/QPlaceContactDetail>
#include <QtLocation/QPlaceContentReply>
#include <QtLocation/QPlaceContentRequest>
-#include <QtLocation/QPlaceEditorial>
#include <QtLocation/QPlaceIcon>
-#include <QtLocation/QPlaceImage>
#include <QtLocation/QPlaceManager>
#include <QtLocation/QPlaceRatings>
#include <QtLocation/QPlaceResult>
-#include <QtLocation/QPlaceReview>
#include <QtLocation/QPlaceSearchReply>
#include <QtLocation/QPlaceSearchRequest>
#include "../../placemanager_utils/placemanager_utils.h"
@@ -621,30 +618,27 @@ void tst_QPlaceManagerNokia::content()
QVERIFY(results.count() > 0);
- for (auto iter = results.cbegin(), end = results.cend(); iter != end; ++iter) {
+ for (const auto &content : qAsConst(results)) {
switch (type) {
- case (QPlaceContent::ImageType): {
- QPlaceImage image = iter.value();
- QVERIFY(!image.url().isEmpty());
+ case QPlaceContent::ImageType:
+ QVERIFY(!content.value(QPlaceContent::ImageUrl).value<QUrl>().isEmpty());
break;
- } case (QPlaceContent::ReviewType) : {
- QPlaceReview review = iter.value();
- QVERIFY(!review.dateTime().isValid());
- QVERIFY(!review.text().isEmpty());
- QVERIFY(review.rating() >= 1 && review.rating() <= 5);
-
- //title and language fields are optional and thus have not been
+ case QPlaceContent::ReviewType:
+ //review title and language fields are optional and thus have not been
//explicitly tested
+ QVERIFY(!content.value(QPlaceContent::ReviewDateTime).value<QDateTime>().isValid());
+ QVERIFY(!content.value(QPlaceContent::ReviewText).value<QString>().isEmpty());
+ QVERIFY(content.value(QPlaceContent::ReviewRating).toReal() >= 1 &&
+ content.value(QPlaceContent::ReviewRating).toReal() <= 5);
break;
- } case (QPlaceContent::EditorialType): {
- QPlaceEditorial editorial = iter.value();
- QVERIFY(!editorial.text().isEmpty());
-
- //The language field is optional and thus has not been
+ case QPlaceContent::EditorialType:
+ //The editorial language field is optional and thus has not been
//explicitly tested.
+ QVERIFY(!content.value(QPlaceContent::EditorialText).value<QString>().isEmpty());
+ break;
+ default:
+ QVERIFY2(false, "Unexpected content type");
break;
- } default:
- QFAIL("Unknown content type");
}
}
diff --git a/tests/auto/qplace/tst_qplace.cpp b/tests/auto/qplace/tst_qplace.cpp
index 8ef1e55c..a6b6bd03 100644
--- a/tests/auto/qplace/tst_qplace.cpp
+++ b/tests/auto/qplace/tst_qplace.cpp
@@ -33,15 +33,13 @@
#include <QtPositioning/QGeoCoordinate>
#include <qplace.h>
-#include <qplaceimage.h>
+#include <qplacecontent.h>
#include <qplaceattribute.h>
#include <qplacecategory.h>
#include <qplacecontactdetail.h>
#include <qplaceicon.h>
#include <qplaceratings.h>
-#include <qplacereview.h>
#include <qplacesupplier.h>
-#include <qplaceeditorial.h>
QT_USE_NAMESPACE
@@ -172,14 +170,14 @@ void tst_Place::imageContentTest()
QPlace place;
QVERIFY2(place.content(QPlaceContent::ImageType).count() ==0,"Wrong default value");
- QPlaceImage dummyImage;
- dummyImage.setUrl(QUrl("www.dummy.one"));
+ QPlaceContent dummyImage(QPlaceContent::ImageType);
+ dummyImage.setValue(QPlaceContent::ImageUrl, QUrl("www.dummy.one"));
- QPlaceImage dummyImage2;
- dummyImage2.setUrl(QUrl("www.dummy.two"));
+ QPlaceContent dummyImage2(QPlaceContent::ImageType);
+ dummyImage2.setValue(QPlaceContent::ImageUrl, QUrl("www.dummy.two"));
- QPlaceImage dummyImage3;
- dummyImage3.setUrl(QUrl("www.dummy.three"));
+ QPlaceContent dummyImage3(QPlaceContent::ImageType);
+ dummyImage3.setValue(QPlaceContent::ImageUrl, QUrl("www.dummy.three"));
QPlaceContent::Collection imageCollection;
imageCollection.insert(0,dummyImage);
@@ -190,17 +188,17 @@ void tst_Place::imageContentTest()
QPlaceContent::Collection retrievedCollection = place.content(QPlaceContent::ImageType);
QCOMPARE(retrievedCollection.count(), 3);
- QCOMPARE(QPlaceImage(retrievedCollection.value(0)), dummyImage);
- QCOMPARE(QPlaceImage(retrievedCollection.value(1)), dummyImage2);
- QCOMPARE(QPlaceImage(retrievedCollection.value(2)), dummyImage3);
+ QCOMPARE(retrievedCollection.value(0), dummyImage);
+ QCOMPARE(retrievedCollection.value(1), dummyImage2);
+ QCOMPARE(retrievedCollection.value(2), dummyImage3);
//replace the second and insert a sixth image
//indexes 4 and 5 are "missing"
- QPlaceImage dummyImage2New;
- dummyImage2.setUrl(QUrl("www.dummy.two.new"));
+ QPlaceContent dummyImage2New(QPlaceContent::ImageType);
+ dummyImage2.setValue(QPlaceContent::ImageUrl, QUrl("www.dummy.two.new"));
- QPlaceImage dummyImage6;
- dummyImage6.setUrl(QUrl("www.dummy.six"));
+ QPlaceContent dummyImage6(QPlaceContent::ImageType);
+ dummyImage6.setValue(QPlaceContent::ImageUrl, QUrl("www.dummy.six"));
imageCollection.clear();
imageCollection.insert(1, dummyImage2New);
@@ -209,12 +207,12 @@ void tst_Place::imageContentTest()
retrievedCollection = place.content(QPlaceContent::ImageType);
QCOMPARE(retrievedCollection.count(), 4);
- QCOMPARE(QPlaceImage(retrievedCollection.value(0)), dummyImage);
- QCOMPARE(QPlaceImage(retrievedCollection.value(1)), dummyImage2New);
- QCOMPARE(QPlaceImage(retrievedCollection.value(2)), dummyImage3);
- QCOMPARE(QPlaceImage(retrievedCollection.value(3)), QPlaceImage());
- QCOMPARE(QPlaceImage(retrievedCollection.value(4)), QPlaceImage());
- QCOMPARE(QPlaceImage(retrievedCollection.value(5)), dummyImage6);
+ QCOMPARE(retrievedCollection.value(0), dummyImage);
+ QCOMPARE(retrievedCollection.value(1), dummyImage2New);
+ QCOMPARE(retrievedCollection.value(2), dummyImage3);
+ QCOMPARE(retrievedCollection.value(3), QPlaceContent());
+ QCOMPARE(retrievedCollection.value(4), QPlaceContent());
+ QCOMPARE(retrievedCollection.value(5), dummyImage6);
}
void tst_Place::reviewContentTest()
@@ -222,14 +220,14 @@ void tst_Place::reviewContentTest()
QPlace place;
QVERIFY2(place.content(QPlaceContent::ReviewType).count() ==0,"Wrong default value");
- QPlaceReview dummyReview;
- dummyReview.setTitle(QStringLiteral("Review 1"));
+ QPlaceContent dummyReview(QPlaceContent::ReviewType);
+ dummyReview.setValue(QPlaceContent::ReviewTitle, QStringLiteral("Review 1"));
- QPlaceReview dummyReview2;
- dummyReview2.setTitle(QStringLiteral("Review 2"));
+ QPlaceContent dummyReview2(QPlaceContent::ReviewType);
+ dummyReview2.setValue(QPlaceContent::ReviewTitle, QStringLiteral("Review 2"));
- QPlaceReview dummyReview3;
- dummyReview3.setTitle(QStringLiteral("Review 3"));
+ QPlaceContent dummyReview3(QPlaceContent::ReviewType);
+ dummyReview3.setValue(QPlaceContent::ReviewTitle, QStringLiteral("Review 3"));
QPlaceContent::Collection reviewCollection;
reviewCollection.insert(0,dummyReview);
@@ -240,17 +238,17 @@ void tst_Place::reviewContentTest()
QPlaceContent::Collection retrievedCollection = place.content(QPlaceContent::ReviewType);
QCOMPARE(retrievedCollection.count(), 3);
- QCOMPARE(QPlaceReview(retrievedCollection.value(0)), dummyReview);
- QCOMPARE(QPlaceReview(retrievedCollection.value(1)), dummyReview2);
- QCOMPARE(QPlaceReview(retrievedCollection.value(2)), dummyReview3);
+ QCOMPARE(retrievedCollection.value(0), dummyReview);
+ QCOMPARE(retrievedCollection.value(1), dummyReview2);
+ QCOMPARE(retrievedCollection.value(2), dummyReview3);
//replace the second and insert a sixth review
//indexes 4 and 5 are "missing"
- QPlaceReview dummyReview2New;
- dummyReview2.setTitle(QStringLiteral("Review 2 new"));
+ QPlaceContent dummyReview2New(QPlaceContent::ReviewType);
+ dummyReview2.setValue(QPlaceContent::ReviewTitle, QStringLiteral("Review 2 new"));
- QPlaceReview dummyReview6;
- dummyReview6.setTitle(QStringLiteral("Review 6"));
+ QPlaceContent dummyReview6(QPlaceContent::ReviewType);
+ dummyReview6.setValue(QPlaceContent::ReviewTitle, QStringLiteral("Review 6"));
reviewCollection.clear();
reviewCollection.insert(1, dummyReview2New);
@@ -259,12 +257,12 @@ void tst_Place::reviewContentTest()
retrievedCollection = place.content(QPlaceContent::ReviewType);
QCOMPARE(retrievedCollection.count(), 4);
- QCOMPARE(QPlaceReview(retrievedCollection.value(0)), dummyReview);
- QCOMPARE(QPlaceReview(retrievedCollection.value(1)), dummyReview2New);
- QCOMPARE(QPlaceReview(retrievedCollection.value(2)), dummyReview3);
- QCOMPARE(QPlaceReview(retrievedCollection.value(3)), QPlaceReview());
- QCOMPARE(QPlaceReview(retrievedCollection.value(4)), QPlaceReview());
- QCOMPARE(QPlaceReview(retrievedCollection.value(5)), dummyReview6);
+ QCOMPARE(retrievedCollection.value(0), dummyReview);
+ QCOMPARE(retrievedCollection.value(1), dummyReview2New);
+ QCOMPARE(retrievedCollection.value(2), dummyReview3);
+ QCOMPARE(retrievedCollection.value(3), QPlaceContent());
+ QCOMPARE(retrievedCollection.value(4), QPlaceContent());
+ QCOMPARE(retrievedCollection.value(5), dummyReview6);
}
void tst_Place::editorialContentTest()
@@ -272,14 +270,14 @@ void tst_Place::editorialContentTest()
QPlace place;
QVERIFY2(place.content(QPlaceContent::EditorialType).count() == 0, "Wrong default value");
- QPlaceEditorial dummyEditorial;
- dummyEditorial.setTitle(QStringLiteral("Editorial 1"));
+ QPlaceContent dummyEditorial(QPlaceContent::EditorialType);
+ dummyEditorial.setValue(QPlaceContent::EditorialTitle, QStringLiteral("Editorial 1"));
- QPlaceEditorial dummyEditorial2;
- dummyEditorial2.setTitle(QStringLiteral("Editorial 2"));
+ QPlaceContent dummyEditorial2(QPlaceContent::EditorialType);
+ dummyEditorial2.setValue(QPlaceContent::EditorialTitle, QStringLiteral("Editorial 2"));
- QPlaceEditorial dummyEditorial3;
- dummyEditorial3.setTitle(QStringLiteral("Editorial 3"));
+ QPlaceContent dummyEditorial3(QPlaceContent::EditorialType);
+ dummyEditorial3.setValue(QPlaceContent::EditorialTitle, QStringLiteral("Editorial 3"));
QPlaceContent::Collection editorialCollection;
editorialCollection.insert(0,dummyEditorial);
@@ -290,17 +288,17 @@ void tst_Place::editorialContentTest()
QPlaceContent::Collection retrievedCollection = place.content(QPlaceContent::EditorialType);
QCOMPARE(retrievedCollection.count(), 3);
- QCOMPARE(QPlaceEditorial(retrievedCollection.value(0)), dummyEditorial);
- QCOMPARE(QPlaceEditorial(retrievedCollection.value(1)), dummyEditorial2);
- QCOMPARE(QPlaceEditorial(retrievedCollection.value(2)), dummyEditorial3);
+ QCOMPARE(retrievedCollection.value(0), dummyEditorial);
+ QCOMPARE(retrievedCollection.value(1), dummyEditorial2);
+ QCOMPARE(retrievedCollection.value(2), dummyEditorial3);
//replace the second and insert a sixth editorial
//indexes 4 and 5 are "missing"
- QPlaceEditorial dummyEditorial2New;
- dummyEditorial2.setTitle(QStringLiteral("Editorial 2 new"));
+ QPlaceContent dummyEditorial2New(QPlaceContent::EditorialType);
+ dummyEditorial2.setValue(QPlaceContent::EditorialTitle, QStringLiteral("Editorial 2 new"));
- QPlaceEditorial dummyEditorial6;
- dummyEditorial6.setTitle(QStringLiteral("Editorial 6"));
+ QPlaceContent dummyEditorial6(QPlaceContent::EditorialType);
+ dummyEditorial6.setValue(QPlaceContent::EditorialTitle, QStringLiteral("Editorial 6"));
editorialCollection.clear();
editorialCollection.insert(1, dummyEditorial2New);
@@ -309,12 +307,12 @@ void tst_Place::editorialContentTest()
retrievedCollection = place.content(QPlaceContent::EditorialType);
QCOMPARE(retrievedCollection.count(), 4);
- QCOMPARE(QPlaceEditorial(retrievedCollection.value(0)), dummyEditorial);
- QCOMPARE(QPlaceEditorial(retrievedCollection.value(1)), dummyEditorial2New);
- QCOMPARE(QPlaceEditorial(retrievedCollection.value(2)), dummyEditorial3);
- QCOMPARE(QPlaceEditorial(retrievedCollection.value(3)), QPlaceEditorial());
- QCOMPARE(QPlaceEditorial(retrievedCollection.value(4)), QPlaceEditorial());
- QCOMPARE(QPlaceEditorial(retrievedCollection.value(5)), dummyEditorial6);
+ QCOMPARE(retrievedCollection.value(0), dummyEditorial);
+ QCOMPARE(retrievedCollection.value(1), dummyEditorial2New);
+ QCOMPARE(retrievedCollection.value(2), dummyEditorial3);
+ QCOMPARE(retrievedCollection.value(3), QPlaceContent());
+ QCOMPARE(retrievedCollection.value(4), QPlaceContent());
+ QCOMPARE(retrievedCollection.value(5), dummyEditorial6);
}
void tst_Place::categoriesTest()
diff --git a/tests/auto/qplaceeditorial/tst_qplaceeditorial.cpp b/tests/auto/qplaceeditorial/tst_qplaceeditorial.cpp
index 1c20bd29..934d94b0 100644
--- a/tests/auto/qplaceeditorial/tst_qplaceeditorial.cpp
+++ b/tests/auto/qplaceeditorial/tst_qplaceeditorial.cpp
@@ -37,6 +37,9 @@
QT_USE_NAMESPACE
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
class tst_QPlaceEditorial : public QObject
{
Q_OBJECT
@@ -44,12 +47,6 @@ class tst_QPlaceEditorial : public QObject
public:
tst_QPlaceEditorial();
- //needed for QLocationTestUtils::testConversion
- QPlaceEditorial initialSubObject();
- bool checkType(const QPlaceContent &);
- void detach(QPlaceContent *);
- void setSubClassProperty(QPlaceEditorial *);
-
private Q_SLOTS:
void constructorTest();
void supplierTest();
@@ -57,48 +54,12 @@ private Q_SLOTS:
void titleTest();
void languageTest();
void operatorsTest();
- void conversionTest();
};
tst_QPlaceEditorial::tst_QPlaceEditorial()
{
}
-QPlaceEditorial tst_QPlaceEditorial::initialSubObject()
-{
- QPlaceUser user;
- user.setName("user 1");
- user.setUserId("0001");
-
- QPlaceSupplier supplier;
- supplier.setName("supplier");
- supplier.setSupplierId("1");
-
- QPlaceEditorial editorial;
- editorial.setTitle("title");
- editorial.setText("text");
- editorial.setLanguage("en");
- editorial.setUser(user);
- editorial.setSupplier(supplier);
- editorial.setAttribution("attribution");
-
- return editorial;
-}
-
-bool tst_QPlaceEditorial::checkType(const QPlaceContent &content)
-{
- return content.type() == QPlaceContent::EditorialType;
-}
-
-void tst_QPlaceEditorial::detach(QPlaceContent *content)
-{
- content->setAttribution("attribution");
-}
-
-void tst_QPlaceEditorial::setSubClassProperty(QPlaceEditorial * editorial)
-{
- editorial->setTitle("new title");
-}
void tst_QPlaceEditorial::constructorTest()
{
QPlaceEditorial testObj;
@@ -155,12 +116,8 @@ void tst_QPlaceEditorial::operatorsTest()
QVERIFY2(testObj != testObj2, "Object should be different");
}
-void tst_QPlaceEditorial::conversionTest()
-{
- QLocationTestUtils::testConversion<tst_QPlaceEditorial,
- QPlaceContent,
- QPlaceEditorial>(this);
-}
+QT_WARNING_POP
+
QTEST_APPLESS_MAIN(tst_QPlaceEditorial);
#include "tst_qplaceeditorial.moc"
diff --git a/tests/auto/qplaceimage/tst_qplaceimage.cpp b/tests/auto/qplaceimage/tst_qplaceimage.cpp
index 1e5396fe..a67eedd8 100644
--- a/tests/auto/qplaceimage/tst_qplaceimage.cpp
+++ b/tests/auto/qplaceimage/tst_qplaceimage.cpp
@@ -36,6 +36,9 @@
QT_USE_NAMESPACE
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
class tst_QPlaceImage : public QObject
{
Q_OBJECT
@@ -43,12 +46,6 @@ class tst_QPlaceImage : public QObject
public:
tst_QPlaceImage();
- //needed for QLocationTestUtils::testConversion
- QPlaceImage initialSubObject();
- bool checkType(const QPlaceContent &);
- void detach(QPlaceContent *);
- void setSubClassProperty(QPlaceImage *);
-
private Q_SLOTS:
void constructorTest();
void supplierTest();
@@ -56,49 +53,12 @@ private Q_SLOTS:
void mimeTypeTest();
void attributionTest();
void operatorsTest();
- void conversionTest();
};
tst_QPlaceImage::tst_QPlaceImage()
{
}
-QPlaceImage tst_QPlaceImage::initialSubObject()
-{
- QPlaceUser user;
- user.setName("user 1");
- user.setUserId("0001");
-
- QPlaceSupplier supplier;
- supplier.setName("supplier");
- supplier.setSupplierId("1");
-
- QPlaceImage image;
- image.setUrl(QUrl(QStringLiteral("file:///opt/icon/img.png")));
- image.setImageId("0001");
- image.setMimeType("image/png");
- image.setUser(user);
- image.setSupplier(supplier);
- image.setAttribution("attribution");
-
- return image;
-}
-
-bool tst_QPlaceImage::checkType(const QPlaceContent &content)
-{
- return content.type() == QPlaceContent::ImageType;
-}
-
-void tst_QPlaceImage::detach(QPlaceContent *content)
-{
- content->setAttribution("attribution");
-}
-
-void tst_QPlaceImage::setSubClassProperty(QPlaceImage *image)
-{
- image->setImageId("0002");
-}
-
void tst_QPlaceImage::constructorTest()
{
QPlaceImage testObj;
@@ -157,12 +117,7 @@ void tst_QPlaceImage::operatorsTest()
QVERIFY2(testObj != testObj2, "Object should be different");
}
-void tst_QPlaceImage::conversionTest()
-{
- QLocationTestUtils::testConversion<tst_QPlaceImage,
- QPlaceContent,
- QPlaceImage>(this);
-}
+QT_WARNING_POP
QTEST_APPLESS_MAIN(tst_QPlaceImage);
diff --git a/tests/auto/qplacereview/tst_qplacereview.cpp b/tests/auto/qplacereview/tst_qplacereview.cpp
index 7f7edfe0..b1607434 100644
--- a/tests/auto/qplacereview/tst_qplacereview.cpp
+++ b/tests/auto/qplacereview/tst_qplacereview.cpp
@@ -37,6 +37,9 @@
QT_USE_NAMESPACE
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
class tst_QPlaceReview : public QObject
{
Q_OBJECT
@@ -44,12 +47,6 @@ class tst_QPlaceReview : public QObject
public:
tst_QPlaceReview();
- //needed for QLocationTestUtils::testConversion
- QPlaceReview initialSubObject();
- bool checkType(const QPlaceContent &);
- void detach(QPlaceContent *);
- void setSubClassProperty(QPlaceReview *);
-
private Q_SLOTS:
void constructorTest();
void supplierTest();
@@ -61,52 +58,12 @@ private Q_SLOTS:
void titleTest();
void userTest();
void operatorsTest();
- void conversionTest();
};
tst_QPlaceReview::tst_QPlaceReview()
{
}
-QPlaceReview tst_QPlaceReview::initialSubObject()
-{
- QPlaceUser user;
- user.setName("user 1");
- user.setUserId("0001");
-
- QPlaceSupplier supplier;
- supplier.setName("supplier");
- supplier.setSupplierId("1");
-
- QPlaceReview review;
- review.setTitle("title");
- review.setText("text");
- review.setRating(4.5);
- review.setLanguage("en");
- review.setDateTime(QDateTime::fromString("01:02 03/04/2000",
- "hh:mm dd/MM/yyyy"));
- review.setUser(user);
- review.setSupplier(supplier);
- review.setAttribution("attribution");
-
- return review;
-}
-
-bool tst_QPlaceReview::checkType(const QPlaceContent &content)
-{
- return content.type() == QPlaceContent::ReviewType;
-}
-
-void tst_QPlaceReview::detach(QPlaceContent *content)
-{
- content->setAttribution("attribution");
-}
-
-void tst_QPlaceReview::setSubClassProperty(QPlaceReview *review)
-{
- review->setTitle("new title");
-}
-
void tst_QPlaceReview::constructorTest()
{
QPlaceReview testObj;
@@ -208,12 +165,7 @@ void tst_QPlaceReview::userTest()
QVERIFY(review.user().name().isEmpty());
}
-void tst_QPlaceReview::conversionTest()
-{
- QLocationTestUtils::testConversion<tst_QPlaceReview,
- QPlaceContent,
- QPlaceReview>(this);
-}
+QT_WARNING_POP
QTEST_APPLESS_MAIN(tst_QPlaceReview)