From c6fce65191e0ab5dd3ca5372fd550b757769c400 Mon Sep 17 00:00:00 2001 From: Xizhi Zhu Date: Wed, 7 Mar 2012 11:29:03 +0100 Subject: Declarative --> Qml adaptation. Change-Id: I09104237f261592bca7869cddf2cdb7af9d2d74b Reviewed-by: Alex Reviewed-by: Andrew Stanley-Jones --- src/imports/publishsubscribe/publishsubscribe.cpp | 6 ++--- src/imports/publishsubscribe/publishsubscribe.pro | 2 +- .../serviceframework/qdeclarativeservice.cpp | 18 +++++++------- .../serviceframework/qdeclarativeservice_p.h | 28 ++++++++++------------ src/imports/serviceframework/serviceframework.cpp | 6 ++--- src/imports/serviceframework/serviceframework.pro | 2 +- src/imports/systeminfo/qsysteminfo.cpp | 6 ++--- src/imports/systeminfo/systeminfo.pro | 2 +- 8 files changed, 34 insertions(+), 36 deletions(-) (limited to 'src/imports') diff --git a/src/imports/publishsubscribe/publishsubscribe.cpp b/src/imports/publishsubscribe/publishsubscribe.cpp index 01565ebe..59c5e108 100644 --- a/src/imports/publishsubscribe/publishsubscribe.cpp +++ b/src/imports/publishsubscribe/publishsubscribe.cpp @@ -39,15 +39,15 @@ ** ****************************************************************************/ -#include -#include +#include +#include #include "qdeclarativevaluespacepublisher_p.h" #include "qdeclarativevaluespacesubscriber_p.h" QT_BEGIN_NAMESPACE -class QSubscriberDeclarativeModule : public QDeclarativeExtensionPlugin +class QSubscriberDeclarativeModule : public QQmlExtensionPlugin { Q_OBJECT public: diff --git a/src/imports/publishsubscribe/publishsubscribe.pro b/src/imports/publishsubscribe/publishsubscribe.pro index 6b6b7241..1dba580e 100644 --- a/src/imports/publishsubscribe/publishsubscribe.pro +++ b/src/imports/publishsubscribe/publishsubscribe.pro @@ -10,7 +10,7 @@ qmldir.files += $$PWD/qmldir qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH INSTALLS += qmldir -QT += declarative publishsubscribe core-private +QT += qml publishsubscribe core-private SOURCES += publishsubscribe.cpp \ qdeclarativevaluespacepublisher.cpp \ diff --git a/src/imports/serviceframework/qdeclarativeservice.cpp b/src/imports/serviceframework/qdeclarativeservice.cpp index 2eb85e0c..547b4b9e 100644 --- a/src/imports/serviceframework/qdeclarativeservice.cpp +++ b/src/imports/serviceframework/qdeclarativeservice.cpp @@ -41,8 +41,8 @@ #include "qdeclarativeservice_p.h" -#include -#include +#include +#include QT_BEGIN_NAMESPACE @@ -575,14 +575,14 @@ void QDeclarativeServiceList::updateFilterResults() } /*! - \qmlproperty QDeclarativeListProperty ServiceList::services + \qmlproperty QQmlListProperty ServiceList::services This property holds the list of \l Service elements that match the Service::interfaceName and minimum Service::versionNumber properties. */ -QDeclarativeListProperty QDeclarativeServiceList::services() +QQmlListProperty QDeclarativeServiceList::services() { - return QDeclarativeListProperty(this, + return QQmlListProperty(this, 0, s_append, s_count, @@ -608,23 +608,23 @@ void QDeclarativeServiceList::listUpdated() emit resultsChanged(); } -void QDeclarativeServiceList::s_append(QDeclarativeListProperty *prop, QDeclarativeService *service) +void QDeclarativeServiceList::s_append(QQmlListProperty *prop, QDeclarativeService *service) { QDeclarativeServiceList* list = static_cast(prop->object); list->m_services.append(service); list->listUpdated(); } -int QDeclarativeServiceList::s_count(QDeclarativeListProperty *prop) +int QDeclarativeServiceList::s_count(QQmlListProperty *prop) { return static_cast(prop->object)->m_services.count(); } -QDeclarativeService* QDeclarativeServiceList::s_at(QDeclarativeListProperty *prop, int index) +QDeclarativeService* QDeclarativeServiceList::s_at(QQmlListProperty *prop, int index) { return static_cast(prop->object)->m_services[index]; } -void QDeclarativeServiceList::s_clear(QDeclarativeListProperty *prop) +void QDeclarativeServiceList::s_clear(QQmlListProperty *prop) { QDeclarativeServiceList* list = static_cast(prop->object); qDeleteAll(list->m_services); diff --git a/src/imports/serviceframework/qdeclarativeservice_p.h b/src/imports/serviceframework/qdeclarativeservice_p.h index fe39e8b7..ee214e31 100644 --- a/src/imports/serviceframework/qdeclarativeservice_p.h +++ b/src/imports/serviceframework/qdeclarativeservice_p.h @@ -45,14 +45,14 @@ #include #include #include -#include -#include +#include +#include QT_BEGIN_NAMESPACE -class QDeclarativeService : public QObject, public QDeclarativeParserStatus { +class QDeclarativeService : public QObject, public QQmlParserStatus { Q_OBJECT - Q_INTERFACES(QDeclarativeParserStatus) + Q_INTERFACES(QQmlParserStatus) Q_PROPERTY(QString interfaceName READ interfaceName WRITE setInterfaceName NOTIFY interfaceNameChanged) Q_PROPERTY(QString serviceName READ serviceName WRITE setServiceName NOTIFY serviceNameChanged) Q_PROPERTY(int majorVersion READ majorVersion WRITE setMajorVersion NOTIFY majorVersionChanged) @@ -120,15 +120,15 @@ private: }; -class QDeclarativeServiceList : public QObject, public QDeclarativeParserStatus { +class QDeclarativeServiceList : public QObject, public QQmlParserStatus { Q_OBJECT - Q_INTERFACES(QDeclarativeParserStatus) + Q_INTERFACES(QQmlParserStatus) Q_PROPERTY(QString serviceName READ serviceName WRITE setServiceName NOTIFY serviceNameChanged) Q_PROPERTY(QString interfaceName READ interfaceName WRITE setInterfaceName NOTIFY interfaceNameChanged) Q_PROPERTY(int majorVersion READ majorVersion WRITE setMajorVersion NOTIFY majorVersionChanged) Q_PROPERTY(int minorVersion READ minorVersion WRITE setMinorVersion NOTIFY minorVersionChanged) Q_PROPERTY(bool monitorServiceRegistrations READ monitorServiceRegistrations WRITE setMonitorServiceRegistrations NOTIFY monitorServiceRegistrationsChanged) - Q_PROPERTY(QDeclarativeListProperty services READ services NOTIFY resultsChanged) + Q_PROPERTY(QQmlListProperty services READ services NOTIFY resultsChanged) Q_PROPERTY(MatchRule versionMatch READ versionMatch WRITE setVersionMatch NOTIFY versionMatchChanged) Q_ENUMS(MatchRule) @@ -142,7 +142,7 @@ public: QDeclarativeServiceList(); ~QDeclarativeServiceList(); - QDeclarativeListProperty services(); + QQmlListProperty services(); void setServiceName(const QString& service); QString serviceName() const; @@ -170,7 +170,7 @@ public: Q_SIGNALS: void resultsChanged(); - void servicesChanged(const QDeclarativeListProperty&); + void servicesChanged(const QQmlListProperty&); void serviceNameChanged(); void interfaceNameChanged(); void minorVersionChanged(); @@ -195,12 +195,10 @@ private: bool m_componentComplete; bool m_dynamicUpdates; - static void s_append(QDeclarativeListProperty *prop, QDeclarativeService *service); - static int s_count(QDeclarativeListProperty *prop); - static QDeclarativeService* s_at(QDeclarativeListProperty *prop, int index); - static void s_clear(QDeclarativeListProperty *prop); - - + static void s_append(QQmlListProperty *prop, QDeclarativeService *service); + static int s_count(QQmlListProperty *prop); + static QDeclarativeService* s_at(QQmlListProperty *prop, int index); + static void s_clear(QQmlListProperty *prop); }; QT_END_NAMESPACE diff --git a/src/imports/serviceframework/serviceframework.cpp b/src/imports/serviceframework/serviceframework.cpp index 63493ea6..10bdd13b 100644 --- a/src/imports/serviceframework/serviceframework.cpp +++ b/src/imports/serviceframework/serviceframework.cpp @@ -39,14 +39,14 @@ ** ****************************************************************************/ -#include -#include +#include +#include #include "qdeclarativeservice_p.h" QT_BEGIN_NAMESPACE -class QServiceDeclarativeModule : public QDeclarativeExtensionPlugin +class QServiceDeclarativeModule : public QQmlExtensionPlugin { Q_OBJECT diff --git a/src/imports/serviceframework/serviceframework.pro b/src/imports/serviceframework/serviceframework.pro index 784919ac..469d3963 100644 --- a/src/imports/serviceframework/serviceframework.pro +++ b/src/imports/serviceframework/serviceframework.pro @@ -11,7 +11,7 @@ qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH INSTALLS += qmldir target -QT += declarative serviceframework +QT += qml serviceframework HEADERS += qdeclarativeservice_p.h diff --git a/src/imports/systeminfo/qsysteminfo.cpp b/src/imports/systeminfo/qsysteminfo.cpp index 30bf7623..32639aa4 100644 --- a/src/imports/systeminfo/qsysteminfo.cpp +++ b/src/imports/systeminfo/qsysteminfo.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include -#include +#include +#include #include "qdeclarativebatteryinfo_p.h" #include "qdeclarativedeviceinfo_p.h" @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE -class QSystemInfoDeclarativeModule : public QDeclarativeExtensionPlugin +class QSystemInfoDeclarativeModule : public QQmlExtensionPlugin { Q_OBJECT diff --git a/src/imports/systeminfo/systeminfo.pro b/src/imports/systeminfo/systeminfo.pro index 250fc8d1..490e2107 100644 --- a/src/imports/systeminfo/systeminfo.pro +++ b/src/imports/systeminfo/systeminfo.pro @@ -9,7 +9,7 @@ qmldir.files += $$PWD/qmldir qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH INSTALLS += qmldir -QT += declarative systeminfo +QT += qml systeminfo HEADERS += \ qdeclarativebatteryinfo_p.h \ -- cgit v1.2.3