From 6ffb4e1e8d56d1fab58fcaa369afde33fd983c1f Mon Sep 17 00:00:00 2001 From: Justin McPherson <justin.mcpherson@nokia.com> Date: Tue, 23 Feb 2010 11:07:22 +1000 Subject: Add private header warning. Reviewed-by: Kurt Korbatits --- src/multimedia/qml/qmetadatacontrolmetaobject_p.h | 11 +++++++++++ src/multimedia/qml/qmlaudio_p.h | 11 +++++++++++ src/multimedia/qml/qmlgraphicsvideo_p.h | 11 +++++++++++ src/multimedia/qml/qmlmediabase_p.h | 10 ++++++++++ src/multimedia/qml/wavedecoder_p.h | 11 +++++++++++ 5 files changed, 54 insertions(+) diff --git a/src/multimedia/qml/qmetadatacontrolmetaobject_p.h b/src/multimedia/qml/qmetadatacontrolmetaobject_p.h index c0fd4e8..ec4df05 100644 --- a/src/multimedia/qml/qmetadatacontrolmetaobject_p.h +++ b/src/multimedia/qml/qmetadatacontrolmetaobject_p.h @@ -42,6 +42,17 @@ #ifndef QMETADATACONTROLMETAOBJECT_P_H #define QMETADATACONTROLMETAOJBECT_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/qmetaobject.h> #include <QtMultimedia/qtmedianamespace.h> diff --git a/src/multimedia/qml/qmlaudio_p.h b/src/multimedia/qml/qmlaudio_p.h index f034518..bb0d301 100644 --- a/src/multimedia/qml/qmlaudio_p.h +++ b/src/multimedia/qml/qmlaudio_p.h @@ -42,6 +42,17 @@ #ifndef QMLAUDIO_P_H #define QMLAUDIO_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtMultimedia/private/qmlmediabase_p.h> #include <QtCore/qbasictimer.h> diff --git a/src/multimedia/qml/qmlgraphicsvideo_p.h b/src/multimedia/qml/qmlgraphicsvideo_p.h index a4f8e32..26252e0 100644 --- a/src/multimedia/qml/qmlgraphicsvideo_p.h +++ b/src/multimedia/qml/qmlgraphicsvideo_p.h @@ -42,6 +42,17 @@ #ifndef QMLGRAPHICSVIDEO_H #define QMLGRAPHICSVIDEO_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtMultimedia/private/qmlmediabase_p.h> #include <QtMultimedia/qgraphicsvideoitem.h> diff --git a/src/multimedia/qml/qmlmediabase_p.h b/src/multimedia/qml/qmlmediabase_p.h index 948a0e8..d6ad9b3 100644 --- a/src/multimedia/qml/qmlmediabase_p.h +++ b/src/multimedia/qml/qmlmediabase_p.h @@ -42,6 +42,16 @@ #ifndef QMLMEDIABASE_P_H #define QMLMEDIABASE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// #include <QtCore/qbasictimer.h> #include <QtMultimedia/qmediaplayer.h> diff --git a/src/multimedia/qml/wavedecoder_p.h b/src/multimedia/qml/wavedecoder_p.h index 3bcd90d..00aa14e 100644 --- a/src/multimedia/qml/wavedecoder_p.h +++ b/src/multimedia/qml/wavedecoder_p.h @@ -42,6 +42,17 @@ #ifndef WAVEDECODER_H #define WAVEDECODER_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/qiodevice.h> #include <QtMultimedia/qaudioformat.h> -- cgit v0.12 From 4b1a9e65bb989e7edcaa0bc0be9924885e7e06c9 Mon Sep 17 00:00:00 2001 From: Justin McPherson <justin.mcpherson@nokia.com> Date: Tue, 23 Feb 2010 11:34:30 +1000 Subject: Change qml.{h,cpp} -> multimediaqml.{h,cpp} in QtMultimedia. Reviewed-by: Nicholas Young --- src/multimedia/qml/multimediaqml.cpp | 68 ++++++++++++++++++++++++ src/multimedia/qml/multimediaqml.h | 60 +++++++++++++++++++++ src/multimedia/qml/qml.cpp | 68 ------------------------ src/multimedia/qml/qml.h | 60 --------------------- src/multimedia/qml/qml.pri | 4 +- src/plugins/qmlmodules/multimedia/multimedia.cpp | 2 +- 6 files changed, 131 insertions(+), 131 deletions(-) create mode 100644 src/multimedia/qml/multimediaqml.cpp create mode 100644 src/multimedia/qml/multimediaqml.h delete mode 100644 src/multimedia/qml/qml.cpp delete mode 100644 src/multimedia/qml/qml.h diff --git a/src/multimedia/qml/multimediaqml.cpp b/src/multimedia/qml/multimediaqml.cpp new file mode 100644 index 0000000..be49915 --- /dev/null +++ b/src/multimedia/qml/multimediaqml.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** 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 QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtMultimedia/multimediaqml.h> +#include <QtMultimedia/private/qsoundeffect_p.h> +#include <QtMultimedia/private/qmlaudio_p.h> +#include <QtMultimedia/private/qmlgraphicsvideo_p.h> + + +QT_BEGIN_NAMESPACE + +namespace QtMultimedia +{ + +/*! + Register the Multimedia QML elements. + \internal +*/ + +void qRegisterQmlElements() +{ + qmlRegisterType<QSoundEffect>("Qt.multimedia", 4, 7, "SoundEffect", "SoundEffect"); + qmlRegisterType<QmlAudio>("Qt.multimedia", 4, 7, "Audio", "Audio"); + qmlRegisterType<QmlGraphicsVideo>("Qt.multimedia", 4, 7, "Video", "Video"); +} + +} + +QT_END_NAMESPACE + diff --git a/src/multimedia/qml/multimediaqml.h b/src/multimedia/qml/multimediaqml.h new file mode 100644 index 0000000..41274c8 --- /dev/null +++ b/src/multimedia/qml/multimediaqml.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** 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 QtMultimedia module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTMULTIMEDIA_QML_H +#define QTMULTIMEDIA_QML_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + +namespace QtMultimedia +{ +extern void Q_MULTIMEDIA_EXPORT qRegisterQmlElements(); +} + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // ifndef QTMULTIMEDIA_QML_H diff --git a/src/multimedia/qml/qml.cpp b/src/multimedia/qml/qml.cpp deleted file mode 100644 index b9ee212..0000000 --- a/src/multimedia/qml/qml.cpp +++ /dev/null @@ -1,68 +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 QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtMultimedia/qml.h> -#include <QtMultimedia/private/qsoundeffect_p.h> -#include <QtMultimedia/private/qmlaudio_p.h> -#include <QtMultimedia/private/qmlgraphicsvideo_p.h> - - -QT_BEGIN_NAMESPACE - -namespace QtMultimedia -{ - -/*! - Register the Multimedia QML elements. - \internal -*/ - -void qRegisterQmlElements() -{ - qmlRegisterType<QSoundEffect>("Qt.multimedia", 4, 7, "SoundEffect", "SoundEffect"); - qmlRegisterType<QmlAudio>("Qt.multimedia", 4, 7, "Audio", "Audio"); - qmlRegisterType<QmlGraphicsVideo>("Qt.multimedia", 4, 7, "Video", "Video"); -} - -} - -QT_END_NAMESPACE - diff --git a/src/multimedia/qml/qml.h b/src/multimedia/qml/qml.h deleted file mode 100644 index 41274c8..0000000 --- a/src/multimedia/qml/qml.h +++ /dev/null @@ -1,60 +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 QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTMULTIMEDIA_QML_H -#define QTMULTIMEDIA_QML_H - -#include <QtCore/qglobal.h> - -QT_BEGIN_HEADER -QT_BEGIN_NAMESPACE - -QT_MODULE(Multimedia) - -namespace QtMultimedia -{ -extern void Q_MULTIMEDIA_EXPORT qRegisterQmlElements(); -} - -QT_END_NAMESPACE -QT_END_HEADER - -#endif // ifndef QTMULTIMEDIA_QML_H diff --git a/src/multimedia/qml/qml.pri b/src/multimedia/qml/qml.pri index e506632..a7ca02e 100644 --- a/src/multimedia/qml/qml.pri +++ b/src/multimedia/qml/qml.pri @@ -17,7 +17,7 @@ contains(QT_CONFIG, declarative) { } HEADERS += \ - $$PWD/qml.h \ + $$PWD/multimediaqml.h \ $$PWD/qmetadatacontrolmetaobject_p.h \ $$PWD/qmlaudio_p.h \ $$PWD/qmlgraphicsvideo_p.h \ @@ -26,7 +26,7 @@ contains(QT_CONFIG, declarative) { $$PWD/wavedecoder_p.h SOURCES += \ - $$PWD/qml.cpp \ + $$PWD/multimediaqml.cpp \ $$PWD/qmetadatacontrolmetaobject.cpp \ $$PWD/qmlaudio.cpp \ $$PWD/qmlgraphicsvideo.cpp \ diff --git a/src/plugins/qmlmodules/multimedia/multimedia.cpp b/src/plugins/qmlmodules/multimedia/multimedia.cpp index d9414ee..d192ed8 100644 --- a/src/plugins/qmlmodules/multimedia/multimedia.cpp +++ b/src/plugins/qmlmodules/multimedia/multimedia.cpp @@ -41,7 +41,7 @@ #include <QtDeclarative/qmlmoduleplugin.h> #include <QtDeclarative/qml.h> -#include <QtMultimedia/qml.h> +#include <QtMultimedia/multimediaqml.h> QT_BEGIN_NAMESPACE -- cgit v0.12 From f56a36d771bb71fe6d0f7025ae427a76a1d22324 Mon Sep 17 00:00:00 2001 From: Nicholas Young <nicholas.young@nokia.com> Date: Tue, 23 Feb 2010 13:32:23 +1000 Subject: Added QNetworkRequest constructor to QMediaContent. Now consistent with QMediaResource. Reviewed-by: Dmytro Poplavskiy --- src/multimedia/base/qmediacontent.cpp | 13 +++++++++++++ src/multimedia/base/qmediacontent.h | 2 ++ tests/auto/qmediacontent/tst_qmediacontent.cpp | 13 +++++++++++++ 3 files changed, 28 insertions(+) diff --git a/src/multimedia/base/qmediacontent.cpp b/src/multimedia/base/qmediacontent.cpp index 3e32af0..fd519c6 100644 --- a/src/multimedia/base/qmediacontent.cpp +++ b/src/multimedia/base/qmediacontent.cpp @@ -109,6 +109,19 @@ QMediaContent::QMediaContent(const QUrl &url): } /*! + Constructs a media content with \a request providing a reference to the content. + + This constructor can be used to reference media content via network protocols such as HTTP. + This may include additional information required to obtain the resource, such as Cookies or HTTP headers. +*/ + +QMediaContent::QMediaContent(const QNetworkRequest &request): + d(new QMediaContentPrivate) +{ + d->resources << QMediaResource(request); +} + +/*! Constructs a media content with \a resource providing a reference to the content. */ diff --git a/src/multimedia/base/qmediacontent.h b/src/multimedia/base/qmediacontent.h index 1ea4898..b6f3017 100644 --- a/src/multimedia/base/qmediacontent.h +++ b/src/multimedia/base/qmediacontent.h @@ -46,6 +46,7 @@ #include <QtCore/qshareddata.h> #include <QtMultimedia/qmediaresource.h> +#include <QtNetwork/qnetworkrequest.h> QT_BEGIN_HEADER @@ -60,6 +61,7 @@ class Q_MULTIMEDIA_EXPORT QMediaContent public: QMediaContent(); QMediaContent(const QUrl &contentUrl); + QMediaContent(const QNetworkRequest &contentRequest); QMediaContent(const QMediaResource &contentResource); QMediaContent(const QMediaResourceList &resources); QMediaContent(const QMediaContent &other); diff --git a/tests/auto/qmediacontent/tst_qmediacontent.cpp b/tests/auto/qmediacontent/tst_qmediacontent.cpp index 35dd0a9..8987241 100644 --- a/tests/auto/qmediacontent/tst_qmediacontent.cpp +++ b/tests/auto/qmediacontent/tst_qmediacontent.cpp @@ -51,6 +51,7 @@ class tst_QMediaContent : public QObject private slots: void testNull(); void testUrlCtor(); + void testRequestCtor(); void testResourceCtor(); void testResourceListCtor(); void testCopy(); @@ -77,6 +78,18 @@ void tst_QMediaContent::testUrlCtor() QCOMPARE(media.canonicalResource().url(), QUrl("http://example.com/movie.mov")); } +void tst_QMediaContent::testRequestCtor() +{ + QNetworkRequest request(QUrl("http://example.com/movie.mov")); + request.setAttribute(QNetworkRequest::User, QVariant(1234)); + + QMediaContent media(request); + + QCOMPARE(media.canonicalUrl(), QUrl("http://example.com/movie.mov")); + QCOMPARE(media.canonicalResource().request(), request); + QCOMPARE(media.canonicalResource().url(), QUrl("http://example.com/movie.mov")); +} + void tst_QMediaContent::testResourceCtor() { QMediaContent media(QMediaResource(QUrl("http://example.com/movie.mov"))); -- cgit v0.12 From 0b4e388d88af73c9f542289d40b261cd32116380 Mon Sep 17 00:00:00 2001 From: Nicholas Young <nicholas.young@nokia.com> Date: Tue, 23 Feb 2010 14:52:03 +1000 Subject: Player demo updated with more user-friendly previous button behaviour. Pressing previous within the first five seconds will go to the previous item in the playlist. Otherwise, it will seek to the beginning of the current item. Reviewed-by: Kurt Korbatits --- demos/multimedia/player/player.cpp | 12 +++++++++++- demos/multimedia/player/player.h | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/demos/multimedia/player/player.cpp b/demos/multimedia/player/player.cpp index 64b1f25..49d18cb 100644 --- a/demos/multimedia/player/player.cpp +++ b/demos/multimedia/player/player.cpp @@ -99,7 +99,7 @@ Player::Player(QWidget *parent) connect(controls, SIGNAL(pause()), player, SLOT(pause())); connect(controls, SIGNAL(stop()), player, SLOT(stop())); connect(controls, SIGNAL(next()), playlist, SLOT(next())); - connect(controls, SIGNAL(previous()), playlist, SLOT(previous())); + connect(controls, SIGNAL(previous()), this, SLOT(previousClicked())); connect(controls, SIGNAL(changeVolume(int)), player, SLOT(setVolume(int))); connect(controls, SIGNAL(changeMuting(bool)), player, SLOT(setMuted(bool))); connect(controls, SIGNAL(changeRate(qreal)), player, SLOT(setPlaybackRate(qreal))); @@ -200,6 +200,16 @@ void Player::metaDataChanged() } } +void Player::previousClicked() +{ + // Go to previous track if we are within the first 5 seconds of playback + // Otherwise, seek to the beginning. + if(player->position() <= 5000) + playlist->previous(); + else + player->setPosition(0); +} + void Player::jump(const QModelIndex &index) { if (index.isValid()) { diff --git a/demos/multimedia/player/player.h b/demos/multimedia/player/player.h index 0ad609b..1de8b1a 100644 --- a/demos/multimedia/player/player.h +++ b/demos/multimedia/player/player.h @@ -77,6 +77,8 @@ private slots: void positionChanged(qint64 progress); void metaDataChanged(); + void previousClicked(); + void seek(int seconds); void jump(const QModelIndex &index); void playlistPositionChanged(int); -- cgit v0.12 From 4325feb3b93a7676e0b2d0301b8a17f69ffa7c1e Mon Sep 17 00:00:00 2001 From: Justin McPherson <justin.mcpherson@nokia.com> Date: Tue, 23 Feb 2010 15:10:03 +1000 Subject: Remove active qDebugs. Change to qWarning where appropriate, otherwise comment Reviewed-by: Dmytro Poplavskiy --- .../mediaservices/directshow/dsserviceplugin.cpp | 2 +- .../directshow/mediaplayer/directshowiosource.cpp | 4 ---- .../mediaplayer/qgstreamermetadataprovider.cpp | 2 +- .../gstreamer/qgstreamerserviceplugin.cpp | 7 +++--- .../qgstreamervideoinputdevicecontrol.cpp | 4 ++-- .../mediaservices/gstreamer/qgstxvimagebuffer.cpp | 4 ++-- .../gstreamer/qvideosurfacegstsink.cpp | 3 +-- .../qt7/mediaplayer/qt7playerservice.mm | 8 +++---- .../qt7/mediaplayer/qt7playersession.mm | 6 +++--- src/plugins/mediaservices/qt7/qt7movierenderer.mm | 25 +++++++++++----------- .../mediaservices/qt7/qt7movievideowidget.mm | 4 ++-- .../mediaservices/qt7/qt7movieviewrenderer.mm | 11 +++++----- 12 files changed, 38 insertions(+), 42 deletions(-) diff --git a/src/plugins/mediaservices/directshow/dsserviceplugin.cpp b/src/plugins/mediaservices/directshow/dsserviceplugin.cpp index f3ab889..c482fd5 100644 --- a/src/plugins/mediaservices/directshow/dsserviceplugin.cpp +++ b/src/plugins/mediaservices/directshow/dsserviceplugin.cpp @@ -94,7 +94,7 @@ QMediaService* DSServicePlugin::create(QString const& key) return new DirectShowPlayerService; #endif - qDebug() << "unsupported key:" << key; + qWarning() << "DirectShow service plugin: unsupported service -" << key; return 0; } diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.cpp index c2fb0d4..1dca465 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.cpp +++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.cpp @@ -624,11 +624,7 @@ bool DirectShowRcSource::open(const QUrl &url) m_file.setFileName(QLatin1Char(':') + url.path()); - qDebug("qrc file %s", qPrintable(m_file.fileName())); - if (m_file.open(QIODevice::ReadOnly)) { - qDebug("Size %d", m_file.size()); - qDebug("Sequential %d", int(m_file.isSequential())); setDevice(&m_file); diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp index 49eeb23..4d0ffe4 100644 --- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp +++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp @@ -41,7 +41,7 @@ #include "qgstreamermetadataprovider.h" #include "qgstreamerplayersession.h" -#include <QDebug> +#include <QtCore/qdebug.h> #include <gst/gstversion.h> diff --git a/src/plugins/mediaservices/gstreamer/qgstreamerserviceplugin.cpp b/src/plugins/mediaservices/gstreamer/qgstreamerserviceplugin.cpp index 9e5f425..589d2b5 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamerserviceplugin.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstreamerserviceplugin.cpp @@ -43,7 +43,6 @@ #include <QtCore/qdebug.h> #include <QtGui/QIcon> #include <QtCore/QDir> -#include <QtCore/QDebug> #include "qgstreamerserviceplugin.h" @@ -99,7 +98,7 @@ QMediaService* QGstreamerServicePlugin::create(const QString &key) return new QGstreamerCaptureService(key); #endif - qDebug() << "unsupported key:" << key; + qWarning() << "GStreamer service plugin: unsupported service -" << key; return 0; } @@ -145,7 +144,7 @@ void QGstreamerServicePlugin::updateDevices() const QFileInfoList entries = devDir.entryInfoList(QStringList() << "video*"); foreach( const QFileInfo &entryInfo, entries ) { - qDebug() << "Try" << entryInfo.filePath(); +// qDebug() << "Try" << entryInfo.filePath(); int fd = ::open(entryInfo.filePath().toLatin1().constData(), O_RDWR ); if (fd == -1) @@ -172,7 +171,7 @@ void QGstreamerServicePlugin::updateDevices() const name = entryInfo.fileName(); else name = QString((const char*)vcap.card); - qDebug() << "found camera: " << name; +// qDebug() << "found camera: " << name; m_cameraDevices.append(entryInfo.filePath().toLocal8Bit()); m_cameraDescriptions.append(name); diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideoinputdevicecontrol.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideoinputdevicecontrol.cpp index ac9a1e3..94ae847 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamervideoinputdevicecontrol.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstreamervideoinputdevicecontrol.cpp @@ -120,7 +120,7 @@ void QGstreamerVideoInputDeviceControl::update() QFileInfoList entries = devDir.entryInfoList(QStringList() << "video*"); foreach( const QFileInfo &entryInfo, entries ) { - qDebug() << "Try" << entryInfo.filePath(); +// qDebug() << "Try" << entryInfo.filePath(); int fd = ::open(entryInfo.filePath().toLatin1().constData(), O_RDWR ); if (fd == -1) @@ -147,7 +147,7 @@ void QGstreamerVideoInputDeviceControl::update() name = entryInfo.fileName(); else name = QString((const char*)vcap.card); - qDebug() << "found camera: " << name; +// qDebug() << "found camera: " << name; m_names.append(entryInfo.filePath()); m_descriptions.append(name); diff --git a/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.cpp b/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.cpp index 0e47c98..5b99817 100644 --- a/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.cpp @@ -182,7 +182,7 @@ void QGstXvImageBufferPool::queuedAlloc() ); if (!xvBuffer->xvImage) { - qDebug() << "QGstXvImageBufferPool: XvShmCreateImage failed"; +// qDebug() << "QGstXvImageBufferPool: XvShmCreateImage failed"; m_allocWaitCondition.wakeOne(); return; } @@ -192,7 +192,7 @@ void QGstXvImageBufferPool::queuedAlloc() xvBuffer->shmInfo.readOnly = False; if (!XShmAttach(QX11Info::display(), &xvBuffer->shmInfo)) { - qDebug() << "QGstXvImageBufferPool: XShmAttach failed"; +// qDebug() << "QGstXvImageBufferPool: XShmAttach failed"; m_allocWaitCondition.wakeOne(); return; } diff --git a/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp b/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp index 9e3807b..402a225 100644 --- a/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp +++ b/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp @@ -41,9 +41,8 @@ #include <QtMultimedia/QAbstractVideoSurface> #include <QtMultimedia/QVideoFrame> -#include <QDebug> +#include <QtCore/qdebug.h> #include <QMap> -#include <QDebug> #include <QThread> #include <QtGui/qx11info_x11.h> diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playerservice.mm b/src/plugins/mediaservices/qt7/mediaplayer/qt7playerservice.mm index df15fa8..faf75d1 100644 --- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playerservice.mm +++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playerservice.mm @@ -79,7 +79,7 @@ QT7PlayerService::QT7PlayerService(QObject *parent): #if defined(QT_MAC_USE_COCOA) m_videoWidnowControl = new QT7MovieViewOutput(this); m_videoOutputControl->enableOutput(QVideoOutputControl::WindowOutput); - qDebug() << "Using cocoa"; +// qDebug() << "Using cocoa"; #endif #ifdef QUICKTIME_C_API_AVAILABLE @@ -88,11 +88,11 @@ QT7PlayerService::QT7PlayerService(QObject *parent): m_videoWidgetControl = new QT7MovieVideoWidget(this); m_videoOutputControl->enableOutput(QVideoOutputControl::WidgetOutput); - qDebug() << "QuickTime C API is available"; +// qDebug() << "QuickTime C API is available"; #else m_videoRendererControl = new QT7MovieViewRenderer(this); m_videoOutputControl->enableOutput(QVideoOutputControl::RendererOutput); - qDebug() << "QuickTime C API is not available"; +// qDebug() << "QuickTime C API is not available"; #endif @@ -129,7 +129,7 @@ QMediaControl *QT7PlayerService::control(const char *name) const void QT7PlayerService::updateVideoOutput() { - qDebug() << "QT7PlayerService::updateVideoOutput" << m_videoOutputControl->output(); +// qDebug() << "QT7PlayerService::updateVideoOutput" << m_videoOutputControl->output(); switch (m_videoOutputControl->output()) { case QVideoOutputControl::WindowOutput: diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm index 5507633..b5561f7 100644 --- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm +++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm @@ -373,7 +373,7 @@ void QT7PlayerSession::setMedia(const QMediaContent &content, QIODevice *stream) else return; - qDebug() << "Open media" << url; +// qDebug() << "Open media" << url; NSError *err = 0; NSString *urlString = (NSString *)qString2CFStringRef(url.toString()); @@ -437,7 +437,7 @@ void QT7PlayerSession::processStateChange() { signed long state = [[(QTMovie*)m_QTMovie attributeForKey:QTMovieLoadStateAttribute] longValue]; - qDebug() << "Moview load state changed:" << state; +// qDebug() << "Moview load state changed:" << state; #ifndef QUICKTIME_C_API_AVAILABLE enum { @@ -506,7 +506,7 @@ void QT7PlayerSession::processNaturalSizeChange() { if (m_videoOutput) { NSSize size = [[(QTMovie*)m_QTMovie attributeForKey:@"QTMovieNaturalSizeAttribute"] sizeValue]; - qDebug() << "Native size changed:" << QSize(size.width, size.height); +// qDebug() << "Native size changed:" << QSize(size.width, size.height); m_videoOutput->updateNaturalSize(QSize(size.width, size.height)); } } diff --git a/src/plugins/mediaservices/qt7/qt7movierenderer.mm b/src/plugins/mediaservices/qt7/qt7movierenderer.mm index 587f3b9..6b9fd21 100644 --- a/src/plugins/mediaservices/qt7/qt7movierenderer.mm +++ b/src/plugins/mediaservices/qt7/qt7movierenderer.mm @@ -169,7 +169,7 @@ QT7MovieRenderer::QT7MovieRenderer(QObject *parent) #endif m_surface(0) { - qDebug() << "QT7MovieRenderer"; +// qDebug() << "QT7MovieRenderer"; m_displayLink = new QCvDisplayLink(this); connect(m_displayLink, SIGNAL(tick(CVTimeStamp)), SLOT(updateVideoFrame(CVTimeStamp))); @@ -262,7 +262,7 @@ void QT7MovieRenderer::setupVideoOutput() { AutoReleasePool pool; - qDebug() << "QT7MovieRenderer::setupVideoOutput" << m_movie; +// qDebug() << "QT7MovieRenderer::setupVideoOutput" << m_movie; if (m_movie == 0 || m_surface == 0) { m_displayLink->stop(); @@ -286,9 +286,9 @@ void QT7MovieRenderer::setupVideoOutput() if (m_surface->isActive()) m_surface->stop(); - qDebug() << "Starting the surface with format" << format; +// qDebug() << "Starting the surface with format" << format; if (!m_surface->start(format)) { - qDebug() << "failed to start video surface" << m_surface->error(); +// qDebug() << "failed to start video surface" << m_surface->error(); glSupported = false; } else { m_usingGLContext = true; @@ -301,14 +301,15 @@ void QT7MovieRenderer::setupVideoOutput() QVideoSurfaceFormat format(m_nativeSize, QVideoFrame::Format_RGB32); if (m_surface->isActive() && m_surface->surfaceFormat() != format) { - qDebug() << "Surface format was changed, stop the surface."; +// qDebug() << "Surface format was changed, stop the surface."; m_surface->stop(); } if (!m_surface->isActive()) { - qDebug() << "Starting the surface with format" << format; - if (!m_surface->start(format)) - qDebug() << "failed to start video surface" << m_surface->error(); +// qDebug() << "Starting the surface with format" << format; + m_surface->start(format); +// if (!m_surface->start(format)) +// qDebug() << "failed to start video surface" << m_surface->error(); } } } @@ -328,14 +329,14 @@ void QT7MovieRenderer::setupVideoOutput() if (!m_nativeSize.isEmpty()) { if (!m_visualContext) { if (m_usingGLContext) { - qDebug() << "Building OpenGL visual context" << m_nativeSize; +// qDebug() << "Building OpenGL visual context" << m_nativeSize; m_currentGLContext = QGLContext::currentContext(); if (!createGLVisualContext()) { qWarning() << "QT7MovieRenderer: failed to create visual context"; return; } } else { - qDebug() << "Building Pixel Buffer visual context" << m_nativeSize; +// qDebug() << "Building Pixel Buffer visual context" << m_nativeSize; if (!createPixelBufferVisualContext()) { qWarning() << "QT7MovieRenderer: failed to create visual context"; return; @@ -358,7 +359,7 @@ void QT7MovieRenderer::setEnabled(bool) void QT7MovieRenderer::setMovie(void *movie) { - qDebug() << "QT7MovieRenderer::setMovie" << movie; +// qDebug() << "QT7MovieRenderer::setMovie" << movie; #ifdef QUICKTIME_C_API_AVAILABLE QMutexLocker locker(&m_mutex); @@ -393,7 +394,7 @@ QAbstractVideoSurface *QT7MovieRenderer::surface() const void QT7MovieRenderer::setSurface(QAbstractVideoSurface *surface) { - qDebug() << "Set video surface" << surface; +// qDebug() << "Set video surface" << surface; if (surface == m_surface) return; diff --git a/src/plugins/mediaservices/qt7/qt7movievideowidget.mm b/src/plugins/mediaservices/qt7/qt7movievideowidget.mm index 6e74fcd..4043330 100644 --- a/src/plugins/mediaservices/qt7/qt7movievideowidget.mm +++ b/src/plugins/mediaservices/qt7/qt7movievideowidget.mm @@ -184,7 +184,7 @@ QT7MovieVideoWidget::QT7MovieVideoWidget(QObject *parent) m_hue(0), m_saturation(0) { - qDebug() << "QT7MovieVideoWidget"; +// qDebug() << "QT7MovieVideoWidget"; QGLFormat format = QGLFormat::defaultFormat(); format.setSwapInterval(1); // Vertical sync (avoid tearing) @@ -249,7 +249,7 @@ void QT7MovieVideoWidget::setupVideoOutput() { AutoReleasePool pool; - qDebug() << "QT7MovieVideoWidget::setupVideoOutput" << m_movie; +// qDebug() << "QT7MovieVideoWidget::setupVideoOutput" << m_movie; if (m_movie == 0) { m_displayLink->stop(); diff --git a/src/plugins/mediaservices/qt7/qt7movieviewrenderer.mm b/src/plugins/mediaservices/qt7/qt7movieviewrenderer.mm index 342feb8..255cea1 100644 --- a/src/plugins/mediaservices/qt7/qt7movieviewrenderer.mm +++ b/src/plugins/mediaservices/qt7/qt7movieviewrenderer.mm @@ -245,7 +245,7 @@ void QT7MovieViewRenderer::setupVideoOutput() { AutoReleasePool pool; - qDebug() << "QT7MovieViewRenderer::setupVideoOutput" << m_movie << m_surface; +// qDebug() << "QT7MovieViewRenderer::setupVideoOutput" << m_movie << m_surface; HiddenQTMovieView *movieView = (HiddenQTMovieView*)m_movieView; @@ -272,14 +272,15 @@ void QT7MovieViewRenderer::setupVideoOutput() QVideoSurfaceFormat format(m_nativeSize, QVideoFrame::Format_RGB32); if (m_surface->isActive() && m_surface->surfaceFormat() != format) { - qDebug() << "Surface format was changed, stop the surface."; +// qDebug() << "Surface format was changed, stop the surface."; m_surface->stop(); } if (!m_surface->isActive()) { - qDebug() << "Starting the surface with format" << format; - if (!m_surface->start(format)) - qDebug() << "failed to start video surface" << m_surface->error(); +// qDebug() << "Starting the surface with format" << format; + m_surface->start(format); +// if (!m_surface->start(format)) +// qDebug() << "failed to start video surface" << m_surface->error(); } } } -- cgit v0.12 From b4ee6a8760d382259136da2fc5ffd624fe312b28 Mon Sep 17 00:00:00 2001 From: Andrew den Exter <andrew.den-exter@nokia.com> Date: Wed, 24 Feb 2010 12:49:35 +1000 Subject: Add -mediaservice argument to configure. Enables building the default media service backend for a platform. Is on by default if the build environment requirements are met and -no-mediaservice disables the option. Reviewed-by: Justin McPherson --- configure | 19 +++++++++++++++++-- src/plugins/mediaservices/mediaservices.pro | 24 +++++++++++++----------- tools/configure/configure.pro | 1 + tools/configure/configureapp.cpp | 13 ++++++++++++- 4 files changed, 43 insertions(+), 14 deletions(-) diff --git a/configure b/configure index cd29e95..c579ccc 100755 --- a/configure +++ b/configure @@ -676,6 +676,7 @@ CFG_RELEASE_QMAKE=no CFG_PHONON=auto CFG_PHONON_BACKEND=yes CFG_MULTIMEDIA=yes +CFG_MEDIASERVICE=yes CFG_AUDIO_BACKEND=yes CFG_SVG=yes CFG_DECLARATIVE=auto @@ -921,7 +922,7 @@ while [ "$#" -gt 0 ]; do VAL=no ;; #Qt style yes options - -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-webkit|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config) + -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-mediaservice|-audio-backend|-svg|-declarative|-webkit|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config) VAR=`echo $1 | sed "s,^-\(.*\),\1,"` VAL=yes ;; @@ -2099,6 +2100,13 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; + mediaservice) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_MEDIASERVICE="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; audio-backend) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then CFG_AUDIO_BACKEND="$VAL" @@ -3301,7 +3309,8 @@ Usage: $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info] [-armfpa] [-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns] [-no-multimedia] [-multimedia] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend] - [-no-audio-backend] [-audio-backend] [-no-openssl] [-openssl] [-openssl-linked] + [-no-mediaservice] [-mediaservice] [-no-audio-backend] [-audio-backend] + [-no-openssl] [-openssl] [-openssl-linked] [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-no-javascript-jit] [-javascript-jit] [-no-script] [-script] [-no-scripttools] [-scripttools] [-no-declarative] [-declarative] @@ -3439,6 +3448,9 @@ fi -no-multimedia ..... Do not build the QtMultimedia module. + -multimedia ........ Build the QtMultimedia module. + -no-mediaservice.... Do not build platform mediaservice plugin. + + -mediaservice ...... Build the platform mediaservice plugin. + -no-audio-backend .. Do not build the platform audio backend into QtMultimedia. + -audio-backend ..... Build the platform audio backend into QtMultimedia if available. @@ -6489,6 +6501,9 @@ if [ "$CFG_MULTIMEDIA" = "no" ]; then QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MULTIMEDIA" else QT_CONFIG="$QT_CONFIG multimedia" + if [ "$CFG_MEDIASERVICE" = "yes" ]; then + QT_CONFIG="$QT_CONFIG mediaservice" + fi fi if [ "$CFG_AUDIO_BACKEND" = "yes" ]; then diff --git a/src/plugins/mediaservices/mediaservices.pro b/src/plugins/mediaservices/mediaservices.pro index 55e6aba..0cef605 100644 --- a/src/plugins/mediaservices/mediaservices.pro +++ b/src/plugins/mediaservices/mediaservices.pro @@ -1,18 +1,20 @@ TEMPLATE = subdirs -win32:!wince: SUBDIRS += directshow +contains(QT_CONFIG, mediaservice) { + win32:!wince: SUBDIRS += directshow -mac: SUBDIRS += qt7 + mac: SUBDIRS += qt7 -unix:!mac:!symbian { - TMP_GST_LIBS = \ - gstreamer-0.10 >= 0.10.19 \ - gstreamer-base-0.10 >= 0.10.19 \ - gstreamer-interfaces-0.10 >= 0.10.19 \ - gstreamer-audio-0.10 >= 0.10.19 \ - gstreamer-video-0.10 >= 0.10.19 + unix:!mac:!symbian { + TMP_GST_LIBS = \ + gstreamer-0.10 >= 0.10.19 \ + gstreamer-base-0.10 >= 0.10.19 \ + gstreamer-interfaces-0.10 >= 0.10.19 \ + gstreamer-audio-0.10 >= 0.10.19 \ + gstreamer-video-0.10 >= 0.10.19 - system(pkg-config --exists \'$${TMP_GST_LIBS}\' --print-errors): { - SUBDIRS += gstreamer + system(pkg-config --exists \'$${TMP_GST_LIBS}\' --print-errors): { + SUBDIRS += gstreamer + } } } diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro index 91de7c2..d926a76 100644 --- a/tools/configure/configure.pro +++ b/tools/configure/configure.pro @@ -119,3 +119,4 @@ DEFINES += COMMERCIAL_VERSION INCLUDEPATH += $$QT_SOURCE_TREE/src/corelib/arch/generic \ $$QT_SOURCE_TREE/include/QtCore \ + $$QT_SOURCE_TREE/tools/shared diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 8c2a015..172dcd4 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -248,6 +248,7 @@ Configure::Configure( int& argc, char** argv ) dictionary[ "PHONON_BACKEND" ] = "yes"; dictionary[ "MULTIMEDIA" ] = "yes"; dictionary[ "AUDIO_BACKEND" ] = "auto"; + dictionary[ "MEDIASERVICE"] = "auto"; dictionary[ "DIRECTSHOW" ] = "no"; dictionary[ "WEBKIT" ] = "auto"; dictionary[ "DECLARATIVE" ] = "auto"; @@ -907,6 +908,10 @@ void Configure::parseCmdLine() dictionary[ "AUDIO_BACKEND" ] = "yes"; } else if( configCmdLine.at(i) == "-no-audio-backend" ) { dictionary[ "AUDIO_BACKEND" ] = "no"; + } else if( configCmdLine.at(i) == "-mediaservice") { + dictionary[ "MEDIASERVICE" ] = "yes"; + } else if (configCmdLine.at(i) == "-no-mediaservice") { + dictionary[ "MEDIASERVICE" ] = "no"; } else if( configCmdLine.at(i) == "-no-phonon" ) { dictionary[ "PHONON" ] = "no"; } else if( configCmdLine.at(i) == "-phonon" ) { @@ -1763,6 +1768,8 @@ bool Configure::displayHelp() desc("MULTIMEDIA", "yes","-multimedia", "Compile in multimedia module"); desc("AUDIO_BACKEND", "no","-no-audio-backend", "Do not compile in the platform audio backend into QtMultimedia"); desc("AUDIO_BACKEND", "yes","-audio-backend", "Compile in the platform audio backend into QtMultimedia"); + desc("MEDIASERVICE", "no","-no-mediaservice", "Do not compile in the platform-specific QtMultimedia media service."); + desc("MEDIASERVICE", "yes","-mediaservice", "Compile in the platform-specific QtMultimedia media service."); desc("WEBKIT", "no", "-no-webkit", "Do not compile in the WebKit module"); desc("WEBKIT", "yes", "-webkit", "Compile in the WebKit module (WebKit is built if a decent C++ compiler is used.)"); desc("SCRIPT", "no", "-no-script", "Do not build the QtScript module."); @@ -2044,7 +2051,7 @@ bool Configure::checkAvailability(const QString &part) && dictionary.value("QMAKESPEC") != "win32-msvc.net" // Leave for now, since we can't be sure if they are using 2002 or 2003 with this spec && dictionary.value("QMAKESPEC") != "win32-msvc2002" && dictionary.value("EXCEPTIONS") == "yes"; - } else if (part == "PHONON") { + } else if (part == "PHONON" || part == "MEDIASERVICE") { available = findFile("vmr9.h") && findFile("dshow.h") && findFile("dmo.h") && findFile("dmodshow.h") && (findFile("strmiids.lib") || findFile("libstrmiids.a")) && (findFile("dmoguids.lib") || findFile("libdmoguids.a")) @@ -2204,6 +2211,8 @@ void Configure::autoDetection() dictionary["DECLARATIVE"] = checkAvailability("DECLARATIVE") ? "yes" : "no"; if (dictionary["AUDIO_BACKEND"] == "auto") dictionary["AUDIO_BACKEND"] = checkAvailability("AUDIO_BACKEND") ? "yes" : "no"; + if (dictionary["MEDIASERVICE"] == "auto") + dictionary["MEDIASERVICE"] = checkAvailability("MEDIASERVICE") ? "yes" : "no"; // Qt/WinCE remote test application if (dictionary["CETEST"] == "auto") @@ -2594,6 +2603,8 @@ void Configure::generateOutputVars() qtConfig += "multimedia"; if (dictionary["AUDIO_BACKEND"] == "yes") qtConfig += "audio-backend"; + if (dictionary["MEDIASERVICE"] == "yes") + qtConfig += "mediaservice"; } if (dictionary["WEBKIT"] == "yes") -- cgit v0.12 From 74706e6bd25f0a2a7e65925309c8774df1cc2ee8 Mon Sep 17 00:00:00 2001 From: Andrew den Exter <andrew.den-exter@nokia.com> Date: Wed, 24 Feb 2010 12:58:00 +1000 Subject: Rebuild configure.exe --- configure.exe | Bin 1008128 -> 1221632 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/configure.exe b/configure.exe index 9974236..f937ea2 100755 Binary files a/configure.exe and b/configure.exe differ -- cgit v0.12 From 800d6691c5fd9c7139ff8b32aab39eab72e443f8 Mon Sep 17 00:00:00 2001 From: Warwick Allison <warwick.allison@nokia.com> Date: Wed, 24 Feb 2010 15:48:57 +1000 Subject: Uses Qt.widgets (still doesn't work yet...) --- tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml b/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml index 70fafd6..c00173d 100644 --- a/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml +++ b/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import Qt.widgets 4.6 QGraphicsView { objectName: "GView" -- cgit v0.12 From 754c72b54409f4ed124f5ba53a20f0bfc53e448d Mon Sep 17 00:00:00 2001 From: Justin McPherson <justin.mcpherson@nokia.com> Date: Wed, 24 Feb 2010 17:37:38 +1000 Subject: QMediaContent test; make sure to use network. Reviewed-by: Andrew den Exter --- tests/auto/qmediacontent/qmediacontent.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qmediacontent/qmediacontent.pro b/tests/auto/qmediacontent/qmediacontent.pro index f7884f6..6c13c8b 100644 --- a/tests/auto/qmediacontent/qmediacontent.pro +++ b/tests/auto/qmediacontent/qmediacontent.pro @@ -2,5 +2,5 @@ load(qttest_p4) SOURCES += tst_qmediacontent.cpp -QT = core multimedia +QT = core network multimedia -- cgit v0.12 From 63cb5d9dea14050db706ca69880a494db5a3c547 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Wed, 24 Feb 2010 10:14:25 +0100 Subject: compile fix with namespaces after a broken automatical merge --- src/multimedia/base/qmediaserviceprovider.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/multimedia/base/qmediaserviceprovider.cpp b/src/multimedia/base/qmediaserviceprovider.cpp index 76377d9..02c9b29 100644 --- a/src/multimedia/base/qmediaserviceprovider.cpp +++ b/src/multimedia/base/qmediaserviceprovider.cpp @@ -594,8 +594,6 @@ QMediaServiceProvider *QMediaServiceProvider::defaultServiceProvider() #endif } -QT_END_NAMESPACE - /*! \class QMediaServiceProviderPlugin \preliminary -- cgit v0.12 From 8a6ac436b00de84501dba5968f960dd3f4561dd3 Mon Sep 17 00:00:00 2001 From: Justin McPherson <justin.mcpherson@nokia.com> Date: Thu, 25 Feb 2010 10:27:16 +1000 Subject: Change Multimedia declarative module in line with recent commits. --- src/multimedia/qml/multimediadeclarative.cpp | 15 +++++++++------ src/multimedia/qml/multimediadeclarative.h | 4 +++- src/plugins/qdeclarativemodules/multimedia/multimedia.cpp | 4 ++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/multimedia/qml/multimediadeclarative.cpp b/src/multimedia/qml/multimediadeclarative.cpp index be49915..cfb8999 100644 --- a/src/multimedia/qml/multimediadeclarative.cpp +++ b/src/multimedia/qml/multimediadeclarative.cpp @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#include <QtMultimedia/multimediaqml.h> +#include <QtMultimedia/multimediadeclarative.h> #include <QtMultimedia/private/qsoundeffect_p.h> -#include <QtMultimedia/private/qmlaudio_p.h> -#include <QtMultimedia/private/qmlgraphicsvideo_p.h> +#include <QtMultimedia/private/qdeclarativeaudio_p.h> +#include <QtMultimedia/private/qdeclarativevideo_p.h> QT_BEGIN_NAMESPACE @@ -55,11 +55,14 @@ namespace QtMultimedia \internal */ -void qRegisterQmlElements() +void qRegisterDeclarativeElements(QDeclarativeEngine *engine, const char *uri) { + Q_UNUSED(engine) + Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.multimedia")); + qmlRegisterType<QSoundEffect>("Qt.multimedia", 4, 7, "SoundEffect", "SoundEffect"); - qmlRegisterType<QmlAudio>("Qt.multimedia", 4, 7, "Audio", "Audio"); - qmlRegisterType<QmlGraphicsVideo>("Qt.multimedia", 4, 7, "Video", "Video"); + qmlRegisterType<QDeclarativeAudio>("Qt.multimedia", 4, 7, "Audio", "Audio"); + qmlRegisterType<QDeclarativeVideo>("Qt.multimedia", 4, 7, "Video", "Video"); } } diff --git a/src/multimedia/qml/multimediadeclarative.h b/src/multimedia/qml/multimediadeclarative.h index 41274c8..befddb6 100644 --- a/src/multimedia/qml/multimediadeclarative.h +++ b/src/multimedia/qml/multimediadeclarative.h @@ -49,9 +49,11 @@ QT_BEGIN_NAMESPACE QT_MODULE(Multimedia) +class QDeclarativeEngine; + namespace QtMultimedia { -extern void Q_MULTIMEDIA_EXPORT qRegisterQmlElements(); +extern void Q_MULTIMEDIA_EXPORT qRegisterDeclarativeElements(QDeclarativeEngine* engine, const char *uri); } QT_END_NAMESPACE diff --git a/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp b/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp index 1158c88..e27dd8d 100644 --- a/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp +++ b/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp @@ -41,7 +41,7 @@ #include <QtDeclarative/qdeclarativeextensionplugin.h> #include <QtDeclarative/qdeclarative.h> -#include <QtMultimedia/qdeclarative.h> +#include <QtMultimedia/multimediadeclarative.h> QT_BEGIN_NAMESPACE @@ -51,7 +51,7 @@ class QMultimediaQmlModule : public QDeclarativeExtensionPlugin public: virtual void initialize(QDeclarativeEngine *engine, const char *uri) { - QtMultimedia::qRegisterQmlElements(engine, uri); + QtMultimedia::qRegisterDeclarativeElements(engine, uri); } }; -- cgit v0.12 From 88eb10ee9163777d7534e3c7bb297745e0ed102e Mon Sep 17 00:00:00 2001 From: Justin McPherson <justin.mcpherson@nokia.com> Date: Thu, 25 Feb 2010 10:28:30 +1000 Subject: Fix include of renamed header --- src/multimedia/qml/qdeclarativeaudio_p.h | 2 +- src/multimedia/qml/qdeclarativevideo_p.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/multimedia/qml/qdeclarativeaudio_p.h b/src/multimedia/qml/qdeclarativeaudio_p.h index a3fe1e8..d1fb275 100644 --- a/src/multimedia/qml/qdeclarativeaudio_p.h +++ b/src/multimedia/qml/qdeclarativeaudio_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include <QtMultimedia/private/qmlmediabase_p.h> +#include <QtMultimedia/private/qdeclarativemediabase_p.h> #include <QtCore/qbasictimer.h> #include <QtDeclarative/qdeclarativeitem.h> diff --git a/src/multimedia/qml/qdeclarativevideo_p.h b/src/multimedia/qml/qdeclarativevideo_p.h index 8d9ec20..d5ebde1 100644 --- a/src/multimedia/qml/qdeclarativevideo_p.h +++ b/src/multimedia/qml/qdeclarativevideo_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include <QtMultimedia/private/qmlmediabase_p.h> +#include <QtMultimedia/private/qdeclarativemediabase_p.h> #include <QtMultimedia/qgraphicsvideoitem.h> -- cgit v0.12 From b888a694c35fb0c291942a2aa4a056d7deec3245 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy <aaron.kennedy@nokia.com> Date: Thu, 25 Feb 2010 10:29:39 +1000 Subject: Revert "Add QDeclarativeGraphicsWidget, a QGraphicsWidget version of QmlView" This reverts commit 327d212f5cff81f1c21b7be5c54b3e1eab4f0ac5. --- doc/src/declarative/integrating.qdoc | 10 - .../util/qdeclarativegraphicswidget.cpp | 457 --------------------- src/declarative/util/qdeclarativegraphicswidget.h | 113 ----- src/declarative/util/util.pri | 6 +- 4 files changed, 2 insertions(+), 584 deletions(-) delete mode 100644 src/declarative/util/qdeclarativegraphicswidget.cpp delete mode 100644 src/declarative/util/qdeclarativegraphicswidget.h diff --git a/doc/src/declarative/integrating.qdoc b/doc/src/declarative/integrating.qdoc index 09ed178..c685d3d 100644 --- a/doc/src/declarative/integrating.qdoc +++ b/doc/src/declarative/integrating.qdoc @@ -86,9 +86,6 @@ QGraphicsObject *object = scene->addItem(object); \endcode -There is a convenience QGraphicsWidget subclass, QDeclarativeGraphicsWidget, which takes care of the engine -and component instantiation for you. - The following QGraphicsView options are recommended for optimal performance of QML UIs: @@ -98,13 +95,6 @@ of QML UIs: \o QGraphicsScene::setItemIndexMethod(QGraphicsScene::NoIndex); \endlist -And the following QGraphicsView options are required for QML key handling to work: - -\list -\o QGraphicsView::viewport()->setFocusPolicy(Qt::NoFocus); -\o QGraphicsScene::setStickyFocus(true); -\endlist - \section1 Using existing QGraphicsWidgets in QML Another way of integrating with a QGraphicsView based UI is to expose your existing QGraphicsWidgets to QML, and constructing your scene in QML. Note that diff --git a/src/declarative/util/qdeclarativegraphicswidget.cpp b/src/declarative/util/qdeclarativegraphicswidget.cpp deleted file mode 100644 index 1d0d468..0000000 --- a/src/declarative/util/qdeclarativegraphicswidget.cpp +++ /dev/null @@ -1,457 +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 QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativegraphicswidget.h" - -#include "qperformancelog_p_p.h" -#include "qfxperf_p_p.h" - -#include <qdeclarative.h> -#include <qdeclarativeitem.h> -#include <qdeclarativeengine.h> -#include <qdeclarativecontext.h> -#include <qdeclarativedebug_p.h> -#include <qdeclarativedebugservice_p.h> -#include <qdeclarativeglobal_p.h> -#include <qdeclarativeerror.h> - -#include <qscriptvalueiterator.h> -#include <qdebug.h> -#include <qtimer.h> -#include <qevent.h> -#include <qdir.h> -#include <qcoreapplication.h> -#include <qfontdatabase.h> -#include <qicon.h> -#include <qurl.h> -#include <qboxlayout.h> -#include <qbasictimer.h> -#include <QtCore/qabstractanimation.h> -#include <private/qguard_p.h> - -QT_BEGIN_NAMESPACE - -class QDeclarativeGraphicsWidgetSharedQDeclarativeEngine -{ -public: - QDeclarativeGraphicsWidgetSharedQDeclarativeEngine(){} - - static QDeclarativeEngine* sharedEngine(){ - if(!references) - return 0; - return &QDeclarativeGraphicsWidgetSharedQDeclarativeEngine::m_instance->engine; - } - static void attach(){ - if(!references++) - m_instance = new QDeclarativeGraphicsWidgetSharedQDeclarativeEngine(); - } - - static void detach(){ - if(!--references) - delete m_instance; - } - -private: - static QDeclarativeGraphicsWidgetSharedQDeclarativeEngine* m_instance; - static int references; - QDeclarativeEngine engine; -}; - -int QDeclarativeGraphicsWidgetSharedQDeclarativeEngine::references = 0; -QDeclarativeGraphicsWidgetSharedQDeclarativeEngine* QDeclarativeGraphicsWidgetSharedQDeclarativeEngine::m_instance = 0; - -class QDeclarativeGraphicsWidgetPrivate -{ -public: - QDeclarativeGraphicsWidgetPrivate() - : root(0), component(0), - resizeMode(QDeclarativeGraphicsWidget::SizeViewToRootObject) - { - QDeclarativeGraphicsWidgetSharedQDeclarativeEngine::attach(); - engine = QDeclarativeGraphicsWidgetSharedQDeclarativeEngine::sharedEngine(); - } - - ~QDeclarativeGraphicsWidgetPrivate() - { - QDeclarativeGraphicsWidgetSharedQDeclarativeEngine::detach(); - } - - QGuard<QGraphicsObject> root; - QGuard<QDeclarativeItem> declarativeRoot; - - QUrl source; - - QDeclarativeEngine* engine; - QDeclarativeComponent *component; - QBasicTimer resizetimer; - - mutable QSize initialSize; - QDeclarativeGraphicsWidget::ResizeMode resizeMode; - - void init(); - -}; - -/*! - \class QDeclarativeGraphicsWidget - \brief The QDeclarativeGraphicsWidget class provides a QGraphicsWidget for displaying a Qt Declarative user interface. - - Any QGraphicsObject or QDeclarativeGraphicsItem - created via Qt Declarative can be placed on a standard QGraphicsScene and viewed with a standard - QGraphicsView. - - QDeclarativeGraphicsWidget is a convenience class which handles QDeclarativeComponent loading and object creation. - It shares the same QDeclarativeEngine between all QDeclarativeGraphicsWidgets in the application, to minimize overhead. - - QDeclarativeGraphicsWidget is ideal for when you have many small components styled with Qt Declarative, and want to integrate - them into a larger QGraphicsItem based scene. If your interface is primarily Qt Declarative based, consider using QDeclarativeView - instead. - - Note that the following settings on your QGraphicsScene/View are recommended for optimal performance with Qt Declarative: - \list - \o QGraphicsView::setOptimizationFlags(QGraphicsView::DontSavePainterState); - \o QGraphicsView::setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); - \o QGraphicsScene::setItemIndexMethod(QGraphicsScene::NoIndex); - \endlist - Also note that the following settings on your QGraphicsScene/View are required for key handling in Qt Declarative to work: - \list - \o QGraphicsView::viewport()->setFocusPolicy(Qt::NoFocus); - \o QGraphicsScene::setStickyFocus(true); - \endlist - - To receive errors related to loading and executing declarative files with QDeclarativeGraphicsWidget, - you can connect to the statusChanged() signal and monitor for QDeclarativeGraphicsWidget::Error. - The errors are available via QDeclarativeGraphicsWidget::errors(). -*/ - - -/*! \fn void QDeclarativeGraphicsWidget::sceneResized(QSize size) - This signal is emitted when the view is resized to \a size. -*/ - -/*! \fn void QDeclarativeGraphicsWidget::statusChanged(QDeclarativeGraphicsWidget::Status status) - This signal is emitted when the component's current \l{QDeclarativeGraphicsWidget::Status} {status} changes. -*/ - -/*! - \fn QDeclarativeGraphicsWidget::QDeclarativeGraphicsWidget(QGraphicsItem *parent) - - Constructs a QDeclarativeGraphicsWidget with the given \a parent. -*/ -QDeclarativeGraphicsWidget::QDeclarativeGraphicsWidget(QGraphicsItem *parent) -: QGraphicsWidget(parent), d(new QDeclarativeGraphicsWidgetPrivate) -{ - setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); - d->init(); -} - -void QDeclarativeGraphicsWidgetPrivate::init() -{ -} - -/*! - The destructor clears the view's \l {QGraphicsObject} {items} and - deletes the internal representation. - */ -QDeclarativeGraphicsWidget::~QDeclarativeGraphicsWidget() -{ - delete d->root; - delete d; -} - -/*! - Sets the source to the \a url. - - Will also load the QML file and instantiate the component. - - */ -void QDeclarativeGraphicsWidget::setSource(const QUrl& url) -{ - d->source = url; - - //Execute - if(d->root) - delete d->root; - if(d->component) - delete d->component; - d->component = new QDeclarativeComponent(d->engine, d->source, this); - - if (!d->component->isLoading()) { - continueExecute(); - } else { - connect(d->component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(continueExecute())); - } -} - -/*! - Returns the source URL, if set. - - \sa setSource() - */ -QUrl QDeclarativeGraphicsWidget::source() const -{ - return d->source; -} - -/*! - Returns a pointer to the QDeclarativeEngine used for instantiating - Qt Declarative Components. - */ -QDeclarativeEngine* QDeclarativeGraphicsWidget::engine() -{ - return d->engine; -} - -/*! - This function returns the root of the context hierarchy. Each declarative - component is instantiated in a QDeclarativeContext. QDeclarativeContext's are - essential for passing data to declarative components. In Qt Declarative, contexts are - arranged hierarchically and this hierarchy is managed by the - QDeclarativeEngine. - */ -QDeclarativeContext* QDeclarativeGraphicsWidget::rootContext() -{ - return d->engine->rootContext(); -} - - -/*! - \enum QDeclarativeGraphicsWidget::Status - - Specifies the loading status of the QDeclarativeGraphicsWidget. - - \value Null This QDeclarativeGraphicsWidget has no source set. - \value Ready This QDeclarativeGraphicsWidget has loaded and created the declarative component. - \value Loading This QDeclarativeGraphicsWidget is loading network data. - \value Error An error has occured. Calling errorDescription() to retrieve a description. -*/ - -/*! - \property QDeclarativeGraphicsWidget::status - The component's current \l{QDeclarativeGraphicsWidget::Status} {status}. -*/ - -QDeclarativeGraphicsWidget::Status QDeclarativeGraphicsWidget::status() const -{ - if (!d->component) - return QDeclarativeGraphicsWidget::Null; - - return QDeclarativeGraphicsWidget::Status(d->component->status()); -} - -/*! - Return the list of errors that occured during the last compile or create - operation. An empty list is returned if isError() is not set. -*/ -QList<QDeclarativeError> QDeclarativeGraphicsWidget::errors() const -{ - if (d->component) - return d->component->errors(); - return QList<QDeclarativeError>(); -} - - -/*! - \property QDeclarativeGraphicsWidget::resizeMode - \brief whether the view should resize the canvas contents - - If this property is set to SizeViewToRootObject (the default), the view - resizes with the root item in the declarative file. - - If this property is set to SizeRootObjectToView, the view will - automatically resize the root item. - - Regardless of this property, the sizeHint of the view - is the initial size of the root item. Note though that - since declarative files may load dynamically, that size may change. - - \sa initialSize() -*/ - -void QDeclarativeGraphicsWidget::setResizeMode(ResizeMode mode) -{ - if (d->resizeMode == mode) - return; - - d->resizeMode = mode; - if (d->declarativeRoot) { - if (d->resizeMode == SizeRootObjectToView) { - d->declarativeRoot->setWidth(size().width()); - d->declarativeRoot->setHeight(size().height()); - } else { - d->declarativeRoot->setWidth(d->initialSize.width()); - d->declarativeRoot->setHeight(d->initialSize.height()); - } - } -} - -QDeclarativeGraphicsWidget::ResizeMode QDeclarativeGraphicsWidget::resizeMode() const -{ - return d->resizeMode; -} - -/*! - \internal - */ -void QDeclarativeGraphicsWidget::continueExecute() -{ - - disconnect(d->component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(continueExecute())); - - if (d->component->isError()) { - QList<QDeclarativeError> errorList = d->component->errors(); - foreach (const QDeclarativeError &error, errorList) { - qWarning() << error; - } - emit statusChanged(status()); - return; - } - - QObject *obj = d->component->create(); - - if(d->component->isError()) { - QList<QDeclarativeError> errorList = d->component->errors(); - foreach (const QDeclarativeError &error, errorList) { - qWarning() << error; - } - emit statusChanged(status()); - return; - } - - if (obj) { - if (QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(obj)) { - - item->QGraphicsItem::setParentItem(this); - item->QObject::setParent(this); - - d->root = item; - d->declarativeRoot = item; - connect(item, SIGNAL(widthChanged()), this, SLOT(sizeChanged())); - connect(item, SIGNAL(heightChanged()), this, SLOT(sizeChanged())); - if (d->initialSize.height() <= 0 && d->declarativeRoot->width() > 0) - d->initialSize.setWidth(d->declarativeRoot->width()); - if (d->initialSize.height() <= 0 && d->declarativeRoot->height() > 0) - d->initialSize.setHeight(d->declarativeRoot->height()); - resize(d->initialSize); - - if (d->resizeMode == SizeRootObjectToView) { - d->declarativeRoot->setWidth(size().width()); - d->declarativeRoot->setHeight(size().height()); - } else { - QSizeF sz(d->declarativeRoot->width(),d->declarativeRoot->height()); - emit sceneResized(sz); - resize(sz); - } - updateGeometry(); - } else if (QGraphicsObject *item = qobject_cast<QGraphicsObject *>(obj)) { - item->setParent(this); - qWarning() << "QDeclarativeGraphicsWidget::resizeMode is not honored for components of type QGraphicsObject"; - } else if (qobject_cast<QWidget *>(obj)) { - qWarning() << "QDeclarativeGraphicsWidget does not support loading QML files containing QWidgets"; - } - } - emit statusChanged(status()); -} - -/*! - \internal - */ -void QDeclarativeGraphicsWidget::sizeChanged() -{ - // delay, so we catch both width and height changing. - d->resizetimer.start(0,this); -} - -/*! - \internal - If the \l {QTimerEvent} {timer event} \a e is this - view's resize timer, sceneResized() is emitted. - */ -void QDeclarativeGraphicsWidget::timerEvent(QTimerEvent* e) -{ - if (!e || e->timerId() == d->resizetimer.timerId()) { - if (d->declarativeRoot) { - QSize sz(d->declarativeRoot->width(),d->declarativeRoot->height()); - emit sceneResized(sz); - } - d->resizetimer.stop(); - updateGeometry(); - } -} - -/*! - \internal - The size hint is the size of the root item. -*/ -QSizeF QDeclarativeGraphicsWidget::sizeHint() const -{ - if (d->declarativeRoot) { - if (d->initialSize.width() <= 0) - d->initialSize.setWidth(d->declarativeRoot->width()); - if (d->initialSize.height() <= 0) - d->initialSize.setHeight(d->declarativeRoot->height()); - } - return d->initialSize; -} - -/*! - Returns the view's root \l {QGraphicsObject} {item}. - */ -QGraphicsObject *QDeclarativeGraphicsWidget::rootObject() const -{ - return d->root; -} - -/*! - \internal - This function handles the \l {QGraphicsSceneResizeEvent} {resize event} - \a e. - */ -void QDeclarativeGraphicsWidget::resizeEvent(QGraphicsSceneResizeEvent *e) -{ - if (d->resizeMode == SizeRootObjectToView && d->declarativeRoot) { - d->declarativeRoot->setWidth(size().width()); - d->declarativeRoot->setHeight(size().height()); - } - QGraphicsWidget::resizeEvent(e); -} - -QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativegraphicswidget.h b/src/declarative/util/qdeclarativegraphicswidget.h deleted file mode 100644 index 33ebc7b..0000000 --- a/src/declarative/util/qdeclarativegraphicswidget.h +++ /dev/null @@ -1,113 +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 QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEGRAPHICSWIDGET_H -#define QDECLARATIVEGRAPHICSWIDGET_H - -#include <QtCore/qdatetime.h> -#include <QtCore/qurl.h> -#include <QtGui/qgraphicssceneevent.h> -#include <QtGui/qgraphicswidget.h> -#include <QtGui/qwidget.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QGraphicsObject; -class QDeclarativeEngine; -class QDeclarativeContext; -class QDeclarativeError; - -class QDeclarativeGraphicsWidgetPrivate; - -class Q_DECLARATIVE_EXPORT QDeclarativeGraphicsWidget : public QGraphicsWidget -{ - Q_OBJECT - Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode) - Q_PROPERTY(Status status READ status NOTIFY statusChanged) - Q_PROPERTY(QUrl source READ source WRITE setSource) - -public: - explicit QDeclarativeGraphicsWidget(QGraphicsItem *parent = 0); - virtual ~QDeclarativeGraphicsWidget(); - - QUrl source() const; - void setSource(const QUrl&); - - QDeclarativeEngine* engine(); - QDeclarativeContext* rootContext(); - - QGraphicsObject *rootObject() const; - - enum ResizeMode { SizeViewToRootObject, SizeRootObjectToView }; - ResizeMode resizeMode() const; - void setResizeMode(ResizeMode); - QSizeF sizeHint() const; - - enum Status { Null, Ready, Loading, Error }; - Status status() const; - - QList<QDeclarativeError> errors() const; - -Q_SIGNALS: - void sceneResized(QSizeF size); - void statusChanged(QDeclarativeGraphicsWidget::Status); - -private Q_SLOTS: - void continueExecute(); - void sizeChanged(); - -protected: - virtual void resizeEvent(QGraphicsSceneResizeEvent *); - void timerEvent(QTimerEvent*); - -private: - QDeclarativeGraphicsWidgetPrivate* d; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECLARATIVEGRAPHICSWIDGET_H diff --git a/src/declarative/util/util.pri b/src/declarative/util/util.pri index 46126e5..610eb3f 100644 --- a/src/declarative/util/util.pri +++ b/src/declarative/util/util.pri @@ -30,8 +30,7 @@ SOURCES += \ $$PWD/qdeclarativedatetimeformatter.cpp \ $$PWD/qdeclarativebehavior.cpp \ $$PWD/qdeclarativefontloader.cpp \ - $$PWD/qdeclarativestyledtext.cpp \ - $$PWD/qdeclarativegraphicswidget.cpp + $$PWD/qdeclarativestyledtext.cpp HEADERS += \ $$PWD/qdeclarativeutilmodule_p.h\ @@ -66,8 +65,7 @@ HEADERS += \ $$PWD/qdeclarativedatetimeformatter_p.h \ $$PWD/qdeclarativebehavior_p.h \ $$PWD/qdeclarativefontloader_p.h \ - $$PWD/qdeclarativestyledtext_p.h \ - $$PWD/qdeclarativegraphicswidget.h + $$PWD/qdeclarativestyledtext_p.h contains(QT_CONFIG, xmlpatterns) { QT+=xmlpatterns -- cgit v0.12 From d46c4d5d32a14ae119d88c59c00ebe62ae8ce027 Mon Sep 17 00:00:00 2001 From: Yann Bodson <yann.bodson@nokia.com> Date: Thu, 25 Feb 2010 11:49:31 +1000 Subject: QML Text item clipping logic was reversed Task-number: QTBUG-8180 --- src/declarative/graphicsitems/qdeclarativetext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 307b674..ca253df 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -811,8 +811,8 @@ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid break; } - bool needClip = !clip() && (d->imgCache.width() > width() || - d->imgCache.height() > height()); + bool needClip = clip() && (d->imgCache.width() > width() || + d->imgCache.height() > height()); if (needClip) { p->save(); -- cgit v0.12 From 43b1f81bc359a2c9d5c3d26f5110319803ef31c2 Mon Sep 17 00:00:00 2001 From: Warwick Allison <warwick.allison@nokia.com> Date: Thu, 25 Feb 2010 11:56:59 +1000 Subject: Make QML_REGISTER...TYPE functions unnecessary (still exist for now). Fix multimedia plugin. --- src/declarative/qml/qdeclarative.h | 26 +++++++++++----------- src/multimedia/qml/multimediadeclarative.cpp | 8 +++---- .../qdeclarativemodules/multimedia/multimedia.cpp | 4 ++-- .../qdeclarativemodules/widgets/widgets.cpp | 12 +++++----- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/declarative/qml/qdeclarative.h b/src/declarative/qml/qdeclarative.h index 3133d27..77b7484 100644 --- a/src/declarative/qml/qdeclarative.h +++ b/src/declarative/qml/qdeclarative.h @@ -87,9 +87,9 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) template<typename T> -int qmlRegisterType(const char *typeName) +int qmlRegisterType() { - QByteArray name(typeName); + QByteArray name(T::staticMetaObject.className()); QByteArray pointerName(name + '*'); QByteArray listName("QDeclarativeListProperty<" + name + ">"); @@ -119,9 +119,9 @@ int qmlRegisterType(const char *typeName) } template<typename T> -int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const char *typeName) +int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName) { - QByteArray name(typeName); + QByteArray name(T::staticMetaObject.className()); QByteArray pointerName(name + '*'); QByteArray listName("QDeclarativeListProperty<" + name + ">"); @@ -151,9 +151,9 @@ int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const c } template<typename T, typename E> -int qmlRegisterExtendedType(const char *typeName) +int qmlRegisterExtendedType() { - QByteArray name(typeName); + QByteArray name(T::staticMetaObject.className()); QByteArray pointerName(name + '*'); QByteArray listName("QDeclarativeListProperty<" + name + ">"); @@ -184,9 +184,9 @@ int qmlRegisterExtendedType(const char *typeName) template<typename T, typename E> int qmlRegisterExtendedType(const char *uri, int versionMajor, int versionMinor, - const char *qmlName, const char *typeName) + const char *qmlName) { - QByteArray name(typeName); + QByteArray name(T::staticMetaObject.className()); QByteArray pointerName(name + '*'); QByteArray listName("QDeclarativeListProperty<" + name + ">"); @@ -278,14 +278,14 @@ int qmlRegisterCustomType(const char *uri, int versionMajor, int versionMinor, #define QML_REGISTER_INTERFACE(INTERFACE) \ qmlRegisterInterface<INTERFACE>(#INTERFACE) -#define QML_REGISTER_EXTENDED_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE, EXTENSION) \ - qmlRegisterExtendedType<TYPE,EXTENSION>(#URI, VERSION_MAJ, VERSION_MIN, #NAME, #TYPE) +#define QML_REGISTER_EXTENDED_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, CLASS, EXTENSION) \ + qmlRegisterExtendedType<CLASS,EXTENSION>(#URI, VERSION_MAJ, VERSION_MIN, #NAME) -#define QML_REGISTER_TYPE(URI,VMAJ,VMIN,TYPE,CLASS) \ - qmlRegisterType<CLASS>(#URI, VMAJ, VMIN, #TYPE, #CLASS) +#define QML_REGISTER_TYPE(URI,VMAJ,VMIN,NAME,CLASS) \ + qmlRegisterType<CLASS>(#URI, VMAJ, VMIN, #NAME) #define QML_REGISTER_NOCREATE_TYPE(CLASS) \ - qmlRegisterType<CLASS>(#CLASS) + qmlRegisterType<CLASS>() class QDeclarativeContext; class QDeclarativeEngine; diff --git a/src/multimedia/qml/multimediadeclarative.cpp b/src/multimedia/qml/multimediadeclarative.cpp index cfb8999..ba4036f 100644 --- a/src/multimedia/qml/multimediadeclarative.cpp +++ b/src/multimedia/qml/multimediadeclarative.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include <QtMultimedia/multimediadeclarative.h> +#include <QtMultimedia/qdeclarative.h> #include <QtMultimedia/private/qsoundeffect_p.h> #include <QtMultimedia/private/qdeclarativeaudio_p.h> #include <QtMultimedia/private/qdeclarativevideo_p.h> @@ -60,9 +60,9 @@ void qRegisterDeclarativeElements(QDeclarativeEngine *engine, const char *uri) Q_UNUSED(engine) Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.multimedia")); - qmlRegisterType<QSoundEffect>("Qt.multimedia", 4, 7, "SoundEffect", "SoundEffect"); - qmlRegisterType<QDeclarativeAudio>("Qt.multimedia", 4, 7, "Audio", "Audio"); - qmlRegisterType<QDeclarativeVideo>("Qt.multimedia", 4, 7, "Video", "Video"); + qmlRegisterType<QSoundEffect>("Qt.multimedia", 4, 7, "SoundEffect"); + qmlRegisterType<QDeclarativeAudio>("Qt.multimedia", 4, 7, "Audio"); + qmlRegisterType<QDeclarativeVideo>("Qt.multimedia", 4, 7, "Video"); } } diff --git a/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp b/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp index e27dd8d..1158c88 100644 --- a/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp +++ b/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp @@ -41,7 +41,7 @@ #include <QtDeclarative/qdeclarativeextensionplugin.h> #include <QtDeclarative/qdeclarative.h> -#include <QtMultimedia/multimediadeclarative.h> +#include <QtMultimedia/qdeclarative.h> QT_BEGIN_NAMESPACE @@ -51,7 +51,7 @@ class QMultimediaQmlModule : public QDeclarativeExtensionPlugin public: virtual void initialize(QDeclarativeEngine *engine, const char *uri) { - QtMultimedia::qRegisterDeclarativeElements(engine, uri); + QtMultimedia::qRegisterQmlElements(engine, uri); } }; diff --git a/src/plugins/qdeclarativemodules/widgets/widgets.cpp b/src/plugins/qdeclarativemodules/widgets/widgets.cpp index dc45428..7229d88 100644 --- a/src/plugins/qdeclarativemodules/widgets/widgets.cpp +++ b/src/plugins/qdeclarativemodules/widgets/widgets.cpp @@ -127,12 +127,12 @@ public: QML_REGISTER_INTERFACE(QGraphicsLayoutItem); QML_REGISTER_INTERFACE(QGraphicsLayout); - qmlRegisterType<QGraphicsLinearLayoutStretchItemObject>(uri,4,6,"QGraphicsLinearLayoutStretchItem","QGraphicsLinearLayoutStretchItemObject"); - qmlRegisterType<QGraphicsLinearLayoutObject>(uri,4,6,"QGraphicsLinearLayout","QGraphicsLinearLayoutObject"); - qmlRegisterType<QGraphicsGridLayoutObject>(uri,4,6,"QGraphicsGridLayout","QGraphicsGridLayoutObject"); - qmlRegisterExtendedType<QGraphicsView, QGraphicsViewDeclarativeUI>(uri,4,6,"QGraphicsView","QGraphicsView"); - qmlRegisterExtendedType<QGraphicsScene,QGraphicsSceneDeclarativeUI>(uri,4,6,"QGraphicsScene","QGraphicsScene"); - qmlRegisterExtendedType<QGraphicsWidget,QGraphicsWidgetDeclarativeUI>(uri,4,6,"QGraphicsWidget","QGraphicsWidget"); + qmlRegisterType<QGraphicsLinearLayoutStretchItemObject>(uri,4,6,"QGraphicsLinearLayoutStretchItem"); + qmlRegisterType<QGraphicsLinearLayoutObject>(uri,4,6,"QGraphicsLinearLayout"); + qmlRegisterType<QGraphicsGridLayoutObject>(uri,4,6,"QGraphicsGridLayout"); + qmlRegisterExtendedType<QGraphicsView, QGraphicsViewDeclarativeUI>(uri,4,6,"QGraphicsView"); + qmlRegisterExtendedType<QGraphicsScene,QGraphicsSceneDeclarativeUI>(uri,4,6,"QGraphicsScene"); + qmlRegisterExtendedType<QGraphicsWidget,QGraphicsWidgetDeclarativeUI>(uri,4,6,"QGraphicsWidget"); QML_REGISTER_INTERFACE(QGraphicsItem); } }; -- cgit v0.12 From a645ab52a7ba10018419b552b8f50ce4b7ad9cd8 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy <aaron.kennedy@nokia.com> Date: Thu, 25 Feb 2010 12:45:38 +1000 Subject: Move private QDeclarativeMetaProperty functions into the private class We don't want to allow manipulation of bindings and signal properties through the public API. Equivalents of the public functions now exist in QDeclarativeMetaPropertyPrivate for internal use. --- src/declarative/qml/qdeclarativeenginedebug.cpp | 4 +- src/declarative/qml/qdeclarativemetaproperty.cpp | 43 ++++---- src/declarative/qml/qdeclarativemetaproperty.h | 7 -- src/declarative/qml/qdeclarativemetaproperty_p.h | 27 +++-- src/declarative/qml/qdeclarativepropertycache_p.h | 2 +- .../util/qdeclarativepropertychanges.cpp | 11 +- src/declarative/util/qdeclarativestate.cpp | 7 +- src/declarative/util/qdeclarativestate_p_p.h | 3 +- src/declarative/util/qdeclarativestategroup.cpp | 4 +- .../util/qdeclarativetransitionmanager.cpp | 10 +- .../qdeclarativedebug/tst_qdeclarativedebug.cpp | 4 +- .../tst_qdeclarativemetaproperty.cpp | 111 +++++++++++---------- 12 files changed, 128 insertions(+), 105 deletions(-) diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp index 6a81e52..2ae0b54 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp @@ -45,6 +45,7 @@ #include "qdeclarativeengine.h" #include "qdeclarativemetatype_p.h" #include "qdeclarativemetaproperty.h" +#include "qdeclarativemetaproperty_p.h" #include "qdeclarativebinding_p.h" #include "qdeclarativecontext_p.h" #include "qdeclarativewatcher_p.h" @@ -108,7 +109,8 @@ QDeclarativeEngineDebugServer::propertyData(QObject *obj, int propIdx) rv.valueTypeName = QString::fromUtf8(prop.typeName()); rv.name = QString::fromUtf8(prop.name()); rv.hasNotifySignal = prop.hasNotifySignal(); - QDeclarativeAbstractBinding *binding = QDeclarativeMetaProperty(obj, rv.name).binding(); + QDeclarativeAbstractBinding *binding = + QDeclarativeMetaPropertyPrivate::binding(QDeclarativeMetaProperty(obj, rv.name)); if (binding) rv.binding = binding->expression(); diff --git a/src/declarative/qml/qdeclarativemetaproperty.cpp b/src/declarative/qml/qdeclarativemetaproperty.cpp index e94ce8c..3bbc337 100644 --- a/src/declarative/qml/qdeclarativemetaproperty.cpp +++ b/src/declarative/qml/qdeclarativemetaproperty.cpp @@ -502,22 +502,23 @@ QMetaMethod QDeclarativeMetaProperty::method() const Returns the binding associated with this property, or 0 if no binding exists. */ -QDeclarativeAbstractBinding *QDeclarativeMetaProperty::binding() const +QDeclarativeAbstractBinding * +QDeclarativeMetaPropertyPrivate::binding(const QDeclarativeMetaProperty &that) { - if (!isProperty() || (type() & Attached) || !d->object) + if (!that.isProperty() || (that.type() & QDeclarativeMetaProperty::Attached) || !that.d->object) return 0; - QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(d->object); + QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(that.d->object); if (!data) return 0; - if (!data->hasBindingBit(d->core.coreIndex)) + if (!data->hasBindingBit(that.d->core.coreIndex)) return 0; QDeclarativeAbstractBinding *binding = data->bindings; while (binding) { // ### This wont work for value types - if (binding->propertyIndex() == d->core.coreIndex) + if (binding->propertyIndex() == that.d->core.coreIndex) return binding; binding = binding->m_nextBinding; } @@ -538,15 +539,17 @@ QDeclarativeAbstractBinding *QDeclarativeMetaProperty::binding() const the binding sets the intial value, it will use these flags for the write). */ QDeclarativeAbstractBinding * -QDeclarativeMetaProperty::setBinding(QDeclarativeAbstractBinding *newBinding, QDeclarativeMetaProperty::WriteFlags flags) const +QDeclarativeMetaPropertyPrivate::setBinding(const QDeclarativeMetaProperty &that, + QDeclarativeAbstractBinding *newBinding, + QDeclarativeMetaProperty::WriteFlags flags) { - if (!isProperty() || (type() & Attached) || !d->object) { + if (!that.isProperty() || (that.type() & QDeclarativeMetaProperty::Attached) || !that.d->object) { if (newBinding) newBinding->destroy(); return 0; } - return d->setBinding(d->object, d->core, newBinding, flags); + return that.d->setBinding(that.d->object, that.d->core, newBinding, flags); } QDeclarativeAbstractBinding * @@ -577,22 +580,24 @@ QDeclarativeMetaPropertyPrivate::setBinding(QObject *object, const QDeclarativeP return 0; } + /*! Returns the expression associated with this signal property, or 0 if no signal expression exists. */ -QDeclarativeExpression *QDeclarativeMetaProperty::signalExpression() const +QDeclarativeExpression * +QDeclarativeMetaPropertyPrivate::signalExpression(const QDeclarativeMetaProperty &that) { - if (!(type() & SignalProperty)) + if (!(that.type() & QDeclarativeMetaProperty::SignalProperty)) return 0; - const QObjectList &children = d->object->children(); + const QObjectList &children = that.d->object->children(); for (int ii = 0; ii < children.count(); ++ii) { QObject *child = children.at(ii); QDeclarativeBoundSignal *signal = QDeclarativeBoundSignal::cast(child); - if (signal && signal->index() == coreIndex()) + if (signal && signal->index() == that.coreIndex()) return signal->expression(); } @@ -606,25 +611,27 @@ QDeclarativeExpression *QDeclarativeMetaProperty::signalExpression() const Ownership of \a expr transfers to QML. Ownership of the return value is assumed by the caller. */ -QDeclarativeExpression *QDeclarativeMetaProperty::setSignalExpression(QDeclarativeExpression *expr) const +QDeclarativeExpression * +QDeclarativeMetaPropertyPrivate::setSignalExpression(const QDeclarativeMetaProperty &that, + QDeclarativeExpression *expr) { - if (!(type() & SignalProperty)) { + if (!(that.type() & QDeclarativeMetaProperty::SignalProperty)) { delete expr; return 0; } - const QObjectList &children = d->object->children(); + const QObjectList &children = that.d->object->children(); for (int ii = 0; ii < children.count(); ++ii) { QObject *child = children.at(ii); QDeclarativeBoundSignal *signal = QDeclarativeBoundSignal::cast(child); - if (signal && signal->index() == coreIndex()) + if (signal && signal->index() == that.coreIndex()) return signal->setExpression(expr); } if (expr) { - QDeclarativeBoundSignal *signal = new QDeclarativeBoundSignal(d->object, method(), d->object); + QDeclarativeBoundSignal *signal = new QDeclarativeBoundSignal(that.d->object, that.method(), that.d->object); return signal->setExpression(expr); } else { return 0; @@ -758,7 +765,7 @@ bool QDeclarativeMetaPropertyPrivate::writeValueProperty(const QVariant &value, { // Remove any existing bindings on this property if (!(flags & QDeclarativeMetaProperty::DontRemoveBinding)) { - QDeclarativeAbstractBinding *binding = q->setBinding(0); + QDeclarativeAbstractBinding *binding = setBinding(*q, 0); if (binding) binding->destroy(); } diff --git a/src/declarative/qml/qdeclarativemetaproperty.h b/src/declarative/qml/qdeclarativemetaproperty.h index 4dd6668..9a3a793 100644 --- a/src/declarative/qml/qdeclarativemetaproperty.h +++ b/src/declarative/qml/qdeclarativemetaproperty.h @@ -121,13 +121,6 @@ public: QMetaProperty property() const; - QDeclarativeAbstractBinding *binding() const; - QDeclarativeAbstractBinding *setBinding(QDeclarativeAbstractBinding *, - QDeclarativeMetaProperty::WriteFlags flags = QDeclarativeMetaProperty::DontRemoveBinding) const; - - QDeclarativeExpression *signalExpression() const; - QDeclarativeExpression *setSignalExpression(QDeclarativeExpression *) const; - static QDeclarativeMetaProperty createProperty(QObject *, const QString &, QDeclarativeContext *context=0); int coreIndex() const; diff --git a/src/declarative/qml/qdeclarativemetaproperty_p.h b/src/declarative/qml/qdeclarativemetaproperty_p.h index 9fd5ed2..b769e42 100644 --- a/src/declarative/qml/qdeclarativemetaproperty_p.h +++ b/src/declarative/qml/qdeclarativemetaproperty_p.h @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE class QDeclarativeContext; class QDeclarativeEnginePrivate; -class QDeclarativeMetaPropertyPrivate +class Q_AUTOTEST_EXPORT QDeclarativeMetaPropertyPrivate { public: QDeclarativeMetaPropertyPrivate() @@ -105,19 +105,32 @@ public: bool writeValueProperty(const QVariant &, QDeclarativeMetaProperty::WriteFlags); static const QMetaObject *rawMetaObjectForType(QDeclarativeEnginePrivate *, int); - static bool writeEnumProperty(const QMetaProperty &prop, int idx, QObject *object, const QVariant &value, int flags); - static bool write(QObject *, const QDeclarativePropertyCache::Data &, const QVariant &, QDeclarativeContext *, - QDeclarativeMetaProperty::WriteFlags flags = 0); - static QDeclarativeAbstractBinding *setBinding(QObject *, const QDeclarativePropertyCache::Data &, QDeclarativeAbstractBinding *, - QDeclarativeMetaProperty::WriteFlags flags = QDeclarativeMetaProperty::DontRemoveBinding); + static bool writeEnumProperty(const QMetaProperty &prop, int idx, QObject *object, + const QVariant &value, int flags); + static bool write(QObject *, const QDeclarativePropertyCache::Data &, const QVariant &, + QDeclarativeContext *, QDeclarativeMetaProperty::WriteFlags flags = 0); + static QDeclarativeAbstractBinding *setBinding(QObject *, const QDeclarativePropertyCache::Data &, + QDeclarativeAbstractBinding *, + QDeclarativeMetaProperty::WriteFlags flags = QDeclarativeMetaProperty::DontRemoveBinding); static QByteArray saveValueType(const QMetaObject *, int, const QMetaObject *, int); static QByteArray saveProperty(const QMetaObject *, int); - static QDeclarativeMetaProperty restore(const QByteArray &, QObject *, QDeclarativeContext * = 0); + static QDeclarativeMetaProperty restore(const QByteArray &, QObject *, QDeclarativeContext *); static bool equal(const QMetaObject *, const QMetaObject *); static bool canConvert(const QMetaObject *from, const QMetaObject *to); + + + // "Public" (to QML) methods + static QDeclarativeAbstractBinding *binding(const QDeclarativeMetaProperty &that); + static QDeclarativeAbstractBinding *setBinding(const QDeclarativeMetaProperty &that, + QDeclarativeAbstractBinding *, + QDeclarativeMetaProperty::WriteFlags flags = QDeclarativeMetaProperty::DontRemoveBinding); + static QDeclarativeExpression *signalExpression(const QDeclarativeMetaProperty &that); + static QDeclarativeExpression *setSignalExpression(const QDeclarativeMetaProperty &that, + QDeclarativeExpression *) ; + }; QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativepropertycache_p.h b/src/declarative/qml/qdeclarativepropertycache_p.h index 7f4b174..68e6e6b 100644 --- a/src/declarative/qml/qdeclarativepropertycache_p.h +++ b/src/declarative/qml/qdeclarativepropertycache_p.h @@ -58,7 +58,7 @@ #include <QtCore/qvector.h> -#include <private/qscriptdeclarativeclass_p.h> +#include <QtScript/private/qscriptdeclarativeclass_p.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index 5907ddb..ad39574 100644 --- a/src/declarative/util/qdeclarativepropertychanges.cpp +++ b/src/declarative/util/qdeclarativepropertychanges.cpp @@ -50,6 +50,7 @@ #include <qdeclarativebinding_p.h> #include <qdeclarativecontext.h> #include <qdeclarativeguard_p.h> +#include <qdeclarativemetaproperty_p.h> #include <QtCore/qdebug.h> @@ -132,12 +133,12 @@ public: QDeclarativeGuard<QDeclarativeExpression> ownedExpression; virtual void execute() { - ownedExpression = property.setSignalExpression(expression); + ownedExpression = QDeclarativeMetaPropertyPrivate::setSignalExpression(property, expression); } virtual bool isReversable() { return true; } virtual void reverse() { - ownedExpression = property.setSignalExpression(reverseExpression); + ownedExpression = QDeclarativeMetaPropertyPrivate::setSignalExpression(property, reverseExpression); } virtual void saveOriginals() { @@ -146,9 +147,11 @@ public: } virtual void rewind() { - ownedExpression = property.setSignalExpression(rewindExpression); + ownedExpression = QDeclarativeMetaPropertyPrivate::setSignalExpression(property, rewindExpression); + } + virtual void saveCurrentValues() { + rewindExpression = QDeclarativeMetaPropertyPrivate::signalExpression(property); } - virtual void saveCurrentValues() { rewindExpression = property.signalExpression(); } virtual bool override(QDeclarativeActionEvent*other) { if (other == this) diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index 5c3b909..d1dd318 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -334,7 +334,7 @@ void QDeclarativeState::cancel() void QDeclarativeAction::deleteFromBinding() { if (fromBinding) { - property.setBinding(0); + QDeclarativeMetaPropertyPrivate::setBinding(property, 0); fromBinding->destroy(); fromBinding = 0; } @@ -388,7 +388,7 @@ void QDeclarativeState::apply(QDeclarativeStateGroup *group, QDeclarativeTransit else if (action.event->isRewindable()) action.event->saveCurrentValues(); } else { - action.fromBinding = action.property.binding(); + action.fromBinding = QDeclarativeMetaPropertyPrivate::binding(action.property); for (jj = 0; jj < d->revertList.count(); ++jj) { if (d->revertList.at(jj).property == action.property) { @@ -436,7 +436,8 @@ void QDeclarativeState::apply(QDeclarativeStateGroup *group, QDeclarativeTransit } if (!found) { QVariant cur = d->revertList.at(ii).property.read(); - QDeclarativeAbstractBinding *delBinding = d->revertList.at(ii).property.setBinding(0); + QDeclarativeAbstractBinding *delBinding = + QDeclarativeMetaPropertyPrivate::setBinding(d->revertList.at(ii).property, 0); if (delBinding) delBinding->destroy(); diff --git a/src/declarative/util/qdeclarativestate_p_p.h b/src/declarative/util/qdeclarativestate_p_p.h index dd925f2..6b32f04 100644 --- a/src/declarative/util/qdeclarativestate_p_p.h +++ b/src/declarative/util/qdeclarativestate_p_p.h @@ -58,6 +58,7 @@ #include "qdeclarativeanimation_p_p.h" #include "qdeclarativetransitionmanager_p_p.h" +#include <qdeclarativemetaproperty_p.h> #include <qdeclarativeguard_p.h> #include <private/qobject_p.h> @@ -76,7 +77,7 @@ public: event = a.event; if (state == StartState) { value = a.fromValue; - binding = property.binding(); + binding = QDeclarativeMetaPropertyPrivate::binding(property); reverseEvent = true; } else { value = a.toValue; diff --git a/src/declarative/util/qdeclarativestategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp index 0b81a53..1a7c256 100644 --- a/src/declarative/util/qdeclarativestategroup.cpp +++ b/src/declarative/util/qdeclarativestategroup.cpp @@ -59,7 +59,7 @@ class QDeclarativeStateGroupPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QDeclarativeStateGroup) public: - QDeclarativeStateGroupPrivate(QDeclarativeStateGroup *p) + QDeclarativeStateGroupPrivate() : nullState(0), componentComplete(true), ignoreTrans(false), applyingState(false) {} @@ -111,7 +111,7 @@ public: */ QDeclarativeStateGroup::QDeclarativeStateGroup(QObject *parent) - : QObject(*(new QDeclarativeStateGroupPrivate(this)), parent) + : QObject(*(new QDeclarativeStateGroupPrivate), parent) { } diff --git a/src/declarative/util/qdeclarativetransitionmanager.cpp b/src/declarative/util/qdeclarativetransitionmanager.cpp index b5841dc..9fa1488 100644 --- a/src/declarative/util/qdeclarativetransitionmanager.cpp +++ b/src/declarative/util/qdeclarativetransitionmanager.cpp @@ -98,7 +98,7 @@ void QDeclarativeTransitionManagerPrivate::applyBindings() { foreach(const QDeclarativeAction &action, bindingsList) { if (action.toBinding) { - action.property.setBinding(action.toBinding); + QDeclarativeMetaPropertyPrivate::setBinding(action.property, action.toBinding); } else if (action.event) { if (action.reverseEvent) action.event->reverse(); @@ -122,7 +122,7 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> & if (action.toBinding) d->bindingsList << action; if (action.fromBinding) - action.property.setBinding(0); // Disable current binding + QDeclarativeMetaPropertyPrivate::setBinding(action.property, 0); // Disable current binding if (action.event && action.event->changesBindings()) { //### assume isReversable()? d->bindingsList << action; if (action.reverseEvent) @@ -149,7 +149,7 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> & for (int ii = 0; ii < applyList.size(); ++ii) { const QDeclarativeAction &action = applyList.at(ii); if (action.toBinding) { - action.property.setBinding(action.toBinding, QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding); + QDeclarativeMetaPropertyPrivate::setBinding(action.property, action.toBinding, QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding); } else if (!action.event) { action.property.write(action.toValue, QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding); } else if (action.event->isReversable()) { @@ -190,7 +190,7 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> & } if (action.toBinding) - action.property.setBinding(0); // Make sure this is disabled during the transition + QDeclarativeMetaPropertyPrivate::setBinding(action.property, 0); // Make sure this is disabled during the transition action.property.write(action.fromValue, QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding); } @@ -266,7 +266,7 @@ void QDeclarativeTransitionManager::cancel() for(int i = 0; i < d->bindingsList.count(); ++i) { QDeclarativeAction action = d->bindingsList[i]; if (action.toBinding && action.deletableToBinding) { - action.property.setBinding(0); + QDeclarativeMetaPropertyPrivate::setBinding(action.property, 0); action.toBinding->destroy(); action.toBinding = 0; action.deletableToBinding = false; diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp index 40cd737..8d5a1f6 100644 --- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp +++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp @@ -58,6 +58,7 @@ #include <private/qdeclarativedebugservice_p.h> #include <private/qdeclarativerectangle_p.h> #include <private/qdeclarativemetatype_p.h> +#include <private/qdeclarativemetaproperty_p.h> #include "../shared/debugutil_p.h" @@ -216,7 +217,8 @@ void tst_QDeclarativeDebug::recursiveObjectTest(QObject *o, const QDeclarativeDe else QCOMPARE(p.valueTypeName(), QString::fromUtf8(pmeta.typeName())); - QDeclarativeAbstractBinding *binding = QDeclarativeMetaProperty(o, p.name()).binding(); + QDeclarativeAbstractBinding *binding = + QDeclarativeMetaPropertyPrivate::binding(QDeclarativeMetaProperty(o, p.name())); if (binding) QCOMPARE(binding->expression(), p.binding()); diff --git a/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp b/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp index e19bea0..42d77bb 100644 --- a/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp +++ b/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp @@ -42,6 +42,7 @@ #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativecomponent.h> #include <QtDeclarative/qdeclarativemetaproperty.h> +#include <QtDeclarative/private/qdeclarativemetaproperty_p.h> #include <private/qguard_p.h> #include <private/qdeclarativebinding_p.h> #include <QtGui/QLineEdit> @@ -160,11 +161,11 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty() QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); - QVERIFY(prop.binding() == 0); - QVERIFY(prop.setBinding(binding) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0); QVERIFY(binding == 0); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); QCOMPARE(prop.coreIndex(), -1); QCOMPARE(prop.valueTypeCoreIndex(), -1); @@ -248,11 +249,11 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object() QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); - QVERIFY(prop.binding() == 0); - QVERIFY(prop.setBinding(binding) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0); QVERIFY(binding == 0); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); QCOMPARE(prop.coreIndex(), -1); QCOMPARE(prop.valueTypeCoreIndex(), -1); @@ -295,13 +296,13 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object() QCOMPARE(prop.propertyType(), (int)QVariant::Int); QCOMPARE(prop.propertyTypeName(), "int"); QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); - QVERIFY(prop.binding() == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0); QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int"); - QVERIFY(prop.setBinding(binding) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0); QVERIFY(binding != 0); - QVERIFY(prop.binding() == binding); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(prop.valueTypeCoreIndex(), -1); @@ -349,11 +350,11 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string() QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); - QVERIFY(prop.binding() == 0); - QVERIFY(prop.setBinding(binding) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0); QVERIFY(binding == 0); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); QCOMPARE(prop.coreIndex(), -1); QCOMPARE(prop.valueTypeCoreIndex(), -1); @@ -396,13 +397,13 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string() QCOMPARE(prop.propertyType(), (int)QVariant::Int); QCOMPARE(prop.propertyTypeName(), "int"); QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); - QVERIFY(prop.binding() == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0); QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int"); - QVERIFY(prop.setBinding(binding) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0); QVERIFY(binding != 0); - QVERIFY(prop.binding() == binding); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(prop.valueTypeCoreIndex(), -1); @@ -445,13 +446,13 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string() QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); - QVERIFY(prop.binding() == 0); - QVERIFY(prop.setBinding(binding) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0); QVERIFY(binding == 0); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression != 0); - QVERIFY(prop.signalExpression() == expression); + QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == expression); QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfMethod("clicked()")); QCOMPARE(prop.valueTypeCoreIndex(), -1); @@ -498,11 +499,11 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_context() QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); - QVERIFY(prop.binding() == 0); - QVERIFY(prop.setBinding(binding) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0); QVERIFY(binding == 0); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); QCOMPARE(prop.coreIndex(), -1); QCOMPARE(prop.valueTypeCoreIndex(), -1); @@ -545,13 +546,13 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_context() QCOMPARE(prop.propertyType(), (int)QVariant::Int); QCOMPARE(prop.propertyTypeName(), "int"); QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); - QVERIFY(prop.binding() == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0); QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int"); - QVERIFY(prop.setBinding(binding) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0); QVERIFY(binding != 0); - QVERIFY(prop.binding() == binding); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(prop.valueTypeCoreIndex(), -1); @@ -599,11 +600,11 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); - QVERIFY(prop.binding() == 0); - QVERIFY(prop.setBinding(binding) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0); QVERIFY(binding == 0); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); QCOMPARE(prop.coreIndex(), -1); QCOMPARE(prop.valueTypeCoreIndex(), -1); @@ -646,13 +647,13 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.propertyType(), (int)QVariant::Int); QCOMPARE(prop.propertyTypeName(), "int"); QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); - QVERIFY(prop.binding() == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0); QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int"); - QVERIFY(prop.setBinding(binding) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0); QVERIFY(binding != 0); - QVERIFY(prop.binding() == binding); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression == 0); QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty")); QCOMPARE(prop.valueTypeCoreIndex(), -1); @@ -695,13 +696,13 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); - QVERIFY(prop.binding() == 0); - QVERIFY(prop.setBinding(binding) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0); QVERIFY(binding == 0); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0); QVERIFY(expression != 0); - QVERIFY(prop.signalExpression() == expression); + QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == expression); QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfMethod("clicked()")); QCOMPARE(prop.valueTypeCoreIndex(), -1); @@ -824,8 +825,8 @@ void tst_qdeclarativemetaproperty::read() QDeclarativeMetaProperty p(&o, "onClicked"); QCOMPARE(p.read(), QVariant()); - QVERIFY(0 == p.setSignalExpression(new QDeclarativeExpression())); - QVERIFY(0 != p.signalExpression()); + QVERIFY(0 == QDeclarativeMetaPropertyPrivate::setSignalExpression(p, new QDeclarativeExpression())); + QVERIFY(0 != QDeclarativeMetaPropertyPrivate::signalExpression(p)); QCOMPARE(p.read(), QVariant()); } @@ -928,12 +929,12 @@ void tst_qdeclarativemetaproperty::write() QDeclarativeMetaProperty p(&o, "onClicked"); QCOMPARE(p.write(QVariant("console.log(1921)")), false); - QVERIFY(0 == p.setSignalExpression(new QDeclarativeExpression())); - QVERIFY(0 != p.signalExpression()); + QVERIFY(0 == QDeclarativeMetaPropertyPrivate::setSignalExpression(p, new QDeclarativeExpression())); + QVERIFY(0 != QDeclarativeMetaPropertyPrivate::signalExpression(p)); QCOMPARE(p.write(QVariant("console.log(1921)")), false); - QVERIFY(0 != p.signalExpression()); + QVERIFY(0 != QDeclarativeMetaPropertyPrivate::signalExpression(p)); } // Value-type property -- cgit v0.12 From eed6afb54c48892b0f748d7d8accbecadf0680af Mon Sep 17 00:00:00 2001 From: Joona Petrell <joona.t.petrell@nokia.com> Date: Thu, 25 Feb 2010 12:51:42 +1000 Subject: Add import Qt.widgets 4.6 to loader auto test using graphics widgets --- tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml b/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml index 627c7df..4ebf366 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import Qt.widgets 4.6 QGraphicsWidget { size: "250x250" -- cgit v0.12 From e5f169eaff00b68a233a76ddbac97201d819bc28 Mon Sep 17 00:00:00 2001 From: Yann Bodson <yann.bodson@nokia.com> Date: Thu, 25 Feb 2010 14:16:01 +1000 Subject: Connections example could be turned incorrectly Task-number: QTBUG-8345 --- examples/declarative/connections/connections.qml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/examples/declarative/connections/connections.qml b/examples/declarative/connections/connections.qml index ef2cb54..c140017 100644 --- a/examples/declarative/connections/connections.qml +++ b/examples/declarative/connections/connections.qml @@ -5,15 +5,11 @@ Rectangle { id: window; color: "#646464" width: 640; height: 480 - function turnLeft() { - image.rotation -= 90 - } - function turnRight() { - image.rotation += 90 - } + property int angle: 0 Image { id: image; source: "content/bg1.jpg"; anchors.centerIn: parent; transformOrigin: Item.Center + rotation: window.angle rotation: Behavior { NumberAnimation { easing.type: "OutCubic"; duration: 300 } } } @@ -26,6 +22,6 @@ Rectangle { anchors { right: parent.right; bottom: parent.bottom; rightMargin: 10; bottomMargin: 10 } } - Connection { sender: leftButton; signal: "clicked()"; script: window.turnLeft() } - Connection { sender: rightButton; signal: "clicked()"; script: window.turnRight() } + Connection { sender: leftButton; signal: "clicked()"; script: window.angle -= 90 } + Connection { sender: rightButton; signal: "clicked()"; script: window.angle += 90 } } -- cgit v0.12 From 9c147ba5e39dffea91d492896cc836529715d7ac Mon Sep 17 00:00:00 2001 From: Aaron Kennedy <aaron.kennedy@nokia.com> Date: Thu, 25 Feb 2010 14:11:52 +1000 Subject: Remove QDeclarativeMetaProperty::createProperty() method The behavior of createProperty() (to resolve dot properties) is now the behavior of the constructors. --- src/declarative/qml/qdeclarativemetaproperty.cpp | 190 ++++++++++----------- src/declarative/qml/qdeclarativemetaproperty.h | 2 - src/declarative/util/qdeclarativeanimation.cpp | 2 +- .../util/qdeclarativepropertychanges.cpp | 2 +- src/declarative/util/qdeclarativestate.cpp | 8 +- .../tst_qdeclarativelanguage.cpp | 2 +- .../tst_qdeclarativemetaproperty.cpp | 26 +-- 7 files changed, 106 insertions(+), 126 deletions(-) diff --git a/src/declarative/qml/qdeclarativemetaproperty.cpp b/src/declarative/qml/qdeclarativemetaproperty.cpp index 3bbc337..477ef3a 100644 --- a/src/declarative/qml/qdeclarativemetaproperty.cpp +++ b/src/declarative/qml/qdeclarativemetaproperty.cpp @@ -146,50 +146,111 @@ QDeclarativeMetaProperty::QDeclarativeMetaProperty(QObject *obj, const QString & if (!isValid()) { d->object = 0; d->context = 0; } } +Q_GLOBAL_STATIC(QDeclarativeValueTypeFactory, qmlValueTypes); + void QDeclarativeMetaPropertyPrivate::initProperty(QObject *obj, const QString &name) { - QDeclarativeEnginePrivate *enginePrivate = 0; - if (context && context->engine()) - enginePrivate = QDeclarativeEnginePrivate::get(context->engine()); + if (!obj) return; - object = obj; + QDeclarativeEngine *engine = context?context->engine():0; + QDeclarativeTypeNameCache *typeNameCache = context?QDeclarativeContextPrivate::get(context)->imports:0; - if (name.isEmpty() || !obj) - return; + QStringList path = name.split(QLatin1Char('.')); + if (path.isEmpty()) return; + + QObject *currentObject = obj; + + // Everything up to the last property must be an "object type" property + for (int ii = 0; ii < path.count() - 1; ++ii) { + const QString &pathName = path.at(ii); + + if (QDeclarativeTypeNameCache::Data *data = typeNameCache?typeNameCache->data(pathName):0) { + if (data->type) { + QDeclarativeAttachedPropertiesFunc func = data->type->attachedPropertiesFunction(); + if (!func) return; // Not an attachable type + + currentObject = qmlAttachedPropertiesObjectById(data->type->index(), currentObject); + if (!currentObject) return; // Something is broken with the attachable type + } else { + Q_ASSERT(data->typeNamespace); + if ((ii + 1) == path.count()) return; // No type following the namespace + + ++ii; data = data->typeNamespace->data(path.at(ii)); + if (!data || !data->type) return; // Invalid type in namespace + + QDeclarativeAttachedPropertiesFunc func = data->type->attachedPropertiesFunction(); + if (!func) return; // Not an attachable type + + currentObject = qmlAttachedPropertiesObjectById(data->type->index(), currentObject); + if (!currentObject) return; // Something is broken with the attachable type + } + } else { + + QDeclarativePropertyCache::Data local; + QDeclarativePropertyCache::Data *property = + QDeclarativePropertyCache::property(engine, obj, pathName, local); + + if (!property) return; // Not a property + if (property->flags & QDeclarativePropertyCache::Data::IsFunction) + return; // Not an object property + + if (ii == (path.count() - 2) && property->propType < (int)QVariant::UserType) { + // We're now at a value type property. We can use a global valuetypes array as we + // never actually use the objects, just look up their properties. + QObject *typeObject = qmlValueTypes()->valueTypes[property->propType]; + if (!typeObject) return; // Not a value type + + int idx = typeObject->metaObject()->indexOfProperty(path.last().toUtf8().constData()); + if (idx == -1) return; // Value type property does not exist + + QMetaProperty vtProp = typeObject->metaObject()->property(idx); + + object = currentObject; + core = *property; + valueType.flags = QDeclarativePropertyCache::Data::flagsForProperty(vtProp); + valueType.valueTypeCoreIdx = idx; + valueType.valueTypePropType = vtProp.userType(); + + return; + } else { + if (!(property->flags & QDeclarativePropertyCache::Data::IsQObjectDerived)) + return; // Not an object property + + void *args[] = { ¤tObject, 0 }; + QMetaObject::metacall(currentObject, QMetaObject::ReadProperty, property->coreIndex, args); + if (!currentObject) return; // No value - if (enginePrivate && name.at(0).isUpper()) { - // Attached property - // ### What about qualified types? - QDeclarativeTypeNameCache *tnCache = QDeclarativeContextPrivate::get(context)->imports; - if (tnCache) { - QDeclarativeTypeNameCache::Data *d = tnCache->data(name); - if (d && d->type && d->type->attachedPropertiesFunction()) { - attachedFunc = d->type->index(); } } - return; - } else if (name.count() >= 3 && - name.at(0) == QChar(QLatin1Char('o')) && - name.at(1) == QChar(QLatin1Char('n')) && - name.at(2).isUpper()) { - // Signal - QString signalName = name.mid(2); + } + + const QString &terminal = path.last(); + + if (terminal.count() >= 3 && + terminal.at(0) == QLatin1Char('o') && + terminal.at(1) == QLatin1Char('n') && + terminal.at(2).isUpper()) { + + QString signalName = terminal.mid(2); signalName[0] = signalName.at(0).toLower(); - QMetaMethod method = findSignal(obj, signalName); + QMetaMethod method = findSignal(currentObject, signalName); if (method.signature()) { + object = currentObject; core.load(method); return; } - } + } // Property QDeclarativePropertyCache::Data local; QDeclarativePropertyCache::Data *property = - QDeclarativePropertyCache::property(context?context->engine():0, obj, name, local); - if (property && !(property->flags & QDeclarativePropertyCache::Data::IsFunction)) + QDeclarativePropertyCache::property(context?context->engine():0, currentObject, terminal, local); + if (property && !(property->flags & QDeclarativePropertyCache::Data::IsFunction)) { + object = currentObject; core = *property; + } } /*! @@ -1077,8 +1138,6 @@ int QDeclarativeMetaProperty::valueTypeCoreIndex() const return d->valueType.valueTypeCoreIdx; } -Q_GLOBAL_STATIC(QDeclarativeValueTypeFactory, qmlValueTypes); - struct SerializedData { QDeclarativeMetaProperty::Type type; @@ -1141,83 +1200,6 @@ QDeclarativeMetaPropertyPrivate::restore(const QByteArray &data, QObject *object } /*! - \internal - - Creates a QDeclarativeMetaProperty for the property \a name of \a obj. Unlike - the QDeclarativeMetaProperty(QObject*, QString, QDeclarativeContext*) constructor, this static function - will correctly handle dot properties, including value types and attached properties. -*/ -QDeclarativeMetaProperty QDeclarativeMetaProperty::createProperty(QObject *obj, - const QString &name, - QDeclarativeContext *context) -{ - QDeclarativeTypeNameCache *typeNameCache = context?QDeclarativeContextPrivate::get(context)->imports:0; - - QStringList path = name.split(QLatin1Char('.')); - QObject *object = obj; - - for (int jj = 0; jj < path.count() - 1; ++jj) { - const QString &pathName = path.at(jj); - - if (QDeclarativeTypeNameCache::Data *data = typeNameCache?typeNameCache->data(pathName):0) { - if (data->type) { - QDeclarativeAttachedPropertiesFunc func = data->type->attachedPropertiesFunction(); - if (!func) - return QDeclarativeMetaProperty(); - object = qmlAttachedPropertiesObjectById(data->type->index(), object); - if (!object) - return QDeclarativeMetaProperty(); - continue; - } else { - Q_ASSERT(data->typeNamespace); - ++jj; - data = data->typeNamespace->data(path.at(jj)); - if (!data || !data->type) - return QDeclarativeMetaProperty(); - QDeclarativeAttachedPropertiesFunc func = data->type->attachedPropertiesFunction(); - if (!func) - return QDeclarativeMetaProperty(); - object = qmlAttachedPropertiesObjectById(data->type->index(), object); - if (!object) - return QDeclarativeMetaProperty(); - continue; - } - } - - QDeclarativeMetaProperty prop(object, pathName, context); - - if (jj == path.count() - 2 && prop.propertyType() < (int)QVariant::UserType && - qmlValueTypes()->valueTypes[prop.propertyType()]) { - // We're now at a value type property. We can use a global valuetypes array as we - // never actually use the objects, just look up their properties. - QObject *typeObject = - qmlValueTypes()->valueTypes[prop.propertyType()]; - int idx = typeObject->metaObject()->indexOfProperty(path.last().toUtf8().constData()); - if (idx == -1) - return QDeclarativeMetaProperty(); - QMetaProperty vtProp = typeObject->metaObject()->property(idx); - - QDeclarativeMetaProperty p = prop; - p.d->valueType.valueTypeCoreIdx = idx; - p.d->valueType.valueTypePropType = vtProp.userType(); - return p; - } - - QObject *objVal = QDeclarativeMetaType::toQObject(prop.read()); - if (!objVal) - return QDeclarativeMetaProperty(); - object = objVal; - } - - const QString &propName = path.last(); - QDeclarativeMetaProperty prop(object, propName, context); - if (!prop.isValid()) - return QDeclarativeMetaProperty(); - else - return prop; -} - -/*! Returns true if lhs and rhs refer to the same metaobject data */ bool QDeclarativeMetaPropertyPrivate::equal(const QMetaObject *lhs, const QMetaObject *rhs) diff --git a/src/declarative/qml/qdeclarativemetaproperty.h b/src/declarative/qml/qdeclarativemetaproperty.h index 9a3a793..8ea3bcd 100644 --- a/src/declarative/qml/qdeclarativemetaproperty.h +++ b/src/declarative/qml/qdeclarativemetaproperty.h @@ -121,8 +121,6 @@ public: QMetaProperty property() const; - static QDeclarativeMetaProperty createProperty(QObject *, const QString &, QDeclarativeContext *context=0); - int coreIndex() const; int valueTypeCoreIndex() const; private: diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index eb3a376..9e777a0 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -156,7 +156,7 @@ void QDeclarativeAbstractAnimationPrivate::commence() QDeclarativeMetaProperty QDeclarativeAbstractAnimationPrivate::createProperty(QObject *obj, const QString &str, QObject *infoObj) { - QDeclarativeMetaProperty prop = QDeclarativeMetaProperty::createProperty(obj, str, qmlContext(infoObj)); + QDeclarativeMetaProperty prop(obj, str, qmlContext(infoObj)); if (!prop.isValid()) { qmlInfo(infoObj) << QDeclarativeAbstractAnimation::tr("Cannot animate non-existent property \"%1\"").arg(str); return QDeclarativeMetaProperty(); diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index ad39574..6c2e256 100644 --- a/src/declarative/util/qdeclarativepropertychanges.cpp +++ b/src/declarative/util/qdeclarativepropertychanges.cpp @@ -348,7 +348,7 @@ QDeclarativeMetaProperty QDeclarativePropertyChangesPrivate::property(const QByteArray &property) { Q_Q(QDeclarativePropertyChanges); - QDeclarativeMetaProperty prop = QDeclarativeMetaProperty::createProperty(object, QString::fromUtf8(property)); + QDeclarativeMetaProperty prop(object, QString::fromUtf8(property)); if (!prop.isValid()) { qmlInfo(q) << QDeclarativePropertyChanges::tr("Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(property)); return QDeclarativeMetaProperty(); diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index d1dd318..3b06e33 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -65,11 +65,11 @@ QDeclarativeAction::QDeclarativeAction() QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyName, const QVariant &value) -: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), toValue(value), fromBinding(0), - toBinding(0), event(0), specifiedObject(target), - specifiedProperty(propertyName) +: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), + property(target, propertyName), toValue(value), + fromBinding(0), toBinding(0), event(0), + specifiedObject(target), specifiedProperty(propertyName) { - property = QDeclarativeMetaProperty::createProperty(target, propertyName); if (property.isValid()) fromValue = property.read(); } diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index ae07112..2907757 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -747,7 +747,7 @@ void tst_qdeclarativelanguage::valueTypes() // ### #if 0 - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(object, "rectProperty.x"); + QDeclarativeMetaProperty p(object, "rectProperty.x"); QCOMPARE(p.read(), QVariant(12)); p.write(13); QCOMPARE(p.read(), QVariant(13)); diff --git a/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp b/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp index 42d77bb..0740d0f 100644 --- a/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp +++ b/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp @@ -754,19 +754,19 @@ void tst_qdeclarativemetaproperty::name() { PropertyObject o; - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(&o, "rectProperty"); + QDeclarativeMetaProperty p(&o, "rectProperty"); QCOMPARE(p.name(), QString("rectProperty")); } { PropertyObject o; - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(&o, "rectProperty.x"); + QDeclarativeMetaProperty p(&o, "rectProperty.x"); QCOMPARE(p.name(), QString("rectProperty.x")); } { PropertyObject o; - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(&o, "rectProperty.foo"); + QDeclarativeMetaProperty p(&o, "rectProperty.foo"); QCOMPARE(p.name(), QString()); } } @@ -808,14 +808,14 @@ void tst_qdeclarativemetaproperty::read() // Value-type prop { PropertyObject o; - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(&o, "rectProperty.x"); + QDeclarativeMetaProperty p(&o, "rectProperty.x"); QCOMPARE(p.read(), QVariant(10)); } // Invalid value-type prop { PropertyObject o; - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(&o, "rectProperty.foo"); + QDeclarativeMetaProperty p(&o, "rectProperty.foo"); QCOMPARE(p.read(), QVariant()); } @@ -834,7 +834,7 @@ void tst_qdeclarativemetaproperty::read() // Deleted object { PropertyObject *o = new PropertyObject; - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(o, "rectProperty.x"); + QDeclarativeMetaProperty p(o, "rectProperty.x"); QCOMPARE(p.read(), QVariant(10)); delete o; QCOMPARE(p.read(), QVariant()); @@ -847,7 +847,7 @@ void tst_qdeclarativemetaproperty::read() QObject *object = component.create(); QVERIFY(object != 0); - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(object, "MyContainer.foo", qmlContext(object)); + QDeclarativeMetaProperty p(object, "MyContainer.foo", qmlContext(object)); QCOMPARE(p.read(), QVariant(13)); delete object; } @@ -857,7 +857,7 @@ void tst_qdeclarativemetaproperty::read() QObject *object = component.create(); QVERIFY(object != 0); - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(object, "MyContainer.foo", qmlContext(object)); + QDeclarativeMetaProperty p(object, "MyContainer.foo", qmlContext(object)); QCOMPARE(p.read(), QVariant(10)); delete object; } @@ -867,7 +867,7 @@ void tst_qdeclarativemetaproperty::read() QObject *object = component.create(); QVERIFY(object != 0); - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(object, "Foo.MyContainer.foo", qmlContext(object)); + QDeclarativeMetaProperty p(object, "Foo.MyContainer.foo", qmlContext(object)); QCOMPARE(p.read(), QVariant(10)); delete object; } @@ -946,7 +946,7 @@ void tst_qdeclarativemetaproperty::write() QCOMPARE(p.write(QRect(1, 13, 99, 8)), true); QCOMPARE(o.wrectProperty(), QRect(1, 13, 99, 8)); - QDeclarativeMetaProperty p2 = QDeclarativeMetaProperty::createProperty(&o, "wrectProperty.x"); + QDeclarativeMetaProperty p2(&o, "wrectProperty.x"); QCOMPARE(p2.read(), QVariant(1)); QCOMPARE(p2.write(QVariant(6)), true); QCOMPARE(p2.read(), QVariant(6)); @@ -977,7 +977,7 @@ void tst_qdeclarativemetaproperty::write() QObject *object = component.create(); QVERIFY(object != 0); - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(object, "MyContainer.foo", qmlContext(object)); + QDeclarativeMetaProperty p(object, "MyContainer.foo", qmlContext(object)); p.write(QVariant(99)); QCOMPARE(p.read(), QVariant(99)); delete object; @@ -988,7 +988,7 @@ void tst_qdeclarativemetaproperty::write() QObject *object = component.create(); QVERIFY(object != 0); - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(object, "Foo.MyContainer.foo", qmlContext(object)); + QDeclarativeMetaProperty p(object, "Foo.MyContainer.foo", qmlContext(object)); p.write(QVariant(99)); QCOMPARE(p.read(), QVariant(99)); delete object; @@ -1116,7 +1116,7 @@ void tst_qdeclarativemetaproperty::crashOnValueProperty() PropertyObject *obj = qobject_cast<PropertyObject*>(component.create()); QVERIFY(obj != 0); - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(obj, "wrectProperty.x", qmlContext(obj)); + QDeclarativeMetaProperty p(obj, "wrectProperty.x", qmlContext(obj)); QCOMPARE(p.name(), QString("wrectProperty.x")); QCOMPARE(p.read(), QVariant(10)); -- cgit v0.12 From f29a6c8b9fbeb899997c1e4cc2a4be009a231502 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy <aaron.kennedy@nokia.com> Date: Thu, 25 Feb 2010 14:56:13 +1000 Subject: Remove QDeclarativeMetaProperty::Attached We now prohibit QDeclarativeMetaProperty ever getting into a state where it is pointing to the attached object itself. --- src/declarative/qml/qdeclarativemetaproperty.cpp | 40 ++++++------------------ src/declarative/qml/qdeclarativemetaproperty.h | 3 +- src/declarative/qml/qdeclarativemetaproperty_p.h | 10 ++---- 3 files changed, 13 insertions(+), 40 deletions(-) diff --git a/src/declarative/qml/qdeclarativemetaproperty.cpp b/src/declarative/qml/qdeclarativemetaproperty.cpp index 477ef3a..b4e920c 100644 --- a/src/declarative/qml/qdeclarativemetaproperty.cpp +++ b/src/declarative/qml/qdeclarativemetaproperty.cpp @@ -284,7 +284,6 @@ QDeclarativeMetaProperty::QDeclarativeMetaProperty(const QDeclarativeMetaPropert \value Property The property is a regular Qt property. \value SignalProperty The property is a signal property. \value Default The property is the default property. - \value Attached The property is an attached property. */ /*! @@ -302,8 +301,6 @@ QDeclarativeMetaPropertyPrivate::propertyCategory() const if (type & QDeclarativeMetaProperty::ValueTypeProperty) { return QDeclarativeMetaProperty::Normal; - } else if (type & QDeclarativeMetaProperty::Attached) { - return QDeclarativeMetaProperty::Object; } else if (type & QDeclarativeMetaProperty::Property) { int type = propertyType(); if (type == QVariant::Invalid) @@ -359,8 +356,7 @@ bool QDeclarativeMetaProperty::operator==(const QDeclarativeMetaProperty &other) // from the other members return d->object == other.d->object && d->core == other.d->core && - d->valueType == other.d->valueType && - d->attachedFunc == other.d->attachedFunc; + d->valueType == other.d->valueType; } /*! @@ -377,8 +373,6 @@ int QDeclarativeMetaPropertyPrivate::propertyType() const uint type = q->type(); if (type & QDeclarativeMetaProperty::ValueTypeProperty) { return valueType.valueTypePropType; - } else if (type & QDeclarativeMetaProperty::Attached) { - return qMetaTypeId<QObject *>(); } else if (type & QDeclarativeMetaProperty::Property) { if (core.propType == (int)QVariant::LastType) return qMetaTypeId<QVariant>(); @@ -396,8 +390,6 @@ QDeclarativeMetaProperty::Type QDeclarativeMetaProperty::type() const { if (d->core.flags & QDeclarativePropertyCache::Data::IsFunction) return SignalProperty; - else if (d->attachedFunc != -1) - return Attached; else if (d->valueType.valueTypeCoreIdx != -1) return (Type)(Property | ValueTypeProperty); else if (d->core.isValid()) @@ -445,7 +437,6 @@ QDeclarativeMetaProperty &QDeclarativeMetaProperty::operator=(const QDeclarative d->valueType = other.d->valueType; - d->attachedFunc = other.d->attachedFunc; return *this; } @@ -566,7 +557,7 @@ QMetaMethod QDeclarativeMetaProperty::method() const QDeclarativeAbstractBinding * QDeclarativeMetaPropertyPrivate::binding(const QDeclarativeMetaProperty &that) { - if (!that.isProperty() || (that.type() & QDeclarativeMetaProperty::Attached) || !that.d->object) + if (!that.isProperty() || !that.d->object) return 0; QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(that.d->object); @@ -604,7 +595,7 @@ QDeclarativeMetaPropertyPrivate::setBinding(const QDeclarativeMetaProperty &that QDeclarativeAbstractBinding *newBinding, QDeclarativeMetaProperty::WriteFlags flags) { - if (!that.isProperty() || (that.type() & QDeclarativeMetaProperty::Attached) || !that.d->object) { + if (!that.isProperty() || !that.d->object) { if (newBinding) newBinding->destroy(); return 0; @@ -716,14 +707,6 @@ QMetaMethod QDeclarativeMetaPropertyPrivate::findSignal(QObject *obj, const QStr return QMetaMethod(); } -QObject *QDeclarativeMetaPropertyPrivate::attachedObject() const -{ - if (attachedFunc == -1) - return 0; - else - return qmlAttachedPropertiesObjectById(attachedFunc, object); -} - /*! Returns the property value. */ @@ -736,7 +719,7 @@ QVariant QDeclarativeMetaProperty::read() const return QVariant(); - } else if (type() & Property || type() & Attached) { + } else if (type() & Property) { return d->readValueProperty(); @@ -747,11 +730,7 @@ QVariant QDeclarativeMetaProperty::read() const QVariant QDeclarativeMetaPropertyPrivate::readValueProperty() { uint type = q->type(); - if (type & QDeclarativeMetaProperty::Attached) { - - return QVariant::fromValue(attachedObject()); - - } else if(type & QDeclarativeMetaProperty::ValueTypeProperty) { + if(type & QDeclarativeMetaProperty::ValueTypeProperty) { QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(context); QDeclarativeValueType *valueType = 0; @@ -1062,7 +1041,7 @@ bool QDeclarativeMetaProperty::write(const QVariant &value, QDeclarativeMetaProp */ bool QDeclarativeMetaProperty::hasChangedNotifier() const { - if (type() & Property && !(type() & Attached) && d->object) { + if (type() & Property && d->object) { return d->object->metaObject()->property(d->core.coreIndex).hasNotifySignal(); } return false; @@ -1077,8 +1056,7 @@ bool QDeclarativeMetaProperty::hasChangedNotifier() const */ bool QDeclarativeMetaProperty::needsChangedNotifier() const { - return type() & Property && !(type() & Attached) && - !property().isConstant(); + return type() & Property && !property().isConstant(); } /*! @@ -1091,7 +1069,7 @@ bool QDeclarativeMetaProperty::needsChangedNotifier() const */ bool QDeclarativeMetaProperty::connectNotifier(QObject *dest, int method) const { - if (!(type() & Property) || (type() & Attached) || !d->object) + if (!(type() & Property) || !d->object) return false; QMetaProperty prop = d->object->metaObject()->property(d->core.coreIndex); @@ -1112,7 +1090,7 @@ bool QDeclarativeMetaProperty::connectNotifier(QObject *dest, int method) const */ bool QDeclarativeMetaProperty::connectNotifier(QObject *dest, const char *slot) const { - if (!(type() & Property) || (type() & Attached) || !d->object) + if (!(type() & Property) || !d->object) return false; QMetaProperty prop = d->object->metaObject()->property(d->core.coreIndex); diff --git a/src/declarative/qml/qdeclarativemetaproperty.h b/src/declarative/qml/qdeclarativemetaproperty.h index 8ea3bcd..dce0b4f 100644 --- a/src/declarative/qml/qdeclarativemetaproperty.h +++ b/src/declarative/qml/qdeclarativemetaproperty.h @@ -100,8 +100,7 @@ public: Property = 0x01, SignalProperty = 0x02, Default = 0x08, - Attached = 0x10, - ValueTypeProperty = 0x20 }; + ValueTypeProperty = 0x10 }; Type type() const; bool isProperty() const; diff --git a/src/declarative/qml/qdeclarativemetaproperty_p.h b/src/declarative/qml/qdeclarativemetaproperty_p.h index b769e42..5ebd2c5 100644 --- a/src/declarative/qml/qdeclarativemetaproperty_p.h +++ b/src/declarative/qml/qdeclarativemetaproperty_p.h @@ -68,14 +68,14 @@ class Q_AUTOTEST_EXPORT QDeclarativeMetaPropertyPrivate { public: QDeclarativeMetaPropertyPrivate() - : q(0), context(0), object(0), isDefaultProperty(false), isNameCached(false), - attachedFunc(-1) {} + : q(0), context(0), object(0), isDefaultProperty(false), isNameCached(false) {} + QDeclarativeMetaPropertyPrivate(const QDeclarativeMetaPropertyPrivate &other) : q(0), context(other.context), object(other.object), isDefaultProperty(other.isDefaultProperty), isNameCached(other.isNameCached), core(other.core), nameCache(other.nameCache), - valueType(other.valueType), attachedFunc(other.attachedFunc) {} + valueType(other.valueType) {} QDeclarativeMetaProperty *q; QDeclarativeContext *context; @@ -89,13 +89,9 @@ public: // Describes the "virtual" value-type sub-property. QDeclarativePropertyCache::ValueTypeData valueType; - // The attached property accessor - int attachedFunc; - void initProperty(QObject *obj, const QString &name); void initDefault(QObject *obj); - QObject *attachedObject() const; QMetaMethod findSignal(QObject *, const QString &); int propertyType() const; -- cgit v0.12 From d022acd47350f61d3959b076d7bc92df86015b16 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy <aaron.kennedy@nokia.com> Date: Thu, 25 Feb 2010 15:45:44 +1000 Subject: Tweak QDeclarativeMetaProperty type category API --- src/declarative/qml/qdeclarativebinding.cpp | 2 +- src/declarative/qml/qdeclarativemetaproperty.cpp | 22 ++++++--------- src/declarative/qml/qdeclarativemetaproperty.h | 30 ++++++++++---------- src/declarative/qml/qdeclarativemetaproperty_p.h | 2 +- .../tst_qdeclarativelistreference.cpp | 4 +-- .../tst_qdeclarativemetaproperty.cpp | 32 +++++++++++----------- 6 files changed, 45 insertions(+), 47 deletions(-) diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index 5ac5701..bde01ae 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -128,7 +128,7 @@ void QDeclarativeBinding::update(QDeclarativeMetaProperty::WriteFlags flags) if (!data->updating) { data->updating = true; - if (data->property.propertyCategory() == QDeclarativeMetaProperty::Bindable) { + if (data->property.propertyType() == qMetaTypeId<QDeclarativeBinding *>()) { int idx = data->property.coreIndex(); Q_ASSERT(idx != -1); diff --git a/src/declarative/qml/qdeclarativemetaproperty.cpp b/src/declarative/qml/qdeclarativemetaproperty.cpp index b4e920c..f4c930f 100644 --- a/src/declarative/qml/qdeclarativemetaproperty.cpp +++ b/src/declarative/qml/qdeclarativemetaproperty.cpp @@ -263,13 +263,11 @@ QDeclarativeMetaProperty::QDeclarativeMetaProperty(const QDeclarativeMetaPropert } /*! - \enum QDeclarativeMetaProperty::PropertyCategory + \enum QDeclarativeMetaProperty::PropertyTypeCategory This enum specifies a category of QML property. - \value Unknown The category is unknown. This will never be returned from propertyCategory() - \value InvalidProperty The property is invalid. - \value Bindable The property is a QDeclarativeBinding. + \value InvalidCategory The property is invalid. \value List The property is a QList pointer \value Object The property is a QObject derived type pointer \value Normal The property is none of the above. @@ -289,13 +287,13 @@ QDeclarativeMetaProperty::QDeclarativeMetaProperty(const QDeclarativeMetaPropert /*! Returns the property category. */ -QDeclarativeMetaProperty::PropertyCategory QDeclarativeMetaProperty::propertyCategory() const +QDeclarativeMetaProperty::PropertyTypeCategory QDeclarativeMetaProperty::propertyTypeCategory() const { - return d->propertyCategory(); + return d->propertyTypeCategory(); } -QDeclarativeMetaProperty::PropertyCategory -QDeclarativeMetaPropertyPrivate::propertyCategory() const +QDeclarativeMetaProperty::PropertyTypeCategory +QDeclarativeMetaPropertyPrivate::propertyTypeCategory() const { uint type = q->type(); @@ -304,11 +302,9 @@ QDeclarativeMetaPropertyPrivate::propertyCategory() const } else if (type & QDeclarativeMetaProperty::Property) { int type = propertyType(); if (type == QVariant::Invalid) - return QDeclarativeMetaProperty::InvalidProperty; + return QDeclarativeMetaProperty::InvalidCategory; else if ((uint)type < QVariant::UserType) return QDeclarativeMetaProperty::Normal; - else if (type == qMetaTypeId<QDeclarativeBinding *>()) - return QDeclarativeMetaProperty::Bindable; else if (core.flags & QDeclarativePropertyCache::Data::IsQObjectDerived) return QDeclarativeMetaProperty::Object; else if (core.flags & QDeclarativePropertyCache::Data::IsQList) @@ -316,7 +312,7 @@ QDeclarativeMetaPropertyPrivate::propertyCategory() const else return QDeclarativeMetaProperty::Normal; } else { - return QDeclarativeMetaProperty::InvalidProperty; + return QDeclarativeMetaProperty::InvalidCategory; } } @@ -445,7 +441,7 @@ QDeclarativeMetaProperty &QDeclarativeMetaProperty::operator=(const QDeclarative */ bool QDeclarativeMetaProperty::isWritable() const { - QDeclarativeMetaProperty::PropertyCategory category = propertyCategory(); + QDeclarativeMetaProperty::PropertyTypeCategory category = propertyTypeCategory(); if (!d->object) return false; diff --git a/src/declarative/qml/qdeclarativemetaproperty.h b/src/declarative/qml/qdeclarativemetaproperty.h index dce0b4f..900d1cd 100644 --- a/src/declarative/qml/qdeclarativemetaproperty.h +++ b/src/declarative/qml/qdeclarativemetaproperty.h @@ -63,22 +63,31 @@ class QDeclarativeMetaPropertyPrivate; class Q_DECLARATIVE_EXPORT QDeclarativeMetaProperty { public: - enum PropertyCategory { - Unknown, - InvalidProperty, - Bindable, + enum PropertyTypeCategory { + InvalidCategory, List, Object, Normal }; + + enum Type { Invalid = 0x00, + Property = 0x01, + SignalProperty = 0x02, + Default = 0x08, + ValueTypeProperty = 0x10 + }; + QDeclarativeMetaProperty(); + ~QDeclarativeMetaProperty(); + QDeclarativeMetaProperty(QObject *); - QDeclarativeMetaProperty(QObject *, const QString &); QDeclarativeMetaProperty(QObject *, QDeclarativeContext *); + + QDeclarativeMetaProperty(QObject *, const QString &); QDeclarativeMetaProperty(QObject *, const QString &, QDeclarativeContext *); + QDeclarativeMetaProperty(const QDeclarativeMetaProperty &); QDeclarativeMetaProperty &operator=(const QDeclarativeMetaProperty &); - ~QDeclarativeMetaProperty(); QString name() const; @@ -96,12 +105,6 @@ public: QMetaMethod method() const; - enum Type { Invalid = 0x00, - Property = 0x01, - SignalProperty = 0x02, - Default = 0x08, - ValueTypeProperty = 0x10 }; - Type type() const; bool isProperty() const; bool isDefault() const; @@ -111,9 +114,8 @@ public: bool isValid() const; QObject *object() const; - PropertyCategory propertyCategory() const; - int propertyType() const; + PropertyTypeCategory propertyTypeCategory() const; const char *propertyTypeName() const; bool operator==(const QDeclarativeMetaProperty &) const; diff --git a/src/declarative/qml/qdeclarativemetaproperty_p.h b/src/declarative/qml/qdeclarativemetaproperty_p.h index 5ebd2c5..937cfd7 100644 --- a/src/declarative/qml/qdeclarativemetaproperty_p.h +++ b/src/declarative/qml/qdeclarativemetaproperty_p.h @@ -95,7 +95,7 @@ public: QMetaMethod findSignal(QObject *, const QString &); int propertyType() const; - QDeclarativeMetaProperty::PropertyCategory propertyCategory() const; + QDeclarativeMetaProperty::PropertyTypeCategory propertyTypeCategory() const; QVariant readValueProperty(); bool writeValueProperty(const QVariant &, QDeclarativeMetaProperty::WriteFlags); diff --git a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp index 5c6ceef..fdcb98a 100644 --- a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp +++ b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp @@ -547,10 +547,10 @@ void tst_qdeclarativelistreference::engineTypes() QVERIFY(o); QDeclarativeMetaProperty p1(o, QLatin1String("myList")); - QVERIFY(p1.propertyCategory() == QDeclarativeMetaProperty::Normal); + QVERIFY(p1.propertyTypeCategory() == QDeclarativeMetaProperty::Normal); QDeclarativeMetaProperty p2(o, QLatin1String("myList"), engine.rootContext()); - QVERIFY(p2.propertyCategory() == QDeclarativeMetaProperty::List); + QVERIFY(p2.propertyTypeCategory() == QDeclarativeMetaProperty::List); QVariant v = p2.read(); QVERIFY(v.userType() == qMetaTypeId<QDeclarativeListReference>()); QDeclarativeListReference ref = qvariant_cast<QDeclarativeListReference>(v); diff --git a/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp b/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp index 0740d0f..4d07a19 100644 --- a/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp +++ b/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp @@ -157,7 +157,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), false); QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); @@ -245,7 +245,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), false); QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); @@ -292,7 +292,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(prop.propertyType(), (int)QVariant::Int); QCOMPARE(prop.propertyTypeName(), "int"); QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); @@ -346,7 +346,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), false); QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); @@ -393,7 +393,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(prop.propertyType(), (int)QVariant::Int); QCOMPARE(prop.propertyTypeName(), "int"); QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); @@ -442,7 +442,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); @@ -495,7 +495,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_context() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), false); QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); @@ -542,7 +542,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_context() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(prop.propertyType(), (int)QVariant::Int); QCOMPARE(prop.propertyTypeName(), "int"); QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); @@ -596,7 +596,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), false); QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); @@ -643,7 +643,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(prop.propertyType(), (int)QVariant::Int); QCOMPARE(prop.propertyTypeName(), "int"); QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); @@ -692,7 +692,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); @@ -1139,14 +1139,14 @@ void tst_qdeclarativemetaproperty::copy() QCOMPARE(property->name(), QString("defaultProperty")); QCOMPARE(property->read(), QVariant(10)); QCOMPARE(property->type(), QDeclarativeMetaProperty::Property); - QCOMPARE(property->propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(property->propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(property->propertyType(), (int)QVariant::Int); QDeclarativeMetaProperty p1(*property); QCOMPARE(p1.name(), QString("defaultProperty")); QCOMPARE(p1.read(), QVariant(10)); QCOMPARE(p1.type(), QDeclarativeMetaProperty::Property); - QCOMPARE(p1.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(p1.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(p1.propertyType(), (int)QVariant::Int); QDeclarativeMetaProperty p2(&object, QLatin1String("url")); @@ -1155,7 +1155,7 @@ void tst_qdeclarativemetaproperty::copy() QCOMPARE(p2.name(), QString("defaultProperty")); QCOMPARE(p2.read(), QVariant(10)); QCOMPARE(p2.type(), QDeclarativeMetaProperty::Property); - QCOMPARE(p2.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(p2.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(p2.propertyType(), (int)QVariant::Int); delete property; property = 0; @@ -1163,13 +1163,13 @@ void tst_qdeclarativemetaproperty::copy() QCOMPARE(p1.name(), QString("defaultProperty")); QCOMPARE(p1.read(), QVariant(10)); QCOMPARE(p1.type(), QDeclarativeMetaProperty::Property); - QCOMPARE(p1.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(p1.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(p1.propertyType(), (int)QVariant::Int); QCOMPARE(p2.name(), QString("defaultProperty")); QCOMPARE(p2.read(), QVariant(10)); QCOMPARE(p2.type(), QDeclarativeMetaProperty::Property); - QCOMPARE(p2.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(p2.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(p2.propertyType(), (int)QVariant::Int); } -- cgit v0.12