diff options
author | Sze Howe Koh <szehowe.koh@gmail.com> | 2013-10-04 21:53:07 +0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-04 17:36:53 +0200 |
commit | 590fa9441c01ec1acf987091929a4d07d744b72b (patch) | |
tree | e6a81ffddb4b9689c48ccf4e193270d2db076c95 | |
parent | eefe516bd08771d037afafc833764ebaa6ff213e (diff) |
Rename QDeclarativeNdefRecord -> QQmlNdefRecord
The QDeclarative* class prefix is associated with the now-deprecated
Qt Declarative module (a.k.a. Qt Quick 1). In Qt Quick 2, all
QDeclarative* classes have been renamed to QQml* or QQuick*
Also rename the example, QDeclarativeNdefFooRecord -> QQmlNdefFooRecord
Change-Id: Ie81a9ea2fdda145ad749afb07ef758f791b278d0
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
-rw-r--r-- | src/imports/nfc/plugin.cpp | 4 | ||||
-rw-r--r-- | src/imports/nfc/plugins.qmltypes | 10 | ||||
-rw-r--r-- | src/imports/nfc/qdeclarativendeffilter.cpp | 4 | ||||
-rw-r--r-- | src/imports/nfc/qdeclarativendeffilter_p.h | 10 | ||||
-rw-r--r-- | src/imports/nfc/qdeclarativendefmimerecord.cpp | 4 | ||||
-rw-r--r-- | src/imports/nfc/qdeclarativendefmimerecord_p.h | 4 | ||||
-rw-r--r-- | src/imports/nfc/qdeclarativendeftextrecord.cpp | 4 | ||||
-rw-r--r-- | src/imports/nfc/qdeclarativendeftextrecord_p.h | 4 | ||||
-rw-r--r-- | src/imports/nfc/qdeclarativendefurirecord.cpp | 4 | ||||
-rw-r--r-- | src/imports/nfc/qdeclarativendefurirecord_p.h | 4 | ||||
-rw-r--r-- | src/imports/nfc/qdeclarativenearfield.cpp | 14 | ||||
-rw-r--r-- | src/imports/nfc/qdeclarativenearfield_p.h | 18 | ||||
-rw-r--r-- | src/nfc/doc/snippets/foorecord.cpp | 16 | ||||
-rw-r--r-- | src/nfc/doc/snippets/foorecord.h | 10 | ||||
-rw-r--r-- | src/nfc/nfc.pro | 4 | ||||
-rw-r--r-- | src/nfc/qqmlndefrecord.cpp (renamed from src/nfc/qdeclarativendefrecord.cpp) | 76 | ||||
-rw-r--r-- | src/nfc/qqmlndefrecord.h (renamed from src/nfc/qdeclarativendefrecord.h) | 20 | ||||
-rw-r--r-- | tests/auto/qndefrecord/tst_qndefrecord.cpp | 48 |
18 files changed, 129 insertions, 129 deletions
diff --git a/src/imports/nfc/plugin.cpp b/src/imports/nfc/plugin.cpp index dd97e296..6be71c73 100644 --- a/src/imports/nfc/plugin.cpp +++ b/src/imports/nfc/plugin.cpp @@ -42,7 +42,7 @@ #include <QtQml/QQmlEngine> #include <QtQml/QQmlExtensionPlugin> -#include "qdeclarativendefrecord.h" +#include "qqmlndefrecord.h" //#include "qdeclarativenearfieldsocket_p.h" #include "qdeclarativenearfield_p.h" #include "qdeclarativendeffilter_p.h" @@ -71,7 +71,7 @@ public: qmlRegisterType<QDeclarativeNearField>(uri, major, minor, "NearField"); qmlRegisterType<QDeclarativeNdefFilter>(uri, major, minor, "NdefFilter"); - qmlRegisterType<QDeclarativeNdefRecord>(uri, major, minor, "NdefRecord"); + qmlRegisterType<QQmlNdefRecord>(uri, major, minor, "NdefRecord"); qmlRegisterType<QDeclarativeNdefTextRecord>(uri, major, minor, "NdefTextRecord"); qmlRegisterType<QDeclarativeNdefUriRecord>(uri, major, minor, "NdefUriRecord"); qmlRegisterType<QDeclarativeNdefMimeRecord>(uri, major, minor, "NdefMimeRecord"); diff --git a/src/imports/nfc/plugins.qmltypes b/src/imports/nfc/plugins.qmltypes index 2d8eef8e..3e7cb4e4 100644 --- a/src/imports/nfc/plugins.qmltypes +++ b/src/imports/nfc/plugins.qmltypes @@ -18,13 +18,13 @@ Module { } Component { name: "QDeclarativeNdefMimeRecord" - prototype: "QDeclarativeNdefRecord" + prototype: "QQmlNdefRecord" exports: ["QtNfc/NdefMimeRecord 5.0"] exportMetaObjectRevisions: [0] Property { name: "uri"; type: "string"; isReadonly: true } } Component { - name: "QDeclarativeNdefRecord" + name: "QQmlNdefRecord" prototype: "QObject" exports: ["QtNfc/NdefRecord 5.0"] exportMetaObjectRevisions: [0] @@ -33,7 +33,7 @@ Module { } Component { name: "QDeclarativeNdefTextRecord" - prototype: "QDeclarativeNdefRecord" + prototype: "QQmlNdefRecord" exports: ["QtNfc/NdefTextRecord 5.0"] exportMetaObjectRevisions: [0] Enum { @@ -51,7 +51,7 @@ Module { } Component { name: "QDeclarativeNdefUriRecord" - prototype: "QDeclarativeNdefRecord" + prototype: "QQmlNdefRecord" exports: ["QtNfc/NdefUriRecord 5.0"] exportMetaObjectRevisions: [0] Property { name: "uri"; type: "string" } @@ -63,7 +63,7 @@ Module { exportMetaObjectRevisions: [0] Property { name: "messageRecords" - type: "QDeclarativeNdefRecord" + type: "QQmlNdefRecord" isList: true isReadonly: true } diff --git a/src/imports/nfc/qdeclarativendeffilter.cpp b/src/imports/nfc/qdeclarativendeffilter.cpp index ae551774..b1c2f74c 100644 --- a/src/imports/nfc/qdeclarativendeffilter.cpp +++ b/src/imports/nfc/qdeclarativendeffilter.cpp @@ -119,12 +119,12 @@ void QDeclarativeNdefFilter::setType(const QString &t) emit typeChanged(); } -QDeclarativeNdefRecord::TypeNameFormat QDeclarativeNdefFilter::typeNameFormat() const +QQmlNdefRecord::TypeNameFormat QDeclarativeNdefFilter::typeNameFormat() const { return m_typeNameFormat; } -void QDeclarativeNdefFilter::setTypeNameFormat(QDeclarativeNdefRecord::TypeNameFormat format) +void QDeclarativeNdefFilter::setTypeNameFormat(QQmlNdefRecord::TypeNameFormat format) { if (m_typeNameFormat == format) return; diff --git a/src/imports/nfc/qdeclarativendeffilter_p.h b/src/imports/nfc/qdeclarativendeffilter_p.h index 8622aece..2ff8e8e2 100644 --- a/src/imports/nfc/qdeclarativendeffilter_p.h +++ b/src/imports/nfc/qdeclarativendeffilter_p.h @@ -43,14 +43,14 @@ #define QDECLARATIVENDEFFILTER_P_H #include <QtCore/QObject> -#include <qdeclarativendefrecord.h> +#include <qqmlndefrecord.h> class QDeclarativeNdefFilter : public QObject { Q_OBJECT Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) - Q_PROPERTY(QDeclarativeNdefRecord::TypeNameFormat typeNameFormat READ typeNameFormat WRITE setTypeNameFormat NOTIFY typeNameFormatChanged) + Q_PROPERTY(QQmlNdefRecord::TypeNameFormat typeNameFormat READ typeNameFormat WRITE setTypeNameFormat NOTIFY typeNameFormatChanged) Q_PROPERTY(int minimum READ minimum WRITE setMinimum NOTIFY minimumChanged) Q_PROPERTY(int maximum READ maximum WRITE setMaximum NOTIFY maximumChanged) public: @@ -59,8 +59,8 @@ public: QString type() const; void setType(const QString &t); - QDeclarativeNdefRecord::TypeNameFormat typeNameFormat() const; - void setTypeNameFormat(QDeclarativeNdefRecord::TypeNameFormat format); + QQmlNdefRecord::TypeNameFormat typeNameFormat() const; + void setTypeNameFormat(QQmlNdefRecord::TypeNameFormat format); int minimum() const; void setMinimum(int value); @@ -78,7 +78,7 @@ private: QString m_type; int m_minimum; int m_maximum; - QDeclarativeNdefRecord::TypeNameFormat m_typeNameFormat; + QQmlNdefRecord::TypeNameFormat m_typeNameFormat; }; #endif // QDECLARATIVENDEFFILTER_P_H diff --git a/src/imports/nfc/qdeclarativendefmimerecord.cpp b/src/imports/nfc/qdeclarativendefmimerecord.cpp index b1c49bde..9468c01a 100644 --- a/src/imports/nfc/qdeclarativendefmimerecord.cpp +++ b/src/imports/nfc/qdeclarativendefmimerecord.cpp @@ -80,12 +80,12 @@ static inline QNdefRecord castToMimeRecord(const QNdefRecord &record) } QDeclarativeNdefMimeRecord::QDeclarativeNdefMimeRecord(QObject *parent) -: QDeclarativeNdefRecord(createMimeRecord(), parent) +: QQmlNdefRecord(createMimeRecord(), parent) { } QDeclarativeNdefMimeRecord::QDeclarativeNdefMimeRecord(const QNdefRecord &record, QObject *parent) -: QDeclarativeNdefRecord(castToMimeRecord(record), parent) +: QQmlNdefRecord(castToMimeRecord(record), parent) { } diff --git a/src/imports/nfc/qdeclarativendefmimerecord_p.h b/src/imports/nfc/qdeclarativendefmimerecord_p.h index bad83235..3338fcc6 100644 --- a/src/imports/nfc/qdeclarativendefmimerecord_p.h +++ b/src/imports/nfc/qdeclarativendefmimerecord_p.h @@ -42,11 +42,11 @@ #ifndef QDECLARATIVENDEFMIMERECORD_P_H #define QDECLARATIVENDEFMIMERECORD_P_H -#include <qdeclarativendefrecord.h> +#include <qqmlndefrecord.h> QT_USE_NAMESPACE -class QDeclarativeNdefMimeRecord : public QDeclarativeNdefRecord +class QDeclarativeNdefMimeRecord : public QQmlNdefRecord { Q_OBJECT diff --git a/src/imports/nfc/qdeclarativendeftextrecord.cpp b/src/imports/nfc/qdeclarativendeftextrecord.cpp index ad3cda6a..d487c351 100644 --- a/src/imports/nfc/qdeclarativendeftextrecord.cpp +++ b/src/imports/nfc/qdeclarativendeftextrecord.cpp @@ -108,12 +108,12 @@ Q_DECLARE_NDEFRECORD(QDeclarativeNdefTextRecord, QNdefRecord::NfcRtd, "T") QDeclarativeNdefTextRecord::QDeclarativeNdefTextRecord(QObject *parent) -: QDeclarativeNdefRecord(QNdefNfcTextRecord(), parent) +: QQmlNdefRecord(QNdefNfcTextRecord(), parent) { } QDeclarativeNdefTextRecord::QDeclarativeNdefTextRecord(const QNdefRecord &record, QObject *parent) -: QDeclarativeNdefRecord(QNdefNfcTextRecord(record), parent) +: QQmlNdefRecord(QNdefNfcTextRecord(record), parent) { } diff --git a/src/imports/nfc/qdeclarativendeftextrecord_p.h b/src/imports/nfc/qdeclarativendeftextrecord_p.h index 8701ab17..946e1fb4 100644 --- a/src/imports/nfc/qdeclarativendeftextrecord_p.h +++ b/src/imports/nfc/qdeclarativendeftextrecord_p.h @@ -42,13 +42,13 @@ #ifndef QDECLARATIVENDEFTEXTRECORD_P_H #define QDECLARATIVENDEFTEXTRECORD_P_H -#include <qdeclarativendefrecord.h> +#include <qqmlndefrecord.h> #include <qndefnfctextrecord.h> QT_USE_NAMESPACE -class QDeclarativeNdefTextRecord : public QDeclarativeNdefRecord +class QDeclarativeNdefTextRecord : public QQmlNdefRecord { Q_OBJECT diff --git a/src/imports/nfc/qdeclarativendefurirecord.cpp b/src/imports/nfc/qdeclarativendefurirecord.cpp index 47a65cfa..069472e5 100644 --- a/src/imports/nfc/qdeclarativendefurirecord.cpp +++ b/src/imports/nfc/qdeclarativendefurirecord.cpp @@ -66,12 +66,12 @@ Q_DECLARE_NDEFRECORD(QDeclarativeNdefUriRecord, QNdefRecord::NfcRtd, "U") QDeclarativeNdefUriRecord::QDeclarativeNdefUriRecord(QObject *parent) -: QDeclarativeNdefRecord(QNdefNfcUriRecord(), parent) +: QQmlNdefRecord(QNdefNfcUriRecord(), parent) { } QDeclarativeNdefUriRecord::QDeclarativeNdefUriRecord(const QNdefRecord &record, QObject *parent) -: QDeclarativeNdefRecord(QNdefNfcUriRecord(record), parent) +: QQmlNdefRecord(QNdefNfcUriRecord(record), parent) { } diff --git a/src/imports/nfc/qdeclarativendefurirecord_p.h b/src/imports/nfc/qdeclarativendefurirecord_p.h index b935a55b..67718c7f 100644 --- a/src/imports/nfc/qdeclarativendefurirecord_p.h +++ b/src/imports/nfc/qdeclarativendefurirecord_p.h @@ -42,7 +42,7 @@ #ifndef QDECLARATIVENDEFURIRECORD_P_H #define QDECLARATIVENDEFURIRECORD_P_H -#include <qdeclarativendefrecord.h> +#include <qqmlndefrecord.h> #include <qndefnfcurirecord.h> @@ -50,7 +50,7 @@ QT_USE_NAMESPACE -class QDeclarativeNdefUriRecord : public QDeclarativeNdefRecord +class QDeclarativeNdefUriRecord : public QQmlNdefRecord { Q_OBJECT diff --git a/src/imports/nfc/qdeclarativenearfield.cpp b/src/imports/nfc/qdeclarativenearfield.cpp index ed907292..9c871319 100644 --- a/src/imports/nfc/qdeclarativenearfield.cpp +++ b/src/imports/nfc/qdeclarativenearfield.cpp @@ -109,9 +109,9 @@ QDeclarativeNearField::QDeclarativeNearField(QObject *parent) { } -QQmlListProperty<QDeclarativeNdefRecord> QDeclarativeNearField::messageRecords() +QQmlListProperty<QQmlNdefRecord> QDeclarativeNearField::messageRecords() { - return QQmlListProperty<QDeclarativeNdefRecord>(this, 0, + return QQmlListProperty<QQmlNdefRecord>(this, 0, &QDeclarativeNearField::append_messageRecord, &QDeclarativeNearField::count_messageRecords, &QDeclarativeNearField::at_messageRecord, @@ -186,8 +186,8 @@ void QDeclarativeNearField::_q_handleNdefMessage(const QNdefMessage &message) emit messageRecordsChanged(); } -void QDeclarativeNearField::append_messageRecord(QQmlListProperty<QDeclarativeNdefRecord> *list, - QDeclarativeNdefRecord *record) +void QDeclarativeNearField::append_messageRecord(QQmlListProperty<QQmlNdefRecord> *list, + QQmlNdefRecord *record) { QDeclarativeNearField *nearField = qobject_cast<QDeclarativeNearField *>(list->object); if (!nearField) @@ -199,7 +199,7 @@ void QDeclarativeNearField::append_messageRecord(QQmlListProperty<QDeclarativeNd emit nearField->messageRecordsChanged(); } -int QDeclarativeNearField::count_messageRecords(QQmlListProperty<QDeclarativeNdefRecord> *list) +int QDeclarativeNearField::count_messageRecords(QQmlListProperty<QQmlNdefRecord> *list) { QDeclarativeNearField *nearField = qobject_cast<QDeclarativeNearField *>(list->object); if (!nearField) @@ -208,7 +208,7 @@ int QDeclarativeNearField::count_messageRecords(QQmlListProperty<QDeclarativeNde return nearField->m_message.count(); } -QDeclarativeNdefRecord *QDeclarativeNearField::at_messageRecord(QQmlListProperty<QDeclarativeNdefRecord> *list, +QQmlNdefRecord *QDeclarativeNearField::at_messageRecord(QQmlListProperty<QQmlNdefRecord> *list, int index) { QDeclarativeNearField *nearField = qobject_cast<QDeclarativeNearField *>(list->object); @@ -218,7 +218,7 @@ QDeclarativeNdefRecord *QDeclarativeNearField::at_messageRecord(QQmlListProperty return nearField->m_message.at(index); } -void QDeclarativeNearField::clear_messageRecords(QQmlListProperty<QDeclarativeNdefRecord> *list) +void QDeclarativeNearField::clear_messageRecords(QQmlListProperty<QQmlNdefRecord> *list) { QDeclarativeNearField *nearField = qobject_cast<QDeclarativeNearField *>(list->object); if (nearField) { diff --git a/src/imports/nfc/qdeclarativenearfield_p.h b/src/imports/nfc/qdeclarativenearfield_p.h index ad551308..14a6d986 100644 --- a/src/imports/nfc/qdeclarativenearfield_p.h +++ b/src/imports/nfc/qdeclarativenearfield_p.h @@ -47,7 +47,7 @@ #include <QtQml/QQmlParserStatus> #include <QtNfc/QNearFieldManager> -#include "qdeclarativendefrecord.h" +#include "qqmlndefrecord.h" QT_USE_NAMESPACE @@ -57,7 +57,7 @@ class QDeclarativeNearField : public QObject, public QQmlParserStatus { Q_OBJECT - Q_PROPERTY(QQmlListProperty<QDeclarativeNdefRecord> messageRecords READ messageRecords NOTIFY messageRecordsChanged) + Q_PROPERTY(QQmlListProperty<QQmlNdefRecord> messageRecords READ messageRecords NOTIFY messageRecordsChanged) Q_PROPERTY(QQmlListProperty<QDeclarativeNdefFilter> filter READ filter NOTIFY filterChanged) Q_PROPERTY(bool orderMatch READ orderMatch WRITE setOrderMatch NOTIFY orderMatchChanged) @@ -66,7 +66,7 @@ class QDeclarativeNearField : public QObject, public QQmlParserStatus public: explicit QDeclarativeNearField(QObject *parent = 0); - QQmlListProperty<QDeclarativeNdefRecord> messageRecords(); + QQmlListProperty<QQmlNdefRecord> messageRecords(); QQmlListProperty<QDeclarativeNdefFilter> filter(); @@ -86,7 +86,7 @@ private slots: void _q_handleNdefMessage(const QNdefMessage &message); private: - QList<QDeclarativeNdefRecord *> m_message; + QList<QQmlNdefRecord *> m_message; QList<QDeclarativeNdefFilter *> m_filterList; bool m_orderMatch; bool m_componentCompleted; @@ -97,12 +97,12 @@ private: void registerMessageHandler(); - static void append_messageRecord(QQmlListProperty<QDeclarativeNdefRecord> *list, - QDeclarativeNdefRecord *record); - static int count_messageRecords(QQmlListProperty<QDeclarativeNdefRecord> *list); - static QDeclarativeNdefRecord *at_messageRecord(QQmlListProperty<QDeclarativeNdefRecord> *list, + static void append_messageRecord(QQmlListProperty<QQmlNdefRecord> *list, + QQmlNdefRecord *record); + static int count_messageRecords(QQmlListProperty<QQmlNdefRecord> *list); + static QQmlNdefRecord *at_messageRecord(QQmlListProperty<QQmlNdefRecord> *list, int index); - static void clear_messageRecords(QQmlListProperty<QDeclarativeNdefRecord> *list); + static void clear_messageRecords(QQmlListProperty<QQmlNdefRecord> *list); static void append_filter(QQmlListProperty<QDeclarativeNdefFilter> *list, QDeclarativeNdefFilter *filter); diff --git a/src/nfc/doc/snippets/foorecord.cpp b/src/nfc/doc/snippets/foorecord.cpp index be0a6f89..2c4daeb1 100644 --- a/src/nfc/doc/snippets/foorecord.cpp +++ b/src/nfc/doc/snippets/foorecord.cpp @@ -42,7 +42,7 @@ #include <qndefrecord.h> //! [Declare foo record] -Q_DECLARE_NDEFRECORD(QDeclarativeNdefFooRecord, QNdefRecord::ExternalRtd, "com.example:f") +Q_DECLARE_NDEFRECORD(QQmlNdefFooRecord, QNdefRecord::ExternalRtd, "com.example:f") //! [Declare foo record] //! [createFooRecord] @@ -69,22 +69,22 @@ static inline QNdefRecord copyFooRecord(const QNdefRecord &record) //! [copyFooRecord] //! [Constructors] -QDeclarativeNdefFooRecord::QDeclarativeNdefFooRecord(QObject *parent) -: QDeclarativeNdefRecord(createFooRecord(), parent) +QQmlNdefFooRecord::QQmlNdefFooRecord(QObject *parent) +: QQmlNdefRecord(createFooRecord(), parent) { } -QDeclarativeNdefFooRecord::QDeclarativeNdefFooRecord(const QNdefRecord &record, QObject *parent) -: QDeclarativeNdefRecord(copyFooRecord(record), parent) +QQmlNdefFooRecord::QQmlNdefFooRecord(const QNdefRecord &record, QObject *parent) +: QQmlNdefRecord(copyFooRecord(record), parent) { } //! [Constructors] -QDeclarativeNdefFooRecord::~QDeclarativeNdefFooRecord() +QQmlNdefFooRecord::~QQmlNdefFooRecord() { } -int QDeclarativeNdefFooRecord::foo() const +int QQmlNdefFooRecord::foo() const { QByteArray payload = record().payload(); @@ -96,7 +96,7 @@ int QDeclarativeNdefFooRecord::foo() const return value; } -void QDeclarativeNdefFooRecord::setFoo(int value) +void QQmlNdefFooRecord::setFoo(int value) { if (foo() == value) return; diff --git a/src/nfc/doc/snippets/foorecord.h b/src/nfc/doc/snippets/foorecord.h index c6432361..59d13df9 100644 --- a/src/nfc/doc/snippets/foorecord.h +++ b/src/nfc/doc/snippets/foorecord.h @@ -41,21 +41,21 @@ #ifndef FOORECORD_H #define FOORECORD_H -#include <qdeclarativendefrecord.h> +#include <qqmlndefrecord.h> QT_USE_NAMESPACE //! [Foo declaration] -class QDeclarativeNdefFooRecord : public QDeclarativeNdefRecord +class QQmlNdefFooRecord : public QQmlNdefRecord { Q_OBJECT Q_PROPERTY(int foo READ foo WRITE setFoo NOTIFY fooChanged) public: - explicit QDeclarativeNdefFooRecord(QObject *parent = 0); - Q_INVOKABLE QDeclarativeNdefFooRecord(const QNdefRecord &record, QObject *parent = 0); - ~QDeclarativeNdefFooRecord(); + explicit QQmlNdefFooRecord(QObject *parent = 0); + Q_INVOKABLE QQmlNdefFooRecord(const QNdefRecord &record, QObject *parent = 0); + ~QQmlNdefFooRecord(); int foo() const; void setFoo(int value); diff --git a/src/nfc/nfc.pro b/src/nfc/nfc.pro index 1b4d6e24..dfa1d3ef 100644 --- a/src/nfc/nfc.pro +++ b/src/nfc/nfc.pro @@ -15,7 +15,7 @@ PUBLIC_HEADERS += \ qndefmessage.h \ qndeffilter.h \ qndefnfcurirecord.h \ - qdeclarativendefrecord.h \ + qqmlndefrecord.h \ qndefnfcsmartposterrecord.h PRIVATE_HEADERS += \ @@ -46,7 +46,7 @@ SOURCES += \ qnearfieldtagtype4.cpp \ qtlv.cpp \ qllcpserver.cpp \ - qdeclarativendefrecord.cpp \ + qqmlndefrecord.cpp \ qndefnfcsmartposterrecord.cpp qnx { diff --git a/src/nfc/qdeclarativendefrecord.cpp b/src/nfc/qqmlndefrecord.cpp index edec632e..fd154d74 100644 --- a/src/nfc/qdeclarativendefrecord.cpp +++ b/src/nfc/qqmlndefrecord.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qdeclarativendefrecord.h" +#include "qqmlndefrecord.h" #include <QtCore/QMap> #include <QtCore/QRegExp> @@ -47,15 +47,15 @@ QT_BEGIN_NAMESPACE /*! - \class QDeclarativeNdefRecord - \brief The QDeclarativeNdefRecord class implements the NdefRecord type in QML. + \class QQmlNdefRecord + \brief The QQmlNdefRecord class implements the NdefRecord type in QML. \ingroup connectivity-nfc \inmodule QtNfc \sa NdefRecord - The QDeclarativeNdefRecord class is the base class for all NdefRecord types in QML. To + The QQmlNdefRecord class is the base class for all NdefRecord types in QML. To support a new NDEF record type in QML subclass this class and expose new properties, member functions and signals appropriate for the new record type. The following must be done to create a new NDEF record type in QML: @@ -80,13 +80,13 @@ QT_BEGIN_NAMESPACE Finially the application or plugin code calls qmlRegisterType(): \code - qmlRegisterType<QDeclarativeNdefFooRecord>(uri, 1, 0, "NdefFooRecord"); + qmlRegisterType<QQmlNdefFooRecord>(uri, 1, 0, "NdefFooRecord"); \endcode */ /*! \qmltype NdefRecord - \instantiates QDeclarativeNdefRecord + \instantiates QQmlNdefRecord \brief The NdefRecord type represents a record in an NDEF message. \ingroup nfc-qml @@ -102,7 +102,7 @@ QT_BEGIN_NAMESPACE This class is not intended to be used directly, but extended from C++. - \sa QDeclarativeNdefRecord + \sa QQmlNdefRecord */ /*! @@ -141,32 +141,32 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QDeclarativeNdefRecord::typeChanged() + \fn void QQmlNdefRecord::typeChanged() This signal is emitted when the record type changes. */ /*! - \property QDeclarativeNdefRecord::record + \property QQmlNdefRecord::record This property hold the NDEF record that this class represents. */ /*! - \property QDeclarativeNdefRecord::type + \property QQmlNdefRecord::type This property hold the type of the NDEF record. */ /*! - \property QDeclarativeNdefRecord::typeNameFormat + \property QQmlNdefRecord::typeNameFormat This property hold the TNF of the NDEF record. */ /*! \macro Q_DECLARE_NDEFRECORD(className, typeNameFormat, type) - \relates QDeclarativeNdefRecord + \relates QQmlNdefRecord This macro ensures that \a className is declared as the class implementing the NDEF record identified by \a typeNameFormat and \a type. @@ -176,7 +176,7 @@ QT_BEGIN_NAMESPACE static QMap<QString, const QMetaObject *> registeredNdefRecordTypes; -class QDeclarativeNdefRecordPrivate +class QQmlNdefRecordPrivate { public: QNdefRecord record; @@ -209,7 +209,7 @@ void qRegisterNdefRecordTypeHelper(const QMetaObject *metaObject, /*! \internal */ -QDeclarativeNdefRecord *qNewDeclarativeNdefRecordForNdefRecord(const QNdefRecord &record) +QQmlNdefRecord *qNewDeclarativeNdefRecordForNdefRecord(const QNdefRecord &record) { const QString urn = urnForRecordType(record.typeNameFormat(), record.type()); @@ -225,33 +225,33 @@ QDeclarativeNdefRecord *qNewDeclarativeNdefRecordForNdefRecord(const QNdefRecord if (!metaObject) continue; - return static_cast<QDeclarativeNdefRecord *>(metaObject->newInstance( + return static_cast<QQmlNdefRecord *>(metaObject->newInstance( Q_ARG(QNdefRecord, record), Q_ARG(QObject *, 0))); } - return new QDeclarativeNdefRecord(record); + return new QQmlNdefRecord(record); } /*! - Constructs a new empty QDeclarativeNdefRecord with \a parent. + Constructs a new empty QQmlNdefRecord with \a parent. */ -QDeclarativeNdefRecord::QDeclarativeNdefRecord(QObject *parent) -: QObject(parent), d_ptr(new QDeclarativeNdefRecordPrivate) +QQmlNdefRecord::QQmlNdefRecord(QObject *parent) +: QObject(parent), d_ptr(new QQmlNdefRecordPrivate) { } /*! - Constructs a new QDeclarativeNdefRecord representing \a record. The parent of the newly + Constructs a new QQmlNdefRecord representing \a record. The parent of the newly constructed object will be set to \a parent. */ -QDeclarativeNdefRecord::QDeclarativeNdefRecord(const QNdefRecord &record, QObject *parent) -: QObject(parent), d_ptr(new QDeclarativeNdefRecordPrivate) +QQmlNdefRecord::QQmlNdefRecord(const QNdefRecord &record, QObject *parent) +: QObject(parent), d_ptr(new QQmlNdefRecordPrivate) { d_ptr->record = record; } /*! - \enum QDeclarativeNdefRecord::TypeNameFormat + \enum QQmlNdefRecord::TypeNameFormat This enum describes the type name format of an NDEF record. The values of this enum are according to \l QNdefRecord::TypeNameFormat @@ -269,9 +269,9 @@ QDeclarativeNdefRecord::QDeclarativeNdefRecord(const QNdefRecord &record, QObjec \sa QNdefRecord::setType(), QNdefRecord::type() */ -QString QDeclarativeNdefRecord::type() const +QString QQmlNdefRecord::type() const { - Q_D(const QDeclarativeNdefRecord); + Q_D(const QQmlNdefRecord); return QLatin1String(d->record.type()); } @@ -282,12 +282,12 @@ QString QDeclarativeNdefRecord::type() const \sa QNdefRecord::setType(), QNdefRecord::type() */ -void QDeclarativeNdefRecord::setType(const QString &newtype) +void QQmlNdefRecord::setType(const QString &newtype) { if (newtype == type()) return; - Q_D(QDeclarativeNdefRecord); + Q_D(QQmlNdefRecord); d->record.setType(newtype.toUtf8()); emit typeChanged(); @@ -296,11 +296,11 @@ void QDeclarativeNdefRecord::setType(const QString &newtype) /*! Sets the type name format of the NDEF record to \a typeNameFormat. */ -void QDeclarativeNdefRecord::setTypeNameFormat(QDeclarativeNdefRecord::TypeNameFormat typeNameFormat) +void QQmlNdefRecord::setTypeNameFormat(QQmlNdefRecord::TypeNameFormat typeNameFormat) { - Q_D(QDeclarativeNdefRecord); + Q_D(QQmlNdefRecord); bool emitChanged = true; - if (static_cast<QDeclarativeNdefRecord::TypeNameFormat>(d->record.typeNameFormat()) == typeNameFormat) { + if (static_cast<QQmlNdefRecord::TypeNameFormat>(d->record.typeNameFormat()) == typeNameFormat) { emitChanged = false; } @@ -313,22 +313,22 @@ void QDeclarativeNdefRecord::setTypeNameFormat(QDeclarativeNdefRecord::TypeNameF } /*! - \fn QDeclarativeNdefRecord::TypeNameFormat QDeclarativeNdefRecord::typeNameFormat() const + \fn QQmlNdefRecord::TypeNameFormat QQmlNdefRecord::typeNameFormat() const Returns the type name format of the NDEF record. */ -QDeclarativeNdefRecord::TypeNameFormat QDeclarativeNdefRecord::typeNameFormat() const +QQmlNdefRecord::TypeNameFormat QQmlNdefRecord::typeNameFormat() const { - Q_D(const QDeclarativeNdefRecord); - return static_cast<QDeclarativeNdefRecord::TypeNameFormat>(d->record.typeNameFormat()); + Q_D(const QQmlNdefRecord); + return static_cast<QQmlNdefRecord::TypeNameFormat>(d->record.typeNameFormat()); } /*! Returns a copy of the record. */ -QNdefRecord QDeclarativeNdefRecord::record() const +QNdefRecord QQmlNdefRecord::record() const { - Q_D(const QDeclarativeNdefRecord); + Q_D(const QQmlNdefRecord); return d->record; } @@ -337,9 +337,9 @@ QNdefRecord QDeclarativeNdefRecord::record() const Sets the record to \a record. If the record is set the recordChanged() signal will be emitted. */ -void QDeclarativeNdefRecord::setRecord(const QNdefRecord &record) +void QQmlNdefRecord::setRecord(const QNdefRecord &record) { - Q_D(QDeclarativeNdefRecord); + Q_D(QQmlNdefRecord); if (d->record == record) return; diff --git a/src/nfc/qdeclarativendefrecord.h b/src/nfc/qqmlndefrecord.h index 52c436fe..76ba8bf2 100644 --- a/src/nfc/qdeclarativendefrecord.h +++ b/src/nfc/qqmlndefrecord.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QDECLARATIVENDEFRECORD_P_H -#define QDECLARATIVENDEFRECORD_P_H +#ifndef QQMLNDEFRECORD_H +#define QQMLNDEFRECORD_H #include <QtCore/QObject> #include <QtCore/QMetaType> @@ -48,13 +48,13 @@ QT_BEGIN_NAMESPACE -class QDeclarativeNdefRecordPrivate; +class QQmlNdefRecordPrivate; -class Q_NFC_EXPORT QDeclarativeNdefRecord : public QObject +class Q_NFC_EXPORT QQmlNdefRecord : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QDeclarativeNdefRecord) + Q_DECLARE_PRIVATE(QQmlNdefRecord) Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) Q_PROPERTY(TypeNameFormat typeNameFormat READ typeNameFormat WRITE setTypeNameFormat NOTIFY typeNameFormatChanged) @@ -71,8 +71,8 @@ public: Unknown = QNdefRecord::Unknown }; - explicit QDeclarativeNdefRecord(QObject *parent = 0); - explicit QDeclarativeNdefRecord(const QNdefRecord &record, QObject *parent = 0); + explicit QQmlNdefRecord(QObject *parent = 0); + explicit QQmlNdefRecord(const QNdefRecord &record, QObject *parent = 0); QString type() const; void setType(const QString &t); @@ -89,14 +89,14 @@ Q_SIGNALS: void recordChanged(); private: - QDeclarativeNdefRecordPrivate *d_ptr; + QQmlNdefRecordPrivate *d_ptr; }; void Q_NFC_EXPORT qRegisterNdefRecordTypeHelper(const QMetaObject *metaObject, QNdefRecord::TypeNameFormat typeNameFormat, const QByteArray &type); -Q_NFC_EXPORT QDeclarativeNdefRecord *qNewDeclarativeNdefRecordForNdefRecord(const QNdefRecord &record); +Q_NFC_EXPORT QQmlNdefRecord *qNewDeclarativeNdefRecordForNdefRecord(const QNdefRecord &record); template<typename T> bool qRegisterNdefRecordType(QNdefRecord::TypeNameFormat typeNameFormat, const QByteArray &type) @@ -110,4 +110,4 @@ static bool _q_##className##_registered = qRegisterNdefRecordType<className>(typ QT_END_NAMESPACE -#endif // QDECLARATIVENDEFRECORD_P_H +#endif // QQMLNDEFRECORD_H diff --git a/tests/auto/qndefrecord/tst_qndefrecord.cpp b/tests/auto/qndefrecord/tst_qndefrecord.cpp index 6ccb9566..000ff017 100644 --- a/tests/auto/qndefrecord/tst_qndefrecord.cpp +++ b/tests/auto/qndefrecord/tst_qndefrecord.cpp @@ -44,7 +44,7 @@ #include <qndefrecord.h> #include <qndefnfctextrecord.h> #include <qndefnfcurirecord.h> -#include <qdeclarativendefrecord.h> +#include <qqmlndefrecord.h> QT_USE_NAMESPACE @@ -99,10 +99,10 @@ void tst_QNdefRecord::tst_record() QCOMPARE(record, QNdefRecord()); QVERIFY(!(record != QNdefRecord())); - QDeclarativeNdefRecord declRecord; + QQmlNdefRecord declRecord; QCOMPARE(declRecord.record(), record); QCOMPARE(declRecord.type(), QString()); - QCOMPARE(declRecord.typeNameFormat(), QDeclarativeNdefRecord::Empty); + QCOMPARE(declRecord.typeNameFormat(), QQmlNdefRecord::Empty); } // test type name format @@ -256,10 +256,10 @@ void tst_QNdefRecord::tst_textRecord() QVERIFY(record != QNdefRecord()); - QDeclarativeNdefRecord declRecord(record); + QQmlNdefRecord declRecord(record); QCOMPARE(declRecord.record(), QNdefRecord(record)); QCOMPARE(declRecord.type(), QString("T")); - QCOMPARE(declRecord.typeNameFormat(), QDeclarativeNdefRecord::NfcRtd); + QCOMPARE(declRecord.typeNameFormat(), QQmlNdefRecord::NfcRtd); } // test getters @@ -325,10 +325,10 @@ void tst_QNdefRecord::tst_uriRecord() QVERIFY(record != QNdefRecord()); - QDeclarativeNdefRecord declRecord(record); + QQmlNdefRecord declRecord(record); QCOMPARE(declRecord.record(), QNdefRecord(record)); QCOMPARE(declRecord.type(), QString("U")); - QCOMPARE(declRecord.typeNameFormat(), QDeclarativeNdefRecord::NfcRtd); + QCOMPARE(declRecord.typeNameFormat(), QQmlNdefRecord::NfcRtd); } // test getters @@ -386,34 +386,34 @@ void tst_QNdefRecord::tst_declarative_record() QCOMPARE(record.typeNameFormat(), typeNameFormat); QCOMPARE(record.type(), type); - QDeclarativeNdefRecord declRecord(record); + QQmlNdefRecord declRecord(record); QCOMPARE(declRecord.record(), record); QCOMPARE(declRecord.record().typeNameFormat(), typeNameFormat); QCOMPARE(declRecord.record().type(), type); QCOMPARE(declRecord.type(), QString(type)); - QCOMPARE(declRecord.typeNameFormat(), static_cast<QDeclarativeNdefRecord::TypeNameFormat>(typeNameFormat)); + QCOMPARE(declRecord.typeNameFormat(), static_cast<QQmlNdefRecord::TypeNameFormat>(typeNameFormat)); - QDeclarativeNdefRecord declRecord2; + QQmlNdefRecord declRecord2; declRecord2.setRecord(record); QCOMPARE(declRecord2.record(), record); QCOMPARE(declRecord2.record().typeNameFormat(), typeNameFormat); QCOMPARE(declRecord2.record().type(), type); QCOMPARE(declRecord2.type(), QString(type)); - QCOMPARE(declRecord2.typeNameFormat(), static_cast<QDeclarativeNdefRecord::TypeNameFormat>(typeNameFormat)); + QCOMPARE(declRecord2.typeNameFormat(), static_cast<QQmlNdefRecord::TypeNameFormat>(typeNameFormat)); - QDeclarativeNdefRecord declRecord3; - declRecord3.setTypeNameFormat((QDeclarativeNdefRecord::TypeNameFormat)typeNameFormat); + QQmlNdefRecord declRecord3; + declRecord3.setTypeNameFormat((QQmlNdefRecord::TypeNameFormat)typeNameFormat); declRecord3.setType(type); QCOMPARE(declRecord3.type(), QString(type)); QCOMPARE(declRecord3.record().typeNameFormat(), typeNameFormat); QCOMPARE(declRecord3.record().type(), type); - QCOMPARE(declRecord3.typeNameFormat(), static_cast<QDeclarativeNdefRecord::TypeNameFormat>(typeNameFormat)); + QCOMPARE(declRecord3.typeNameFormat(), static_cast<QQmlNdefRecord::TypeNameFormat>(typeNameFormat)); } } void tst_QNdefRecord::tst_declarativeChangedSignals() { - QDeclarativeNdefRecord record; + QQmlNdefRecord record; QSignalSpy typeSpy(&record, SIGNAL(typeChanged())); QSignalSpy tnfSpy(&record, SIGNAL(typeNameFormatChanged())); QSignalSpy recordSpy(&record, SIGNAL(recordChanged())); @@ -422,14 +422,14 @@ void tst_QNdefRecord::tst_declarativeChangedSignals() QCOMPARE(recordSpy.count(), 0); record.setType("U"); - record.setTypeNameFormat(QDeclarativeNdefRecord::NfcRtd); + record.setTypeNameFormat(QQmlNdefRecord::NfcRtd); QCOMPARE(typeSpy.count(), 1); QCOMPARE(tnfSpy.count(), 1); QCOMPARE(recordSpy.count(), 0); QCOMPARE(record.type(), QString("U")); QCOMPARE(record.record().type(), QByteArray("U")); QCOMPARE(record.record().typeNameFormat(), QNdefRecord::NfcRtd); - QCOMPARE(record.typeNameFormat(), QDeclarativeNdefRecord::NfcRtd); + QCOMPARE(record.typeNameFormat(), QQmlNdefRecord::NfcRtd); record.setType("U"); //same value, no signal QCOMPARE(typeSpy.count(), 1); @@ -438,18 +438,18 @@ void tst_QNdefRecord::tst_declarativeChangedSignals() QCOMPARE(record.type(), QString("U")); QCOMPARE(record.record().type(), QByteArray("U")); QCOMPARE(record.record().typeNameFormat(), QNdefRecord::NfcRtd); - QCOMPARE(record.typeNameFormat(), QDeclarativeNdefRecord::NfcRtd); + QCOMPARE(record.typeNameFormat(), QQmlNdefRecord::NfcRtd); record.setType("blah"); record.setType("blah2"); - record.setTypeNameFormat(QDeclarativeNdefRecord::ExternalRtd); + record.setTypeNameFormat(QQmlNdefRecord::ExternalRtd); QCOMPARE(typeSpy.count(), 3); QCOMPARE(tnfSpy.count(), 2); QCOMPARE(recordSpy.count(), 0); QCOMPARE(record.type(), QString("blah2")); QCOMPARE(record.record().type(), QByteArray("blah2")); QCOMPARE(record.record().typeNameFormat(), QNdefRecord::ExternalRtd); - QCOMPARE(record.typeNameFormat(), QDeclarativeNdefRecord::ExternalRtd); + QCOMPARE(record.typeNameFormat(), QQmlNdefRecord::ExternalRtd); record.setType("Rubbish"); QCOMPARE(typeSpy.count(), 4); @@ -458,17 +458,17 @@ void tst_QNdefRecord::tst_declarativeChangedSignals() QCOMPARE(record.type(), QString("Rubbish")); QCOMPARE(record.record().type(), QByteArray("Rubbish")); QCOMPARE(record.record().typeNameFormat(), QNdefRecord::ExternalRtd); - QCOMPARE(record.typeNameFormat(), QDeclarativeNdefRecord::ExternalRtd); + QCOMPARE(record.typeNameFormat(), QQmlNdefRecord::ExternalRtd); record.setType("QQQQ"); - record.setTypeNameFormat(QDeclarativeNdefRecord::Mime); + record.setTypeNameFormat(QQmlNdefRecord::Mime); QCOMPARE(typeSpy.count(), 5); QCOMPARE(tnfSpy.count(), 3); QCOMPARE(recordSpy.count(), 0); QCOMPARE(record.type(), QString("QQQQ")); QCOMPARE(record.record().type(), QByteArray("QQQQ")); QCOMPARE(record.record().typeNameFormat(), QNdefRecord::Mime); - QCOMPARE(record.typeNameFormat(), QDeclarativeNdefRecord::Mime); + QCOMPARE(record.typeNameFormat(), QQmlNdefRecord::Mime); record.setRecord(QNdefRecord()); QCOMPARE(typeSpy.count(), 5); //setting record -> no recordChanged signal @@ -477,7 +477,7 @@ void tst_QNdefRecord::tst_declarativeChangedSignals() QCOMPARE(record.type(), QString("")); QCOMPARE(record.record().type(), QByteArray()); QCOMPARE(record.record().typeNameFormat(), QNdefRecord::Empty); - QCOMPARE(record.typeNameFormat(), QDeclarativeNdefRecord::Empty); + QCOMPARE(record.typeNameFormat(), QQmlNdefRecord::Empty); } QTEST_MAIN(tst_QNdefRecord) |