summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-09-16 01:26:43 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-09-22 18:08:49 +0200
commitf47ca3c977f6431f36973f4cf60bee64ac4930ef (patch)
tree4e01e3dee828bd7d0cb81a46cd6251fa773ac8f6 /src
parent34e64b8bb4e54185d3235a9d8cd15cd446eb20c1 (diff)
downloadqtlocation-f47ca3c977f6431f36973f4cf60bee64ac4930ef.tar.gz
Cleanup: QPlaceContent and subclasses (3/3)
Remove the dedicated declarative model implementations for the special QPlaceContent types. Since everyhing is now a QPlaceContent, the generic model can return all the data, depending on which QPlaceContent::Type it has been created for. For QML clients, nothing changes. Change-Id: I7c8c02dc5986f4223b8f112dc5766ce073a41a4d Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/imports/location/location.cpp2
-rw-r--r--src/location/CMakeLists.txt6
-rw-r--r--src/location/declarativeplaces/qdeclarativeplace.cpp4
-rw-r--r--src/location/declarativeplaces/qdeclarativeplace_p.h10
-rw-r--r--src/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp183
-rw-r--r--src/location/declarativeplaces/qdeclarativeplacecontentmodel_p.h43
-rw-r--r--src/location/declarativeplaces/qdeclarativeplaceeditorialmodel.cpp172
-rw-r--r--src/location/declarativeplaces/qdeclarativeplaceeditorialmodel_p.h79
-rw-r--r--src/location/declarativeplaces/qdeclarativeplaceimagemodel.cpp171
-rw-r--r--src/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h79
-rw-r--r--src/location/declarativeplaces/qdeclarativereviewmodel.cpp184
-rw-r--r--src/location/declarativeplaces/qdeclarativereviewmodel_p.h81
12 files changed, 223 insertions, 791 deletions
diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp
index a294879b..0b5ddd65 100644
--- a/src/imports/location/location.cpp
+++ b/src/imports/location/location.cpp
@@ -186,7 +186,7 @@ public:
qmlRegisterType<QDeclarativePlaceEditorialModel >(uri, major, minor, "EditorialModel");
qmlRegisterType<QDeclarativePlaceImageModel >(uri, major, minor, "ImageModel");
qmlRegisterType<QDeclarativePlace >(uri, major, minor, "Place");
- qmlRegisterType<QDeclarativeReviewModel >(uri, major, minor, "ReviewModel");
+ qmlRegisterType<QDeclarativePlaceReviewModel >(uri, major, minor, "ReviewModel");
qmlRegisterType<QDeclarativeRectangleMapItem >(uri, major, minor, "MapRectangle");
qmlRegisterType<QDeclarativeCircleMapItem >(uri, major, minor, "MapCircle");
qmlRegisterAnonymousType<QDeclarativeMapLineProperties >(uri, major);
diff --git a/src/location/CMakeLists.txt b/src/location/CMakeLists.txt
index 80faaf17..fbb55ba1 100644
--- a/src/location/CMakeLists.txt
+++ b/src/location/CMakeLists.txt
@@ -134,13 +134,7 @@ qt_internal_add_module(Location
declarativeplaces/qdeclarativeplacecontentmodel.cpp
declarativeplaces/qdeclarativeplacecontentmodel_p.h
declarativeplaces/qdeclarativeplace.cpp
- declarativeplaces/qdeclarativeplaceeditorialmodel.cpp
- declarativeplaces/qdeclarativeplaceeditorialmodel_p.h
- declarativeplaces/qdeclarativeplaceimagemodel.cpp
- declarativeplaces/qdeclarativeplaceimagemodel_p.h
declarativeplaces/qdeclarativeplace_p.h
- declarativeplaces/qdeclarativereviewmodel.cpp
- declarativeplaces/qdeclarativereviewmodel_p.h
declarativeplaces/qdeclarativesearchmodelbase.cpp
declarativeplaces/qdeclarativesearchmodelbase_p.h
declarativeplaces/qdeclarativesearchresultmodel.cpp
diff --git a/src/location/declarativeplaces/qdeclarativeplace.cpp b/src/location/declarativeplaces/qdeclarativeplace.cpp
index 4a672cae..5cdb7649 100644
--- a/src/location/declarativeplaces/qdeclarativeplace.cpp
+++ b/src/location/declarativeplaces/qdeclarativeplace.cpp
@@ -261,10 +261,10 @@ QDeclarativeGeoServiceProvider *QDeclarativePlace::plugin() const
This property holds a model which can be used to retrieve reviews about the place.
*/
-QDeclarativeReviewModel *QDeclarativePlace::reviewModel()
+QDeclarativePlaceReviewModel *QDeclarativePlace::reviewModel()
{
if (!m_reviewModel) {
- m_reviewModel = new QDeclarativeReviewModel(this);
+ m_reviewModel = new QDeclarativePlaceReviewModel(this);
m_reviewModel->setPlace(this);
}
diff --git a/src/location/declarativeplaces/qdeclarativeplace_p.h b/src/location/declarativeplaces/qdeclarativeplace_p.h
index 451b1e60..9774b8eb 100644
--- a/src/location/declarativeplaces/qdeclarativeplace_p.h
+++ b/src/location/declarativeplaces/qdeclarativeplace_p.h
@@ -62,9 +62,7 @@
#include <QtPositioningQuick/private/qdeclarativegeolocation_p.h>
#include <QtLocation/private/qdeclarativecategory_p.h>
-#include <QtLocation/private/qdeclarativereviewmodel_p.h>
-#include <QtLocation/private/qdeclarativeplaceimagemodel_p.h>
-#include <QtLocation/private/qdeclarativeplaceeditorialmodel_p.h>
+#include <QtLocation/private/qdeclarativeplacecontentmodel_p.h>
QT_BEGIN_NAMESPACE
@@ -90,7 +88,7 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativePlace : public QObject, public QQmlP
Q_PROPERTY(QString placeId READ placeId WRITE setPlaceId NOTIFY placeIdChanged)
Q_PROPERTY(QString attribution READ attribution WRITE setAttribution NOTIFY attributionChanged)
- Q_PROPERTY(QDeclarativeReviewModel *reviewModel READ reviewModel NOTIFY reviewModelChanged)
+ Q_PROPERTY(QDeclarativePlaceReviewModel *reviewModel READ reviewModel NOTIFY reviewModelChanged)
Q_PROPERTY(QDeclarativePlaceImageModel *imageModel READ imageModel NOTIFY imageModelChanged)
Q_PROPERTY(QDeclarativePlaceEditorialModel *editorialModel READ editorialModel NOTIFY editorialModelChanged)
@@ -129,7 +127,7 @@ public:
void setPlugin(QDeclarativeGeoServiceProvider *plugin);
QDeclarativeGeoServiceProvider *plugin() const;
- QDeclarativeReviewModel *reviewModel();
+ QDeclarativePlaceReviewModel *reviewModel();
QDeclarativePlaceImageModel *imageModel();
QDeclarativePlaceEditorialModel *editorialModel();
@@ -231,7 +229,7 @@ private:
QPlaceRatings m_ratings;
QPlaceSupplier m_supplier;
QPlaceIcon m_icon;
- QDeclarativeReviewModel *m_reviewModel = nullptr;
+ QDeclarativePlaceReviewModel *m_reviewModel = nullptr;
QDeclarativePlaceImageModel *m_imageModel = nullptr;
QDeclarativePlaceEditorialModel *m_editorialModel = nullptr;
QQmlPropertyMap *m_extendedAttributes = nullptr;
diff --git a/src/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp b/src/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp
index 6f7d7bd4..bd2d182a 100644
--- a/src/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp
+++ b/src/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp
@@ -50,6 +50,126 @@
QT_BEGIN_NAMESPACE
+/*!
+ \qmltype ContentModel
+ \instantiates QDeclarativePlaceContentModel
+ \inqmlmodule QtLocation
+ \ingroup qml-QtLocation5-places
+ \ingroup qml-QtLocation5-places-models
+ \since QtLocation 5.5
+
+ \brief The EditorialModel type provides a model of place content.
+
+ The EditorialModel is a read-only model used to fetch editorials related to a \l Place.
+ Binding a \l Place via \l EditorialModel::place initiates an initial fetch of editorials.
+ The model performs fetches incrementally and is intended to be used in conjunction
+ with a View such as a \l ListView. When the View reaches the last of the editorials
+ currently in the model, a fetch is performed to retrieve more if they are available.
+ The View is automatically updated as the editorials are received. The number of
+ editorials which are fetched at a time is specified by the \l batchSize property.
+ The total number of editorials available can be accessed via the \l totalCount property.
+
+ The model returns data for the following roles:
+
+ \table
+ \header
+ \li Role
+ \li Type
+ \li Description
+ \row
+ \li supplier
+ \li \l Supplier
+ \li The supplier of the content.
+ \row
+ \li user
+ \li \l {QtLocation::User}{User}
+ \li The user who contributed the content.
+ \row
+ \li attribution
+ \li string
+ \li Attribution text which must be displayed when displaying the content.
+ \row
+ \li url
+ \li url
+ \li The URL of the image.
+ \row
+ \li imageId
+ \li string
+ \li The identifier of the image.
+ \row
+ \li mimeType
+ \li string
+ \li The MIME type of the image.
+ \row
+ \li text
+ \li string
+ \li The editorial's textual description of the place. It can be either rich (HTML based) text or plain text
+ depending upon the provider.
+ \row
+ \li title
+ \li string
+ \li The title of the editorial.
+ \row
+ \li language
+ \li string
+ \li The language that the editorial is written in.
+ \row
+ \li dateTime
+ \li datetime
+ \li The date and time that the review was posted.
+ \row
+ \li text
+ \li string
+ \li The review's textual description of the place. It can be either rich (HTML based) text or plain text
+ depending on the provider.
+ \row
+ \li language
+ \li string
+ \li The language that the review is written in.
+ \row
+ \li rating
+ \li real
+ \li The rating that the reviewer gave to the place.
+ \row
+ \li reviewId
+ \li string
+ \li The identifier of the review.
+ \row
+ \li title
+ \li string
+ \li The title of the review.
+ \endtable
+
+ \section1 Example
+
+ The following example shows how to display editorials for a place:
+
+ \snippet declarative/places.qml QtQuick import
+ \snippet declarative/maps.qml QtLocation import
+ \codeline
+ \snippet declarative/places.qml EditorialModel
+
+*/
+
+/*!
+ \qmlproperty Place EditorialModel::place
+
+ This property holds the Place that the editorials are for.
+*/
+
+/*!
+ \qmlproperty int EditorialModel::batchSize
+
+ This property holds the batch size to use when fetching more editorials items.
+*/
+
+/*!
+ \qmlproperty int EditorialModel::totalCount
+
+ This property holds the total number of editorial items for the place.
+*/
+
+
QDeclarativePlaceContentModel::QDeclarativePlaceContentModel(QPlaceContent::Type type,
QObject *parent)
: QAbstractListModel(parent), m_type(type)
@@ -194,16 +314,44 @@ QVariant QDeclarativePlaceContentModel::data(const QModelIndex &index, int role)
return QVariant();
const QPlaceContent &content = m_content.value(index.row());
+ if (content.type() != m_type)
+ return QVariant();
switch (role) {
- case SupplierRole:
+ case ContentSupplierRole:
return QVariant::fromValue(m_suppliers.value(content.value(QPlaceContent::ContentSupplier)
.value<QPlaceSupplier>().supplierId()));
- case PlaceUserRole:
+ case ContentUserRole:
return QVariant::fromValue(m_users.value(content.value(QPlaceContent::ContentUser)
.value<QPlaceUser>().userId()));
- case AttributionRole:
+ case ContentAttributionRole:
return content.value(QPlaceContent::ContentAttribution);
+ case ImageUrlRole:
+ return content.value(QPlaceContent::ImageUrl);
+ case ImageIdRole:
+ return content.value(QPlaceContent::ImageId);
+ case ImageMimeTypeRole:
+ return content.value(QPlaceContent::ImageMimeType);
+
+ case EditorialTextRole:
+ return content.value(QPlaceContent::EditorialText);
+ case EditorialTitleRole:
+ return content.value(QPlaceContent::EditorialTitle);
+ case EditorialLanguageRole:
+ return content.value(QPlaceContent::EditorialLanguage);
+
+ case ReviewDateTimeRole:
+ return content.value(QPlaceContent::ReviewDateTime);
+ case ReviewTextRole:
+ return content.value(QPlaceContent::ReviewText);
+ case ReviewLanguageRole:
+ return content.value(QPlaceContent::ReviewLanguage);
+ case ReviewRatingRole:
+ return content.value(QPlaceContent::ReviewRating);
+ case ReviewIdRole:
+ return content.value(QPlaceContent::ReviewId);
+ case ReviewTitleRole:
+ return content.value(QPlaceContent::ReviewTitle);
default:
return QVariant();
}
@@ -212,9 +360,32 @@ QVariant QDeclarativePlaceContentModel::data(const QModelIndex &index, int role)
QHash<int, QByteArray> QDeclarativePlaceContentModel::roleNames() const
{
QHash<int, QByteArray> roles = QAbstractListModel::roleNames();
- roles.insert(SupplierRole, "supplier");
- roles.insert(PlaceUserRole, "user");
- roles.insert(AttributionRole, "attribution");
+ roles.insert(ContentSupplierRole, "supplier");
+ roles.insert(ContentUserRole, "user");
+ roles.insert(ContentAttributionRole, "attribution");
+
+ switch (m_type) {
+ case QPlaceContent::EditorialType:
+ roles.insert(EditorialTextRole, "text");
+ roles.insert(EditorialTitleRole, "title");
+ roles.insert(EditorialLanguageRole, "language");
+ break;
+ case QPlaceContent::ImageType:
+ roles.insert(ImageUrlRole, "url");
+ roles.insert(ImageIdRole, "imageId");
+ roles.insert(ImageMimeTypeRole, "mimeType");
+ break;
+ case QPlaceContent::ReviewType:
+ roles.insert(ReviewDateTimeRole, "dateTime");
+ roles.insert(ReviewTextRole, "text");
+ roles.insert(ReviewLanguageRole, "language");
+ roles.insert(ReviewRatingRole, "rating");
+ roles.insert(ReviewIdRole, "reviewId");
+ roles.insert(ReviewTitleRole, "title");
+ break;
+ default:
+ break;
+ }
return roles;
}
diff --git a/src/location/declarativeplaces/qdeclarativeplacecontentmodel_p.h b/src/location/declarativeplaces/qdeclarativeplacecontentmodel_p.h
index ea41f210..c5b09eaa 100644
--- a/src/location/declarativeplaces/qdeclarativeplacecontentmodel_p.h
+++ b/src/location/declarativeplaces/qdeclarativeplacecontentmodel_p.h
@@ -99,10 +99,21 @@ public:
QHash<int, QByteArray> roleNames() const override;
enum Roles {
- SupplierRole = Qt::UserRole,
- PlaceUserRole,
- AttributionRole,
- UserRole //indicator for next conten type specific role
+ ContentSupplierRole = Qt::UserRole,
+ ContentUserRole,
+ ContentAttributionRole,
+ EditorialTitleRole,
+ EditorialTextRole,
+ EditorialLanguageRole,
+ ImageIdRole,
+ ImageUrlRole,
+ ImageMimeTypeRole,
+ ReviewIdRole,
+ ReviewDateTimeRole,
+ ReviewTitleRole,
+ ReviewTextRole,
+ ReviewLanguageRole,
+ ReviewRatingRole
};
bool canFetchMore(const QModelIndex &parent) const override;
@@ -137,6 +148,30 @@ private:
bool m_complete = false;
};
+class QDeclarativePlaceReviewModel : public QDeclarativePlaceContentModel
+{
+public:
+ explicit QDeclarativePlaceReviewModel(QObject *parent = nullptr)
+ : QDeclarativePlaceContentModel(QPlaceContent::ReviewType, parent)
+ {}
+};
+
+class QDeclarativePlaceEditorialModel : public QDeclarativePlaceContentModel
+{
+public:
+ explicit QDeclarativePlaceEditorialModel(QObject *parent = nullptr)
+ : QDeclarativePlaceContentModel(QPlaceContent::EditorialType, parent)
+ {}
+};
+
+class QDeclarativePlaceImageModel : public QDeclarativePlaceContentModel
+{
+public:
+ explicit QDeclarativePlaceImageModel(QObject *parent = nullptr)
+ : QDeclarativePlaceContentModel(QPlaceContent::ImageType, parent)
+ {}
+};
+
QT_END_NAMESPACE
#endif // QDECLARATIVEPLACECONTENTMODEL_H
diff --git a/src/location/declarativeplaces/qdeclarativeplaceeditorialmodel.cpp b/src/location/declarativeplaces/qdeclarativeplaceeditorialmodel.cpp
deleted file mode 100644
index 3dffeec5..00000000
--- a/src/location/declarativeplaces/qdeclarativeplaceeditorialmodel.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 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$
-**
-****************************************************************************/
-
-#include "qdeclarativeplaceeditorialmodel_p.h"
-
-#include <QtCore/QUrl>
-#include <QtLocation/QPlaceContent>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype EditorialModel
- \instantiates QDeclarativePlaceEditorialModel
- \inqmlmodule QtLocation
- \ingroup qml-QtLocation5-places
- \ingroup qml-QtLocation5-places-models
- \since QtLocation 5.5
-
- \brief The EditorialModel type provides a model of place editorials.
-
- The EditorialModel is a read-only model used to fetch editorials related to a \l Place.
- Binding a \l Place via \l EditorialModel::place initiates an initial fetch of editorials.
- The model performs fetches incrementally and is intended to be used in conjunction
- with a View such as a \l ListView. When the View reaches the last of the editorials
- currently in the model, a fetch is performed to retrieve more if they are available.
- The View is automatically updated as the editorials are received. The number of
- editorials which are fetched at a time is specified by the \l batchSize property.
- The total number of editorials available can be accessed via the \l totalCount property.
-
- The model returns data for the following roles:
-
- \table
- \header
- \li Role
- \li Type
- \li Description
- \row
- \li text
- \li string
- \li The editorial's textual description of the place. It can be either rich (HTML based) text or plain text
- depending upon the provider.
- \row
- \li title
- \li string
- \li The title of the editorial.
- \row
- \li language
- \li string
- \li The language that the editorial is written in.
- \row
- \li supplier
- \li \l Supplier
- \li The supplier of the editorial.
- \row
- \li user
- \li \l {QtLocation::User}{User}
- \li The user who contributed the editorial.
- \row
- \li attribution
- \li string
- \li Attribution text which must be displayed when displaying the editorial.
- \endtable
-
- \section1 Example
-
- The following example shows how to display editorials for a place:
-
- \snippet declarative/places.qml QtQuick import
- \snippet declarative/maps.qml QtLocation import
- \codeline
- \snippet declarative/places.qml EditorialModel
-
-*/
-
-/*!
- \qmlproperty Place EditorialModel::place
-
- This property holds the Place that the editorials are for.
-*/
-
-/*!
- \qmlproperty int EditorialModel::batchSize
-
- This property holds the batch size to use when fetching more editorials items.
-*/
-
-/*!
- \qmlproperty int EditorialModel::totalCount
-
- This property holds the total number of editorial items for the place.
-*/
-
-QDeclarativePlaceEditorialModel::QDeclarativePlaceEditorialModel(QObject *parent)
-: QDeclarativePlaceContentModel(QPlaceContent::EditorialType, parent)
-{
-}
-
-QDeclarativePlaceEditorialModel::~QDeclarativePlaceEditorialModel()
-{
-}
-
-/*!
- \internal
-*/
-QVariant QDeclarativePlaceEditorialModel::data(const QModelIndex &index, int role) const
-{
- if (!index.isValid())
- return QVariant();
-
- if (index.row() >= rowCount(index.parent()) || index.row() < 0)
- return QVariant();
-
- const QPlaceContent &content = m_content.value(index.row());
-
- switch (role) {
- case TextRole:
- return content.value(QPlaceContent::EditorialText);
- case TitleRole:
- return content.value(QPlaceContent::EditorialTitle);
- case LanguageRole:
- return content.value(QPlaceContent::EditorialLanguage);
- }
-
- return QDeclarativePlaceContentModel::data(index, role);
-}
-
-QHash<int, QByteArray> QDeclarativePlaceEditorialModel::roleNames() const
-{
- QHash<int, QByteArray> roleNames = QDeclarativePlaceContentModel::roleNames();
- roleNames.insert(TextRole, "text");
- roleNames.insert(TitleRole, "title");
- roleNames.insert(LanguageRole, "language");
- return roleNames;
-}
-
-QT_END_NAMESPACE
diff --git a/src/location/declarativeplaces/qdeclarativeplaceeditorialmodel_p.h b/src/location/declarativeplaces/qdeclarativeplaceeditorialmodel_p.h
deleted file mode 100644
index c545f519..00000000
--- a/src/location/declarativeplaces/qdeclarativeplaceeditorialmodel_p.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 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 QDECLARATIVEPLACEEDITORIALMODEL_H
-#define QDECLARATIVEPLACEEDITORIALMODEL_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 <QtLocation/private/qlocationglobal_p.h>
-#include <QtLocation/private/qdeclarativeplacecontentmodel_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_LOCATION_PRIVATE_EXPORT QDeclarativePlaceEditorialModel : public QDeclarativePlaceContentModel
-{
- Q_OBJECT
-
-public:
- explicit QDeclarativePlaceEditorialModel(QObject *parent = nullptr);
- ~QDeclarativePlaceEditorialModel();
-
- QVariant data(const QModelIndex &index, int role) const override;
- QHash<int, QByteArray> roleNames() const override;
-
- enum Roles {
- TextRole = UserRole,
- TitleRole,
- LanguageRole
- };
-};
-
-QT_END_NAMESPACE
-
-#endif // QDECLARATIVEPLACEEDITORIALMODEL_H
diff --git a/src/location/declarativeplaces/qdeclarativeplaceimagemodel.cpp b/src/location/declarativeplaces/qdeclarativeplaceimagemodel.cpp
deleted file mode 100644
index b32a1292..00000000
--- a/src/location/declarativeplaces/qdeclarativeplaceimagemodel.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 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$
-**
-****************************************************************************/
-
-#include "qdeclarativeplaceimagemodel_p.h"
-
-#include <QtCore/QUrl>
-#include <QtLocation/QPlaceContent>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype ImageModel
- \instantiates QDeclarativePlaceImageModel
- \inqmlmodule QtLocation
- \ingroup qml-QtLocation5-places
- \ingroup qml-QtLocation5-places-models
- \since QtLocation 5.5
-
- \brief The ImageModel type provides a model of place images.
-
- The ImageModel is a read-only model used to fetch images related to a \l Place.
- Binding a \l Place via \l ImageModel::place initiates an initial fetch of images.
- The model performs fetches incrementally and is intended to be used in conjunction
- with a View such as a \l ListView. When the View reaches the last of the images
- currently in the model, a fetch is performed to retrieve more if they are available.
- The View is automatically updated as the images are received. The number of images
- which are fetched at a time is specified by the \l batchSize property. The total number
- of images available can be accessed via the \l totalCount property.
-
- The model returns data for the following roles:
-
- \table
- \header
- \li Role
- \li Type
- \li Description
- \row
- \li url
- \li url
- \li The URL of the image.
- \row
- \li imageId
- \li string
- \li The identifier of the image.
- \row
- \li mimeType
- \li string
- \li The MIME type of the image.
- \row
- \li supplier
- \li \l Supplier
- \li The supplier of the image.
- \row
- \li user
- \li \l {QtLocation::User}{User}
- \li The user who contributed the image.
- \row
- \li attribution
- \li string
- \li Attribution text which must be displayed when displaying the image.
- \endtable
-
-
- \section1 Example
-
- The following example shows how to display images for a place:
-
- \snippet declarative/places.qml QtQuick import
- \snippet declarative/maps.qml QtLocation import
- \codeline
- \snippet declarative/places.qml ImageModel
-*/
-
-/*!
- \qmlproperty Place ImageModel::place
-
- This property holds the Place that the images are for.
-*/
-
-/*!
- \qmlproperty int ImageModel::batchSize
-
- This property holds the batch size to use when fetching more image items.
-*/
-
-/*!
- \qmlproperty int ImageModel::totalCount
-
- This property holds the total number of image items for the place.
-*/
-
-QDeclarativePlaceImageModel::QDeclarativePlaceImageModel(QObject *parent)
-: QDeclarativePlaceContentModel(QPlaceContent::ImageType, parent)
-{
-}
-
-QDeclarativePlaceImageModel::~QDeclarativePlaceImageModel()
-{
-}
-
-/*!
- \internal
-*/
-QVariant QDeclarativePlaceImageModel::data(const QModelIndex &index, int role) const
-{
- if (!index.isValid())
- return QVariant();
-
- if (index.row() >= rowCount(index.parent()) || index.row() < 0)
- return QVariant();
-
- const QPlaceContent &image = m_content.value(index.row());
-
- switch (role) {
- case UrlRole:
- return image.value(QPlaceContent::ImageUrl);
- case ImageIdRole:
- return image.value(QPlaceContent::ImageId);
- case MimeTypeRole:
- return image.value(QPlaceContent::ImageMimeType);
- }
-
- return QDeclarativePlaceContentModel::data(index, role);
-}
-
-QHash<int, QByteArray> QDeclarativePlaceImageModel::roleNames() const
-{
- QHash<int, QByteArray> roles = QDeclarativePlaceContentModel::roleNames();
- roles.insert(UrlRole, "url");
- roles.insert(ImageIdRole, "imageId");
- roles.insert(MimeTypeRole, "mimeType");
- return roles;
-}
-
-QT_END_NAMESPACE
diff --git a/src/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h b/src/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h
deleted file mode 100644
index f07e671c..00000000
--- a/src/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 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 QDECLARATIVEPLACEIMAGEMODEL_P_H
-#define QDECLARATIVEPLACEIMAGEMODEL_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 <QtLocation/private/qlocationglobal_p.h>
-#include <QtLocation/private/qdeclarativeplacecontentmodel_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_LOCATION_PRIVATE_EXPORT QDeclarativePlaceImageModel : public QDeclarativePlaceContentModel
-{
- Q_OBJECT
-
-public:
- explicit QDeclarativePlaceImageModel(QObject *parent = nullptr);
- ~QDeclarativePlaceImageModel();
-
- QVariant data(const QModelIndex &index, int role) const override;
- QHash<int, QByteArray> roleNames() const override;
-
- enum Roles {
- UrlRole = UserRole,
- ImageIdRole,
- MimeTypeRole
- };
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/location/declarativeplaces/qdeclarativereviewmodel.cpp b/src/location/declarativeplaces/qdeclarativereviewmodel.cpp
deleted file mode 100644
index 2c4997ce..00000000
--- a/src/location/declarativeplaces/qdeclarativereviewmodel.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 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$
-**
-****************************************************************************/
-
-#include "qdeclarativereviewmodel_p.h"
-
-#include <QtCore/QDateTime>
-#include <QtLocation/QPlaceContent>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype ReviewModel
- \instantiates QDeclarativeReviewModel
- \inqmlmodule QtLocation
- \ingroup qml-QtLocation5-places
- \ingroup qml-QtLocation5-places-models
- \since QtLocation 5.5
-
- \brief Provides access to reviews of a \l Place.
-
- The ReviewModel is a read-only model used to fetch reviews about a \l Place. The model
- incrementally fetches. The number of reviews which are fetched at a time is specified
- by the \l batchSize property. The total number of reviews available can be accessed via the
- \l totalCount property.
-
- To use the ReviewModel we need a view and a delegate. In this snippet we
- see the setting up of a ListView with a ReviewModel model and a delegate.
-
- \snippet places/views/ReviewView.qml ReviewModel delegate
-
- The model returns data for the following roles:
-
- \table
- \header
- \li Role
- \li Type
- \li Description
- \row
- \li dateTime
- \li datetime
- \li The date and time that the review was posted.
- \row
- \li text
- \li string
- \li The review's textual description of the place. It can be either rich (HTML based) text or plain text
- depending on the provider.
- \row
- \li language
- \li string
- \li The language that the review is written in.
- \row
- \li rating
- \li real
- \li The rating that the reviewer gave to the place.
- \row
- \li reviewId
- \li string
- \li The identifier of the review.
- \row
- \li title
- \li string
- \li The title of the review.
- \row
- \li supplier
- \li \l Supplier
- \li The supplier of the review.
- \row
- \li user
- \li \l {QtLocation::User}{User}
- \li The user who contributed the review.
- \row
- \li attribution
- \li string
- \li Attribution text which must be displayed when displaying the review.
- \endtable
-*/
-
-/*!
- \qmlproperty Place QtLocation::ReviewModel::place
-
- This property holds the Place that the reviews are for.
-*/
-
-/*!
- \qmlproperty int QtLocation::ReviewModel::batchSize
-
- This property holds the batch size to use when fetching more reviews.
-*/
-
-/*!
- \qmlproperty int QtLocation::ReviewModel::totalCount
-
- This property holds the total number of reviews for the place.
-*/
-
-QDeclarativeReviewModel::QDeclarativeReviewModel(QObject *parent)
-: QDeclarativePlaceContentModel(QPlaceContent::ReviewType, parent)
-{
-}
-
-QDeclarativeReviewModel::~QDeclarativeReviewModel()
-{
-}
-
-/*!
- \internal
-*/
-QVariant QDeclarativeReviewModel::data(const QModelIndex &index, int role) const
-{
- if (!index.isValid())
- return QVariant();
-
- if (index.row() >= rowCount(index.parent()) || index.row() < 0)
- return QVariant();
-
- const QPlaceContent &content = m_content.value(index.row());
-
- switch (role) {
- case DateTimeRole:
- return content.value(QPlaceContent::ReviewDateTime);
- case TextRole:
- return content.value(QPlaceContent::ReviewText);
- case LanguageRole:
- return content.value(QPlaceContent::ReviewLanguage);
- case RatingRole:
- return content.value(QPlaceContent::ReviewRating);
- case ReviewIdRole:
- return content.value(QPlaceContent::ReviewId);
- case TitleRole:
- return content.value(QPlaceContent::ReviewTitle);
- }
-
- return QDeclarativePlaceContentModel::data(index, role);
-}
-
-QHash<int, QByteArray> QDeclarativeReviewModel::roleNames() const
-{
- QHash<int, QByteArray> roles = QDeclarativePlaceContentModel::roleNames();
- roles.insert(DateTimeRole, "dateTime");
- roles.insert(TextRole, "text");
- roles.insert(LanguageRole, "language");
- roles.insert(RatingRole, "rating");
- roles.insert(ReviewIdRole, "reviewId");
- roles.insert(TitleRole, "title");
- return roles;
-}
-
-QT_END_NAMESPACE
diff --git a/src/location/declarativeplaces/qdeclarativereviewmodel_p.h b/src/location/declarativeplaces/qdeclarativereviewmodel_p.h
deleted file mode 100644
index 63da95d6..00000000
--- a/src/location/declarativeplaces/qdeclarativereviewmodel_p.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 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 QDECLARATIVEREVIEWMODEL_P_H
-#define QDECLARATIVEREVIEWMODEL_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 <QtLocation/private/qlocationglobal_p.h>
-#include <QtLocation/private/qdeclarativeplacecontentmodel_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_LOCATION_PRIVATE_EXPORT QDeclarativeReviewModel : public QDeclarativePlaceContentModel
-{
- Q_OBJECT
-
-public:
- explicit QDeclarativeReviewModel(QObject *parent = nullptr);
- ~QDeclarativeReviewModel();
-
- QVariant data(const QModelIndex &index, int role) const override;
- QHash<int, QByteArray> roleNames() const override;
- enum Roles {
- DateTimeRole = UserRole,
- TextRole,
- LanguageRole,
- RatingRole,
- ReviewIdRole,
- TitleRole
- };
-};
-
-QT_END_NAMESPACE
-
-#endif // QDECLARATIVEREVIEWMODEL_P_H