summaryrefslogtreecommitdiff
path: root/src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2011-08-25 10:14:53 +1000
committerAaron McCarthy <aaron.mccarthy@nokia.com>2011-08-25 03:41:33 +0200
commit6c6643b73a451f30f4e7e565110c1f5cd93c7495 (patch)
tree287f39956b46c03f3b993796e86539aa26fa54e9 /src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h
parent76a04c0b7b4ef12e1887990c14871aaa09c641a4 (diff)
downloadqtlocation-6c6643b73a451f30f4e7e565110c1f5cd93c7495.tar.gz
Add a common base class for content models.
Removes duplicate code in review and image models. Change-Id: I0f2657e5da79455153b53d53f22092c7079705ee Reviewed-on: http://codereview.qt.nokia.com/3535 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: abcd <qt_abcd1@ovi.com> Reviewed-by: Aaron McCarthy <aaron.mccarthy@nokia.com>
Diffstat (limited to 'src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h')
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h92
1 files changed, 45 insertions, 47 deletions
diff --git a/src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h b/src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h
index db2fd01c..548aa318 100644
--- a/src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h
@@ -1,42 +1,64 @@
+/****************************************************************************
+**
+** 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 QDECLARATIVEPLACEIMAGEMODEL_P_H
#define QDECLARATIVEPLACEIMAGEMODEL_P_H
-#include <QtCore/QObject>
-#include <QtCore/QAbstractListModel>
-#include <QtDeclarative/QDeclarativeParserStatus>
-#include <QtLocation/QPlaceManager>
-#include <QtLocation/QPlaceImage>
+#include "qdeclarativeplacecontentmodel.h"
QT_BEGIN_NAMESPACE
-class QDeclarativePlace;
-class QDeclarativeGeoServiceProvider;
-class QGeoServiceProvider;
class QDeclarativeSupplier;
-class QDeclarativePlaceImageModel : public QAbstractListModel, public QDeclarativeParserStatus
+class QDeclarativePlaceImageModel : public QDeclarativePlaceContentModel
{
Q_OBJECT
- Q_INTERFACES(QDeclarativeParserStatus)
-
- Q_PROPERTY(QDeclarativePlace *place READ place WRITE setPlace NOTIFY placeChanged)
- Q_PROPERTY(int batchSize READ batchSize WRITE setBatchSize NOTIFY batchSizeChanged)
- Q_PROPERTY(int totalCount READ totalCount NOTIFY totalCountChanged)
-
public:
explicit QDeclarativePlaceImageModel(QObject* parent = 0);
~QDeclarativePlaceImageModel();
- QDeclarativePlace *place() const;
- void setPlace(QDeclarativePlace *place);
+ void clearData();
+ void processContent(const QPlaceContent &content, int index);
- int batchSize() const;
- void setBatchSize(int batchSize);
-
- int totalCount() const;
-
- int rowCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
enum Roles {
UrlRole = Qt::UserRole,
@@ -47,32 +69,8 @@ public:
SupplierRole
};
- bool canFetchMore(const QModelIndex &parent) const;
- void fetchMore(const QModelIndex &parent);
-
- void clear();
-
- void classBegin();
- void componentComplete();
-
-signals:
- void placeChanged();
- void batchSizeChanged();
- void totalCountChanged();
-
-private slots:
- void fetchFinished();
-
private:
- QDeclarativePlace *m_place;
- int m_batchSize;
- int m_imageCount;
- QMap<int, QPlaceImage> m_images;
QMap<QString, QDeclarativeSupplier *> m_suppliers;
-
- QPlaceContentReply *m_reply;
-
- bool m_complete;
};
QT_END_NAMESPACE