aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/xmllistmodel
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-02-16 14:43:03 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-24 04:51:31 +0100
commitb855240b782395f94315f43ea3e7e182299fac48 (patch)
treebc594c04449be8cd14cd0ab0bb72dafc2be0ffb2 /src/imports/xmllistmodel
parent6a42a6e0a9a1abdda0d07a5a20b4ac7e45348684 (diff)
Rename QDeclarative symbols to QQuick and QQml
Symbols beginning with QDeclarative are already exported by the quick1 module. Users can apply the bin/rename-qtdeclarative-symbols.sh script to modify client code using the previous names of the renamed symbols. Task-number: QTBUG-23737 Change-Id: Ifaa482663767634931e8711a8e9bf6e404859e66 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/imports/xmllistmodel')
-rw-r--r--src/imports/xmllistmodel/plugin.cpp14
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel.cpp (renamed from src/imports/xmllistmodel/qdeclarativexmllistmodel.cpp)276
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel_p.h (renamed from src/imports/xmllistmodel/qdeclarativexmllistmodel_p.h)52
-rw-r--r--src/imports/xmllistmodel/xmllistmodel.pro8
4 files changed, 175 insertions, 175 deletions
diff --git a/src/imports/xmllistmodel/plugin.cpp b/src/imports/xmllistmodel/plugin.cpp
index 9085a60885..54a6d5e212 100644
--- a/src/imports/xmllistmodel/plugin.cpp
+++ b/src/imports/xmllistmodel/plugin.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
+** This file is part of the QtQml module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@@ -39,22 +39,22 @@
**
****************************************************************************/
-#include <QtDeclarative/qdeclarativeextensionplugin.h>
-#include <QtDeclarative/qdeclarative.h>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
-#include "qdeclarativexmllistmodel_p.h"
+#include "qqmlxmllistmodel_p.h"
QT_BEGIN_NAMESPACE
-class QmlXmlListModelPlugin : public QDeclarativeExtensionPlugin
+class QmlXmlListModelPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
public:
virtual void registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.XmlListModel"));
- qmlRegisterType<QDeclarativeXmlListModel>(uri,2,0,"XmlListModel");
- qmlRegisterType<QDeclarativeXmlListModelRole>(uri,2,0,"XmlRole");
+ qmlRegisterType<QQuickXmlListModel>(uri,2,0,"XmlListModel");
+ qmlRegisterType<QQuickXmlListModelRole>(uri,2,0,"XmlRole");
}
};
diff --git a/src/imports/xmllistmodel/qdeclarativexmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
index db7fec2c97..1377859b5e 100644
--- a/src/imports/xmllistmodel/qdeclarativexmllistmodel.cpp
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
+** This file is part of the QtQml module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#include "qdeclarativexmllistmodel_p.h"
+#include "qqmlxmllistmodel_p.h"
-#include <qdeclarativecontext.h>
-#include <private/qdeclarativeengine_p.h>
+#include <qqmlcontext.h>
+#include <private/qqmlengine_p.h>
#include <QDebug>
#include <QStringList>
@@ -59,22 +59,22 @@
#include <private/qobject_p.h>
-Q_DECLARE_METATYPE(QDeclarativeXmlQueryResult)
+Q_DECLARE_METATYPE(QQuickXmlQueryResult)
QT_BEGIN_NAMESPACE
-typedef QPair<int, int> QDeclarativeXmlListRange;
+typedef QPair<int, int> QQuickXmlListRange;
#define XMLLISTMODEL_CLEAR_ID 0
/*!
- \qmlclass XmlRole QDeclarativeXmlListModelRole
+ \qmlclass XmlRole QQuickXmlListModelRole
\inqmlmodule QtQuick 2
\ingroup qml-working-with-data
\brief The XmlRole element allows you to specify a role for an XmlListModel.
- \sa {QtDeclarative}
+ \sa {QtQml}
*/
/*!
@@ -111,12 +111,12 @@ typedef QPair<int, int> QDeclarativeXmlListRange;
For example, if there is an XML document like this:
- \quotefile doc/src/snippets/declarative/xmlrole.xml
+ \quotefile doc/src/snippets/qml/xmlrole.xml
Here are some valid XPath expressions for XmlRole queries on this document:
- \snippet doc/src/snippets/declarative/xmlrole.qml 0
+ \snippet doc/src/snippets/qml/xmlrole.qml 0
\dots 4
- \snippet doc/src/snippets/declarative/xmlrole.qml 1
+ \snippet doc/src/snippets/qml/xmlrole.qml 1
See the \l{http://www.w3.org/TR/xpath20/}{W3C XPath 2.0 specification} for more information.
*/
@@ -145,37 +145,37 @@ struct XmlQueryJob
};
-class QDeclarativeXmlQueryEngine;
-class QDeclarativeXmlQueryThreadObject : public QObject
+class QQuickXmlQueryEngine;
+class QQuickXmlQueryThreadObject : public QObject
{
Q_OBJECT
public:
- QDeclarativeXmlQueryThreadObject(QDeclarativeXmlQueryEngine *);
+ QQuickXmlQueryThreadObject(QQuickXmlQueryEngine *);
void processJobs();
virtual bool event(QEvent *e);
private:
- QDeclarativeXmlQueryEngine *m_queryEngine;
+ QQuickXmlQueryEngine *m_queryEngine;
};
-class QDeclarativeXmlQueryEngine : public QThread
+class QQuickXmlQueryEngine : public QThread
{
Q_OBJECT
public:
- QDeclarativeXmlQueryEngine(QDeclarativeEngine *eng);
- ~QDeclarativeXmlQueryEngine();
+ QQuickXmlQueryEngine(QQmlEngine *eng);
+ ~QQuickXmlQueryEngine();
- int doQuery(QString query, QString namespaces, QByteArray data, QList<QDeclarativeXmlListModelRole *>* roleObjects, QStringList keyRoleResultsCache);
+ int doQuery(QString query, QString namespaces, QByteArray data, QList<QQuickXmlListModelRole *>* roleObjects, QStringList keyRoleResultsCache);
void abort(int id);
void processJobs();
- static QDeclarativeXmlQueryEngine *instance(QDeclarativeEngine *engine);
+ static QQuickXmlQueryEngine *instance(QQmlEngine *engine);
signals:
- void queryCompleted(const QDeclarativeXmlQueryResult &);
+ void queryCompleted(const QQuickXmlQueryResult &);
void error(void*, const QString&);
protected:
@@ -183,38 +183,38 @@ protected:
private:
void processQuery(XmlQueryJob *job);
- void doQueryJob(XmlQueryJob *job, QDeclarativeXmlQueryResult *currentResult);
- void doSubQueryJob(XmlQueryJob *job, QDeclarativeXmlQueryResult *currentResult);
+ void doQueryJob(XmlQueryJob *job, QQuickXmlQueryResult *currentResult);
+ void doSubQueryJob(XmlQueryJob *job, QQuickXmlQueryResult *currentResult);
void getValuesOfKeyRoles(const XmlQueryJob& currentJob, QStringList *values, QXmlQuery *query) const;
- void addIndexToRangeList(QList<QDeclarativeXmlListRange> *ranges, int index) const;
+ void addIndexToRangeList(QList<QQuickXmlListRange> *ranges, int index) const;
QMutex m_mutex;
- QDeclarativeXmlQueryThreadObject *m_threadObject;
+ QQuickXmlQueryThreadObject *m_threadObject;
QList<XmlQueryJob> m_jobs;
QSet<int> m_cancelledJobs;
QAtomicInt m_queryIds;
- QDeclarativeEngine *m_engine;
+ QQmlEngine *m_engine;
QObject *m_eventLoopQuitHack;
- static QHash<QDeclarativeEngine *,QDeclarativeXmlQueryEngine*> queryEngines;
+ static QHash<QQmlEngine *,QQuickXmlQueryEngine*> queryEngines;
static QMutex queryEnginesMutex;
};
-QHash<QDeclarativeEngine *,QDeclarativeXmlQueryEngine*> QDeclarativeXmlQueryEngine::queryEngines;
-QMutex QDeclarativeXmlQueryEngine::queryEnginesMutex;
+QHash<QQmlEngine *,QQuickXmlQueryEngine*> QQuickXmlQueryEngine::queryEngines;
+QMutex QQuickXmlQueryEngine::queryEnginesMutex;
-QDeclarativeXmlQueryThreadObject::QDeclarativeXmlQueryThreadObject(QDeclarativeXmlQueryEngine *e)
+QQuickXmlQueryThreadObject::QQuickXmlQueryThreadObject(QQuickXmlQueryEngine *e)
: m_queryEngine(e)
{
}
-void QDeclarativeXmlQueryThreadObject::processJobs()
+void QQuickXmlQueryThreadObject::processJobs()
{
QCoreApplication::postEvent(this, new QEvent(QEvent::User));
}
-bool QDeclarativeXmlQueryThreadObject::event(QEvent *e)
+bool QQuickXmlQueryThreadObject::event(QEvent *e)
{
if (e->type() == QEvent::User) {
m_queryEngine->processJobs();
@@ -226,10 +226,10 @@ bool QDeclarativeXmlQueryThreadObject::event(QEvent *e)
-QDeclarativeXmlQueryEngine::QDeclarativeXmlQueryEngine(QDeclarativeEngine *eng)
+QQuickXmlQueryEngine::QQuickXmlQueryEngine(QQmlEngine *eng)
: QThread(eng), m_threadObject(0), m_queryIds(XMLLISTMODEL_CLEAR_ID + 1), m_engine(eng), m_eventLoopQuitHack(0)
{
- qRegisterMetaType<QDeclarativeXmlQueryResult>("QDeclarativeXmlQueryResult");
+ qRegisterMetaType<QQuickXmlQueryResult>("QQuickXmlQueryResult");
m_eventLoopQuitHack = new QObject;
m_eventLoopQuitHack->moveToThread(this);
@@ -237,7 +237,7 @@ QDeclarativeXmlQueryEngine::QDeclarativeXmlQueryEngine(QDeclarativeEngine *eng)
start(QThread::IdlePriority);
}
-QDeclarativeXmlQueryEngine::~QDeclarativeXmlQueryEngine()
+QQuickXmlQueryEngine::~QQuickXmlQueryEngine()
{
queryEnginesMutex.lock();
queryEngines.remove(m_engine);
@@ -247,7 +247,7 @@ QDeclarativeXmlQueryEngine::~QDeclarativeXmlQueryEngine()
wait();
}
-int QDeclarativeXmlQueryEngine::doQuery(QString query, QString namespaces, QByteArray data, QList<QDeclarativeXmlListModelRole *>* roleObjects, QStringList keyRoleResultsCache) {
+int QQuickXmlQueryEngine::doQuery(QString query, QString namespaces, QByteArray data, QList<QQuickXmlListModelRole *>* roleObjects, QStringList keyRoleResultsCache) {
{
QMutexLocker m1(&m_mutex);
m_queryIds.ref();
@@ -283,17 +283,17 @@ int QDeclarativeXmlQueryEngine::doQuery(QString query, QString namespaces, QByte
return job.queryId;
}
-void QDeclarativeXmlQueryEngine::abort(int id)
+void QQuickXmlQueryEngine::abort(int id)
{
QMutexLocker ml(&m_mutex);
if (id != -1)
m_cancelledJobs.insert(id);
}
-void QDeclarativeXmlQueryEngine::run()
+void QQuickXmlQueryEngine::run()
{
m_mutex.lock();
- m_threadObject = new QDeclarativeXmlQueryThreadObject(this);
+ m_threadObject = new QQuickXmlQueryThreadObject(this);
m_mutex.unlock();
processJobs();
@@ -303,7 +303,7 @@ void QDeclarativeXmlQueryEngine::run()
m_threadObject = 0;
}
-void QDeclarativeXmlQueryEngine::processJobs()
+void QQuickXmlQueryEngine::processJobs()
{
QMutexLocker locker(&m_mutex);
@@ -324,12 +324,12 @@ void QDeclarativeXmlQueryEngine::processJobs()
}
}
-QDeclarativeXmlQueryEngine *QDeclarativeXmlQueryEngine::instance(QDeclarativeEngine *engine)
+QQuickXmlQueryEngine *QQuickXmlQueryEngine::instance(QQmlEngine *engine)
{
queryEnginesMutex.lock();
- QDeclarativeXmlQueryEngine *queryEng = queryEngines.value(engine);
+ QQuickXmlQueryEngine *queryEng = queryEngines.value(engine);
if (!queryEng) {
- queryEng = new QDeclarativeXmlQueryEngine(engine);
+ queryEng = new QQuickXmlQueryEngine(engine);
queryEngines.insert(engine, queryEng);
}
queryEnginesMutex.unlock();
@@ -337,9 +337,9 @@ QDeclarativeXmlQueryEngine *QDeclarativeXmlQueryEngine::instance(QDeclarativeEng
return queryEng;
}
-void QDeclarativeXmlQueryEngine::processQuery(XmlQueryJob *job)
+void QQuickXmlQueryEngine::processQuery(XmlQueryJob *job)
{
- QDeclarativeXmlQueryResult result;
+ QQuickXmlQueryResult result;
result.queryId = job->queryId;
doQueryJob(job, &result);
doSubQueryJob(job, &result);
@@ -354,7 +354,7 @@ void QDeclarativeXmlQueryEngine::processQuery(XmlQueryJob *job)
}
}
-void QDeclarativeXmlQueryEngine::doQueryJob(XmlQueryJob *currentJob, QDeclarativeXmlQueryResult *currentResult)
+void QQuickXmlQueryEngine::doQueryJob(XmlQueryJob *currentJob, QQuickXmlQueryResult *currentResult)
{
Q_ASSERT(currentJob->queryId != -1);
@@ -393,7 +393,7 @@ void QDeclarativeXmlQueryEngine::doQueryJob(XmlQueryJob *currentJob, QDeclarativ
currentResult->size = (count > 0 ? count : 0);
}
-void QDeclarativeXmlQueryEngine::getValuesOfKeyRoles(const XmlQueryJob& currentJob, QStringList *values, QXmlQuery *query) const
+void QQuickXmlQueryEngine::getValuesOfKeyRoles(const XmlQueryJob& currentJob, QStringList *values, QXmlQuery *query) const
{
const QStringList &keysQueries = currentJob.keyRoleQueries;
QString keysQuery;
@@ -414,7 +414,7 @@ void QDeclarativeXmlQueryEngine::getValuesOfKeyRoles(const XmlQueryJob& currentJ
}
}
-void QDeclarativeXmlQueryEngine::addIndexToRangeList(QList<QDeclarativeXmlListRange> *ranges, int index) const {
+void QQuickXmlQueryEngine::addIndexToRangeList(QList<QQuickXmlListRange> *ranges, int index) const {
if (ranges->isEmpty())
ranges->append(qMakePair(index, 1));
else if (ranges->last().first + ranges->last().second == index)
@@ -423,7 +423,7 @@ void QDeclarativeXmlQueryEngine::addIndexToRangeList(QList<QDeclarativeXmlListRa
ranges->append(qMakePair(index, 1));
}
-void QDeclarativeXmlQueryEngine::doSubQueryJob(XmlQueryJob *currentJob, QDeclarativeXmlQueryResult *currentResult)
+void QQuickXmlQueryEngine::doSubQueryJob(XmlQueryJob *currentJob, QQuickXmlQueryResult *currentResult)
{
Q_ASSERT(currentJob->queryId != -1);
@@ -489,7 +489,7 @@ void QDeclarativeXmlQueryEngine::doSubQueryJob(XmlQueryJob *currentJob, QDeclara
/*for (int j = 0; j < m_size; ++j) {
QList<QVariant> resultList;
for (int i = 0; i < m_roleObjects->size(); ++i) {
- QDeclarativeXmlListModelRole *role = m_roleObjects->at(i);
+ QQuickXmlListModelRole *role = m_roleObjects->at(i);
subquery.setQuery(m_prefix.arg(j+1) + role->query());
if (role->isStringList()) {
QStringList data;
@@ -514,27 +514,27 @@ void QDeclarativeXmlQueryEngine::doSubQueryJob(XmlQueryJob *currentJob, QDeclara
}*/
}
-class QDeclarativeXmlListModelPrivate : public QObjectPrivate
+class QQuickXmlListModelPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QDeclarativeXmlListModel)
+ Q_DECLARE_PUBLIC(QQuickXmlListModel)
public:
- QDeclarativeXmlListModelPrivate()
+ QQuickXmlListModelPrivate()
: isComponentComplete(true), size(-1), highestRole(Qt::UserRole)
- , reply(0), status(QDeclarativeXmlListModel::Null), progress(0.0)
+ , reply(0), status(QQuickXmlListModel::Null), progress(0.0)
, queryId(-1), roleObjects(), redirectCount(0) {}
void notifyQueryStarted(bool remoteSource) {
- Q_Q(QDeclarativeXmlListModel);
+ Q_Q(QQuickXmlListModel);
progress = remoteSource ? 0.0 : 1.0;
- status = QDeclarativeXmlListModel::Loading;
+ status = QQuickXmlListModel::Loading;
errorString.clear();
emit q->progressChanged(progress);
emit q->statusChanged(status);
}
void deleteReply() {
- Q_Q(QDeclarativeXmlListModel);
+ Q_Q(QQuickXmlListModel);
if (reply) {
QObject::disconnect(reply, 0, q, 0);
reply->deleteLater();
@@ -553,23 +553,23 @@ public:
int highestRole;
QNetworkReply *reply;
- QDeclarativeXmlListModel::Status status;
+ QQuickXmlListModel::Status status;
QString errorString;
qreal progress;
int queryId;
QStringList keyRoleResultsCache;
- QList<QDeclarativeXmlListModelRole *> roleObjects;
+ QList<QQuickXmlListModelRole *> roleObjects;
- static void append_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list, QDeclarativeXmlListModelRole *role);
- static void clear_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list);
+ static void append_role(QQmlListProperty<QQuickXmlListModelRole> *list, QQuickXmlListModelRole *role);
+ static void clear_role(QQmlListProperty<QQuickXmlListModelRole> *list);
QList<QList<QVariant> > data;
int redirectCount;
};
-void QDeclarativeXmlListModelPrivate::append_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list, QDeclarativeXmlListModelRole *role)
+void QQuickXmlListModelPrivate::append_role(QQmlListProperty<QQuickXmlListModelRole> *list, QQuickXmlListModelRole *role)
{
- QDeclarativeXmlListModel *_this = qobject_cast<QDeclarativeXmlListModel *>(list->object);
+ QQuickXmlListModel *_this = qobject_cast<QQuickXmlListModel *>(list->object);
if (_this && role) {
int i = _this->d_func()->roleObjects.count();
_this->d_func()->roleObjects.append(role);
@@ -585,16 +585,16 @@ void QDeclarativeXmlListModelPrivate::append_role(QDeclarativeListProperty<QDecl
//### clear needs to invalidate any cached data (in data table) as well
// (and the model should emit the appropriate signals)
-void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list)
+void QQuickXmlListModelPrivate::clear_role(QQmlListProperty<QQuickXmlListModelRole> *list)
{
- QDeclarativeXmlListModel *_this = static_cast<QDeclarativeXmlListModel *>(list->object);
+ QQuickXmlListModel *_this = static_cast<QQuickXmlListModel *>(list->object);
_this->d_func()->roles.clear();
_this->d_func()->roleNames.clear();
_this->d_func()->roleObjects.clear();
}
/*!
- \qmlclass XmlListModel QDeclarativeXmlListModel
+ \qmlclass XmlListModel QQuickXmlListModel
\inqmlmodule QtQuick 2
\ingroup qml-working-with-data
\brief The XmlListModel element is used to specify a read-only model using XPath expressions.
@@ -690,12 +690,12 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla
\sa {RSS News}
*/
-QDeclarativeXmlListModel::QDeclarativeXmlListModel(QObject *parent)
- : QListModelInterface(*(new QDeclarativeXmlListModelPrivate), parent)
+QQuickXmlListModel::QQuickXmlListModel(QObject *parent)
+ : QListModelInterface(*(new QQuickXmlListModelPrivate), parent)
{
}
-QDeclarativeXmlListModel::~QDeclarativeXmlListModel()
+QQuickXmlListModel::~QQuickXmlListModel()
{
}
@@ -704,18 +704,18 @@ QDeclarativeXmlListModel::~QDeclarativeXmlListModel()
The roles to make available for this model.
*/
-QDeclarativeListProperty<QDeclarativeXmlListModelRole> QDeclarativeXmlListModel::roleObjects()
+QQmlListProperty<QQuickXmlListModelRole> QQuickXmlListModel::roleObjects()
{
- Q_D(QDeclarativeXmlListModel);
- QDeclarativeListProperty<QDeclarativeXmlListModelRole> list(this, d->roleObjects);
- list.append = &QDeclarativeXmlListModelPrivate::append_role;
- list.clear = &QDeclarativeXmlListModelPrivate::clear_role;
+ Q_D(QQuickXmlListModel);
+ QQmlListProperty<QQuickXmlListModelRole> list(this, d->roleObjects);
+ list.append = &QQuickXmlListModelPrivate::append_role;
+ list.clear = &QQuickXmlListModelPrivate::clear_role;
return list;
}
-QHash<int,QVariant> QDeclarativeXmlListModel::data(int index, const QList<int> &roles) const
+QHash<int,QVariant> QQuickXmlListModel::data(int index, const QList<int> &roles) const
{
- Q_D(const QDeclarativeXmlListModel);
+ Q_D(const QQuickXmlListModel);
QHash<int, QVariant> rv;
for (int i = 0; i < roles.size(); ++i) {
int role = roles.at(i);
@@ -725,9 +725,9 @@ QHash<int,QVariant> QDeclarativeXmlListModel::data(int index, const QList<int> &
return rv;
}
-QVariant QDeclarativeXmlListModel::data(int index, int role) const
+QVariant QQuickXmlListModel::data(int index, int role) const
{
- Q_D(const QDeclarativeXmlListModel);
+ Q_D(const QQuickXmlListModel);
int roleIndex = d->roles.indexOf(role);
return (roleIndex == -1) ? QVariant() : d->data.value(roleIndex).value(index);
}
@@ -736,21 +736,21 @@ QVariant QDeclarativeXmlListModel::data(int index, int role) const
\qmlproperty int QtQuick2::XmlListModel::count
The number of data entries in the model.
*/
-int QDeclarativeXmlListModel::count() const
+int QQuickXmlListModel::count() const
{
- Q_D(const QDeclarativeXmlListModel);
+ Q_D(const QQuickXmlListModel);
return d->size;
}
-QList<int> QDeclarativeXmlListModel::roles() const
+QList<int> QQuickXmlListModel::roles() const
{
- Q_D(const QDeclarativeXmlListModel);
+ Q_D(const QQuickXmlListModel);
return d->roles;
}
-QString QDeclarativeXmlListModel::toString(int role) const
+QString QQuickXmlListModel::toString(int role) const
{
- Q_D(const QDeclarativeXmlListModel);
+ Q_D(const QQuickXmlListModel);
int index = d->roles.indexOf(role);
if (index == -1)
return QString();
@@ -763,15 +763,15 @@ QString QDeclarativeXmlListModel::toString(int role) const
If both \c source and \l xml are set, \l xml is used.
*/
-QUrl QDeclarativeXmlListModel::source() const
+QUrl QQuickXmlListModel::source() const
{
- Q_D(const QDeclarativeXmlListModel);
+ Q_D(const QQuickXmlListModel);
return d->src;
}
-void QDeclarativeXmlListModel::setSource(const QUrl &src)
+void QQuickXmlListModel::setSource(const QUrl &src)
{
- Q_D(QDeclarativeXmlListModel);
+ Q_D(QQuickXmlListModel);
if (d->src != src) {
d->src = src;
if (d->xml.isEmpty()) // src is only used if d->xml is not set
@@ -788,15 +788,15 @@ void QDeclarativeXmlListModel::setSource(const QUrl &src)
If both \l source and \c xml are set, \c xml is used.
*/
-QString QDeclarativeXmlListModel::xml() const
+QString QQuickXmlListModel::xml() const
{
- Q_D(const QDeclarativeXmlListModel);
+ Q_D(const QQuickXmlListModel);
return d->xml;
}
-void QDeclarativeXmlListModel::setXml(const QString &xml)
+void QQuickXmlListModel::setXml(const QString &xml)
{
- Q_D(QDeclarativeXmlListModel);
+ Q_D(QQuickXmlListModel);
if (d->xml != xml) {
d->xml = xml;
reload();
@@ -809,17 +809,17 @@ void QDeclarativeXmlListModel::setXml(const QString &xml)
An absolute XPath query representing the base query for creating model items
from this model's XmlRole objects. The query should start with '/' or '//'.
*/
-QString QDeclarativeXmlListModel::query() const
+QString QQuickXmlListModel::query() const
{
- Q_D(const QDeclarativeXmlListModel);
+ Q_D(const QQuickXmlListModel);
return d->query;
}
-void QDeclarativeXmlListModel::setQuery(const QString &query)
+void QQuickXmlListModel::setQuery(const QString &query)
{
- Q_D(QDeclarativeXmlListModel);
+ Q_D(QQuickXmlListModel);
if (!query.startsWith(QLatin1Char('/'))) {
- qmlInfo(this) << QCoreApplication::translate("QDeclarativeXmlRoleList", "An XmlListModel query must start with '/' or \"//\"");
+ qmlInfo(this) << QCoreApplication::translate("QQuickXmlRoleList", "An XmlListModel query must start with '/' or \"//\"");
return;
}
@@ -848,15 +848,15 @@ void QDeclarativeXmlListModel::setQuery(const QString &query)
}
\endqml
*/
-QString QDeclarativeXmlListModel::namespaceDeclarations() const
+QString QQuickXmlListModel::namespaceDeclarations() const
{
- Q_D(const QDeclarativeXmlListModel);
+ Q_D(const QQuickXmlListModel);
return d->namespaces;
}
-void QDeclarativeXmlListModel::setNamespaceDeclarations(const QString &declarations)
+void QQuickXmlListModel::setNamespaceDeclarations(const QString &declarations)
{
- Q_D(QDeclarativeXmlListModel);
+ Q_D(QQuickXmlListModel);
if (d->namespaces != declarations) {
d->namespaces = declarations;
reload();
@@ -886,22 +886,22 @@ void QDeclarativeXmlListModel::setNamespaceDeclarations(const QString &declarati
var title = model.get(0).title;
\endjs
*/
-QDeclarativeV8Handle QDeclarativeXmlListModel::get(int index) const
+QQmlV8Handle QQuickXmlListModel::get(int index) const
{
// Must be called with a context and handle scope
- Q_D(const QDeclarativeXmlListModel);
+ Q_D(const QQuickXmlListModel);
if (index < 0 || index >= count())
- return QDeclarativeV8Handle::fromHandle(v8::Undefined());
+ return QQmlV8Handle::fromHandle(v8::Undefined());
- QDeclarativeEngine *engine = qmlContext(this)->engine();
- QV8Engine *v8engine = QDeclarativeEnginePrivate::getV8Engine(engine);
+ QQmlEngine *engine = qmlContext(this)->engine();
+ QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine);
v8::Local<v8::Object> rv = v8::Object::New();
for (int ii = 0; ii < d->roleObjects.count(); ++ii)
rv->Set(v8engine->toString(d->roleObjects[ii]->name()),
v8engine->fromVariant(d->data.value(ii).value(index)));
- return QDeclarativeV8Handle::fromHandle(rv);
+ return QQmlV8Handle::fromHandle(rv);
}
/*!
@@ -919,9 +919,9 @@ QDeclarativeV8Handle QDeclarativeXmlListModel::get(int index) const
\sa progress
*/
-QDeclarativeXmlListModel::Status QDeclarativeXmlListModel::status() const
+QQuickXmlListModel::Status QQuickXmlListModel::status() const
{
- Q_D(const QDeclarativeXmlListModel);
+ Q_D(const QQuickXmlListModel);
return d->status;
}
@@ -940,9 +940,9 @@ QDeclarativeXmlListModel::Status QDeclarativeXmlListModel::status() const
\sa status, source
*/
-qreal QDeclarativeXmlListModel::progress() const
+qreal QQuickXmlListModel::progress() const
{
- Q_D(const QDeclarativeXmlListModel);
+ Q_D(const QQuickXmlListModel);
return d->progress;
}
@@ -952,27 +952,27 @@ qreal QDeclarativeXmlListModel::progress() const
Returns a string description of the last error that occurred
if \l status is XmlListModel::Error.
*/
-QString QDeclarativeXmlListModel::errorString() const
+QString QQuickXmlListModel::errorString() const
{
- Q_D(const QDeclarativeXmlListModel);
+ Q_D(const QQuickXmlListModel);
return d->errorString;
}
-void QDeclarativeXmlListModel::classBegin()
+void QQuickXmlListModel::classBegin()
{
- Q_D(QDeclarativeXmlListModel);
+ Q_D(QQuickXmlListModel);
d->isComponentComplete = false;
- QDeclarativeXmlQueryEngine *queryEngine = QDeclarativeXmlQueryEngine::instance(qmlEngine(this));
- connect(queryEngine, SIGNAL(queryCompleted(QDeclarativeXmlQueryResult)),
- SLOT(queryCompleted(QDeclarativeXmlQueryResult)));
+ QQuickXmlQueryEngine *queryEngine = QQuickXmlQueryEngine::instance(qmlEngine(this));
+ connect(queryEngine, SIGNAL(queryCompleted(QQuickXmlQueryResult)),
+ SLOT(queryCompleted(QQuickXmlQueryResult)));
connect(queryEngine, SIGNAL(error(void*,QString)),
SLOT(queryError(void*,QString)));
}
-void QDeclarativeXmlListModel::componentComplete()
+void QQuickXmlListModel::componentComplete()
{
- Q_D(QDeclarativeXmlListModel);
+ Q_D(QQuickXmlListModel);
d->isComponentComplete = true;
reload();
}
@@ -990,14 +990,14 @@ void QDeclarativeXmlListModel::componentComplete()
\sa {Using key XML roles}, XmlRole::isKey
*/
-void QDeclarativeXmlListModel::reload()
+void QQuickXmlListModel::reload()
{
- Q_D(QDeclarativeXmlListModel);
+ Q_D(QQuickXmlListModel);
if (!d->isComponentComplete)
return;
- QDeclarativeXmlQueryEngine::instance(qmlEngine(this))->abort(d->queryId);
+ QQuickXmlQueryEngine::instance(qmlEngine(this))->abort(d->queryId);
d->queryId = -1;
if (d->size < 0)
@@ -1009,7 +1009,7 @@ void QDeclarativeXmlListModel::reload()
}
if (!d->xml.isEmpty()) {
- d->queryId = QDeclarativeXmlQueryEngine::instance(qmlEngine(this))->doQuery(d->query, d->namespaces, d->xml.toUtf8(), &d->roleObjects, d->keyRoleResultsCache);
+ d->queryId = QQuickXmlQueryEngine::instance(qmlEngine(this))->doQuery(d->query, d->namespaces, d->xml.toUtf8(), &d->roleObjects, d->keyRoleResultsCache);
d->notifyQueryStarted(false);
} else if (d->src.isEmpty()) {
@@ -1030,9 +1030,9 @@ void QDeclarativeXmlListModel::reload()
#define XMLLISTMODEL_MAX_REDIRECT 16
-void QDeclarativeXmlListModel::requestFinished()
+void QQuickXmlListModel::requestFinished()
{
- Q_D(QDeclarativeXmlListModel);
+ Q_D(QQuickXmlListModel);
d->redirectCount++;
if (d->redirectCount < XMLLISTMODEL_MAX_REDIRECT) {
@@ -1067,7 +1067,7 @@ void QDeclarativeXmlListModel::requestFinished()
d->queryId = XMLLISTMODEL_CLEAR_ID;
QTimer::singleShot(0, this, SLOT(dataCleared()));
} else {
- d->queryId = QDeclarativeXmlQueryEngine::instance(qmlEngine(this))->doQuery(d->query, d->namespaces, data, &d->roleObjects, d->keyRoleResultsCache);
+ d->queryId = QQuickXmlQueryEngine::instance(qmlEngine(this))->doQuery(d->query, d->namespaces, data, &d->roleObjects, d->keyRoleResultsCache);
}
d->deleteReply();
@@ -1076,19 +1076,19 @@ void QDeclarativeXmlListModel::requestFinished()
}
}
-void QDeclarativeXmlListModel::requestProgress(qint64 received, qint64 total)
+void QQuickXmlListModel::requestProgress(qint64 received, qint64 total)
{
- Q_D(QDeclarativeXmlListModel);
+ Q_D(QQuickXmlListModel);
if (d->status == Loading && total > 0) {
d->progress = qreal(received)/total;
emit progressChanged(d->progress);
}
}
-void QDeclarativeXmlListModel::dataCleared()
+void QQuickXmlListModel::dataCleared()
{
- Q_D(QDeclarativeXmlListModel);
- QDeclarativeXmlQueryResult r;
+ Q_D(QQuickXmlListModel);
+ QQuickXmlQueryResult r;
r.queryId = XMLLISTMODEL_CLEAR_ID;
r.size = 0;
r.removed << qMakePair(0, count());
@@ -1096,12 +1096,12 @@ void QDeclarativeXmlListModel::dataCleared()
queryCompleted(r);
}
-void QDeclarativeXmlListModel::queryError(void* object, const QString& error)
+void QQuickXmlListModel::queryError(void* object, const QString& error)
{
// Be extra careful, object may no longer exist, it's just an ID.
- Q_D(QDeclarativeXmlListModel);
+ Q_D(QQuickXmlListModel);
for (int i=0; i<d->roleObjects.count(); i++) {
- if (d->roleObjects.at(i) == static_cast<QDeclarativeXmlListModelRole*>(object)) {
+ if (d->roleObjects.at(i) == static_cast<QQuickXmlListModelRole*>(object)) {
qmlInfo(d->roleObjects.at(i)) << QObject::tr("invalid query: \"%1\"").arg(error);
return;
}
@@ -1109,9 +1109,9 @@ void QDeclarativeXmlListModel::queryError(void* object, const QString& error)
qmlInfo(this) << QObject::tr("invalid query: \"%1\"").arg(error);
}
-void QDeclarativeXmlListModel::queryCompleted(const QDeclarativeXmlQueryResult &result)
+void QQuickXmlListModel::queryCompleted(const QQuickXmlQueryResult &result)
{
- Q_D(QDeclarativeXmlListModel);
+ Q_D(QQuickXmlListModel);
if (result.queryId != d->queryId)
return;
@@ -1157,4 +1157,4 @@ void QDeclarativeXmlListModel::queryCompleted(const QDeclarativeXmlQueryResult &
QT_END_NAMESPACE
-#include <qdeclarativexmllistmodel.moc>
+#include <qqmlxmllistmodel.moc>
diff --git a/src/imports/xmllistmodel/qdeclarativexmllistmodel_p.h b/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
index f34591d0a3..5bc4c7b494 100644
--- a/src/imports/xmllistmodel/qdeclarativexmllistmodel_p.h
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
+** This file is part of the QtQml module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@@ -39,11 +39,11 @@
**
****************************************************************************/
-#ifndef QDECLARATIVEXMLLISTMODEL_H
-#define QDECLARATIVEXMLLISTMODEL_H
+#ifndef QQUICKXMLLISTMODEL_H
+#define QQUICKXMLLISTMODEL_H
-#include <qdeclarative.h>
-#include <qdeclarativeinfo.h>
+#include <qqml.h>
+#include <qqmlinfo.h>
#include <QtCore/qurl.h>
#include <QtCore/qstringlist.h>
@@ -56,11 +56,11 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class QDeclarativeContext;
-class QDeclarativeXmlListModelRole;
-class QDeclarativeXmlListModelPrivate;
+class QQmlContext;
+class QQuickXmlListModelRole;
+class QQuickXmlListModelPrivate;
-struct QDeclarativeXmlQueryResult {
+struct QQuickXmlQueryResult {
int queryId;
int size;
QList<QList<QVariant> > data;
@@ -69,10 +69,10 @@ struct QDeclarativeXmlQueryResult {
QStringList keyRoleResultsCache;
};
-class QDeclarativeXmlListModel : public QListModelInterface, public QDeclarativeParserStatus
+class QQuickXmlListModel : public QListModelInterface, public QQmlParserStatus
{
Q_OBJECT
- Q_INTERFACES(QDeclarativeParserStatus)
+ Q_INTERFACES(QQmlParserStatus)
Q_ENUMS(Status)
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
@@ -81,13 +81,13 @@ class QDeclarativeXmlListModel : public QListModelInterface, public QDeclarative
Q_PROPERTY(QString xml READ xml WRITE setXml NOTIFY xmlChanged)
Q_PROPERTY(QString query READ query WRITE setQuery NOTIFY queryChanged)
Q_PROPERTY(QString namespaceDeclarations READ namespaceDeclarations WRITE setNamespaceDeclarations NOTIFY namespaceDeclarationsChanged)
- Q_PROPERTY(QDeclarativeListProperty<QDeclarativeXmlListModelRole> roles READ roleObjects)
+ Q_PROPERTY(QQmlListProperty<QQuickXmlListModelRole> roles READ roleObjects)
Q_PROPERTY(int count READ count NOTIFY countChanged)
Q_CLASSINFO("DefaultProperty", "roles")
public:
- QDeclarativeXmlListModel(QObject *parent = 0);
- ~QDeclarativeXmlListModel();
+ QQuickXmlListModel(QObject *parent = 0);
+ ~QQuickXmlListModel();
virtual QHash<int,QVariant> data(int index, const QList<int> &roles = (QList<int>())) const;
virtual QVariant data(int index, int role) const;
@@ -95,7 +95,7 @@ public:
virtual QList<int> roles() const;
virtual QString toString(int role) const;
- QDeclarativeListProperty<QDeclarativeXmlListModelRole> roleObjects();
+ QQmlListProperty<QQuickXmlListModelRole> roleObjects();
QUrl source() const;
void setSource(const QUrl&);
@@ -109,7 +109,7 @@ public:
QString namespaceDeclarations() const;
void setNamespaceDeclarations(const QString&);
- Q_INVOKABLE QDeclarativeV8Handle get(int index) const;
+ Q_INVOKABLE QQmlV8Handle get(int index) const;
enum Status { Null, Ready, Loading, Error };
Status status() const;
@@ -121,7 +121,7 @@ public:
virtual void componentComplete();
Q_SIGNALS:
- void statusChanged(QDeclarativeXmlListModel::Status);
+ void statusChanged(QQuickXmlListModel::Status);
void progressChanged(qreal progress);
void countChanged();
void sourceChanged();
@@ -140,23 +140,23 @@ private Q_SLOTS:
void requestFinished();
void requestProgress(qint64,qint64);
void dataCleared();
- void queryCompleted(const QDeclarativeXmlQueryResult &);
+ void queryCompleted(const QQuickXmlQueryResult &);
void queryError(void* object, const QString& error);
private:
- Q_DECLARE_PRIVATE(QDeclarativeXmlListModel)
- Q_DISABLE_COPY(QDeclarativeXmlListModel)
+ Q_DECLARE_PRIVATE(QQuickXmlListModel)
+ Q_DISABLE_COPY(QQuickXmlListModel)
};
-class QDeclarativeXmlListModelRole : public QObject
+class QQuickXmlListModelRole : public QObject
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
Q_PROPERTY(QString query READ query WRITE setQuery NOTIFY queryChanged)
Q_PROPERTY(bool isKey READ isKey WRITE setIsKey NOTIFY isKeyChanged)
public:
- QDeclarativeXmlListModelRole() : m_isKey(false) {}
- ~QDeclarativeXmlListModelRole() {}
+ QQuickXmlListModelRole() : m_isKey(false) {}
+ ~QQuickXmlListModelRole() {}
QString name() const { return m_name; }
void setName(const QString &name) {
@@ -204,9 +204,9 @@ private:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QDeclarativeXmlListModel)
-QML_DECLARE_TYPE(QDeclarativeXmlListModelRole)
+QML_DECLARE_TYPE(QQuickXmlListModel)
+QML_DECLARE_TYPE(QQuickXmlListModelRole)
QT_END_HEADER
-#endif // QDECLARATIVEXMLLISTMODEL_H
+#endif // QQUICKXMLLISTMODEL_H
diff --git a/src/imports/xmllistmodel/xmllistmodel.pro b/src/imports/xmllistmodel/xmllistmodel.pro
index d8121e8db8..8c056e8448 100644
--- a/src/imports/xmllistmodel/xmllistmodel.pro
+++ b/src/imports/xmllistmodel/xmllistmodel.pro
@@ -2,12 +2,12 @@ TARGET = qmlxmllistmodelplugin
TARGETPATH = QtQuick/XmlListModel
include(../qimportbase.pri)
-QT += network declarative xmlpatterns declarative-private v8-private core-private
+QT += network qml xmlpatterns qml-private v8-private core-private
-SOURCES += qdeclarativexmllistmodel.cpp plugin.cpp
-HEADERS += qdeclarativexmllistmodel_p.h
+SOURCES += qqmlxmllistmodel.cpp plugin.cpp
+HEADERS += qqmlxmllistmodel_p.h
-DESTDIR = $$QT.declarative.imports/$$TARGETPATH
+DESTDIR = $$QT.qml.imports/$$TARGETPATH
target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
qmldir.files += $$PWD/qmldir