summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/declarative/qmlplaces/ImageGrid.qml (renamed from examples/declarative/qmlplaces/MediaGrid.qml)10
-rw-r--r--examples/declarative/qmlplaces/SearchResultDelegate.qml6
-rw-r--r--examples/declarative/qmlplaces/qmlplaces.pro2
-rw-r--r--examples/declarative/qmlplaces/qmlplaces.qml4
-rw-r--r--examples/declarative/qmlplaces/qmlplaces.qrc2
-rw-r--r--src/imports/location/declarativeplaces/declarativeplaces.pri8
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativeplace.cpp16
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativeplace_p.h10
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativeplaceimage.cpp (renamed from src/imports/location/declarativeplaces/qdeclarativemediaobject.cpp)62
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativeplaceimage_p.h (renamed from src/imports/location/declarativeplaces/qdeclarativemediaobject_p.h)24
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel.cpp (renamed from src/imports/location/declarativeplaces/qdeclarativemediamodel.cpp)132
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h (renamed from src/imports/location/declarativeplaces/qdeclarativemediamodel_p.h)24
-rw-r--r--src/imports/location/location.cpp6
-rw-r--r--src/location/places/places.pri13
-rw-r--r--src/location/places/qplacecontent.cpp83
-rw-r--r--src/location/places/qplacecontent.h97
-rw-r--r--src/location/places/qplacecontent_p.h112
-rw-r--r--src/location/places/qplacecontentreply.cpp (renamed from src/location/places/qplacemediareply.cpp)57
-rw-r--r--src/location/places/qplacecontentreply.h (renamed from src/location/places/qplacemediareply.h)26
-rw-r--r--src/location/places/qplaceimage.cpp217
-rw-r--r--src/location/places/qplaceimage.h (renamed from src/location/places/qplacemediaobject.h)35
-rw-r--r--src/location/places/qplaceimage_p.h (renamed from src/location/places/qplacemediaobject_p.h)21
-rw-r--r--src/location/places/qplacemanager.cpp8
-rw-r--r--src/location/places/qplacemanager.h6
-rw-r--r--src/location/places/qplacemanagerengine.cpp2
-rw-r--r--src/location/places/qplacemanagerengine.h2
-rw-r--r--src/location/places/qplacemediaobject.cpp229
-rw-r--r--src/location/places/qplacereply.cpp4
-rw-r--r--src/location/places/qplacereply.h2
-rw-r--r--src/location/places/qplacereviewreply.cpp4
-rw-r--r--src/location/qgeoplace.cpp51
-rw-r--r--src/location/qgeoplace.h13
-rw-r--r--src/location/qgeoplace_p.h4
-rw-r--r--src/plugins/geoservices/nokia/places/places.pri4
-rw-r--r--src/plugins/geoservices/nokia/places/qplaceimagereplyimpl.cpp (renamed from src/plugins/geoservices/nokia/places/qplacemediareplyimpl.cpp)37
-rw-r--r--src/plugins/geoservices/nokia/places/qplaceimagereplyimpl.h (renamed from src/plugins/geoservices/nokia/places/qplacemediareplyimpl.h)17
-rw-r--r--src/plugins/geoservices/nokia/places/qplacejsondetailsparser.cpp37
-rw-r--r--src/plugins/geoservices/nokia/places/qplacejsondetailsparser.h5
-rw-r--r--src/plugins/geoservices/nokia/places/qplacejsonmediaparser.cpp7
-rw-r--r--src/plugins/geoservices/nokia/places/qplacejsonmediaparser.h8
-rw-r--r--src/plugins/geoservices/nokia/qplacemanagerengine_nokia.cpp32
-rw-r--r--src/plugins/geoservices/nokia/qplacemanagerengine_nokia.h2
-rw-r--r--tests/auto/auto.pro2
-rw-r--r--tests/auto/geotestplugin/qplacemanagerengine_test.h3
-rw-r--r--tests/auto/qgeoplace/tst_qgeoplace.cpp68
-rw-r--r--tests/auto/qplaceimage/qplaceimage.pro7
-rw-r--r--tests/auto/qplaceimage/tst_qplaceimage.cpp (renamed from tests/auto/qplacemediaobject/tst_qplacemediaobject.cpp)54
-rw-r--r--tests/auto/qplacemediaobject/qplacemediaobject.pro7
48 files changed, 936 insertions, 646 deletions
diff --git a/examples/declarative/qmlplaces/MediaGrid.qml b/examples/declarative/qmlplaces/ImageGrid.qml
index 0c552978..6a1e89d4 100644
--- a/examples/declarative/qmlplaces/MediaGrid.qml
+++ b/examples/declarative/qmlplaces/ImageGrid.qml
@@ -9,7 +9,7 @@ Rectangle {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
- anchors.bottom: closeMediaButton.top
+ anchors.bottom: closeImagesButton.top
cellHeight: 200
cellWidth: 200
@@ -21,15 +21,15 @@ Rectangle {
Image {
anchors.fill: parent
anchors.margins: 5
- source: media.url
+ source: image.url
fillMode: Image.PreserveAspectFit
}
}
}
Rectangle {
- id: closeMediaButton
- height: mediaClose.height
+ id: closeImagesButton
+ height: imagesClose.height
width: parent.width
anchors.bottom: parent.bottom
gradient: Gradient {
@@ -39,7 +39,7 @@ Rectangle {
}
Text {
- id: mediaClose;
+ id: imagesClose;
anchors.horizontalCenter: parent.horizontalCenter
text: 'Close';
}
diff --git a/examples/declarative/qmlplaces/SearchResultDelegate.qml b/examples/declarative/qmlplaces/SearchResultDelegate.qml
index acb75298..e780773f 100644
--- a/examples/declarative/qmlplaces/SearchResultDelegate.qml
+++ b/examples/declarative/qmlplaces/SearchResultDelegate.qml
@@ -87,10 +87,10 @@ Rectangle {
}
Text {
- text: '<b>Media count: </b> ' + result.place.mediaModel.totalCount +
- ((result.place.mediaModel.totalCount <= 0) ? '' : ', <a href=\"dummy\">show media</a>')
+ text: '<b>Image count: </b> ' + result.place.imageModel.totalCount +
+ ((result.place.imageModel.totalCount <= 0) ? '' : ', <a href=\"dummy\">show images</a>')
font.pixelSize: 16
- onLinkActivated: mediaGrid.model = result.place.mediaModel
+ onLinkActivated: imageGrid.model = result.place.imageModel
}
Text {
diff --git a/examples/declarative/qmlplaces/qmlplaces.pro b/examples/declarative/qmlplaces/qmlplaces.pro
index 5911ac8b..40713279 100644
--- a/examples/declarative/qmlplaces/qmlplaces.pro
+++ b/examples/declarative/qmlplaces/qmlplaces.pro
@@ -12,7 +12,7 @@ OTHER_FILES = qmlplaces.qml \
SearchResultDelegate.qml \
ReviewDelegate.qml \
CategoryView.qml \
- MediaGrid.qml \
+ ImageGrid.qml \
DescriptionDelegate.qml \
RatingView.qml
diff --git a/examples/declarative/qmlplaces/qmlplaces.qml b/examples/declarative/qmlplaces/qmlplaces.qml
index 181436cd..c063c303 100644
--- a/examples/declarative/qmlplaces/qmlplaces.qml
+++ b/examples/declarative/qmlplaces/qmlplaces.qml
@@ -219,8 +219,8 @@ Rectangle {
hierarchical: true
}
- MediaGrid {
- id: mediaGrid
+ ImageGrid {
+ id: imageGrid
anchors.fill: parent
visible: model != undefined
diff --git a/examples/declarative/qmlplaces/qmlplaces.qrc b/examples/declarative/qmlplaces/qmlplaces.qrc
index 03c472a1..8736fbc3 100644
--- a/examples/declarative/qmlplaces/qmlplaces.qrc
+++ b/examples/declarative/qmlplaces/qmlplaces.qrc
@@ -6,9 +6,9 @@
<file>SearchResultDelegate.qml</file>
<file>ReviewDelegate.qml</file>
<file>CategoryView.qml</file>
- <file>MediaGrid.qml</file>
<file>DescriptionDelegate.qml</file>
<file>RatingView.qml</file>
<file>star.png</file>
+ <file>ImageGrid.qml</file>
</qresource>
</RCC>
diff --git a/src/imports/location/declarativeplaces/declarativeplaces.pri b/src/imports/location/declarativeplaces/declarativeplaces.pri
index 42e08252..26632296 100644
--- a/src/imports/location/declarativeplaces/declarativeplaces.pri
+++ b/src/imports/location/declarativeplaces/declarativeplaces.pri
@@ -6,11 +6,11 @@ SOURCES += \
declarativeplaces/qdeclarativetextpredictionmodel.cpp \
declarativeplaces/qdeclarativesearchresultmodel.cpp \
declarativeplaces/qdeclarativereviewmodel.cpp \
- declarativeplaces/qdeclarativemediamodel.cpp \
+ declarativeplaces/qdeclarativeplaceimagemodel.cpp \
#data
declarativeplaces/qdeclarativecategory.cpp \
declarativeplaces/qdeclarativedescription.cpp \
- declarativeplaces/qdeclarativemediaobject.cpp \
+ declarativeplaces/qdeclarativeplaceimage.cpp \
declarativeplaces/qdeclarativeplace.cpp \
declarativeplaces/qdeclarativeplaceattribute.cpp \
declarativeplaces/qdeclarativerating.cpp \
@@ -25,11 +25,11 @@ HEADERS += \
declarativeplaces/qdeclarativetextpredictionmodel_p.h \
declarativeplaces/qdeclarativesearchresultmodel_p.h \
declarativeplaces/qdeclarativereviewmodel_p.h \
- declarativeplaces/qdeclarativemediamodel_p.h \
+ declarativeplaces/qdeclarativeplaceimagemodel_p.h \
#data
declarativeplaces/qdeclarativecategory_p.h \
declarativeplaces/qdeclarativedescription_p.h \
- declarativeplaces/qdeclarativemediaobject_p.h \
+ declarativeplaces/qdeclarativeplaceimage_p.h \
declarativeplaces/qdeclarativeplace_p.h \
declarativeplaces/qdeclarativeplaceattribute_p.h \
declarativeplaces/qdeclarativerating_p.h \
diff --git a/src/imports/location/declarativeplaces/qdeclarativeplace.cpp b/src/imports/location/declarativeplaces/qdeclarativeplace.cpp
index 7a7eae4e..98f40b95 100644
--- a/src/imports/location/declarativeplaces/qdeclarativeplace.cpp
+++ b/src/imports/location/declarativeplaces/qdeclarativeplace.cpp
@@ -20,13 +20,13 @@ QT_USE_NAMESPACE
*/
QDeclarativePlace::QDeclarativePlace(QObject* parent)
-: QObject(parent), m_reviewModel(0), m_mediaModel(0), m_detailsReply(0), m_plugin(0),
+: QObject(parent), m_reviewModel(0), m_imageModel(0), m_detailsReply(0), m_plugin(0),
m_complete(false), m_extendedAttributes(new QDeclarativePropertyMap())
{
}
QDeclarativePlace::QDeclarativePlace(const QGeoPlace &src, QObject *parent)
-: QObject(parent), m_reviewModel(0), m_mediaModel(0), m_src(src), m_detailsReply(0), m_plugin(0),
+: QObject(parent), m_reviewModel(0), m_imageModel(0), m_src(src), m_detailsReply(0), m_plugin(0),
m_complete(false), m_extendedAttributes(new QDeclarativePropertyMap())
{
synchronizeCategories();
@@ -79,14 +79,14 @@ QDeclarativeReviewModel *QDeclarativePlace::reviewModel()
return m_reviewModel;
}
-QDeclarativeMediaModel *QDeclarativePlace::mediaModel()
+QDeclarativePlaceImageModel *QDeclarativePlace::imageModel()
{
- if (!m_mediaModel) {
- m_mediaModel = new QDeclarativeMediaModel(this);
- m_mediaModel->setPlace(this);
+ if (!m_imageModel) {
+ m_imageModel = new QDeclarativePlaceImageModel(this);
+ m_imageModel->setPlace(this);
}
- return m_mediaModel;
+ return m_imageModel;
}
void QDeclarativePlace::setPlace(const QGeoPlace &src)
@@ -150,7 +150,7 @@ void QDeclarativePlace::setPlace(const QGeoPlace &src)
if (previous.placeId() != m_src.placeId()) {
m_reviewModel->clear();
- m_mediaModel->clear();
+ m_imageModel->clear();
}
if (previous.extendedAttributes() != m_src.extendedAttributes())
diff --git a/src/imports/location/declarativeplaces/qdeclarativeplace_p.h b/src/imports/location/declarativeplaces/qdeclarativeplace_p.h
index b049eef7..9bd88d0c 100644
--- a/src/imports/location/declarativeplaces/qdeclarativeplace_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativeplace_p.h
@@ -10,7 +10,7 @@
#include "qdeclarativerating_p.h"
#include "qdeclarativedescription_p.h"
#include "qdeclarativereviewmodel_p.h"
-#include "qdeclarativemediamodel_p.h"
+#include "qdeclarativeplaceimagemodel_p.h"
#include <QDeclarativePropertyMap>
QT_BEGIN_NAMESPACE
@@ -36,7 +36,7 @@ class QDeclarativePlace : public QObject, public QDeclarativeParserStatus
Q_PROPERTY(bool detailsFetched READ detailsFetched WRITE setDetailsFetched NOTIFY detailsFetchedChanged);
Q_PROPERTY(bool fetchingDetails READ fetchingDetails WRITE setFetchingDetails NOTIFY fetchingDetailsChanged)
Q_PROPERTY(QDeclarativeReviewModel *reviewModel READ reviewModel NOTIFY reviewModelChanged)
- Q_PROPERTY(QDeclarativeMediaModel *mediaModel READ mediaModel NOTIFY mediaModelChanged)
+ Q_PROPERTY(QDeclarativePlaceImageModel *imageModel READ imageModel NOTIFY imageModelChanged)
Q_PROPERTY(QDeclarativePropertyMap *extendedAttributes READ extendedAttributes WRITE setExtendedAttributes NOTIFY extendedAttributesChanged);
Q_INTERFACES(QDeclarativeParserStatus)
@@ -58,7 +58,7 @@ public:
QDeclarativeGeoServiceProvider* plugin() const;
QDeclarativeReviewModel *reviewModel();
- QDeclarativeMediaModel *mediaModel();
+ QDeclarativePlaceImageModel *imageModel();
QGeoPlace place();
void setPlace(const QGeoPlace &src);
@@ -137,7 +137,7 @@ signals:
void detailsFetchedChanged();
void fetchingDetailsChanged();
void reviewModelChanged();
- void mediaModelChanged();
+ void imageModelChanged();
void primaryPhoneChanged();
void primaryFaxChanged();
@@ -163,7 +163,7 @@ private:
QDeclarativeRating m_rating;
QList<QDeclarativeSupplier*> m_suppliers;
QDeclarativeReviewModel *m_reviewModel;
- QDeclarativeMediaModel *m_mediaModel;
+ QDeclarativePlaceImageModel *m_imageModel;
QDeclarativePropertyMap *m_extendedAttributes;
QGeoPlace m_src;
diff --git a/src/imports/location/declarativeplaces/qdeclarativemediaobject.cpp b/src/imports/location/declarativeplaces/qdeclarativeplaceimage.cpp
index 2cea72a6..8681c59a 100644
--- a/src/imports/location/declarativeplaces/qdeclarativemediaobject.cpp
+++ b/src/imports/location/declarativeplaces/qdeclarativeplaceimage.cpp
@@ -1,27 +1,27 @@
-#include "qdeclarativemediaobject_p.h"
+#include "qdeclarativeplaceimage_p.h"
#include <QtCore/QUrl>
QT_USE_NAMESPACE
/*!
- \qmlclass MediaObject
+ \qmlclass PlaceImage
- \brief The MediaObject element holds media data.
+ \brief The PlaceImage element holds image meta-data.
\inherits QObject
- MediaObject cointains many properties holding data of the media like URL,
- type, etc.
+ PlaceImage cointains many properties holding data of the image like URL,
+ thumbnail URL etc.
\ingroup qml-places
*/
-QDeclarativeMediaObject::QDeclarativeMediaObject(QObject* parent)
+QDeclarativePlaceImage::QDeclarativePlaceImage(QObject* parent)
: QObject(parent)
{
}
-QDeclarativeMediaObject::QDeclarativeMediaObject(const QPlaceMediaObject &src,
+QDeclarativePlaceImage::QDeclarativePlaceImage(const QPlaceImage &src,
QObject *parent)
: QObject(parent),
m_declarativeSupplier(src.supplier()),
@@ -29,13 +29,13 @@ QDeclarativeMediaObject::QDeclarativeMediaObject(const QPlaceMediaObject &src,
{
}
-QDeclarativeMediaObject::~QDeclarativeMediaObject()
+QDeclarativePlaceImage::~QDeclarativePlaceImage()
{
}
-void QDeclarativeMediaObject::setMediaObject(const QPlaceMediaObject &src)
+void QDeclarativePlaceImage::setImage(const QPlaceImage &src)
{
- QPlaceMediaObject previous = m_src;
+ QPlaceImage previous = m_src;
m_src = src;
if (previous.url() != m_src.url()) {
@@ -59,19 +59,19 @@ void QDeclarativeMediaObject::setMediaObject(const QPlaceMediaObject &src)
}
}
-QPlaceMediaObject QDeclarativeMediaObject::mediaObject()
+QPlaceImage QDeclarativePlaceImage::image()
{
m_src.setSupplier(m_declarativeSupplier.supplier());
return m_src;
}
/*!
- \qmlproperty string MediaObject::url
+ \qmlproperty string PlaceImage::url
- This property holds URL of the media.
+ This property holds URL of the image.
*/
-void QDeclarativeMediaObject::setUrl(const QUrl &url)
+void QDeclarativePlaceImage::setUrl(const QUrl &url)
{
if (m_src.url() != url) {
m_src.setUrl(url);
@@ -79,18 +79,18 @@ void QDeclarativeMediaObject::setUrl(const QUrl &url)
}
}
-QUrl QDeclarativeMediaObject::url() const
+QUrl QDeclarativePlaceImage::url() const
{
return m_src.url();
}
/*!
- \qmlproperty string MediaObject::thumbnailURL
+ \qmlproperty string PlaceImage::thumbnailURL
This property holds thumbnail URL.
*/
-void QDeclarativeMediaObject::setThumbnailUrl(const QUrl &thumbnailUrl)
+void QDeclarativePlaceImage::setThumbnailUrl(const QUrl &thumbnailUrl)
{
if (m_src.thumbnailUrl() != thumbnailUrl) {
m_src.setThumbnailUrl(thumbnailUrl);
@@ -98,18 +98,18 @@ void QDeclarativeMediaObject::setThumbnailUrl(const QUrl &thumbnailUrl)
}
}
-QUrl QDeclarativeMediaObject::thumbnailUrl() const
+QUrl QDeclarativePlaceImage::thumbnailUrl() const
{
return m_src.thumbnailUrl();
}
/*!
- \qmlproperty string MediaObject::mimeType
+ \qmlproperty string PlaceImage::mimeType
This property holds mime type.
*/
-void QDeclarativeMediaObject::setMimeType(const QString &mimeType)
+void QDeclarativePlaceImage::setMimeType(const QString &mimeType)
{
if (m_src.mimeType() != mimeType) {
m_src.setMimeType(mimeType);
@@ -117,18 +117,18 @@ void QDeclarativeMediaObject::setMimeType(const QString &mimeType)
}
}
-QString QDeclarativeMediaObject::mimeType() const
+QString QDeclarativePlaceImage::mimeType() const
{
return m_src.mimeType();
}
/*!
- \qmlproperty string MediaObject::metaInfo
+ \qmlproperty string PlaceImage::metaInfo
This property holds meta information.
*/
-void QDeclarativeMediaObject::setMetaInfo(const QString &metaInfo)
+void QDeclarativePlaceImage::setMetaInfo(const QString &metaInfo)
{
if (m_src.metaInfo() != metaInfo) {
m_src.setMetaInfo(metaInfo);
@@ -136,18 +136,18 @@ void QDeclarativeMediaObject::setMetaInfo(const QString &metaInfo)
}
}
-QString QDeclarativeMediaObject::metaInfo() const
+QString QDeclarativePlaceImage::metaInfo() const
{
return m_src.metaInfo();
}
/*!
- \qmlproperty string MediaObject::id
+ \qmlproperty string PlaceImage::id
- This property holds id of media.
+ This property holds id of image.
*/
-void QDeclarativeMediaObject::setId(const QString &id)
+void QDeclarativePlaceImage::setId(const QString &id)
{
if (m_src.id() != id) {
m_src.setId(id);
@@ -155,20 +155,20 @@ void QDeclarativeMediaObject::setId(const QString &id)
}
}
-QString QDeclarativeMediaObject::id() const
+QString QDeclarativePlaceImage::id() const
{
return m_src.id();
}
/*!
- \qmlproperty string MediaObject::supplier
+ \qmlproperty string PlaceImage::supplier
This property holds supplier info.
Note: this property's changed() signal is currently emitted only if the
whole element changes, not if only the contents of the element change.
*/
-void QDeclarativeMediaObject::setSupplier(QDeclarativeSupplier *src)
+void QDeclarativePlaceImage::setSupplier(QDeclarativeSupplier *src)
{
if (m_declarativeSupplier.supplier() != src->supplier()) {
m_declarativeSupplier.setSupplier(src->supplier());
@@ -176,7 +176,7 @@ void QDeclarativeMediaObject::setSupplier(QDeclarativeSupplier *src)
}
}
-QDeclarativeSupplier *QDeclarativeMediaObject::supplier()
+QDeclarativeSupplier *QDeclarativePlaceImage::supplier()
{
return &m_declarativeSupplier;
}
diff --git a/src/imports/location/declarativeplaces/qdeclarativemediaobject_p.h b/src/imports/location/declarativeplaces/qdeclarativeplaceimage_p.h
index 28ce32ff..03af4788 100644
--- a/src/imports/location/declarativeplaces/qdeclarativemediaobject_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativeplaceimage_p.h
@@ -1,16 +1,16 @@
-#ifndef QDECLARATIVEMEDIAOBJECT_P_H
-#define QDECLARATIVEMEDIAOBJECT_P_H
+#ifndef QDECLARATIVEPLACEIMAGE_P_H
+#define QDECLARATIVEPLACEIMAGE_P_H
#include <QtCore/QObject>
#include <QtCore/QUrl>
#include <QtDeclarative/QDeclarativeListProperty>
-#include <qplacemediaobject.h>
#include "qdeclarativesupplier_p.h"
+#include <qplaceimage.h>
QT_BEGIN_NAMESPACE
-class QDeclarativeMediaObject : public QObject
+class QDeclarativePlaceImage : public QObject
{
Q_OBJECT
@@ -22,12 +22,12 @@ class QDeclarativeMediaObject : public QObject
Q_PROPERTY(QString metaInfo READ metaInfo WRITE setMetaInfo NOTIFY metaInfoChanged);
public:
- explicit QDeclarativeMediaObject(QObject* parent = 0);
- explicit QDeclarativeMediaObject(const QPlaceMediaObject &src, QObject* parent = 0);
- ~QDeclarativeMediaObject();
+ explicit QDeclarativePlaceImage(QObject* parent = 0);
+ explicit QDeclarativePlaceImage(const QPlaceImage &src, QObject* parent = 0);
+ ~QDeclarativePlaceImage();
- QPlaceMediaObject mediaObject();
- void setMediaObject(const QPlaceMediaObject &src);
+ QPlaceImage image();
+ void setImage(const QPlaceImage &src);
QUrl url() const;
void setUrl(const QUrl &url);
@@ -52,11 +52,11 @@ signals:
private:
QDeclarativeSupplier m_declarativeSupplier;
- QPlaceMediaObject m_src;
+ QPlaceImage m_src;
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeMediaObject));
+QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativePlaceImage));
-#endif // QDECLARATIVEMEDIAOBJECT_P_H
+#endif
diff --git a/src/imports/location/declarativeplaces/qdeclarativemediamodel.cpp b/src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel.cpp
index feb093cf..e673e2f7 100644
--- a/src/imports/location/declarativeplaces/qdeclarativemediamodel.cpp
+++ b/src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel.cpp
@@ -1,4 +1,4 @@
-#include "qdeclarativemediamodel_p.h"
+#include "qdeclarativeplaceimagemodel_p.h"
#include "qdeclarativegeoserviceprovider_p.h"
#include "qdeclarativeplace_p.h"
@@ -8,46 +8,46 @@
QT_USE_NAMESPACE
/*!
- \qmlclass MediaModel QDeclarativeMediaModel
+ \qmlclass PlaceImageModel QDeclarativePlaceImage
- \brief The MediaModel element provides access to media items of a Place.
+ \brief The PlaceImageModel element provides access to place images.
\ingroup qml-places
\since 5.0
- The MediaModel is a read-only model lused to fetch media items related to a Place. The model
- incrementally fetches media item URLs. The number of media items which are fetched at a time
- is specified by the batchSize property. The total number of media items available can be
- accessed via the totalCount property and the number of fetched media items via the count
+ The PlaceImageModel is a read-only model used to fetch images related to a Place. The model
+ performs fetches incrmentally. The number of images which are fetched at a time
+ is specified by the batchSize property. The total number of images available can be
+ accessed via the totalCount property and the number of fetched images via the count
property.
- The model provides a single data role, the "media" role, which returns a \l Media object.
+ The model provides a single data role, the "image" role, which returns a \l PlaceImage object.
*/
-QDeclarativeMediaModel::QDeclarativeMediaModel(QObject* parent)
-: QAbstractListModel(parent), m_place(0), m_batchSize(1), m_mediaCount(-1), m_reply(0),
+QDeclarativePlaceImageModel::QDeclarativePlaceImageModel(QObject* parent)
+: QAbstractListModel(parent), m_place(0), m_batchSize(1), m_imageCount(-1), m_reply(0),
m_complete(false)
{
QHash<int, QByteArray> roleNames;
- roleNames.insert(MediaRole, "media");
+ roleNames.insert(ImageRole, "image");
setRoleNames(roleNames);
}
-QDeclarativeMediaModel::~QDeclarativeMediaModel()
+QDeclarativePlaceImageModel::~QDeclarativePlaceImageModel()
{
- qDeleteAll(m_mediaObjects);
+ qDeleteAll(m_images);
}
/*!
- \qmlproperty Place MediaModel::place
+ \qmlproperty Place PlaceImageModel::place
- This property holds the Place that the media items are for.
+ This property holds the Place that the images are for.
*/
-QDeclarativePlace *QDeclarativeMediaModel::place() const
+QDeclarativePlace *QDeclarativePlaceImageModel::place() const
{
return m_place;
}
-void QDeclarativeMediaModel::setPlace(QDeclarativePlace *place)
+void QDeclarativePlaceImageModel::setPlace(QDeclarativePlace *place)
{
if (m_place != place) {
beginResetModel();
@@ -56,12 +56,12 @@ void QDeclarativeMediaModel::setPlace(QDeclarativePlace *place)
m_reply->deleteLater();
m_reply = 0;
}
- qDeleteAll(m_mediaObjects);
- m_mediaObjects.clear();
+ qDeleteAll(m_images);
+ m_images.clear();
endResetModel();
- if (m_mediaCount != -1) {
- m_mediaCount = -1;
+ if (m_imageCount != -1) {
+ m_imageCount = -1;
emit totalCountChanged();
}
@@ -75,16 +75,16 @@ void QDeclarativeMediaModel::setPlace(QDeclarativePlace *place)
}
/*!
- \qmlproperty int MediaModel::batchSize
+ \qmlproperty int PlaceImageModel::batchSize
- This property holds the batch size to use when fetching more media items.
+ This property holds the batch size to use when fetching more image items.
*/
-int QDeclarativeMediaModel::batchSize() const
+int QDeclarativePlaceImageModel::batchSize() const
{
return m_batchSize;
}
-void QDeclarativeMediaModel::setBatchSize(int batchSize)
+void QDeclarativePlaceImageModel::setBatchSize(int batchSize)
{
if (m_batchSize != batchSize) {
m_batchSize = batchSize;
@@ -93,22 +93,22 @@ void QDeclarativeMediaModel::setBatchSize(int batchSize)
}
/*!
- \qmlproperty int MediaModel::totalCount
+ \qmlproperty int PlaceImageModel::totalCount
- This property holds the total number of media items for the place.
+ This property holds the total number of image items for the place.
*/
-int QDeclarativeMediaModel::totalCount() const
+int QDeclarativePlaceImageModel::totalCount() const
{
- return m_mediaCount;
+ return m_imageCount;
}
-static QPair<int, int> findMissingKey(const QMap<int, QDeclarativeMediaObject *> &map)
+static QPair<int, int> findMissingKey(const QMap<int, QDeclarativePlaceImage *> &map)
{
int start = 0;
while (map.value(start, 0) != 0)
++start;
- QMap<int, QDeclarativeMediaObject *>::const_iterator it = map.lowerBound(start);
+ QMap<int, QDeclarativePlaceImage *>::const_iterator it = map.lowerBound(start);
if (it == map.end())
return qMakePair(start, -1);
@@ -119,7 +119,7 @@ static QPair<int, int> findMissingKey(const QMap<int, QDeclarativeMediaObject *>
return qMakePair(start, end - 1);
}
-bool QDeclarativeMediaModel::canFetchMore(const QModelIndex &parent) const
+bool QDeclarativePlaceImageModel::canFetchMore(const QModelIndex &parent) const
{
if (parent.isValid())
return false;
@@ -127,13 +127,13 @@ bool QDeclarativeMediaModel::canFetchMore(const QModelIndex &parent) const
if (!m_place)
return false;
- if (m_mediaCount == -1)
+ if (m_imageCount == -1)
return true;
- return m_mediaObjects.count() != m_mediaCount;
+ return m_images.count() != m_imageCount;
}
-void QDeclarativeMediaModel::fetchMore(const QModelIndex &parent)
+void QDeclarativePlaceImageModel::fetchMore(const QModelIndex &parent)
{
if (parent.isValid())
return;
@@ -158,11 +158,11 @@ void QDeclarativeMediaModel::fetchMore(const QModelIndex &parent)
QPlaceRequest query;
- if (m_mediaCount == -1) {
+ if (m_imageCount == -1) {
query.setOffset(0);
query.setLimit(m_batchSize);
} else {
- QPair<int, int> missing = findMissingKey(m_mediaObjects);
+ QPair<int, int> missing = findMissingKey(m_images);
query.setOffset(missing.first);
if (missing.second == -1)
query.setLimit(m_batchSize);
@@ -170,56 +170,56 @@ void QDeclarativeMediaModel::fetchMore(const QModelIndex &parent)
query.setLimit(qMin(m_batchSize, missing.second - missing.first + 1));
}
- m_reply = placeManager->getMedia(m_place->place(), query);
+ m_reply = placeManager->getContent(QPlaceContent::ImageType, m_place->place(), query);
connect(m_reply, SIGNAL(finished()), this, SLOT(fetchFinished()), Qt::QueuedConnection);
}
-void QDeclarativeMediaModel::clear()
+void QDeclarativePlaceImageModel::clear()
{
beginResetModel();
- m_mediaCount = -1;
- qDeleteAll(m_mediaObjects);
- m_mediaObjects.clear();
+ m_imageCount = -1;
+ qDeleteAll(m_images);
+ m_images.clear();
delete m_reply;
m_reply = 0;
endResetModel();
}
-void QDeclarativeMediaModel::classBegin()
+void QDeclarativePlaceImageModel::classBegin()
{
}
-void QDeclarativeMediaModel::componentComplete()
+void QDeclarativePlaceImageModel::componentComplete()
{
m_complete = true;
fetchMore(QModelIndex());
}
-void QDeclarativeMediaModel::fetchFinished()
+void QDeclarativePlaceImageModel::fetchFinished()
{
- QPlaceMediaReply *reply = m_reply;
+ QPlaceContentReply *reply = m_reply;
m_reply = 0;
- if (m_mediaCount != reply->totalCount()) {
- m_mediaCount = reply->totalCount();
+ if (m_imageCount != reply->totalCount()) {
+ m_imageCount = reply->totalCount();
emit totalCountChanged();
}
- if (!reply->mediaObjects().isEmpty()) {
- PlaceMediaCollection medias = reply->mediaObjects();
+ if (!reply->content().isEmpty()) {
+ QPlaceContent::Collection images = reply->content();
//find out which indexes are new and which ones have changed.
- QMapIterator<int, QPlaceMediaObject> mediasIter(medias);
+ QMapIterator<int, QPlaceContent> imagesIter(images);
QList<int> changedIndexes;
QList<int> newIndexes;
- while (mediasIter.hasNext()) {
- mediasIter.next();
- if (!m_mediaObjects.contains(mediasIter.key())) {
- newIndexes.append(mediasIter.key());
- } else if (mediasIter.value() != m_mediaObjects.value(mediasIter.key())->mediaObject()) {
- changedIndexes.append(mediasIter.key());
+ while (imagesIter.hasNext()) {
+ imagesIter.next();
+ if (!m_images.contains(imagesIter.key())) {
+ newIndexes.append(imagesIter.key());
+ } else if (imagesIter.value() != m_images.value(imagesIter.key())->image()) {
+ changedIndexes.append(imagesIter.key());
} else {
- //media at given index has not changed, do nothing
+ //image item at given index has not changed, do nothing
}
}
@@ -235,7 +235,7 @@ void QDeclarativeMediaModel::fetchFinished()
if (!newIndexesIter.hasNext() || (newIndexesIter.hasNext() && (newIndexesIter.peekNext() > (currentIndex + 1)))) {
beginInsertRows(QModelIndex(),startIndex,currentIndex);
for (int i = startIndex; i <= currentIndex; ++i)
- m_mediaObjects.insert(i, new QDeclarativeMediaObject(medias.value(i), this));
+ m_images.insert(i, new QDeclarativePlaceImage(images.value(i), this));
endInsertRows();
startIndex = -1;
}
@@ -252,8 +252,8 @@ void QDeclarativeMediaModel::fetchFinished()
if (!changedIndexesIter.hasNext() || (changedIndexesIter.hasNext() && changedIndexesIter.peekNext() > (currentIndex +1))) {
for (int i = startIndex; i <= currentIndex; ++i) {
- m_mediaObjects.remove(i);
- m_mediaObjects.insert(i, new QDeclarativeMediaObject(medias.value(i), this));
+ m_images.remove(i);
+ m_images.insert(i, new QDeclarativePlaceImage(images.value(i), this));
}
emit dataChanged(index(startIndex),index(currentIndex));
startIndex = -1;
@@ -264,15 +264,15 @@ void QDeclarativeMediaModel::fetchFinished()
reply->deleteLater();
}
-int QDeclarativeMediaModel::rowCount(const QModelIndex &parent) const
+int QDeclarativePlaceImageModel::rowCount(const QModelIndex &parent) const
{
if (parent.isValid())
return 0;
- return m_mediaObjects.count();
+ return m_images.count();
}
-QVariant QDeclarativeMediaModel::data(const QModelIndex &index, int role) const
+QVariant QDeclarativePlaceImageModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
@@ -280,8 +280,8 @@ QVariant QDeclarativeMediaModel::data(const QModelIndex &index, int role) const
if (index.row() >= rowCount(index.parent()) || index.row() < 0)
return QVariant();
- if (role == MediaRole)
- return QVariant::fromValue(static_cast<QObject *>(m_mediaObjects.value(index.row())));
+ if (role == ImageRole)
+ return QVariant::fromValue(static_cast<QObject *>(m_images.value(index.row())));
return QVariant();
}
diff --git a/src/imports/location/declarativeplaces/qdeclarativemediamodel_p.h b/src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h
index cce9625f..1b507fb6 100644
--- a/src/imports/location/declarativeplaces/qdeclarativemediamodel_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h
@@ -1,9 +1,9 @@
-#ifndef QDECLARATIVEMEDIAMODEL_P_H
-#define QDECLARATIVEMEDIAMODEL_P_H
+#ifndef QDECLARATIVEPLACEIMAGEMODEL_P_H
+#define QDECLARATIVEPLACEIMAGEMODEL_P_H
#include <QtCore/QObject>
#include <QtCore/QAbstractListModel>
-#include "qdeclarativemediaobject_p.h"
+#include "qdeclarativeplaceimage_p.h"
#include <qplacemanager.h>
QT_BEGIN_NAMESPACE
@@ -12,7 +12,7 @@ class QDeclarativePlace;
class QDeclarativeGeoServiceProvider;
class QGeoServiceProvider;
-class QDeclarativeMediaModel : public QAbstractListModel, public QDeclarativeParserStatus
+class QDeclarativePlaceImageModel : public QAbstractListModel, public QDeclarativeParserStatus
{
Q_OBJECT
@@ -23,8 +23,8 @@ class QDeclarativeMediaModel : public QAbstractListModel, public QDeclarativePar
Q_PROPERTY(int totalCount READ totalCount NOTIFY totalCountChanged)
public:
- explicit QDeclarativeMediaModel(QObject* parent = 0);
- ~QDeclarativeMediaModel();
+ explicit QDeclarativePlaceImageModel(QObject* parent = 0);
+ ~QDeclarativePlaceImageModel();
QDeclarativePlace *place() const;
void setPlace(QDeclarativePlace *place);
@@ -37,7 +37,7 @@ public:
int rowCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
enum Roles {
- MediaRole = Qt::UserRole
+ ImageRole = Qt::UserRole
};
bool canFetchMore(const QModelIndex &parent) const;
@@ -59,15 +59,15 @@ private slots:
private:
QDeclarativePlace *m_place;
int m_batchSize;
- int m_mediaCount;
- QMap<int, QDeclarativeMediaObject *> m_mediaObjects;
- QPlaceMediaReply *m_reply;
+ int m_imageCount;
+ QMap<int, QDeclarativePlaceImage *> m_images;
+ QPlaceContentReply *m_reply;
bool m_complete;
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeMediaModel));
+QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativePlaceImageModel));
-#endif // QDECLARATIVEMEDIAMODEL_P_H
+#endif
diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp
index a4856042..9093c63f 100644
--- a/src/imports/location/location.cpp
+++ b/src/imports/location/location.cpp
@@ -78,7 +78,7 @@
#include "qdeclarativecategory_p.h"
#include "qdeclarativedescription_p.h"
#include "qdeclarativegeolocation_p.h"
-#include "qdeclarativemediaobject_p.h"
+#include "qdeclarativeplaceimage_p.h"
#include "qdeclarativeplace_p.h"
#include "qdeclarativeplaceattribute_p.h"
#include "qdeclarativerating_p.h"
@@ -194,8 +194,8 @@ public:
qmlRegisterType<QDeclarativeCategory>(uri, 5, 0, "Category");
qmlRegisterType<QDeclarativeDescription>(uri, 5, 0, "Description");
qmlRegisterType<QDeclarativeGeoLocation>(uri, 5, 0, "Location");
- qmlRegisterType<QDeclarativeMediaObject>(uri, 5, 0, "MediaObject");
- qmlRegisterType<QDeclarativeMediaModel>(uri, 5, 0, "MediaModel");
+ qmlRegisterType<QDeclarativePlaceImage>(uri, 5, 0, "PlaceImage");
+ qmlRegisterType<QDeclarativePlaceImageModel>(uri, 5, 0, "PlaceImageModel");
qmlRegisterType<QDeclarativePlace>(uri, 5, 0, "Place");
qmlRegisterType<QDeclarativeRating>(uri, 5, 0, "Rating");
qmlRegisterType<QDeclarativeReview>(uri, 5, 0, "Review");
diff --git a/src/location/places/places.pri b/src/location/places/places.pri
index 08e052d8..b8756ec3 100644
--- a/src/location/places/places.pri
+++ b/src/location/places/places.pri
@@ -5,8 +5,10 @@ PUBLIC_HEADERS += \
#data classes
places/qplaceattribute.h \
places/qplacecategory.h \
+ places/qplacecontent.h \
+ places/qplacecontentreply.h \
places/qplacedescription.h \
- places/qplacemediaobject.h \
+ places/qplaceimage.h \
places/qplacepaginationlist.h \
places/qplaceperiod.h \
places/qplacerating.h \
@@ -20,7 +22,6 @@ PUBLIC_HEADERS += \
#reply classes
places/qplacereply.h \
places/qplacedetailsreply.h \
- places/qplacemediareply.h \
places/qplacereviewreply.h \
places/qplacesavereply.h \
places/qplacesearchreply.h \
@@ -33,8 +34,9 @@ PUBLIC_HEADERS += \
PRIVATE_HEADERS += \
places/qplaceattribute_p.h \
places/qplacecategory_p.h \
+ places/qplacecontent_p.h \
places/qplacedescription_p.h \
- places/qplacemediaobject_p.h \
+ places/qplaceimage_p.h \
places/qplaceperiod_p.h \
places/qplacerating_p.h \
places/qplacereview_p.h \
@@ -48,9 +50,11 @@ SOURCES += \
#data classes
places/qplaceattribute.cpp \
places/qplacecategory.cpp \
+ places/qplacecontent.cpp \
+ places/qplacecontentreply.cpp \
places/qplacedescription.cpp \
#result
- places/qplacemediaobject.cpp \
+ places/qplaceimage.cpp \
places/qplaceperiod.cpp \
places/qplacerating.cpp \
places/qplacereview.cpp \
@@ -64,7 +68,6 @@ SOURCES += \
#reply classes
places/qplacereply.cpp \
places/qplacedetailsreply.cpp \
- places/qplacemediareply.cpp \
places/qplacereviewreply.cpp \
places/qplacesearchreply.cpp \
places/qplacetextpredictionreply.cpp \
diff --git a/src/location/places/qplacecontent.cpp b/src/location/places/qplacecontent.cpp
new file mode 100644
index 00000000..71f47af5
--- /dev/null
+++ b/src/location/places/qplacecontent.cpp
@@ -0,0 +1,83 @@
+#include "qplacecontent.h"
+#include "qplacecontent_p.h"
+
+#if !defined(Q_CC_MWERKS)
+template<> QT_PREPEND_NAMESPACE(QPlaceContentPrivate) *QSharedDataPointer<QT_PREPEND_NAMESPACE(QPlaceContentPrivate)>::clone()
+{
+ return d->clone();
+}
+#endif
+
+QT_USE_NAMESPACE
+
+/* Constructs an empty content object */
+QPlaceContent::QPlaceContent()
+ :d_ptr(0)
+{
+}
+
+/*!
+ Constructs a new copy of \a other
+*/
+QPlaceContent::QPlaceContent(const QPlaceContent &other)
+ :d_ptr(other.d_ptr)
+{
+}
+
+/*!
+ Assigns the \a other content object to this
+*/
+QPlaceContent &QPlaceContent::operator=(const QPlaceContent &other)
+{
+ if (this != &other ) {
+ d_ptr = other.d_ptr;
+ }
+ return *this;
+}
+
+/*!
+ Destroys the content object
+*/
+QPlaceContent::~QPlaceContent()
+{
+}
+
+/*!
+ Returns the content type.
+*/
+QPlaceContent::Type QPlaceContent::type() const
+{
+ if (!d_ptr)
+ return InvalidType;
+ return d_ptr->type();
+}
+
+/*!
+ Returns true if the content object is equivalent to \a other,
+ otherwise returns false.
+*/
+bool QPlaceContent::operator==(const QPlaceContent &other) const
+{
+ // An invalid content object is only equal to another invalid content object
+ if (!d_ptr)
+ return !other.d_ptr;
+
+ if (type() != other.type())
+ return false;
+
+ return d_ptr->compare(other.d_ptr);
+}
+
+bool QPlaceContent::operator!=(const QPlaceContent &other) const
+{
+ return !(*this == other);
+}
+
+/*!
+ \internal
+ Constructs a new content object from the given pointer \a d.
+*/
+QPlaceContent::QPlaceContent(QPlaceContentPrivate *d)
+ :d_ptr(d)
+{
+}
diff --git a/src/location/places/qplacecontent.h b/src/location/places/qplacecontent.h
new file mode 100644
index 00000000..0beb2ed9
--- /dev/null
+++ b/src/location/places/qplacecontent.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by tOhe Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QPLACECONTENT_H
+#define QPLACECONTENT_H
+
+#include <QMap>
+#include <QMetaType>
+#include <QSharedDataPointer>
+
+QT_BEGIN_HEADER
+
+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;
+
+#define Q_DECLARE_CONTENT_COPY_CTOR(Class) \
+ Class(const QPlaceContent &other);
+
+class QPlaceContentPrivate;
+class Q_LOCATION_EXPORT QPlaceContent
+{
+public:
+ typedef QMap<int, QPlaceContent> Collection;
+
+ enum Type {
+ ImageType,
+ ReviewType,
+ EditorialType,
+ InvalidType
+ };
+
+ QPlaceContent();
+ QPlaceContent(const QPlaceContent &other);
+ virtual ~QPlaceContent();
+
+ QPlaceContent &operator=(const QPlaceContent &other);
+
+ bool operator==(const QPlaceContent &other) const;
+ bool operator!=(const QPlaceContent &other) const;
+
+ QPlaceContent::Type type() const;
+
+protected:
+ explicit QPlaceContent(QPlaceContentPrivate *d);
+ QSharedDataPointer<QPlaceContentPrivate> d_ptr;
+ friend class QPlaceContentPrivate;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QPlaceContent))
+
+#endif
+
diff --git a/src/location/places/qplacecontent_p.h b/src/location/places/qplacecontent_p.h
new file mode 100644
index 00000000..d3b258d0
--- /dev/null
+++ b/src/location/places/qplacecontent_p.h
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by tOhe Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPLACECONTENT_P_H
+#define QPLACECONTENT_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 "qplacecontent.h"
+
+#include <QSharedData>
+#include <QString>
+
+
+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 { return new Class##Private(*this); } \
+ virtual QPlaceContent::Type type() const {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 =0;
+ 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;}
+};
+
+#if defined(Q_CC_MWERKS)
+// This results in multiple symbol definition errors on all other compilers
+// but not having a definition here results in an attempt to use the unspecialized
+// clone (which fails because of the pure virtuals above)
+template<> QPlaceContentPrivate *QSharedDataPointer<QPlaceContentPrivate>::clone()
+{
+ return d->clone();
+}
+#else
+template<> QPlaceContentPrivate *QSharedDataPointer<QPlaceContentPrivate>::clone();
+#endif
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/src/location/places/qplacemediareply.cpp b/src/location/places/qplacecontentreply.cpp
index 98719be4..31228e76 100644
--- a/src/location/places/qplacemediareply.cpp
+++ b/src/location/places/qplacecontentreply.cpp
@@ -39,19 +39,18 @@
**
****************************************************************************/
-#include "qplacemediareply.h"
+#include "qplacecontentreply.h"
#include "qplacereply_p.h"
-#include "qplacepaginationlist.h"
QT_BEGIN_NAMESPACE
-class QPlaceMediaReplyPrivate : public QPlaceReplyPrivate
+class QPlaceContentReplyPrivate : public QPlaceReplyPrivate
{
public:
- QPlaceMediaReplyPrivate()
+ QPlaceContentReplyPrivate()
: totalCount(0)
{ }
- PlaceMediaCollection mediaObjects;
+ QPlaceContent::Collection contentCollection;
int totalCount;
};
@@ -60,9 +59,9 @@ QT_END_NAMESPACE
QT_USE_NAMESPACE
/*!
- \class QPlaceMediaReply
+ \class QPlaceConentReply
- \brief The QPlaceMediaReply class manages a media retrieval operation started by an
+ \brief The QPlaceContentReply class manages a content retrieval operation started by an
instance of QPlaceManager.
\inmodule QtLocation
@@ -71,61 +70,63 @@ QT_USE_NAMESPACE
*/
/*!
- Constructs a media reply with a given \a parent.
+ Constructs a content reply with a given \a parent.
*/
-QPlaceMediaReply::QPlaceMediaReply(QObject *parent)
- : QPlaceReply(new QPlaceMediaReplyPrivate, parent)
+QPlaceContentReply::QPlaceContentReply(QObject *parent)
+ : QPlaceReply(new QPlaceContentReplyPrivate, parent)
{
}
/*!
Destroys the reply.
*/
-QPlaceMediaReply::~QPlaceMediaReply()
+QPlaceContentReply::~QPlaceContentReply()
{
}
/*!
- Returns the media objects.
+ Returns the collection of content retrieved.
*/
-PlaceMediaCollection QPlaceMediaReply::mediaObjects() const
+QPlaceContent::Collection QPlaceContentReply::content() const
{
- Q_D(const QPlaceMediaReply);
- return d->mediaObjects;
+ Q_D(const QPlaceContentReply);
+ return d->contentCollection;
}
/*!
Returns the type of reply.
*/
-QPlaceReply::Type QPlaceMediaReply::type() const
+QPlaceReply::Type QPlaceContentReply::type() const
{
- return QPlaceReply::MediaReply;
+ return QPlaceReply::ContentReply;
}
/*!
- Sets the media \a objects.
+ Sets the \a content of the reply.
*/
-void QPlaceMediaReply::setMediaObjects(const PlaceMediaCollection &mediaObjects)
+void QPlaceContentReply::setContent(const QPlaceContent::Collection &content)
{
- Q_D(QPlaceMediaReply);
- d->mediaObjects = mediaObjects;
+ Q_D(QPlaceContentReply);
+ d->contentCollection = content;
}
/*!
- Returns the total number of media objects for a place. If the total number of
- media objects cannot be counted a value of -1 is returned.
+ Returns the total number of content objects for a place. If the total number of
+ content objects cannot be counted, a value of -1 is returned. This count only
+ refers to the total count for a single content type i.e. the content type that
+ was specified when content was requested with the QPlaceManager.
*/
-int QPlaceMediaReply::totalCount() const
+int QPlaceContentReply::totalCount() const
{
- Q_D(const QPlaceMediaReply);
+ Q_D(const QPlaceContentReply);
return d->totalCount;
}
/*!
- Sets the \a total number of media objects for a place.
+ Sets the \a total number of content objects for a place.
*/
-void QPlaceMediaReply::setTotalCount(int total)
+void QPlaceContentReply::setTotalCount(int total)
{
- Q_D(QPlaceMediaReply);
+ Q_D(QPlaceContentReply);
d->totalCount = total;
}
diff --git a/src/location/places/qplacemediareply.h b/src/location/places/qplacecontentreply.h
index a68d287e..0308bea8 100644
--- a/src/location/places/qplacemediareply.h
+++ b/src/location/places/qplacecontentreply.h
@@ -39,39 +39,37 @@
**
****************************************************************************/
-#ifndef QPLACEMEDIAREPLY_H
-#define QPLACEMEDIAREPLY_H
+#ifndef QPLACECONTENTREPLY_H
+#define QPLACECONTENTREPLY_H
#include "qplacereply.h"
-#include "qplacemediaobject.h"
-#include "qplacepaginationlist.h"
+#include "qplacecontent.h"
-#include <QStringList>
QT_BEGIN_NAMESPACE
-class QPlaceMediaReplyPrivate;
-class Q_LOCATION_EXPORT QPlaceMediaReply : public QPlaceReply
+class QPlaceContentReplyPrivate;
+class Q_LOCATION_EXPORT QPlaceContentReply : public QPlaceReply
{
Q_OBJECT
public:
- QPlaceMediaReply(QObject *parent =0);
- virtual ~QPlaceMediaReply();
+ QPlaceContentReply(QObject *parent =0);
+ virtual ~QPlaceContentReply();
QPlaceReply::Type type() const;
- PlaceMediaCollection mediaObjects() const;
+ QPlaceContent::Collection content() const;
int totalCount() const;
protected:
- void setMediaObjects(const PlaceMediaCollection &mediaObjects);
+ void setContent(const QPlaceContent::Collection &content);
void setTotalCount(int total);
-
+\
private:
- Q_DISABLE_COPY(QPlaceMediaReply)
- Q_DECLARE_PRIVATE(QPlaceMediaReply)
+ Q_DISABLE_COPY(QPlaceContentReply)
+ Q_DECLARE_PRIVATE(QPlaceContentReply)
};
QT_END_NAMESPACE
diff --git a/src/location/places/qplaceimage.cpp b/src/location/places/qplaceimage.cpp
new file mode 100644
index 00000000..0353a9a3
--- /dev/null
+++ b/src/location/places/qplaceimage.cpp
@@ -0,0 +1,217 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qplaceimage.h"
+#include "qplaceimage_p.h"
+
+QT_USE_NAMESPACE
+
+QPlaceImagePrivate::QPlaceImagePrivate() : QPlaceContentPrivate()
+{
+}
+
+QPlaceImagePrivate::QPlaceImagePrivate(const QPlaceImagePrivate &other)
+ : QPlaceContentPrivate(other)
+{
+ this->url = other.url;
+ this->thumbnailUrl = other.thumbnailUrl;
+ this->id = other.id;
+ this->metaInfo = other.metaInfo;
+ this->mimeType = other.mimeType;
+ this->supplier = other.supplier;
+}
+
+QPlaceImagePrivate::~QPlaceImagePrivate()
+{
+}
+
+bool QPlaceImagePrivate::compare(const QPlaceContentPrivate *other) const
+{
+ const QPlaceImagePrivate *od = static_cast<const QPlaceImagePrivate *>(other);
+ return (this->url == od->url
+ && this->thumbnailUrl == od->thumbnailUrl
+ && this->id == od->id
+ && this->metaInfo == od->metaInfo
+ && this->mimeType == od->mimeType
+ && this->supplier == od->supplier
+ );
+}
+
+/*!
+ \class QPlaceImage
+
+ \inmodule QPlaces
+
+ \brief The QPlaceImage class represents an image.
+
+
+ Each QPlaceImage represents an image with a number of attributes
+ such as type, thumbnail, media provider etc.
+
+ QPlaceImage is an in memory representation of an image.
+*/
+
+/*!
+ Constructs an new image object.
+*/
+QPlaceImage::QPlaceImage()
+ : QPlaceContent(new QPlaceImagePrivate)
+{
+}
+
+/*!
+ Destructor.
+*/
+QPlaceImage::~QPlaceImage()
+{
+}
+
+Q_IMPLEMENT_CONTENT_COPY_CTOR(QPlaceImage)
+
+Q_IMPLEMENT_CONTENT_D_FUNC(QPlaceImage)
+
+/*!
+ Returns the image url.
+*/
+QUrl QPlaceImage::url() const
+{
+ Q_D(const QPlaceImage);
+ return d->url;
+}
+
+/*!
+ Sets image url.
+*/
+void QPlaceImage::setUrl(const QUrl &url)
+{
+ Q_D(QPlaceImage);
+ d->url = url;
+}
+
+/*!
+ Returns the thumbnail url.
+*/
+QUrl QPlaceImage::thumbnailUrl() const
+{
+ Q_D(const QPlaceImage);
+ return d->thumbnailUrl;
+}
+
+/*!
+ Sets the thumbnail \a url.
+*/
+void QPlaceImage::setThumbnailUrl(const QUrl &url)
+{
+ Q_D(QPlaceImage);
+ d->thumbnailUrl = url;
+}
+
+/*!
+ Returns image id.
+*/
+QString QPlaceImage::id() const
+{
+ Q_D(const QPlaceImage);
+ return d->id;
+}
+
+/*!
+ Sets image id.
+*/
+void QPlaceImage::setId(const QString &data)
+{
+ Q_D(QPlaceImage);
+ d->id = data;
+}
+
+/*!
+ Returns image meta info.
+*/
+QString QPlaceImage::metaInfo() const
+{
+ Q_D(const QPlaceImage);
+ return d->metaInfo;
+}
+
+/*!
+ Sets image meta info.
+*/
+void QPlaceImage::setMetaInfo(const QString &data)
+{
+ Q_D(QPlaceImage);
+ d->metaInfo = data;
+}
+
+/*!
+ Returns image mime type.
+*/
+QString QPlaceImage::mimeType() const
+{
+ Q_D(const QPlaceImage);
+ return d->mimeType;
+}
+
+/*!
+ Sets image mime type.
+*/
+void QPlaceImage::setMimeType(const QString &data)
+{
+ Q_D(QPlaceImage);
+ d->mimeType = data;
+}
+
+/*!
+ Returns supplier.
+*/
+QPlaceSupplier QPlaceImage::supplier() const
+{
+ Q_D(const QPlaceImage);
+ return d->supplier;
+}
+
+/*!
+ Sets supplier.
+*/
+void QPlaceImage::setSupplier(const QPlaceSupplier &data)
+{
+ Q_D(QPlaceImage);
+ d->supplier = data;
+}
diff --git a/src/location/places/qplacemediaobject.h b/src/location/places/qplaceimage.h
index ee4591e2..f5a9f717 100644
--- a/src/location/places/qplacemediaobject.h
+++ b/src/location/places/qplaceimage.h
@@ -39,41 +39,28 @@
**
****************************************************************************/
-#ifndef QPLACEMEDIAOBJECT_H
-#define QPLACEMEDIAOBJECT_H
+#ifndef QPLACEIMAGE_H
+#define QPLACEIMAGE_H
#include <QSharedDataPointer>
#include <QString>
#include <qlatin1constant.h>
#include "qmobilityglobal.h"
#include "qplacesupplier.h"
+#include "qplacecontent.h"
QT_BEGIN_NAMESPACE
-class QPlaceMediaObjectPrivate;
+class QPlaceImagePrivate;
class QUrl;
-class Q_LOCATION_EXPORT QPlaceMediaObject
+class Q_LOCATION_EXPORT QPlaceImage : public QPlaceContent
{
public:
+ QPlaceImage();
+ Q_DECLARE_CONTENT_COPY_CTOR(QPlaceImage)
-#ifdef Q_QDOC
- static const QLatin1Constant Image;
-#else
- Q_DECLARE_LATIN1_CONSTANT(Image, "Image");
-#endif
-
- QPlaceMediaObject();
- QPlaceMediaObject(const QPlaceMediaObject &other);
-
- virtual ~QPlaceMediaObject();
-
- QPlaceMediaObject &operator=(const QPlaceMediaObject &other);
-
- bool operator==(const QPlaceMediaObject &other) const;
- bool operator!=(const QPlaceMediaObject &other) const {
- return !(other == *this);
- }
+ virtual ~QPlaceImage();
QUrl url() const;
void setUrl(const QUrl &url);
@@ -89,11 +76,9 @@ public:
void setSupplier(const QPlaceSupplier &data);
private:
- QSharedDataPointer<QPlaceMediaObjectPrivate> d;
+ Q_DECLARE_CONTENT_D_FUNC(QPlaceImage)
};
-typedef QMap<int, QPlaceMediaObject> PlaceMediaCollection;
-
QT_END_NAMESPACE
-#endif // QPLACEMEDIAOBJECT_H
+#endif
diff --git a/src/location/places/qplacemediaobject_p.h b/src/location/places/qplaceimage_p.h
index e2a0f998..efa70a5e 100644
--- a/src/location/places/qplacemediaobject_p.h
+++ b/src/location/places/qplaceimage_p.h
@@ -39,25 +39,28 @@
**
****************************************************************************/
-#ifndef QPLACEMEDIAOBJECT_P_H
-#define QPLACEMEDIAOBJECT_P_H
+#ifndef QPLACEIMAGE_P_H
+#define QPLACEIMAGE_P_H
#include <QtCore/QSharedData>
#include <QtCore/QUrl>
-#include "qplacemediaobject.h"
+#include "qplaceimage.h"
+#include "qplacecontent_p.h"
QT_BEGIN_NAMESPACE
-class QPlaceMediaObjectPrivate : public QSharedData
+class QPlaceImagePrivate : public QPlaceContentPrivate
{
public:
- QPlaceMediaObjectPrivate();
- QPlaceMediaObjectPrivate(const QPlaceMediaObjectPrivate &other);
+ QPlaceImagePrivate();
+ QPlaceImagePrivate(const QPlaceImagePrivate &other);
- ~QPlaceMediaObjectPrivate();
+ ~QPlaceImagePrivate();
- bool operator==(const QPlaceMediaObjectPrivate &other) const;
+ bool compare(const QPlaceContentPrivate *other) const;
+
+ Q_DEFINE_CONTENT_PRIVATE_HELPER(QPlaceImage, QPlaceContent::ImageType);
QUrl url;
QUrl thumbnailUrl;
@@ -69,4 +72,4 @@ public:
QT_END_NAMESPACE
-#endif // QPLACEMEDIAOBJECT_P_H
+#endif
diff --git a/src/location/places/qplacemanager.cpp b/src/location/places/qplacemanager.cpp
index ffa0875f..a08c0960 100644
--- a/src/location/places/qplacemanager.cpp
+++ b/src/location/places/qplacemanager.cpp
@@ -78,7 +78,6 @@
\value ImportFeature The manager supports import operations
\value ExportFeature The manager supports export operations
\value CheckInFeature The manaager supports check-in operations
- \value PostMediaFeature The manager supports posting media for places
\value PostRatingFeature The manager supports posting ratings for places
\value SuggestionFeature The manager supports the providing of suggestions
\value ReportPlaceFeature The manager supports reporting a place if it is incorrect/inappropriate.
@@ -137,11 +136,12 @@ QPlaceDetailsReply *QPlaceManager::getPlaceDetails(const QString &placeId) const
}
/*!
- Retrieves media from a given \a place according to the parameters specified in \a request.
+ Retrieves content of type \a contentType from a given \a place according to thes parameters specified in
+ \a request.
*/
-QPlaceMediaReply *QPlaceManager::getMedia(const QGeoPlace &place, const QPlaceRequest &request) const
+QPlaceContentReply *QPlaceManager::getContent(QPlaceContent::Type contentType, const QGeoPlace &place, const QPlaceRequest &request) const
{
- return d->engine->getMedia(place, request);
+ return d->engine->getContent(contentType, place, request);
}
/*!
diff --git a/src/location/places/qplacemanager.h b/src/location/places/qplacemanager.h
index 3e886a0a..483f6dab 100644
--- a/src/location/places/qplacemanager.h
+++ b/src/location/places/qplacemanager.h
@@ -43,8 +43,7 @@
#define QPLACEMANAGER_H
#include "qmobilityglobal.h"
-#include "qplacemediaobject.h"
-#include "qplacemediareply.h"
+#include "qplacecontentreply.h"
#include "qplacerequest.h"
#include "qplacesavereply.h"
#include "qplacereply.h"
@@ -90,7 +89,6 @@ public:
ImportFeature,
ExportFeature,
CheckInFeature,
- PostMediaFeature,
PostRatingFeature,
SuggestionFeature,
ReportPlaceFeature,
@@ -114,7 +112,7 @@ public:
QPlaceReviewReply *getReviews(const QGeoPlace &place, const QPlaceRequest &query) const;
- QPlaceMediaReply *getMedia(const QGeoPlace &place, const QPlaceRequest &query) const;
+ QPlaceContentReply *getContent(QPlaceContent::Type type, const QGeoPlace &place, const QPlaceRequest &query) const;
QPlaceSearchReply *searchForPlaces(const QPlaceSearchRequest &query) const;
diff --git a/src/location/places/qplacemanagerengine.cpp b/src/location/places/qplacemanagerengine.cpp
index 7318b47b..6b5155fc 100644
--- a/src/location/places/qplacemanagerengine.cpp
+++ b/src/location/places/qplacemanagerengine.cpp
@@ -59,7 +59,7 @@ QT_USE_NAMESPACE
\ingroup maps-impl
Subclasses of QPlaceManagerEngine need to provide an implementation of getPlaceDetails(),
- getMedia(), postRating(), getReviews(), searchForPlaces(), supportedSearchVisibilityScopes(),
+ getContent(), postRating(), getReviews(), searchForPlaces(), supportedSearchVisibilityScopes(),
recommendations(), textPredictions(), connectivityMode(), setConnectivityMode(),
supportedConnectivityModes(), savePlace(), supportedSaveVisibilityScopes(), removePlace(),
initializeCategories() and categories().
diff --git a/src/location/places/qplacemanagerengine.h b/src/location/places/qplacemanagerengine.h
index ca9699e6..c49ec472 100644
--- a/src/location/places/qplacemanagerengine.h
+++ b/src/location/places/qplacemanagerengine.h
@@ -61,7 +61,7 @@ public:
virtual QPlaceDetailsReply *getPlaceDetails(const QString &placeId) = 0;
- virtual QPlaceMediaReply *getMedia(const QGeoPlace &place, const QPlaceRequest &request) = 0;
+ virtual QPlaceContentReply *getContent(QPlaceContent::Type, const QGeoPlace &place, const QPlaceRequest &request) = 0;
virtual QPlaceReply *postRating(const QString &placeId, qreal value) = 0;
diff --git a/src/location/places/qplacemediaobject.cpp b/src/location/places/qplacemediaobject.cpp
deleted file mode 100644
index 0f9a8a3e..00000000
--- a/src/location/places/qplacemediaobject.cpp
+++ /dev/null
@@ -1,229 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qplacemediaobject.h"
-#include "qplacemediaobject_p.h"
-
-QT_USE_NAMESPACE
-
-QPlaceMediaObjectPrivate::QPlaceMediaObjectPrivate() : QSharedData()
-{
-}
-
-QPlaceMediaObjectPrivate::QPlaceMediaObjectPrivate(const QPlaceMediaObjectPrivate &other)
- : QSharedData()
-{
- this->url = other.url;
- this->thumbnailUrl = other.thumbnailUrl;
- this->id = other.id;
- this->metaInfo = other.metaInfo;
- this->mimeType = other.mimeType;
- this->supplier = other.supplier;
-}
-
-QPlaceMediaObjectPrivate::~QPlaceMediaObjectPrivate()
-{
-}
-
-bool QPlaceMediaObjectPrivate::operator==(const QPlaceMediaObjectPrivate &other) const
-{
- return (
- this->url == other.url
- && this->thumbnailUrl == other.thumbnailUrl
- && this->id == other.id
- && this->metaInfo == other.metaInfo
- && this->mimeType == other.mimeType
- && this->supplier == other.supplier
- );
-}
-
-/*!
- \class QPlaceMediaObject
-
- \inmodule QPlaces
-
- \brief The QPlaceMediaObject class represents a media object.
-
-
- Each QPlaceMediaObject represents a media object with a number of attributes
- such as type, thumbnail, media provider etc. Each QPlaceMediaObject may be associated
- with place.
-
- Media objects are read-only, e.g. user of API might get list of media objects
- associated to specific place but can not edit its content.
-
- QPlaceMediaObject is an in memory representation of a media object.
-*/
-
-/*!
- \variable QPlaceMediaObject::Image
- The constant used to define the type of media.
-*/
-Q_DEFINE_LATIN1_CONSTANT(QPlaceMediaObject::Image, "Image");
-
-/*!
- Constructs an new media object.
-*/
-QPlaceMediaObject::QPlaceMediaObject()
- : d(new QPlaceMediaObjectPrivate)
-{
-}
-
-/*!
- Constructs a copy of \a other
-*/
-QPlaceMediaObject::QPlaceMediaObject(const QPlaceMediaObject &other)
- :d(other.d)
-{
-}
-
-/*!
- Destructor.
-*/
-QPlaceMediaObject::~QPlaceMediaObject()
-{
-}
-
-QPlaceMediaObject &QPlaceMediaObject::operator =(const QPlaceMediaObject &other) {
- d = other.d;
- return *this;
-}
-
-bool QPlaceMediaObject::operator==(const QPlaceMediaObject &other) const
-{
- return (*(d.constData()) == *(other.d.constData()));
-}
-
-/*!
- Returns media url.
-*/
-QUrl QPlaceMediaObject::url() const
-{
- return d->url;
-}
-
-/*!
- Sets media url.
-*/
-void QPlaceMediaObject::setUrl(const QUrl &url)
-{
- d->url = url;
-}
-
-/*!
- Returns media url for thumbnail.
-*/
-QUrl QPlaceMediaObject::thumbnailUrl() const
-{
- return d->thumbnailUrl;
-}
-
-/*!
- Sets media url for thumbnail.
-*/
-void QPlaceMediaObject::setThumbnailUrl(const QUrl &url)
-{
- d->thumbnailUrl = url;
-}
-
-/*!
- Returns media id.
-*/
-QString QPlaceMediaObject::id() const
-{
- return d->id;
-}
-
-/*!
- Sets media id.
-*/
-void QPlaceMediaObject::setId(const QString &data)
-{
- d->id = data;
-}
-
-/*!
- Returns media meta info.
-*/
-QString QPlaceMediaObject::metaInfo() const
-{
- return d->metaInfo;
-}
-
-/*!
- Sets media meta info.
-*/
-void QPlaceMediaObject::setMetaInfo(const QString &data)
-{
- d->metaInfo = data;
-}
-
-/*!
- Returns media mime type.
-*/
-QString QPlaceMediaObject::mimeType() const
-{
- return d->mimeType;
-}
-
-/*!
- Sets media mime type.
-*/
-void QPlaceMediaObject::setMimeType(const QString &data)
-{
- d->mimeType = data;
-}
-
-/*!
- Returns supplier.
-*/
-QPlaceSupplier QPlaceMediaObject::supplier() const
-{
- return d->supplier;
-}
-
-/*!
- Sets supplier.
-*/
-void QPlaceMediaObject::setSupplier(const QPlaceSupplier &data)
-{
- d->supplier = data;
-}
diff --git a/src/location/places/qplacereply.cpp b/src/location/places/qplacereply.cpp
index f8ced920..f3221a9c 100644
--- a/src/location/places/qplacereply.cpp
+++ b/src/location/places/qplacereply.cpp
@@ -91,8 +91,8 @@ QT_USE_NAMESPACE
Thi is the reply for a text prediction operation.
\value ReviewReply
This is a reply for the retrieval of place reviews.
- \value MediaReply
- This is a reply for the retrieval of place media.
+ \value ContentReply
+ This is a reply for the retrieval of place content.
\value PlaceDetailsReply
This is a reply for the retrieval of place details.
\value PlaceSearchReply
diff --git a/src/location/places/qplacereply.h b/src/location/places/qplacereply.h
index 5a73cffb..1796efe6 100644
--- a/src/location/places/qplacereply.h
+++ b/src/location/places/qplacereply.h
@@ -71,7 +71,7 @@ public:
PlaceSearchReply,
TextPredictionReply,
ReviewReply,
- MediaReply,
+ ContentReply,
SaveReply
};
diff --git a/src/location/places/qplacereviewreply.cpp b/src/location/places/qplacereviewreply.cpp
index e3227c11..590fc7f9 100644
--- a/src/location/places/qplacereviewreply.cpp
+++ b/src/location/places/qplacereviewreply.cpp
@@ -113,7 +113,7 @@ void QPlaceReviewReply::setReviews(const QList<QPlaceReview> &reviews)
}
/*!
- Sets the \a offset number of the first media objects on the current page.
+ Sets the \a offset number of the first review.
*/
void QPlaceReviewReply::setOffset(int offset)
{
@@ -132,7 +132,7 @@ int QPlaceReviewReply::totalCount() const
}
/*!
- Sets the \a total number of media objects for a place.
+ Sets the \a total number of reviews for a place.
*/
void QPlaceReviewReply::setTotalCount(int total)
{
diff --git a/src/location/qgeoplace.cpp b/src/location/qgeoplace.cpp
index 2325491a..79c7520b 100644
--- a/src/location/qgeoplace.cpp
+++ b/src/location/qgeoplace.cpp
@@ -362,57 +362,60 @@ void QGeoPlace::setFeeds(const QStringList &feeds)
}
/*!
- Returns a collection of media associated with a place.
- This collection a map with the key being the index of the media
- and value being the media object itself.
+ Returns a collection of content associated with a place.
+ This collection is a map with the key being the index of the content object
+ and value being the content object itself.
+
+ The \a type specifies which kind of content is to be retrieved.
*/
-PlaceMediaCollection QGeoPlace::media(const QString &mediaType) const
+QPlaceContent::Collection QGeoPlace::content(QPlaceContent::Type type) const
{
Q_D(const QGeoPlace);
- return d->media.value(mediaType);
+ return d->contentCollections.value(type);
}
/*!
- Sets a collection of \a media for the given \a mediaType.
+ Sets a collection of \a content for the given \a type.
*/
-void QGeoPlace::setMedia(const QString &mediaType, const PlaceMediaCollection &media)
+void QGeoPlace::setContent(QPlaceContent::Type type, const QPlaceContent::Collection &content)
{
Q_D(QGeoPlace);
- d->media.insert(mediaType, media);
+ d->contentCollections.insert(type, content);
}
/*!
- Adds a list of \a media to the given \a mediaType. Any index in \a media
+ Adds a collection of \a content of the given \a type to the place. Any index in \a content
that already exists is overwritten.
*/
-void QGeoPlace::addMedia(const QString &mediaType, const PlaceMediaCollection &media)
+void QGeoPlace::addContent(QPlaceContent::Type type, const QPlaceContent::Collection &content)
{
Q_D(QGeoPlace);
- QMapIterator<int, QPlaceMediaObject> iter(media);
+ QMapIterator<int, QPlaceContent> iter(content);
while (iter.hasNext()) {
iter.next();
- d->media[mediaType].insert(iter.key(), iter.value());
+ d->contentCollections[type].insert(iter.key(), iter.value());
}
}
/*!
- Returns the total count of media objects of the given \a mediaType.
+ Returns the total count of content objects of the given \a type.
This total count indicates how many the manager should have available.
(As opposed to how many objects this place instance is currently assigned).
+ A negative count indicates that the total number of items is unknown.
*/
-int QGeoPlace::mediaCount(const QString &mediaType) const
+int QGeoPlace::contentCount(QPlaceContent::Type type) const
{
Q_D(const QGeoPlace);
- return d->mediaCounts.value(mediaType, 0);
+ return d->contentCounts.value(type, 0);
}
/*!
- Sets the total count of media objects of the given \a mediaType.
+ Sets the \a totalCount of content objects of the given \a type.
*/
-void QGeoPlace::setMediaCount(const QString &mediaType, int totalCount)
+void QGeoPlace::setContentCount(QPlaceContent::Type type, int totalCount)
{
Q_D(QGeoPlace);
- d->mediaCounts.insert(mediaType, totalCount);
+ d->contentCounts.insert(type, totalCount);
}
/*!
@@ -665,8 +668,8 @@ QGeoPlacePrivate::QGeoPlacePrivate(const QGeoPlacePrivate &other)
rating(other.rating),
suppliers(other.suppliers),
feeds(other.feeds),
- media(other.media),
- mediaCounts(other.mediaCounts),
+ contentCollections(other.contentCollections),
+ contentCounts(other.contentCounts),
name(other.name),
placeId(other.placeId),
reviews(other.reviews),
@@ -709,8 +712,8 @@ bool QGeoPlacePrivate::operator== (const QGeoPlacePrivate &other) const
qDebug() << "rating" << (rating == other.rating);
qDebug() << "suppliers" << (suppliers == other.suppliers);
qDebug() << "feeds " << (feeds == other.feeds);
- qDebug() << "media " << (media == other.media);
- qDebug() << "mediaCount " << (mediaCounts == other.mediaCounts);
+ qDebug() << "contentCollections " << (contentCollections == other.contentCollections);
+ qDebug() << "contentCounts " << (contentCounts == other.contentCounts);
qDebug() << "name " << (name == other.name);
qDebug() << "placeId" << (placeId == other.placeId);
qDebug() << "reviews" << (reviews == other.reviews);
@@ -735,8 +738,8 @@ bool QGeoPlacePrivate::operator== (const QGeoPlacePrivate &other) const
&& rating == other.rating
&& suppliers == other.suppliers
&& feeds == other.feeds
- && media == other.media
- && mediaCounts == other.mediaCounts
+ && contentCollections == other.contentCollections
+ && contentCounts == other.contentCounts
&& name == other.name
&& placeId == other.placeId
&& reviews == other.reviews
diff --git a/src/location/qgeoplace.h b/src/location/qgeoplace.h
index 9d11250a..65ec5aaa 100644
--- a/src/location/qgeoplace.h
+++ b/src/location/qgeoplace.h
@@ -51,12 +51,11 @@
#include "qgeocoordinate.h"
#include "qgeolocation.h"
#include "qplacecategory.h"
+#include "qplacecontent.h"
#include "qplacedescription.h"
#include "qplacerating.h"
#include "qplacepaginationlist.h"
-#include "qplacemediaobject.h"
#include "qplacereview.h"
-#include "qplacemediaobject.h"
#include "qplaceattribute.h"
QT_BEGIN_NAMESPACE
@@ -106,11 +105,11 @@ public:
QStringList feeds() const;
void setFeeds(const QStringList &feeds);
- PlaceMediaCollection media(const QString &mediaType) const;
- void setMedia(const QString &mediaType, const PlaceMediaCollection &media);
- void addMedia(const QString &mediaType, const PlaceMediaCollection &media);
- int mediaCount(const QString &mediaType) const;
- void setMediaCount(const QString &mediaType, int);
+ QPlaceContent::Collection content(QPlaceContent::Type type) const;
+ void setContent(QPlaceContent::Type type, const QPlaceContent::Collection &content);
+ void addContent(QPlaceContent::Type type, const QPlaceContent::Collection &content);
+ int contentCount(QPlaceContent::Type type) const;
+ void setContentCount(QPlaceContent::Type type, int);
QString name() const;
void setName(const QString &name);
diff --git a/src/location/qgeoplace_p.h b/src/location/qgeoplace_p.h
index 6aabebc8..e34628b3 100644
--- a/src/location/qgeoplace_p.h
+++ b/src/location/qgeoplace_p.h
@@ -101,8 +101,8 @@ public:
QString shortDescription;
QStringList tags;
- QMap<QString, PlaceMediaCollection> media;
- QMap<QString, int> mediaCounts;
+ QMap<QPlaceContent::Type, QPlaceContent::Collection> contentCollections;
+ QMap<QPlaceContent::Type, int> contentCounts;
QString primaryPhone;
QString primaryFax;
diff --git a/src/plugins/geoservices/nokia/places/places.pri b/src/plugins/geoservices/nokia/places/places.pri
index 911262f3..c1112981 100644
--- a/src/plugins/geoservices/nokia/places/places.pri
+++ b/src/plugins/geoservices/nokia/places/places.pri
@@ -14,7 +14,7 @@ HEADERS += \
#query classes
#reply classes
places/qplacecategoriesreplyimpl.h \
- places/qplacemediareplyimpl.h \
+ places/qplaceimagereplyimpl.h \
places/qplacedetailsreplyimpl.h \
places/qplaceratingreplyimpl.h \
places/qplacerecommendationreplyimpl.h \
@@ -44,7 +44,7 @@ SOURCES += \
#reply classes
places/qplacecategoriesreplyimpl.cpp \
places/qplacedetailsreplyimpl.cpp \
- places/qplacemediareplyimpl.cpp \
+ places/qplaceimagereplyimpl.cpp \
places/qplaceratingreplyimpl.cpp \
places/qplacerecommendationreplyimpl.cpp \
places/qplacereviewreplyimpl.cpp \
diff --git a/src/plugins/geoservices/nokia/places/qplacemediareplyimpl.cpp b/src/plugins/geoservices/nokia/places/qplaceimagereplyimpl.cpp
index cab195d3..10ec472d 100644
--- a/src/plugins/geoservices/nokia/places/qplacemediareplyimpl.cpp
+++ b/src/plugins/geoservices/nokia/places/qplaceimagereplyimpl.cpp
@@ -46,7 +46,7 @@
**
****************************************************************************/
-#include "qplacemediareplyimpl.h"
+#include "qplaceimagereplyimpl.h"
#if defined(QT_PLACES_LOGGING)
#include <QDebug>
@@ -57,8 +57,8 @@ QT_USE_NAMESPACE
/*!
Constructor.
*/
-QPlaceMediaReplyImpl::QPlaceMediaReplyImpl(QPlaceRestReply *reply, QObject *parent) :
- QPlaceMediaReply(parent),
+QPlaceImageReplyImpl::QPlaceImageReplyImpl(QPlaceRestReply *reply, QObject *parent) :
+ QPlaceContentReply(parent),
restReply(reply)
{
parser = new QPlaceJSonMediaParser(this);
@@ -77,22 +77,33 @@ QPlaceMediaReplyImpl::QPlaceMediaReplyImpl(QPlaceRestReply *reply, QObject *pare
/*!
Destructor.
*/
-QPlaceMediaReplyImpl::~QPlaceMediaReplyImpl()
+QPlaceImageReplyImpl::~QPlaceImageReplyImpl()
{
}
-void QPlaceMediaReplyImpl::abort()
+void QPlaceImageReplyImpl::abort()
{
if (restReply)
restReply->cancelProcessing();
}
-void QPlaceMediaReplyImpl::setStartNumber(int number)
+void QPlaceImageReplyImpl::setStartNumber(int number)
{
startNumber = number;
}
-void QPlaceMediaReplyImpl::restError(QPlaceRestReply::Error errorId)
+void QPlaceImageReplyImpl::restError(QPlaceReply::Error errorId, const QString &errorString)
+{
+ setError(errorId, errorString);
+
+ emit error(this->error(), this->errorString());
+ emit processingError(this, this->error(), this->errorString());
+ setFinished(true);
+ emit finished();
+ emit processingFinished(this);
+}
+
+void QPlaceImageReplyImpl::restError(QPlaceRestReply::Error errorId)
{
if (errorId == QPlaceRestReply::Canceled) {
this->setError(CancelError, "RequestCanceled");
@@ -106,15 +117,15 @@ void QPlaceMediaReplyImpl::restError(QPlaceRestReply::Error errorId)
emit processingFinished(this);
}
-void QPlaceMediaReplyImpl::resultReady(const QPlaceJSonParser::Error &errorId,
+void QPlaceImageReplyImpl::resultReady(const QPlaceJSonParser::Error &errorId,
const QString &errorMessage)
{
if (errorId == QPlaceJSonParser::NoError) {
- QList<QPlaceMediaObject> mediaObjects = parser->resultMedia();
- PlaceMediaCollection collection;
- for (int i=0; i < mediaObjects.count(); ++i)
- collection.insert(startNumber +i, mediaObjects.at(i));
- setMediaObjects(collection);
+ QList<QPlaceImage> imageOjects = parser->resultMedia();
+ QPlaceContent::Collection collection;
+ for (int i=0; i < imageOjects.count(); ++i)
+ collection.insert(startNumber +i, imageOjects.at(i));
+ setContent(collection);
setTotalCount(parser->allMediaCount());
} else if (errorId == QPlaceJSonParser::ParsingError) {
setError(ParseError, errorMessage);
diff --git a/src/plugins/geoservices/nokia/places/qplacemediareplyimpl.h b/src/plugins/geoservices/nokia/places/qplaceimagereplyimpl.h
index 2aa7ed66..843dc670 100644
--- a/src/plugins/geoservices/nokia/places/qplacemediareplyimpl.h
+++ b/src/plugins/geoservices/nokia/places/qplaceimagereplyimpl.h
@@ -46,24 +46,24 @@
**
****************************************************************************/
-#ifndef QPLACEMEDIAREPLYIMPL_H
-#define QPLACEMEDIAREPLYIMPL_H
+#ifndef QPLACEIMAGEREPLYIMPL_H
+#define QPLACEIMAGEREPLYIMPL_H
#include <QObject>
#include <QHash>
-#include <qplacemediareply.h>
+#include <qplacecontentreply.h>
#include "qplacerestreply.h"
#include "qplacejsonmediaparser.h"
QT_BEGIN_NAMESPACE
-class QPlaceMediaReplyImpl : public QPlaceMediaReply
+class QPlaceImageReplyImpl : public QPlaceContentReply
{
Q_OBJECT
public:
- explicit QPlaceMediaReplyImpl(QPlaceRestReply *reply, QObject *parent = 0);
- ~QPlaceMediaReplyImpl();
+ explicit QPlaceImageReplyImpl(QPlaceRestReply *reply, QObject *parent = 0);
+ ~QPlaceImageReplyImpl();
void abort();
void setStartNumber(int number);
@@ -71,7 +71,8 @@ Q_SIGNALS:
void processingFinished(QPlaceReply *reply);
void processingError(QPlaceReply *reply, const QPlaceReply::Error &error, const QString &errorMessage);
-private slots:
+public slots:
+ void restError(QPlaceReply::Error error, const QString &errorString);
void restError(QPlaceRestReply::Error error);
void resultReady(const QPlaceJSonParser::Error &error,
const QString &errorMessage);
@@ -84,4 +85,4 @@ private:
QT_END_NAMESPACE
-#endif // QPLACEMEDIAREPLYIMPL_H
+#endif
diff --git a/src/plugins/geoservices/nokia/places/qplacejsondetailsparser.cpp b/src/plugins/geoservices/nokia/places/qplacejsondetailsparser.cpp
index aa3f4afc..c5d7c813 100644
--- a/src/plugins/geoservices/nokia/places/qplacejsondetailsparser.cpp
+++ b/src/plugins/geoservices/nokia/places/qplacejsondetailsparser.cpp
@@ -60,7 +60,6 @@
#include <qplacedescription.h>
#include <qplacerating.h>
#include <qgeolocation.h>
-#include <qplacemediaobject.h>
#include <qplaceperiod.h>
#include <qplacesupplier.h>
#include "qplacejsoncategoriesparser.h"
@@ -636,7 +635,7 @@ void QPlaceJSonDetailsParser::processPremiumContentMediaObjects(const QScriptVal
if (value.isArray()) {
QScriptValueIterator it(value);
//Note: Currently only image types are supported by the server
- PlaceMediaCollection images = targetPlace->media(QPlaceMediaObject::Image);
+ QPlaceContent::Collection images = targetPlace->content(QPlaceContent::ImageType);
int insertionIndex = 0;
if (!images.keys().isEmpty())
insertionIndex = images.keys().last() + 1;
@@ -645,7 +644,7 @@ void QPlaceJSonDetailsParser::processPremiumContentMediaObjects(const QScriptVal
it.next();
// array contains count as last element
if (it.name() != "length") {
- QPlaceMediaObject *obj = processPremiumContentMediaObject(it.value());
+ QPlaceImage *obj = processPremiumContentMediaObject(it.value());
if (obj) {
obj->setSupplier(supplier);
images.insert(insertionIndex, *obj);
@@ -654,29 +653,29 @@ void QPlaceJSonDetailsParser::processPremiumContentMediaObjects(const QScriptVal
}
}
}
- targetPlace->setMedia(QPlaceMediaObject::Image, images);
+ targetPlace->setContent(QPlaceContent::ImageType, images);
} else {
- QPlaceMediaObject *obj = processPremiumContentMediaObject(value);
+ QPlaceImage *obj = processPremiumContentMediaObject(value);
if (obj) {
obj->setSupplier(supplier);
- PlaceMediaCollection images = targetPlace->media(QPlaceMediaObject::Image);
+ QPlaceContent::Collection images = targetPlace->content(QPlaceContent::ImageType);
int insertionIndex = 0;
if (!images.keys().isEmpty())
insertionIndex = images.keys().last() + 1;
images.insert(insertionIndex,*obj);
- targetPlace->setMedia(QPlaceMediaObject::Image, images);
+ targetPlace->setContent(QPlaceContent::ImageType, images);
delete obj;
}
}
}
}
-QPlaceMediaObject *QPlaceJSonDetailsParser::processPremiumContentMediaObject(const QScriptValue &content)
+QPlaceImage *QPlaceJSonDetailsParser::processPremiumContentMediaObject(const QScriptValue &content)
{
- QPlaceMediaObject *obj = NULL;
+ QPlaceImage *obj = NULL;
QScriptValue value = content.property(place_premiumcontent_content_mediaurl_element);
if (value.isValid() && !value.toString().isEmpty()) {
- obj = new QPlaceMediaObject();
+ obj = new QPlaceImage();
obj->setUrl(QUrl::fromEncoded(value.toString().toAscii()));
obj->setId(value.toString());
value = content.property(place_premiumcontent_content_mediamimetype_element);
@@ -784,7 +783,7 @@ void QPlaceJSonDetailsParser::processAdContentMediaObjects(const QScriptValue &c
if (value.isArray()) {
QScriptValueIterator it(value);
//The server only has images for now.
- PlaceMediaCollection images =targetPlace->media(QPlaceMediaObject::Image);
+ QPlaceContent::Collection images =targetPlace->content(QPlaceContent::ImageType);
int insertionIndex = 0;
if (!images.keys().isEmpty())
insertionIndex = images.keys().last() + 1;
@@ -793,7 +792,7 @@ void QPlaceJSonDetailsParser::processAdContentMediaObjects(const QScriptValue &c
it.next();
// array contains count as last element
if (it.name() != "length") {
- QPlaceMediaObject *obj = processAdContentMediaObject(it.value());
+ QPlaceImage *obj = processAdContentMediaObject(it.value());
if (obj) {
images.insert(insertionIndex,*obj);
insertionIndex++;
@@ -801,25 +800,25 @@ void QPlaceJSonDetailsParser::processAdContentMediaObjects(const QScriptValue &c
}
}
}
- targetPlace->setMedia(QPlaceMediaObject::Image, images);
+ targetPlace->setContent(QPlaceContent::ImageType, images);
} else {
- QPlaceMediaObject *obj = processAdContentMediaObject(value);
+ QPlaceImage *obj = processAdContentMediaObject(value);
if (obj) {
- PlaceMediaCollection images = targetPlace->media(QPlaceMediaObject::Image);
+ QPlaceContent::Collection images = targetPlace->content(QPlaceContent::ImageType);
int insertionIndex = 0;
if (!images.keys().isEmpty())
insertionIndex = images.keys().last() + 1;
images.insert(insertionIndex, *obj);
- targetPlace->setMedia(QPlaceMediaObject::Image, images);
+ targetPlace->setContent(QPlaceContent::ImageType,images);
delete obj;
}
}
}
}
-QPlaceMediaObject *QPlaceJSonDetailsParser::processAdContentMediaObject(const QScriptValue &content)
+QPlaceImage *QPlaceJSonDetailsParser::processAdContentMediaObject(const QScriptValue &content)
{
- QPlaceMediaObject *obj = NULL;
+ QPlaceImage *obj = NULL;
QString mediaMimeType;
QString mediaUrl;
@@ -832,7 +831,7 @@ QPlaceMediaObject *QPlaceJSonDetailsParser::processAdContentMediaObject(const QS
mediaUrl = value.toString();
}
if (!mediaMimeType.isEmpty() || !mediaUrl.isEmpty()) {
- obj = new QPlaceMediaObject();
+ obj = new QPlaceImage();
obj->setUrl(QUrl::fromEncoded(mediaUrl.toAscii()));
obj->setId(mediaUrl);
obj->setMimeType(mediaMimeType);
diff --git a/src/plugins/geoservices/nokia/places/qplacejsondetailsparser.h b/src/plugins/geoservices/nokia/places/qplacejsondetailsparser.h
index bc09f568..42dd4070 100644
--- a/src/plugins/geoservices/nokia/places/qplacejsondetailsparser.h
+++ b/src/plugins/geoservices/nokia/places/qplacejsondetailsparser.h
@@ -53,6 +53,7 @@
#include <QList>
#include <qgeoplace.h>
+#include <qplaceimage.h>
#include "qplacejsonparser_p.h"
class QScriptEngine;
@@ -93,13 +94,13 @@ private:
static void processPremiumContentMediaObjects(const QScriptValue &content,
const QPlaceSupplier &supplier,
QGeoPlace *targetPlace);
- static QPlaceMediaObject *processPremiumContentMediaObject(const QScriptValue &content);
+ static QPlaceImage *processPremiumContentMediaObject(const QScriptValue &content);
static void processAdContent(const QScriptValue &content, QGeoPlace *targetPlace);
static void processAdContentPackages(const QScriptValue &content, QGeoPlace *targetPlace);
static void processAdContentDescriptions(const QScriptValue &content, QGeoPlace *targetPlace);
static QPlaceDescription *processAdContentDescription(const QScriptValue &content);
static void processAdContentMediaObjects(const QScriptValue &content, QGeoPlace *targetPlace);
- static QPlaceMediaObject *processAdContentMediaObject(const QScriptValue &content);
+ static QPlaceImage *processAdContentMediaObject(const QScriptValue &content);
static void processAdContentPaymentMethods(const QScriptValue &content, QGeoPlace *targetPlace);
static QString processAdContentPaymentMethod(const QScriptValue &content);
static void processAdContentBusinessHours(const QScriptValue &content, QGeoPlace *targetPlace);
diff --git a/src/plugins/geoservices/nokia/places/qplacejsonmediaparser.cpp b/src/plugins/geoservices/nokia/places/qplacejsonmediaparser.cpp
index 7931ec4e..5b6b431f 100644
--- a/src/plugins/geoservices/nokia/places/qplacejsonmediaparser.cpp
+++ b/src/plugins/geoservices/nokia/places/qplacejsonmediaparser.cpp
@@ -53,7 +53,6 @@
#include <QtScript/QScriptValue>
#include <QtScript/QScriptValueIterator>
-#include <qplacemediaobject.h>
#include <qplacesupplier.h>
#include "qplacesuppliersrepository.h"
@@ -82,7 +81,7 @@ QPlaceJSonMediaParser::~QPlaceJSonMediaParser()
{
}
-QList<QPlaceMediaObject> QPlaceJSonMediaParser::resultMedia()
+QList<QPlaceImage> QPlaceJSonMediaParser::resultMedia()
{
return media;
}
@@ -92,9 +91,9 @@ int QPlaceJSonMediaParser::allMediaCount()
return allMedia;
}
-QPlaceMediaObject QPlaceJSonMediaParser::buildMediaObject(const QScriptValue &media)
+QPlaceImage QPlaceJSonMediaParser::buildMediaObject(const QScriptValue &media)
{
- QPlaceMediaObject newMedia;
+ QPlaceImage newMedia;
QScriptValue value = media.property(media_url);
if (value.isValid() && !value.toString().isEmpty()) {
newMedia.setUrl(QUrl::fromEncoded(value.toString().toAscii()));
diff --git a/src/plugins/geoservices/nokia/places/qplacejsonmediaparser.h b/src/plugins/geoservices/nokia/places/qplacejsonmediaparser.h
index 28265994..1fca950d 100644
--- a/src/plugins/geoservices/nokia/places/qplacejsonmediaparser.h
+++ b/src/plugins/geoservices/nokia/places/qplacejsonmediaparser.h
@@ -52,7 +52,7 @@
#include <QObject>
#include <QList>
-#include <qplacemediaobject.h>
+#include <qplaceimage.h>
#include "qplacejsonparser_p.h"
class QScriptEngine;
@@ -67,16 +67,16 @@ public:
explicit QPlaceJSonMediaParser(QObject *parent = 0);
virtual ~QPlaceJSonMediaParser();
- QList<QPlaceMediaObject> resultMedia();
+ QList<QPlaceImage> resultMedia();
int allMediaCount();
- static QPlaceMediaObject buildMediaObject(const QScriptValue &place);
+ static QPlaceImage buildMediaObject(const QScriptValue &place);
private:
void processJSonData(const QScriptValue &sv);
void processMedia(const QScriptValue &contacts);
private:
- QList<QPlaceMediaObject> media;
+ QList<QPlaceImage> media;
int allMedia;
};
diff --git a/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.cpp b/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.cpp
index aa112771..5ebe7b0c 100644
--- a/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.cpp
+++ b/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.cpp
@@ -52,7 +52,7 @@
#include "places/qplacetextpredictionreplyimpl.h"
#include "places/qplacesearchreplyimpl.h"
#include "places/qplacereviewreplyimpl.h"
-#include "places/qplacemediareplyimpl.h"
+#include "places/qplaceimagereplyimpl.h"
#include "places/qplacerecommendationreplyimpl.h"
#include "places/qplacedetailsreplyimpl.h"
#include "places/qplaceratingreplyimpl.h"
@@ -108,20 +108,34 @@ QPlaceDetailsReply *QPlaceManagerEngineNokia::getPlaceDetails(const QString &pla
return reply;
}
-QPlaceMediaReply *QPlaceManagerEngineNokia::getMedia(const QGeoPlace &place, const QPlaceRequest &query)
+QPlaceContentReply *QPlaceManagerEngineNokia::getContent(QPlaceContent::Type type, const QGeoPlace &place, const QPlaceRequest &query)
{
- QPlaceMediaReplyImpl *reply = NULL;
- QPlaceRestReply *restReply = QPlaceRestManager::instance()->sendPlaceImagesRequest(place.placeId(),
- query);
- if (restReply) {
- reply = new QPlaceMediaReplyImpl(restReply, this);
- reply->setStartNumber(query.offset());
+ QPlaceImageReplyImpl *reply = 0;
+ if (type == QPlaceContent::ImageType) {
+ QPlaceImageReplyImpl *reply = NULL;
+ QPlaceRestReply *restReply = QPlaceRestManager::instance()->sendPlaceImagesRequest(place.placeId(),
+ query);
+ if (restReply) {
+ reply = new QPlaceImageReplyImpl(restReply, this);
+ reply->setStartNumber(query.offset());
+ connect(reply, SIGNAL(processingError(QPlaceReply*,QPlaceReply::Error,QString)),
+ this, SLOT(processingError(QPlaceReply*,QPlaceReply::Error,QString)));
+ connect(reply, SIGNAL(processingFinished(QPlaceReply*)),
+ this, SLOT(processingFinished(QPlaceReply*)));
+ }
+ return reply;
+ } else {
+ reply = new QPlaceImageReplyImpl(0, 0);
connect(reply, SIGNAL(processingError(QPlaceReply*,QPlaceReply::Error,QString)),
this, SLOT(processingError(QPlaceReply*,QPlaceReply::Error,QString)));
connect(reply, SIGNAL(processingFinished(QPlaceReply*)),
this, SLOT(processingFinished(QPlaceReply*)));
+
+ QMetaObject::invokeMethod(reply, "restError", Qt::QueuedConnection,
+ Q_ARG(QPlaceReply::Error, QPlaceReply::UnsupportedError),
+ Q_ARG(QString, QString("Retrieval of given content type not supported")));
+ return reply;
}
- return reply;
}
QPlaceReply *QPlaceManagerEngineNokia::postRating(const QString &placeId, qreal value)
diff --git a/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.h b/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.h
index 520e4064..a9038ae8 100644
--- a/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.h
+++ b/src/plugins/geoservices/nokia/qplacemanagerengine_nokia.h
@@ -66,7 +66,7 @@ public:
QPlaceDetailsReply *getPlaceDetails(const QString &placeId);
- QPlaceMediaReply *getMedia(const QGeoPlace &place, const QPlaceRequest &query);
+ QPlaceContentReply *getContent(QPlaceContent::Type contentType, const QGeoPlace &place, const QPlaceRequest &request);
QPlaceReply *postRating(const QString &placeId, qreal value);
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 616cbfad..070b92e8 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -19,7 +19,7 @@ SUBDIRS += geotestplugin \
qplacecategory \
qplacedescription \
qplacemanager \
- qplacemediaobject \
+ qplaceimage \
qplacerequest \
qplacerating \
qplacereview \
diff --git a/tests/auto/geotestplugin/qplacemanagerengine_test.h b/tests/auto/geotestplugin/qplacemanagerengine_test.h
index f0683c73..01973fa2 100644
--- a/tests/auto/geotestplugin/qplacemanagerengine_test.h
+++ b/tests/auto/geotestplugin/qplacemanagerengine_test.h
@@ -77,8 +77,9 @@ public:
return 0;
}
- QPlaceMediaReply *getMedia(const QGeoPlace &place, const QPlaceRequest &query)
+ QPlaceContentReply *getContent(QPlaceContent::Type type, const QGeoPlace &place, const QPlaceRequest &query)
{
+ Q_UNUSED(type)
Q_UNUSED(place)
Q_UNUSED(query)
diff --git a/tests/auto/qgeoplace/tst_qgeoplace.cpp b/tests/auto/qgeoplace/tst_qgeoplace.cpp
index 8099c8c9..a8f9ffd5 100644
--- a/tests/auto/qgeoplace/tst_qgeoplace.cpp
+++ b/tests/auto/qgeoplace/tst_qgeoplace.cpp
@@ -2,7 +2,7 @@
#include <QtTest/QtTest>
#include <qgeoplace.h>
-#include <qplacemediaobject.h>
+#include <qplaceimage.h>
#include <qplaceattribute.h>
QT_USE_NAMESPACE
@@ -24,8 +24,8 @@ private Q_SLOTS:
void ratingTest();
void suppliersTest();
void feedsTest();
- void mediaTest();
- void mediaCountTest();
+ void contentTest();
+ void contentCountTest();
void nameTest();
void placeIdTest();
void reviewsTest();
@@ -99,14 +99,15 @@ void tst_QGeoPlace::shortDescriptionTest()
QVERIFY2(testObj.shortDescription() == "testText", "Wrong value returned");
}
-void tst_QGeoPlace::mediaCountTest()
+void tst_QGeoPlace::contentCountTest()
{
QGeoPlace testObj;
- QVERIFY2(testObj.mediaCount(QPlaceMediaObject::Image) == 0, "Wrong default value");
- QVERIFY2(testObj.mediaCount("Video") == 0, "Wrong default value");
- testObj.setMediaCount(QPlaceMediaObject::Image, 50);
- QVERIFY2(testObj.mediaCount(QPlaceMediaObject::Image) == 50, "Wrong value returned");
- QVERIFY2(testObj.mediaCount("Video") == 0, "Wrong value returned");
+ QVERIFY2(testObj.contentCount(QPlaceContent::ImageType) == 0, "Wrong default value");
+ testObj.setContentCount(QPlaceContent::ImageType, 50);
+ QVERIFY2(testObj.contentCount(QPlaceContent::ImageType) == 50, "Wrong value returned");
+
+ testObj.setContentCount(QPlaceContent::ImageType,0);
+ QVERIFY2(testObj.contentCount(QPlaceContent::ImageType) == 0, "Wrong value returned");
}
void tst_QGeoPlace::reviewCountTest()
@@ -161,63 +162,56 @@ void tst_QGeoPlace::detailsFetchedTest()
QVERIFY2(testPlace.detailsFetched() == false, "Wrong value returned");
}
-void tst_QGeoPlace::mediaTest()
+void tst_QGeoPlace::contentTest()
{
QUrl thumbnailUrl("testId");
- QUrl mediaUrl("testName2");
QGeoPlace place;
- QVERIFY2(place.media(QPlaceMediaObject::Image).count() ==0,"Wrong default value");
- QVERIFY2(place.media(QPlaceMediaObject::Image).count() ==0,"Wrong default value");
- QVERIFY2(place.media("Video").count() ==0,"Wrong default value");
-
+ QVERIFY2(place.content(QPlaceContent::ImageType).count() ==0,"Wrong default value");
- QPlaceMediaObject dummyImage;
+ QPlaceImage dummyImage;
dummyImage.setUrl(QUrl("www.dummy.one"));
- QPlaceMediaObject dummyImage2;
+ QPlaceImage dummyImage2;
dummyImage2.setUrl(QUrl("www.dummy.two"));
- QPlaceMediaObject dummyImage3;
+ QPlaceImage dummyImage3;
dummyImage3.setUrl(QUrl("www.dummy.three"));
- PlaceMediaCollection imageCollection;
+ QPlaceContent::Collection imageCollection;
imageCollection.insert(0,dummyImage);
imageCollection.insert(1, dummyImage2);
imageCollection.insert(2, dummyImage3);
- place.setMedia(QPlaceMediaObject::Image, imageCollection);
- PlaceMediaCollection retrievedCollection = place.media(QPlaceMediaObject::Image);
+ place.setContent(QPlaceContent::ImageType, imageCollection);
+ QPlaceContent::Collection retrievedCollection = place.content(QPlaceContent::ImageType);
QCOMPARE(retrievedCollection.count(), 3);
- QCOMPARE(retrievedCollection.value(0), dummyImage);
- QCOMPARE(retrievedCollection.value(1), dummyImage2);
- QCOMPARE(retrievedCollection.value(2), dummyImage3);
- QCOMPARE(place.media("Video").count(), 0);
-
+ QCOMPARE(QPlaceImage(retrievedCollection.value(0)), dummyImage);
+ QCOMPARE(QPlaceImage(retrievedCollection.value(1)), dummyImage2);
+ QCOMPARE(QPlaceImage(retrievedCollection.value(2)), dummyImage3);
//replace the second and insert a sixth image
//indexes 4 and 5 are "missing"
- QPlaceMediaObject dummyImage2New;
+ QPlaceImage dummyImage2New;
dummyImage2.setUrl(QUrl("www.dummy.two.new"));
- QPlaceMediaObject dummyImage6;
+ QPlaceImage dummyImage6;
dummyImage6.setUrl(QUrl("www.dummy.six"));
imageCollection.clear();
imageCollection.insert(1, dummyImage2New);
imageCollection.insert(5, dummyImage6);
- place.addMedia(QPlaceMediaObject::Image, imageCollection);
+ place.addContent(QPlaceContent::ImageType, imageCollection);
- retrievedCollection = place.media(QPlaceMediaObject::Image);
+ retrievedCollection = place.content(QPlaceContent::ImageType);
QCOMPARE(retrievedCollection.count(), 4);
- QCOMPARE(retrievedCollection.value(0), dummyImage);
- QCOMPARE(retrievedCollection.value(1), dummyImage2New);
- QCOMPARE(retrievedCollection.value(2), dummyImage3);
- QCOMPARE(retrievedCollection.value(3), QPlaceMediaObject());
- QCOMPARE(retrievedCollection.value(4), QPlaceMediaObject());
- QCOMPARE(retrievedCollection.value(5), dummyImage6);
- QCOMPARE(place.media("Video").count(), 0);
+ 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);
}
void tst_QGeoPlace::reviewsTest()
diff --git a/tests/auto/qplaceimage/qplaceimage.pro b/tests/auto/qplaceimage/qplaceimage.pro
new file mode 100644
index 00000000..b6a2805a
--- /dev/null
+++ b/tests/auto/qplaceimage/qplaceimage.pro
@@ -0,0 +1,7 @@
+TEMPLATE = app
+CONFIG += testcase
+TARGET = tst_qplaceimage
+
+SOURCES += tst_qplaceimage.cpp
+
+QT += location testlib
diff --git a/tests/auto/qplacemediaobject/tst_qplacemediaobject.cpp b/tests/auto/qplaceimage/tst_qplaceimage.cpp
index d0e392dd..ddeea2b5 100644
--- a/tests/auto/qplacemediaobject/tst_qplacemediaobject.cpp
+++ b/tests/auto/qplaceimage/tst_qplaceimage.cpp
@@ -1,16 +1,16 @@
#include <QtCore/QString>
#include <QtTest/QtTest>
-#include <qplacemediaobject.h>
+#include <qplaceimage.h>
QT_USE_NAMESPACE
-class tst_QPlaceMediaObject : public QObject
+class tst_QPlaceImage : public QObject
{
Q_OBJECT
public:
- tst_QPlaceMediaObject();
+ tst_QPlaceImage();
private Q_SLOTS:
void constructorTest();
@@ -23,23 +23,23 @@ private Q_SLOTS:
void operatorsTest();
};
-tst_QPlaceMediaObject::tst_QPlaceMediaObject()
+tst_QPlaceImage::tst_QPlaceImage()
{
}
-void tst_QPlaceMediaObject::constructorTest()
+void tst_QPlaceImage::constructorTest()
{
- QPlaceMediaObject testObj;
+ QPlaceImage testObj;
testObj.setId("testId");
- QPlaceMediaObject *testObjPtr = new QPlaceMediaObject(testObj);
+ QPlaceImage *testObjPtr = new QPlaceImage(testObj);
QVERIFY2(testObjPtr != NULL, "Copy constructor - null");
QVERIFY2(*testObjPtr == testObj, "Copy constructor - compare");
delete testObjPtr;
}
-void tst_QPlaceMediaObject::supplierTest()
+void tst_QPlaceImage::supplierTest()
{
- QPlaceMediaObject testObj;
+ QPlaceImage testObj;
QVERIFY2(testObj.supplier().supplierId() == QString(), "Wrong default value");
QPlaceSupplier sup;
sup.setName("testName1");
@@ -48,61 +48,61 @@ void tst_QPlaceMediaObject::supplierTest()
QVERIFY2(testObj.supplier() == sup, "Wrong value returned");
}
-void tst_QPlaceMediaObject::urlTest()
+void tst_QPlaceImage::urlTest()
{
- QUrl mediaUrl("testText");
+ QUrl imageUrl("testText");
- QPlaceMediaObject testObj;
+ QPlaceImage testObj;
QVERIFY2(testObj.url() == QString(), "Wrong default value");
- testObj.setUrl(mediaUrl);
- QVERIFY2(testObj.url() == mediaUrl, "Wrong value returned");
+ testObj.setUrl(imageUrl);
+ QVERIFY2(testObj.url() == imageUrl, "Wrong value returned");
}
-void tst_QPlaceMediaObject::thumbnailUrlTest()
+void tst_QPlaceImage::thumbnailUrlTest()
{
QUrl thumbnailUrl("testText");
- QPlaceMediaObject testObj;
+ QPlaceImage testObj;
QVERIFY2(testObj.thumbnailUrl() == QString(), "Wrong default value");
testObj.setThumbnailUrl(thumbnailUrl);
QVERIFY2(testObj.thumbnailUrl() == thumbnailUrl, "Wrong value returned");
}
-void tst_QPlaceMediaObject::idTest()
+void tst_QPlaceImage::idTest()
{
- QPlaceMediaObject testObj;
+ QPlaceImage testObj;
QVERIFY2(testObj.id() == QString(), "Wrong default value");
testObj.setId("testText");
QVERIFY2(testObj.id() == "testText", "Wrong value returned");
}
-void tst_QPlaceMediaObject::metaInfoTest()
+void tst_QPlaceImage::metaInfoTest()
{
- QPlaceMediaObject testObj;
+ QPlaceImage testObj;
QVERIFY2(testObj.metaInfo() == QString(), "Wrong default value");
testObj.setMetaInfo("testText");
QVERIFY2(testObj.metaInfo() == "testText", "Wrong value returned");
}
-void tst_QPlaceMediaObject::mimeTypeTest()
+void tst_QPlaceImage::mimeTypeTest()
{
- QPlaceMediaObject testObj;
+ QPlaceImage testObj;
QVERIFY2(testObj.mimeType() == QString(), "Wrong default value");
testObj.setMimeType("testText");
QVERIFY2(testObj.mimeType() == "testText", "Wrong value returned");
}
-void tst_QPlaceMediaObject::operatorsTest()
+void tst_QPlaceImage::operatorsTest()
{
- QPlaceMediaObject testObj;
+ QPlaceImage testObj;
testObj.setMimeType("testValue");
- QPlaceMediaObject testObj2;
+ QPlaceImage testObj2;
testObj2 = testObj;
QVERIFY2(testObj == testObj2, "Not copied correctly");
testObj2.setId("testValue2");
QVERIFY2(testObj != testObj2, "Object should be different");
}
-QTEST_APPLESS_MAIN(tst_QPlaceMediaObject);
+QTEST_APPLESS_MAIN(tst_QPlaceImage);
-#include "tst_qplacemediaobject.moc"
+#include "tst_qplaceimage.moc"
diff --git a/tests/auto/qplacemediaobject/qplacemediaobject.pro b/tests/auto/qplacemediaobject/qplacemediaobject.pro
deleted file mode 100644
index f73639cd..00000000
--- a/tests/auto/qplacemediaobject/qplacemediaobject.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = app
-CONFIG += testcase
-TARGET = tst_qplacemediaobject
-
-SOURCES += tst_qplacemediaobject.cpp
-
-QT += location testlib