diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-02-25 05:51:22 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-02-25 05:51:22 (GMT) |
commit | b915bc2d710e365e7c9083ba65d08de08ea02f74 (patch) | |
tree | 8e87760b9154493372f1f8b499b52e661547e3ca | |
parent | 950f3849e3bd2edd6bcc2784dbeadcb604c38e2d (diff) | |
parent | d022acd47350f61d3959b076d7bc92df86015b16 (diff) | |
download | Qt-b915bc2d710e365e7c9083ba65d08de08ea02f74.zip Qt-b915bc2d710e365e7c9083ba65d08de08ea02f74.tar.gz Qt-b915bc2d710e365e7c9083ba65d08de08ea02f74.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
58 files changed, 630 insertions, 990 deletions
@@ -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 @@ -924,7 +925,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 ;; @@ -2105,6 +2106,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" @@ -3318,7 +3326,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] @@ -3458,6 +3467,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. @@ -6537,6 +6549,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/configure.exe b/configure.exe Binary files differindex 9974236..f937ea2 100755 --- a/configure.exe +++ b/configure.exe 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); 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/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 } } 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(); 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/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/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..f4c930f 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; + } } /*! @@ -202,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. @@ -223,34 +282,29 @@ 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. */ /*! 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(); 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) - 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) @@ -258,7 +312,7 @@ QDeclarativeMetaPropertyPrivate::propertyCategory() const else return QDeclarativeMetaProperty::Normal; } else { - return QDeclarativeMetaProperty::InvalidProperty; + return QDeclarativeMetaProperty::InvalidCategory; } } @@ -298,8 +352,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; } /*! @@ -316,8 +369,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>(); @@ -335,8 +386,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()) @@ -384,7 +433,6 @@ QDeclarativeMetaProperty &QDeclarativeMetaProperty::operator=(const QDeclarative d->valueType = other.d->valueType; - d->attachedFunc = other.d->attachedFunc; return *this; } @@ -393,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; @@ -502,22 +550,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.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 +587,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.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 +628,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 +659,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; @@ -648,14 +703,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. */ @@ -668,7 +715,7 @@ QVariant QDeclarativeMetaProperty::read() const return QVariant(); - } else if (type() & Property || type() & Attached) { + } else if (type() & Property) { return d->readValueProperty(); @@ -679,11 +726,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; @@ -758,7 +801,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(); } @@ -994,7 +1037,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; @@ -1009,8 +1052,7 @@ bool QDeclarativeMetaProperty::hasChangedNotifier() const */ bool QDeclarativeMetaProperty::needsChangedNotifier() const { - return type() & Property && !(type() & Attached) && - !property().isConstant(); + return type() & Property && !property().isConstant(); } /*! @@ -1023,7 +1065,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); @@ -1044,7 +1086,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); @@ -1070,8 +1112,6 @@ int QDeclarativeMetaProperty::valueTypeCoreIndex() const return d->valueType.valueTypeCoreIdx; } -Q_GLOBAL_STATIC(QDeclarativeValueTypeFactory, qmlValueTypes); - struct SerializedData { QDeclarativeMetaProperty::Type type; @@ -1134,83 +1174,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 4dd6668..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,13 +105,6 @@ public: QMetaMethod method() const; - enum Type { Invalid = 0x00, - Property = 0x01, - SignalProperty = 0x02, - Default = 0x08, - Attached = 0x10, - ValueTypeProperty = 0x20 }; - Type type() const; bool isProperty() const; bool isDefault() const; @@ -112,24 +114,14 @@ 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; 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; int valueTypeCoreIndex() const; private: diff --git a/src/declarative/qml/qdeclarativemetaproperty_p.h b/src/declarative/qml/qdeclarativemetaproperty_p.h index 9fd5ed2..937cfd7 100644 --- a/src/declarative/qml/qdeclarativemetaproperty_p.h +++ b/src/declarative/qml/qdeclarativemetaproperty_p.h @@ -64,18 +64,18 @@ QT_BEGIN_NAMESPACE class QDeclarativeContext; class QDeclarativeEnginePrivate; -class QDeclarativeMetaPropertyPrivate +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,35 +89,44 @@ 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; - QDeclarativeMetaProperty::PropertyCategory propertyCategory() const; + QDeclarativeMetaProperty::PropertyTypeCategory propertyTypeCategory() const; QVariant readValueProperty(); 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/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/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/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index 5907ddb..6c2e256 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) @@ -345,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 5c3b909..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(); } @@ -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/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 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/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 diff --git a/src/multimedia/qml/multimediadeclarative.cpp b/src/multimedia/qml/multimediadeclarative.cpp new file mode 100644 index 0000000..ba4036f --- /dev/null +++ b/src/multimedia/qml/multimediadeclarative.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** 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/qdeclarative.h> +#include <QtMultimedia/private/qsoundeffect_p.h> +#include <QtMultimedia/private/qdeclarativeaudio_p.h> +#include <QtMultimedia/private/qdeclarativevideo_p.h> + + +QT_BEGIN_NAMESPACE + +namespace QtMultimedia +{ + +/*! + Register the Multimedia QML elements. + \internal +*/ + +void qRegisterDeclarativeElements(QDeclarativeEngine *engine, const char *uri) +{ + Q_UNUSED(engine) + Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.multimedia")); + + qmlRegisterType<QSoundEffect>("Qt.multimedia", 4, 7, "SoundEffect"); + qmlRegisterType<QDeclarativeAudio>("Qt.multimedia", 4, 7, "Audio"); + qmlRegisterType<QDeclarativeVideo>("Qt.multimedia", 4, 7, "Video"); +} + +} + +QT_END_NAMESPACE + diff --git a/src/multimedia/qml/multimediadeclarative.h b/src/multimedia/qml/multimediadeclarative.h new file mode 100644 index 0000000..befddb6 --- /dev/null +++ b/src/multimedia/qml/multimediadeclarative.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** 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) + +class QDeclarativeEngine; + +namespace QtMultimedia +{ +extern void Q_MULTIMEDIA_EXPORT qRegisterDeclarativeElements(QDeclarativeEngine* engine, const char *uri); +} + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // ifndef QTMULTIMEDIA_QML_H diff --git a/src/multimedia/qml/qdeclarativeaudio_p.h b/src/multimedia/qml/qdeclarativeaudio_p.h index d28c1dd..d1fb275 100644 --- a/src/multimedia/qml/qdeclarativeaudio_p.h +++ b/src/multimedia/qml/qdeclarativeaudio_p.h @@ -42,6 +42,17 @@ #ifndef QDECLARATIVEAUDIO_P_H #define QDECLARATIVEAUDIO_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/qdeclarativemediabase_p.h> #include <QtCore/qbasictimer.h> diff --git a/src/multimedia/qml/qdeclarativemediabase_p.h b/src/multimedia/qml/qdeclarativemediabase_p.h index cee190c..2fc48db 100644 --- a/src/multimedia/qml/qdeclarativemediabase_p.h +++ b/src/multimedia/qml/qdeclarativemediabase_p.h @@ -42,6 +42,16 @@ #ifndef QDECLARATIVEMEDIABASE_P_H #define QDECLARATIVEMEDIABASE_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/qdeclarativevideo_p.h b/src/multimedia/qml/qdeclarativevideo_p.h index 164edae..d5ebde1 100644 --- a/src/multimedia/qml/qdeclarativevideo_p.h +++ b/src/multimedia/qml/qdeclarativevideo_p.h @@ -42,6 +42,17 @@ #ifndef QDECLARATIVEVIDEO_H #define QDECLARATIVEVIDEO_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/qdeclarativemediabase_p.h> #include <QtMultimedia/qgraphicsvideoitem.h> 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/qml.pri b/src/multimedia/qml/qml.pri index dfc006e..d0ff71d 100644 --- a/src/multimedia/qml/qml.pri +++ b/src/multimedia/qml/qml.pri @@ -17,7 +17,7 @@ contains(QT_CONFIG, declarative) { } HEADERS += \ - $$PWD/qdeclarative.h \ + $$PWD/multimediadeclarative.h \ $$PWD/qmetadatacontrolmetaobject_p.h \ $$PWD/qdeclarativeaudio_p.h \ $$PWD/qdeclarativevideo_p.h \ @@ -26,7 +26,7 @@ contains(QT_CONFIG, declarative) { $$PWD/wavedecoder_p.h SOURCES += \ - $$PWD/qdeclarative.cpp \ + $$PWD/multimediadeclarative.cpp \ $$PWD/qmetadatacontrolmetaobject.cpp \ $$PWD/qdeclarativeaudio.cpp \ $$PWD/qdeclarativevideo.cpp \ 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> 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/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/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 d516a99..3f198b9 100644 --- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm +++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm @@ -372,7 +372,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()); @@ -436,7 +436,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 { @@ -505,7 +505,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 7271f5b..5047853 100644 --- a/src/plugins/mediaservices/qt7/qt7movieviewrenderer.mm +++ b/src/plugins/mediaservices/qt7/qt7movieviewrenderer.mm @@ -247,7 +247,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; @@ -274,14 +274,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(); } } } 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); } }; 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" 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/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/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/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" diff --git a/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp b/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp index e19bea0..4d07a19 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> @@ -156,15 +157,15 @@ 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); - 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); @@ -244,15 +245,15 @@ 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); - 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); @@ -291,17 +292,17 @@ 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")); - 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); @@ -345,15 +346,15 @@ 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); - 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); @@ -392,17 +393,17 @@ 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")); - 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); @@ -441,17 +442,17 @@ 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); - 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); @@ -494,15 +495,15 @@ 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); - 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); @@ -541,17 +542,17 @@ 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")); - 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); @@ -595,15 +596,15 @@ 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); - 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); @@ -642,17 +643,17 @@ 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")); - 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); @@ -691,17 +692,17 @@ 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); - 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); @@ -753,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()); } } @@ -807,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()); } @@ -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()); } @@ -833,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()); @@ -846,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; } @@ -856,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; } @@ -866,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; } @@ -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 @@ -945,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)); @@ -976,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; @@ -987,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; @@ -1115,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)); @@ -1138,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")); @@ -1154,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; @@ -1162,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); } 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 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"))); 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 1fe4503..0ff7301 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" ) { @@ -1771,6 +1776,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."); @@ -2052,7 +2059,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")) @@ -2212,6 +2219,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") @@ -2602,6 +2611,8 @@ void Configure::generateOutputVars() qtConfig += "multimedia"; if (dictionary["AUDIO_BACKEND"] == "yes") qtConfig += "audio-backend"; + if (dictionary["MEDIASERVICE"] == "yes") + qtConfig += "mediaservice"; } if (dictionary["WEBKIT"] == "yes") |