diff options
Diffstat (limited to 'src/declarative/util')
21 files changed, 353 insertions, 911 deletions
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index d47dcc5..bad142c 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -190,9 +190,13 @@ void QDeclarativeAbstractAnimation::setRunning(bool r) d->running = r; if (d->running) { - if (d->alwaysRunToEnd && d->repeat + if (d->alwaysRunToEnd && d->loopCount != 1 && qtAnimation()->state() == QAbstractAnimation::Running) { - qtAnimation()->setLoopCount(-1); + //we've restarted before the final loop finished; restore proper loop count + if (d->loopCount == -1) + qtAnimation()->setLoopCount(d->loopCount); + else + qtAnimation()->setLoopCount(qtAnimation()->currentLoop() + d->loopCount); } if (!d->connectedTimeLine) { @@ -204,8 +208,8 @@ void QDeclarativeAbstractAnimation::setRunning(bool r) emit started(); } else { if (d->alwaysRunToEnd) { - if (d->repeat) - qtAnimation()->setLoopCount(qtAnimation()->currentLoop()+1); + if (d->loopCount != 1) + qtAnimation()->setLoopCount(qtAnimation()->currentLoop()+1); //finish the current loop } else qtAnimation()->stop(); @@ -300,10 +304,12 @@ void QDeclarativeAbstractAnimation::setAlwaysRunToEnd(bool f) } /*! - \qmlproperty bool Animation::repeat - This property holds whether the animation should repeat. + \qmlproperty int Animation::loops + This property holds the number of times the animation should play. + + By default, \c loops is 1: the animation will play through once and then stop. - If set, the animation will continuously repeat until it is explicitly + If set to Animation.Infinite, the animation will continuously repeat until it is explicitly stopped - either by setting the \c running property to false, or by calling the \c stop() method. @@ -311,28 +317,36 @@ void QDeclarativeAbstractAnimation::setAlwaysRunToEnd(bool f) \code Rectangle { - NumberAnimation on rotation { running: true; repeat: true; from: 0 to: 360 } + width: 100; height: 100; color: "green" + RotationAnimation on rotation { + loops: Animation.Infinite + from: 0 + to: 360 + } } \endcode */ -bool QDeclarativeAbstractAnimation::repeat() const +int QDeclarativeAbstractAnimation::loops() const { Q_D(const QDeclarativeAbstractAnimation); - return d->repeat; + return d->loopCount; } -void QDeclarativeAbstractAnimation::setRepeat(bool r) +void QDeclarativeAbstractAnimation::setLoops(int loops) { Q_D(QDeclarativeAbstractAnimation); - if (r == d->repeat) + if (loops < 0) + loops = -1; + + if (loops == d->loopCount) return; - d->repeat = r; - int lc = r ? -1 : 1; - qtAnimation()->setLoopCount(lc); - emit repeatChanged(r); + d->loopCount = loops; + qtAnimation()->setLoopCount(loops); + emit loopCountChanged(loops); } + int QDeclarativeAbstractAnimation::currentTime() { return qtAnimation()->currentLoopTime(); @@ -509,8 +523,9 @@ void QDeclarativeAbstractAnimation::timelineComplete() { Q_D(QDeclarativeAbstractAnimation); setRunning(false); - if (d->alwaysRunToEnd && d->repeat) { - qtAnimation()->setLoopCount(-1); + if (d->alwaysRunToEnd && d->loopCount != 1) { + //restore the proper loopCount for the next run + qtAnimation()->setLoopCount(d->loopCount); } } @@ -658,6 +673,37 @@ void QDeclarativeColorAnimation::setTo(const QColor &t) \inherits Animation \brief The ScriptAction element allows scripts to be run during an animation. + ScriptAction can be used to run script at a specific point in an animation. + + \qml + SequentialAnimation { + NumberAnimation { ... } + ScriptAction { script: doSomething(); } + NumberAnimation { ... } + } + \endqml + + When used as part of a Transition, you can also target a specific + StateChangeScript to run using the \c scriptName property. + + \qml + State { + StateChangeScript { + name: "myScript" + script: doStateStuff(); + } + } + ... + Transition { + SequentialAnimation { + NumberAnimation { ... } + ScriptAction { scriptName: "myScript" } + NumberAnimation { ... } + } + } + \endqml + + \sa StateChangeScript */ /*! \internal @@ -698,11 +744,14 @@ void QDeclarativeScriptAction::setScript(const QDeclarativeScriptString &script) } /*! - \qmlproperty QString ScriptAction::stateChangeScriptName + \qmlproperty QString ScriptAction::scriptName This property holds the the name of the StateChangeScript to run. This property is only valid when ScriptAction is used as part of a transition. - If both script and stateChangeScriptName are set, stateChangeScriptName will be used. + If both script and scriptName are set, scriptName will be used. + + \note When using scriptName in a reversible transition, the script will only + be run when the transition is being run forwards. */ QString QDeclarativeScriptAction::stateChangeScriptName() const { @@ -718,6 +767,9 @@ void QDeclarativeScriptAction::setStateChangeScriptName(const QString &name) void QDeclarativeScriptActionPrivate::execute() { + if (hasRunScriptScript && reversing) + return; + QDeclarativeScriptString scriptStr = hasRunScriptScript ? runScriptScript : script; const QString &str = scriptStr.script(); @@ -733,19 +785,18 @@ void QDeclarativeScriptAction::transition(QDeclarativeStateActions &actions, { Q_D(QDeclarativeScriptAction); Q_UNUSED(modified); - Q_UNUSED(direction); d->hasRunScriptScript = false; + d->reversing = (direction == Backward); for (int ii = 0; ii < actions.count(); ++ii) { QDeclarativeAction &action = actions[ii]; if (action.event && action.event->typeName() == QLatin1String("StateChangeScript") && static_cast<QDeclarativeStateChangeScript*>(action.event)->name() == d->name) { - //### how should we handle reverse direction? d->runScriptScript = static_cast<QDeclarativeStateChangeScript*>(action.event)->script(); d->hasRunScriptScript = true; action.actionDone = true; - break; //assumes names are unique + break; //only match one (names should be unique) } } } @@ -1006,212 +1057,6 @@ void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions, } } - - -/*! - \qmlclass ParentAction QDeclarativeParentAction - \since 4.7 - \inherits Animation - \brief The ParentAction element allows parent changes during animation. - - ParentAction provides a way to specify at what point in a Transition a ParentChange should - occur. - \qml - State { - ParentChange { - target: myItem - parent: newParent - } - } - Transition { - SequentialAnimation { - PropertyAnimation { ... } - ParentAction {} //reparent myItem now - PropertyAnimation { ... } - } - } - \endqml - - It also provides a way to explicitly reparent an item during an animation. - \qml - SequentialAnimation { - ParentAction { target: myItem; parent: newParent } - PropertyAnimation {} - } - \endqml - - The ParentAction is immediate - it is not animated in any way. -*/ - -QDeclarativeParentAction::QDeclarativeParentAction(QObject *parent) -: QDeclarativeAbstractAnimation(*(new QDeclarativeParentActionPrivate), parent) -{ - Q_D(QDeclarativeParentAction); - d->init(); -} - -QDeclarativeParentAction::~QDeclarativeParentAction() -{ -} - -void QDeclarativeParentActionPrivate::init() -{ - Q_Q(QDeclarativeParentAction); - cpa = new QActionAnimation; - QDeclarative_setParent_noEvent(cpa, q); -} - -/*! - \qmlproperty Item ParentAction::target - - This property holds a target item to reparent. - - In the following example, \c myItem will be reparented by the ParentAction, while - \c myOtherItem will not. - \qml - State { - ParentChange { - target: myItem - parent: newParent - } - ParentChange { - target: myOtherItem - parent: otherNewParent - } - } - Transition { - SequentialAnimation { - PropertyAnimation { ... } - ParentAction { target: myItem } - PropertyAnimation { ... } - } - } - \endqml - - */ -QDeclarativeItem *QDeclarativeParentAction::object() const -{ - Q_D(const QDeclarativeParentAction); - return d->pcTarget; -} - -void QDeclarativeParentAction::setObject(QDeclarativeItem *target) -{ - Q_D(QDeclarativeParentAction); - d->pcTarget = target; -} - -/*! - \qmlproperty Item ParentAction::parent - - The item to reparent to (i.e. the new parent). - */ -QDeclarativeItem *QDeclarativeParentAction::parent() const -{ - Q_D(const QDeclarativeParentAction); - return d->pcParent; -} - -void QDeclarativeParentAction::setParent(QDeclarativeItem *parent) -{ - Q_D(QDeclarativeParentAction); - d->pcParent = parent; -} - -void QDeclarativeParentActionPrivate::doAction() -{ - QDeclarativeParentChange pc; - pc.setObject(pcTarget); - pc.setParent(pcParent); - pc.execute(); -} - -QAbstractAnimation *QDeclarativeParentAction::qtAnimation() -{ - Q_D(QDeclarativeParentAction); - return d->cpa; -} - -void QDeclarativeParentAction::transition(QDeclarativeStateActions &actions, - QDeclarativeProperties &modified, - TransitionDirection direction) -{ - Q_D(QDeclarativeParentAction); - Q_UNUSED(modified); - Q_UNUSED(direction); - - struct QDeclarativeParentActionData : public QAbstractAnimationAction - { - QDeclarativeParentActionData(): pc(0) {} - ~QDeclarativeParentActionData() { delete pc; } - - QDeclarativeStateActions actions; - bool reverse; - QDeclarativeParentChange *pc; - virtual void doAction() - { - for (int ii = 0; ii < actions.count(); ++ii) { - const QDeclarativeAction &action = actions.at(ii); - if (reverse) - action.event->reverse(); - else - action.event->execute(); - } - } - }; - - QDeclarativeParentActionData *data = new QDeclarativeParentActionData; - - //### need to correctly handle modified/done - - bool hasExplicit = false; - if (d->pcTarget && d->pcParent) { - data->reverse = false; - QDeclarativeAction myAction; - QDeclarativeParentChange *pc = new QDeclarativeParentChange; - pc->setObject(d->pcTarget); - pc->setParent(d->pcParent); - myAction.event = pc; - data->pc = pc; - data->actions << myAction; - hasExplicit = true; - } - - if (!hasExplicit) - for (int ii = 0; ii < actions.count(); ++ii) { - QDeclarativeAction &action = actions[ii]; - - if (action.event && action.event->typeName() == QLatin1String("ParentChange") - && (!d->pcTarget || static_cast<QDeclarativeParentChange*>(action.event)->object() == d->pcTarget)) { - QDeclarativeAction myAction = action; - data->reverse = action.reverseEvent; - //### this logic differs from PropertyAnimation - // (probably a result of modified vs. done) - if (d->pcParent) { - //### should we disallow this case? - QDeclarativeParentChange *pc = new QDeclarativeParentChange; - pc->setObject(d->pcTarget); - pc->setParent(static_cast<QDeclarativeParentChange*>(action.event)->parent()); - myAction.event = pc; - data->pc = pc; - data->actions << myAction; - break; //only match one - } else { - action.actionDone = true; - data->actions << myAction; - } - } - } - - if (data->actions.count()) { - d->cpa->setAnimAction(data, QAbstractAnimation::DeleteWhenStopped); - } else { - delete data; - } -} - - - /*! \qmlclass NumberAnimation QDeclarativeNumberAnimation \since 4.7 @@ -1342,9 +1187,10 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t) \brief The RotationAnimation element allows you to animate rotations. RotationAnimation is a specialized PropertyAnimation that gives control - over the direction of rotation. By default, it will rotate - via the shortest path; for example, a rotation from 20 to 340 degrees will - rotation 40 degrees counterclockwise. + over the direction of rotation. By default, it will rotate in the direction + of the numerical change; a rotation from 0 to 240 will rotate 220 degrees + clockwise, while a rotation from 240 to 0 will rotate 220 degrees + counterclockwise. When used in a transition RotationAnimation will rotate all properties named "rotation" or "angle". You can override this by providing @@ -1359,7 +1205,7 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t) State { name: "-90"; PropertyChanges { target: myItem; rotation: -90 } } } transition: Transition { - RotationAnimation { } + RotationAnimation { direction: RotationAnimation.Shortest } } \endqml */ @@ -1411,7 +1257,7 @@ QDeclarativeRotationAnimation::QDeclarativeRotationAnimation(QObject *parent) { Q_D(QDeclarativeRotationAnimation); d->interpolatorType = QMetaType::QReal; - d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(&_q_interpolateShortestRotation); + d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType); d->defaultProperties = QLatin1String("rotation,angle"); } @@ -1474,7 +1320,7 @@ void QDeclarativeRotationAnimation::setTo(qreal t) A rotation from 10 to 350 will rotate 20 degrees counterclockwise. \endtable - The default direction is Shortest. + The default direction is Numerical. */ QDeclarativeRotationAnimation::RotationDirection QDeclarativeRotationAnimation::direction() const { @@ -1523,8 +1369,8 @@ void QDeclarativeAnimationGroupPrivate::append_animation(QDeclarativeListPropert { QDeclarativeAnimationGroup *q = qobject_cast<QDeclarativeAnimationGroup *>(list->object); if (q) { - q->d_func()->animations.append(a); a->setGroup(q); + QDeclarative_setParent_noEvent(a->qtAnimation(), q->d_func()->ag); q->d_func()->ag->addAnimation(a->qtAnimation()); } } @@ -1755,7 +1601,7 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int \qml Rectangle { SequentialAnimation on x { - repeat: true + loops: Animation.Infinite PropertyAnimation { to: 50 } PropertyAnimation { to: 0 } } @@ -2164,7 +2010,7 @@ void QDeclarativePropertyAnimation::setProperties(const QString &prop) id: theRect width: 100; height: 100 color: Qt.rgba(0,0,1) - NumberAnimation on x { to: 500; repeat: true } //animate theRect's x property + NumberAnimation on x { to: 500; loops: Animation.Infinite } //animate theRect's x property Behavior on y { NumberAnimation {} } //animate theRect's y property } \endqml @@ -2483,7 +2329,11 @@ QDeclarativeItem *QDeclarativeParentAnimation::target() const void QDeclarativeParentAnimation::setTarget(QDeclarativeItem *target) { Q_D(QDeclarativeParentAnimation); + if (target == d->target) + return; + d->target = target; + emit targetChanged(); } /*! @@ -2501,7 +2351,11 @@ QDeclarativeItem *QDeclarativeParentAnimation::newParent() const void QDeclarativeParentAnimation::setNewParent(QDeclarativeItem *newParent) { Q_D(QDeclarativeParentAnimation); + if (newParent == d->newParent) + return; + d->newParent = newParent; + emit newParentChanged(); } /*! @@ -2526,7 +2380,11 @@ QDeclarativeItem *QDeclarativeParentAnimation::via() const void QDeclarativeParentAnimation::setVia(QDeclarativeItem *via) { Q_D(QDeclarativeParentAnimation); + if (via == d->via) + return; + d->via = via; + emit viaChanged(); } //### mirrors same-named function in QDeclarativeItem @@ -2561,10 +2419,10 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, { Q_D(QDeclarativeParentAnimation); - struct QDeclarativeParentActionData : public QAbstractAnimationAction + struct QDeclarativeParentAnimationData : public QAbstractAnimationAction { - QDeclarativeParentActionData() {} - ~QDeclarativeParentActionData() { qDeleteAll(pc); } + QDeclarativeParentAnimationData() {} + ~QDeclarativeParentAnimationData() { qDeleteAll(pc); } QDeclarativeStateActions actions; //### reverse should probably apply on a per-action basis @@ -2582,8 +2440,8 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, } }; - QDeclarativeParentActionData *data = new QDeclarativeParentActionData; - QDeclarativeParentActionData *viaData = new QDeclarativeParentActionData; + QDeclarativeParentAnimationData *data = new QDeclarativeParentAnimationData; + QDeclarativeParentAnimationData *viaData = new QDeclarativeParentAnimationData; bool hasExplicit = false; if (d->target && d->newParent) { diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h index eb339f6..816520e 100644 --- a/src/declarative/util/qdeclarativeanimation_p.h +++ b/src/declarative/util/qdeclarativeanimation_p.h @@ -70,24 +70,28 @@ class Q_AUTOTEST_EXPORT QDeclarativeAbstractAnimation : public QObject, public Q Q_INTERFACES(QDeclarativeParserStatus) Q_INTERFACES(QDeclarativePropertyValueSource) + Q_ENUMS(Loops) Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged) Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) - Q_PROPERTY(bool alwaysRunToEnd READ alwaysRunToEnd WRITE setAlwaysRunToEnd NOTIFY alwaysRunToEndChanged()) - Q_PROPERTY(bool repeat READ repeat WRITE setRepeat NOTIFY repeatChanged) + Q_PROPERTY(bool alwaysRunToEnd READ alwaysRunToEnd WRITE setAlwaysRunToEnd NOTIFY alwaysRunToEndChanged) + Q_PROPERTY(int loops READ loops WRITE setLoops NOTIFY loopsChanged) Q_CLASSINFO("DefaultMethod", "start()") public: QDeclarativeAbstractAnimation(QObject *parent=0); virtual ~QDeclarativeAbstractAnimation(); + enum Loops { Infinite = -2 }; + bool isRunning() const; void setRunning(bool); bool isPaused() const; void setPaused(bool); bool alwaysRunToEnd() const; void setAlwaysRunToEnd(bool); - bool repeat() const; - void setRepeat(bool); + + int loops() const; + void setLoops(int); int currentTime(); void setCurrentTime(int); @@ -106,8 +110,8 @@ Q_SIGNALS: void completed(); void runningChanged(bool); void pausedChanged(bool); - void repeatChanged(bool); void alwaysRunToEndChanged(bool); + void loopCountChanged(int); public Q_SLOTS: void restart(); @@ -163,7 +167,7 @@ class QDeclarativeScriptAction : public QDeclarativeAbstractAnimation Q_DECLARE_PRIVATE(QDeclarativeScriptAction) Q_PROPERTY(QDeclarativeScriptString script READ script WRITE setScript) - Q_PROPERTY(QString stateChangeScriptName READ stateChangeScriptName WRITE setStateChangeScriptName) + Q_PROPERTY(QString scriptName READ stateChangeScriptName WRITE setStateChangeScriptName) public: QDeclarativeScriptAction(QObject *parent=0); @@ -227,32 +231,6 @@ protected: }; class QDeclarativeItem; -class QDeclarativeParentActionPrivate; -class QDeclarativeParentAction : public QDeclarativeAbstractAnimation -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QDeclarativeParentAction) - - Q_PROPERTY(QDeclarativeItem *target READ object WRITE setObject) - Q_PROPERTY(QDeclarativeItem *parent READ parent WRITE setParent) //### newParent - -public: - QDeclarativeParentAction(QObject *parent=0); - virtual ~QDeclarativeParentAction(); - - QDeclarativeItem *object() const; - void setObject(QDeclarativeItem *); - - QDeclarativeItem *parent() const; - void setParent(QDeclarativeItem *); - -protected: - virtual void transition(QDeclarativeStateActions &actions, - QDeclarativeProperties &modified, - TransitionDirection direction); - virtual QAbstractAnimation *qtAnimation(); -}; - class QDeclarativePropertyAnimationPrivate; class Q_AUTOTEST_EXPORT QDeclarativePropertyAnimation : public QDeclarativeAbstractAnimation { @@ -456,9 +434,9 @@ class QDeclarativeParentAnimation : public QDeclarativeAnimationGroup Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeParentAnimation) - Q_PROPERTY(QDeclarativeItem *target READ target WRITE setTarget) - Q_PROPERTY(QDeclarativeItem *newParent READ newParent WRITE setNewParent) - Q_PROPERTY(QDeclarativeItem *via READ via WRITE setVia) + Q_PROPERTY(QDeclarativeItem *target READ target WRITE setTarget NOTIFY targetChanged) + Q_PROPERTY(QDeclarativeItem *newParent READ newParent WRITE setNewParent NOTIFY newParentChanged) + Q_PROPERTY(QDeclarativeItem *via READ via WRITE setVia NOTIFY viaChanged) public: QDeclarativeParentAnimation(QObject *parent=0); @@ -473,6 +451,11 @@ public: QDeclarativeItem *via() const; void setVia(QDeclarativeItem *); +Q_SIGNALS: + void targetChanged(); + void newParentChanged(); + void viaChanged(); + protected: virtual void transition(QDeclarativeStateActions &actions, QDeclarativeProperties &modified, @@ -506,7 +489,6 @@ QML_DECLARE_TYPE(QDeclarativeAbstractAnimation) QML_DECLARE_TYPE(QDeclarativePauseAnimation) QML_DECLARE_TYPE(QDeclarativeScriptAction) QML_DECLARE_TYPE(QDeclarativePropertyAction) -QML_DECLARE_TYPE(QDeclarativeParentAction) QML_DECLARE_TYPE(QDeclarativePropertyAnimation) QML_DECLARE_TYPE(QDeclarativeColorAnimation) QML_DECLARE_TYPE(QDeclarativeNumberAnimation) diff --git a/src/declarative/util/qdeclarativeanimation_p_p.h b/src/declarative/util/qdeclarativeanimation_p_p.h index 0460312..3908e50 100644 --- a/src/declarative/util/qdeclarativeanimation_p_p.h +++ b/src/declarative/util/qdeclarativeanimation_p_p.h @@ -225,19 +225,21 @@ class QDeclarativeAbstractAnimationPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QDeclarativeAbstractAnimation) public: QDeclarativeAbstractAnimationPrivate() - : running(false), paused(false), alwaysRunToEnd(false), repeat(false), + : running(false), paused(false), alwaysRunToEnd(false), connectedTimeLine(false), componentComplete(true), - avoidPropertyValueSourceStart(false), disableUserControl(false), group(0) {} + avoidPropertyValueSourceStart(false), disableUserControl(false), + loopCount(1), group(0) {} bool running:1; bool paused:1; bool alwaysRunToEnd:1; - bool repeat:1; bool connectedTimeLine:1; bool componentComplete:1; bool avoidPropertyValueSourceStart:1; bool disableUserControl:1; + int loopCount; + void commence(); QDeclarativeProperty defaultProperty; @@ -264,7 +266,7 @@ class QDeclarativeScriptActionPrivate : public QDeclarativeAbstractAnimationPriv Q_DECLARE_PUBLIC(QDeclarativeScriptAction) public: QDeclarativeScriptActionPrivate() - : QDeclarativeAbstractAnimationPrivate(), hasRunScriptScript(false), proxy(this), rsa(0) {} + : QDeclarativeAbstractAnimationPrivate(), hasRunScriptScript(false), reversing(false), proxy(this), rsa(0) {} void init(); @@ -272,6 +274,7 @@ public: QString name; QDeclarativeScriptString runScriptScript; bool hasRunScriptScript; + bool reversing; void execute(); @@ -300,22 +303,6 @@ public: QActionAnimation *spa; }; -class QDeclarativeParentActionPrivate : public QDeclarativeAbstractAnimationPrivate -{ - Q_DECLARE_PUBLIC(QDeclarativeParentAction) -public: - QDeclarativeParentActionPrivate() - : QDeclarativeAbstractAnimationPrivate(), pcTarget(0), pcParent(0) {} - - void init(); - - QDeclarativeItem *pcTarget; - QDeclarativeItem *pcParent; - - void doAction(); - QActionAnimation *cpa; -}; - class QDeclarativeAnimationGroupPrivate : public QDeclarativeAbstractAnimationPrivate { Q_DECLARE_PUBLIC(QDeclarativeAnimationGroup) @@ -369,7 +356,7 @@ class QDeclarativeRotationAnimationPrivate : public QDeclarativePropertyAnimatio { Q_DECLARE_PUBLIC(QDeclarativeRotationAnimation) public: - QDeclarativeRotationAnimationPrivate() : direction(QDeclarativeRotationAnimation::Shortest) {} + QDeclarativeRotationAnimationPrivate() : direction(QDeclarativeRotationAnimation::Numerical) {} QDeclarativeRotationAnimation::RotationDirection direction; }; diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp index d90ca33..1e000df 100644 --- a/src/declarative/util/qdeclarativebehavior.cpp +++ b/src/declarative/util/qdeclarativebehavior.cpp @@ -83,7 +83,8 @@ public: y: 200 // initial value Behavior on y { NumberAnimation { - easing: "easeOutBounce(amplitude:100)" + easing.type: "OutBounce" + easing.amplitude: 100 duration: 200 } } diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 340e9ac..3e25234 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -401,7 +401,7 @@ void QDeclarativeListModel::remove(int index) values in \a dict. \code - FruitModel.insert(2, {"cost": 5.95, "name":"Pizza"}) + fruitModel.insert(2, {"cost": 5.95, "name":"Pizza"}) \endcode The \a index must be to an existing item in the list, or one past @@ -437,7 +437,7 @@ void QDeclarativeListModel::insert(int index, const QScriptValue& valuemap) to the end of the list: \code - FruitModel.move(0,FruitModel.count-3,3) + fruitModel.move(0,fruitModel.count-3,3) \endcode \sa append() @@ -479,7 +479,7 @@ void QDeclarativeListModel::move(int from, int to, int n) values in \a dict. \code - FruitModel.append({"cost": 5.95, "name":"Pizza"}) + fruitModel.append({"cost": 5.95, "name":"Pizza"}) \endcode \sa set() remove() @@ -500,8 +500,8 @@ void QDeclarativeListModel::append(const QScriptValue& valuemap) Returns the item at \a index in the list model. \code - FruitModel.append({"cost": 5.95, "name":"Jackfruit"}) - FruitModel.get(0).cost + fruitModel.append({"cost": 5.95, "name":"Jackfruit"}) + fruitModel.get(0).cost \endcode The \a index must be an element in the list. @@ -510,10 +510,10 @@ void QDeclarativeListModel::append(const QScriptValue& valuemap) will also be models, and this get() method is used to access elements: \code - FruitModel.append(..., "attributes": + fruitModel.append(..., "attributes": [{"name":"spikes","value":"7mm"}, {"name":"color","value":"green"}]); - FruitModel.get(0).attributes.get(1).value; // == "green" + fruitModel.get(0).attributes.get(1).value; // == "green" \endcode \sa append() @@ -536,7 +536,7 @@ QScriptValue QDeclarativeListModel::get(int index) const are left unchanged. \code - FruitModel.set(3, {"cost": 5.95, "name":"Pizza"}) + fruitModel.set(3, {"cost": 5.95, "name":"Pizza"}) \endcode The \a index must be an element in the list. @@ -574,7 +574,7 @@ void QDeclarativeListModel::set(int index, const QScriptValue& valuemap) Changes the \a property of the item at \a index in the list model to \a value. \code - FruitModel.set(3, "cost", 5.95) + fruitModel.set(3, "cost", 5.95) \endcode The \a index must be an element in the list. diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index 942d5f6..e78fdf1 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -43,8 +43,6 @@ #include "qdeclarativenetworkaccessmanagerfactory.h" #include "qdeclarativeimageprovider.h" -#include "qfxperf_p_p.h" - #include <qdeclarativeengine.h> #include <private/qdeclarativeglobal_p.h> #include <private/qdeclarativeengine_p.h> diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index 8865e04..6ceec5d 100644 --- a/src/declarative/util/qdeclarativepropertychanges.cpp +++ b/src/declarative/util/qdeclarativepropertychanges.cpp @@ -227,6 +227,8 @@ QDeclarativePropertyChangesParser::compileList(QList<QPair<QByteArray, QVariant> const QVariant &value = values.at(ii); if (value.userType() == qMetaTypeId<QDeclarativeCustomParserNode>()) { + error(qvariant_cast<QDeclarativeCustomParserNode>(value), + QDeclarativePropertyChanges::tr("PropertyChanges does not support creating state-specific objects.")); continue; } else if(value.userType() == qMetaTypeId<QDeclarativeCustomParserProperty>()) { diff --git a/src/declarative/util/qdeclarativespringfollow.cpp b/src/declarative/util/qdeclarativespringfollow.cpp index 1d69dd3..76d7c98 100644 --- a/src/declarative/util/qdeclarativespringfollow.cpp +++ b/src/declarative/util/qdeclarativespringfollow.cpp @@ -224,11 +224,11 @@ void QDeclarativeSpringFollowPrivate::stop() color: "#00ff00" y: 200 // initial value SequentialAnimation on y { - running: true - repeat: true + loops: Animation.Infinite NumberAnimation { to: 200 - easing: "easeOutBounce(amplitude:100)" + easing.type: "OutBounce" + easing.amplitude: 100 duration: 2000 } PauseAnimation { duration: 1000 } diff --git a/src/declarative/util/qdeclarativestate_p_p.h b/src/declarative/util/qdeclarativestate_p_p.h index 6f52219..558c99b 100644 --- a/src/declarative/util/qdeclarativestate_p_p.h +++ b/src/declarative/util/qdeclarativestate_p_p.h @@ -58,8 +58,8 @@ #include "qdeclarativeanimation_p_p.h" #include "qdeclarativetransitionmanager_p_p.h" -#include <qdeclarativeproperty_p.h> -#include <qdeclarativeguard_p.h> +#include <private/qdeclarativeproperty_p.h> +#include <private/qdeclarativeguard_p.h> #include <private/qobject_p.h> diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp index 6f5bb66..0bc81ee 100644 --- a/src/declarative/util/qdeclarativestateoperations.cpp +++ b/src/declarative/util/qdeclarativestateoperations.cpp @@ -168,7 +168,7 @@ void QDeclarativeParentChangePrivate::doChange(QDeclarativeItem *targetParent, Q for the original and new parent). You can specify at which point in a transition you want a ParentChange to occur by - using a ParentAnimation or ParentAction. + using a ParentAnimation. */ @@ -456,11 +456,10 @@ void QDeclarativeParentChange::saveCurrentValues() } d->rewindParent = d->target->parentItem(); + d->rewindStackBefore = 0; - if (!d->rewindParent) { - d->rewindStackBefore = 0; + if (!d->rewindParent) return; - } //try to determine the item's original stack position so we can restore it int siblingIndex = ((AccessibleFxItem*)d->target)->siblingIndex() + 1; @@ -495,9 +494,31 @@ public: \qmlclass StateChangeScript QDeclarativeStateChangeScript \brief The StateChangeScript element allows you to run a script in a state. - The script specified will be run immediately when the state is made current. - Alternatively you can use a ScriptAction to specify at which point in the transition + StateChangeScripts are run when entering the state. You can use + ScriptAction to specify at which point in the transition you want the StateChangeScript to be run. + + \qml + State { + name "state1" + StateChangeScript { + name: "myScript" + script: doStateStuff(); + } + ... + } + ... + Transition { + to: "state1" + SequentialAnimation { + NumberAnimation { ... } + ScriptAction { scriptName: "myScript" } + NumberAnimation { ... } + } + } + \endqml + + \sa ScriptAction */ QDeclarativeStateChangeScript::QDeclarativeStateChangeScript(QObject *parent) @@ -944,7 +965,7 @@ void QDeclarativeAnchorChanges::saveOriginals() d->origBaseline = d->target->anchors()->baseline(); d->applyOrigLeft = d->applyOrigRight = d->applyOrigHCenter = d->applyOrigTop - = d->applyOrigBottom = d->applyOrigHCenter = d->applyOrigBaseline = false; + = d->applyOrigBottom = d->applyOrigVCenter = d->applyOrigBaseline = false; saveCurrentValues(); } diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp index ac07b10..4326a55 100644 --- a/src/declarative/util/qdeclarativetransition.cpp +++ b/src/declarative/util/qdeclarativetransition.cpp @@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE \ingroup group_states */ -//ParallelAnimationWrapperallows us to do a "callback" when the animation finishes, rather than connecting +//ParallelAnimationWrapper allows us to do a "callback" when the animation finishes, rather than connecting //and disconnecting signals and slots frequently class ParallelAnimationWrapper : public QParallelAnimationGroup { @@ -195,7 +195,11 @@ QString QDeclarativeTransition::fromState() const void QDeclarativeTransition::setFromState(const QString &f) { Q_D(QDeclarativeTransition); + if (f == d->fromState) + return; + d->fromState = f; + emit fromChanged(); } /*! @@ -213,7 +217,11 @@ bool QDeclarativeTransition::reversible() const void QDeclarativeTransition::setReversible(bool r) { Q_D(QDeclarativeTransition); + if (r == d->reversible) + return; + d->reversible = r; + emit reversibleChanged(); } QString QDeclarativeTransition::toState() const @@ -225,7 +233,11 @@ QString QDeclarativeTransition::toState() const void QDeclarativeTransition::setToState(const QString &t) { Q_D(QDeclarativeTransition); + if (t == d->toState) + return; + d->toState = t; + emit toChanged(); } /*! diff --git a/src/declarative/util/qdeclarativetransition_p.h b/src/declarative/util/qdeclarativetransition_p.h index 861111a..2f9e7b5 100644 --- a/src/declarative/util/qdeclarativetransition_p.h +++ b/src/declarative/util/qdeclarativetransition_p.h @@ -62,9 +62,9 @@ class Q_DECLARATIVE_EXPORT QDeclarativeTransition : public QObject Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeTransition) - Q_PROPERTY(QString from READ fromState WRITE setFromState) - Q_PROPERTY(QString to READ toState WRITE setToState) - Q_PROPERTY(bool reversible READ reversible WRITE setReversible) + Q_PROPERTY(QString from READ fromState WRITE setFromState NOTIFY fromChanged) + Q_PROPERTY(QString to READ toState WRITE setToState NOTIFY toChanged) + Q_PROPERTY(bool reversible READ reversible WRITE setReversible NOTIFY reversibleChanged) Q_PROPERTY(QDeclarativeListProperty<QDeclarativeAbstractAnimation> animations READ animations) Q_CLASSINFO("DefaultProperty", "animations") Q_CLASSINFO("DeferredPropertyNames", "animations") @@ -90,6 +90,11 @@ public: void setReversed(bool r); void stop(); + +Q_SIGNALS: + void fromChanged(); + void toChanged(); + void reversibleChanged(); }; QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativeutilmodule.cpp b/src/declarative/util/qdeclarativeutilmodule.cpp index 4d4678a..d79c6ba 100644 --- a/src/declarative/util/qdeclarativeutilmodule.cpp +++ b/src/declarative/util/qdeclarativeutilmodule.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include "qdeclarativeutilmodule_p.h" -#include "qfxperf_p_p.h" #include "qdeclarativeanimation_p.h" #include "qdeclarativeanimation_p_p.h" #include "qdeclarativebehavior_p.h" @@ -71,7 +70,38 @@ #ifndef QT_NO_XMLPATTERNS #include "qdeclarativexmllistmodel_p.h" #endif -#include "qperformancelog_p_p.h" + +template<typename T> +int qmlRegisterTypeEnums(const char *qmlName) +{ + QByteArray name(T::staticMetaObject.className()); + + QByteArray pointerName(name + '*'); + QByteArray listName("QDeclarativeListProperty<" + name + ">"); + + QDeclarativePrivate::RegisterType type = { + 0, + + qRegisterMetaType<T *>(pointerName.constData()), + qRegisterMetaType<QDeclarativeListProperty<T> >(listName.constData()), + 0, 0, + + "Qt", 4, 6, qmlName, &T::staticMetaObject, + + QDeclarativePrivate::attachedPropertiesFunc<T>(), + QDeclarativePrivate::attachedPropertiesMetaObject<T>(), + + QDeclarativePrivate::StaticCastSelector<T,QDeclarativeParserStatus>::cast(), + QDeclarativePrivate::StaticCastSelector<T,QDeclarativePropertyValueSource>::cast(), + QDeclarativePrivate::StaticCastSelector<T,QDeclarativePropertyValueInterceptor>::cast(), + + 0, 0, + + 0 + }; + + return QDeclarativePrivate::registerType(type); +} void QDeclarativeUtilModule::defineModule() { @@ -87,7 +117,6 @@ void QDeclarativeUtilModule::defineModule() qmlRegisterType<QDeclarativeNumberAnimation>("Qt",4,6,"NumberAnimation"); qmlRegisterType<QDeclarativePackage>("Qt",4,6,"Package"); qmlRegisterType<QDeclarativeParallelAnimation>("Qt",4,6,"ParallelAnimation"); - qmlRegisterType<QDeclarativeParentAction>("Qt",4,6,"ParentAction"); qmlRegisterType<QDeclarativeParentAnimation>("Qt",4,6,"ParentAnimation"); qmlRegisterType<QDeclarativeParentChange>("Qt",4,6,"ParentChange"); qmlRegisterType<QDeclarativePauseAnimation>("Qt",4,6,"PauseAnimation"); @@ -110,9 +139,10 @@ void QDeclarativeUtilModule::defineModule() #endif qmlRegisterType<QDeclarativeAnchors>(); - qmlRegisterType<QDeclarativeAbstractAnimation>(); qmlRegisterType<QDeclarativeStateOperation>(); + qmlRegisterTypeEnums<QDeclarativeAbstractAnimation>("Animation"); + qmlRegisterCustomType<QDeclarativeListModel>("Qt", 4,6, "ListModel", "QDeclarativeListModel", new QDeclarativeListModelParser); qmlRegisterCustomType<QDeclarativePropertyChanges>("Qt", 4, 6, "PropertyChanges", "QDeclarativePropertyChanges", diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index 59a062a..d97fb5f 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -41,9 +41,6 @@ #include "qdeclarativeview.h" -#include "qperformancelog_p_p.h" -#include "qfxperf_p_p.h" - #include <qdeclarative.h> #include <qdeclarativeitem.h> #include <qdeclarativeengine.h> @@ -132,6 +129,7 @@ class QDeclarativeViewPrivate public: QDeclarativeViewPrivate(QDeclarativeView *view) : q(view), root(0), component(0), resizeMode(QDeclarativeView::SizeViewToRootObject) {} + ~QDeclarativeViewPrivate() { delete root; } void execute(); @@ -251,13 +249,6 @@ QDeclarativeView::QDeclarativeView(const QUrl &source, QWidget *parent) void QDeclarativeViewPrivate::init() { -#ifdef Q_ENABLE_PERFORMANCE_LOG - { - QDeclarativePerfTimer<QDeclarativePerf::FontDatabase> perf; - QFontDatabase database; - } -#endif - q->setScene(&scene); q->setOptimizationFlags(QGraphicsView::DontSavePainterState); @@ -280,7 +271,7 @@ void QDeclarativeViewPrivate::init() */ QDeclarativeView::~QDeclarativeView() { - delete d->root; + delete d; } /*! \property QDeclarativeView::source @@ -455,8 +446,6 @@ void QDeclarativeView::setRootObject(QObject *obj) if (QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(obj)) { d->scene.addItem(item); - QPerformanceLog::displayData(); - QPerformanceLog::clear(); d->root = item; d->qmlRoot = item; connect(item, SIGNAL(widthChanged(qreal)), this, SLOT(sizeChanged())); diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 01ae2ed..f7beeaa 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -46,6 +46,7 @@ #include <QDebug> #include <QStringList> +#include <QQueue> #include <QApplication> #include <QThread> #include <QMutex> @@ -59,9 +60,9 @@ #include <private/qobject_p.h> -QT_BEGIN_NAMESPACE - +Q_DECLARE_METATYPE(QDeclarativeXmlQueryResult) +QT_BEGIN_NAMESPACE typedef QPair<int, int> QDeclarativeXmlListRange; @@ -109,13 +110,25 @@ typedef QPair<int, int> QDeclarativeXmlListRange; \sa XmlListModel */ +struct XmlQueryJob +{ + int queryId; + QByteArray data; + QString query; + QString namespaces; + QStringList roleQueries; + QStringList keyRoleQueries; + QStringList keyRoleResultsCache; +}; + class QDeclarativeXmlQuery : public QThread { Q_OBJECT public: QDeclarativeXmlQuery(QObject *parent=0) - : QThread(parent), m_quit(false), m_restart(false), m_abort(false), m_queryId(0) { + : QThread(parent), m_quit(false), m_abortQueryId(-1), m_queryIds(0) { + qRegisterMetaType<QDeclarativeXmlQueryResult>("QDeclarativeXmlQueryResult"); } ~QDeclarativeXmlQuery() { m_mutex.lock(); @@ -126,27 +139,38 @@ public: wait(); } - void abort() { + void abort(int id) { QMutexLocker locker(&m_mutex); - m_abort = true; + m_abortQueryId = id; } - int doQuery(QString query, QString namespaces, QByteArray data, QList<QDeclarativeXmlListModelRole *> *roleObjects) { + int doQuery(QString query, QString namespaces, QByteArray data, QList<QDeclarativeXmlListModelRole *> *roleObjects, QStringList keyRoleResultsCache) { QMutexLocker locker(&m_mutex); - m_size = 0; - m_data = data; - m_query = QLatin1String("doc($src)") + query; - m_namespaces = namespaces; - m_roleObjects = roleObjects; - if (!isRunning()) { - m_abort = false; + + XmlQueryJob job; + job.queryId = m_queryIds; + job.data = data; + job.query = QLatin1String("doc($src)") + query; + job.namespaces = namespaces; + job.keyRoleResultsCache = keyRoleResultsCache; + + for (int i=0; i<roleObjects->count(); i++) { + if (!roleObjects->at(i)->isValid()) { + job.roleQueries << ""; + continue; + } + job.roleQueries << roleObjects->at(i)->query(); + if (roleObjects->at(i)->isKey()) + job.keyRoleQueries << job.roleQueries.last(); + } + m_jobs.enqueue(job); + m_queryIds++; + + if (!isRunning()) start(); - } else { - m_restart = true; + else m_condition.wakeOne(); - } - m_queryId++; - return m_queryId; + return job.queryId; } QList<QList<QVariant> > modelData() { @@ -164,26 +188,33 @@ public: return m_removedItemRanges; } + Q_SIGNALS: - void queryCompleted(int queryId, int size); + void queryCompleted(const QDeclarativeXmlQueryResult &); protected: void run() { while (!m_quit) { m_mutex.lock(); - int queryId = m_queryId; doQueryJob(); doSubQueryJob(); - m_data.clear(); // no longer needed m_mutex.unlock(); m_mutex.lock(); - if (!m_abort) - emit queryCompleted(queryId, m_size); - if (!m_restart) + const XmlQueryJob &job = m_jobs.dequeue(); + if (m_abortQueryId != job.queryId) { + QDeclarativeXmlQueryResult r; + r.queryId = job.queryId; + r.size = m_size; + r.data = m_modelData; + r.inserted = m_insertedItemRanges; + r.removed = m_removedItemRanges; + r.keyRoleResultsCache = job.keyRoleResultsCache; + emit queryCompleted(r); + } + if (m_jobs.isEmpty()) m_condition.wait(&m_mutex); - m_abort = false; - m_restart = false; + m_abortQueryId = -1; m_mutex.unlock(); } } @@ -197,30 +228,30 @@ private: private: QMutex m_mutex; QWaitCondition m_condition; + QQueue<XmlQueryJob> m_jobs; bool m_quit; - bool m_restart; - bool m_abort; - QByteArray m_data; - QString m_query; - QString m_namespaces; + int m_abortQueryId; QString m_prefix; int m_size; - int m_queryId; - const QList<QDeclarativeXmlListModelRole *> *m_roleObjects; + int m_queryIds; QList<QList<QVariant> > m_modelData; - QStringList m_keysValues; QList<QDeclarativeXmlListRange> m_insertedItemRanges; QList<QDeclarativeXmlListRange> m_removedItemRanges; }; +Q_GLOBAL_STATIC(QDeclarativeXmlQuery, globalXmlQuery) + void QDeclarativeXmlQuery::doQueryJob() { + Q_ASSERT(!m_jobs.isEmpty()); + XmlQueryJob &job = m_jobs.head(); + QString r; QXmlQuery query; - QBuffer buffer(&m_data); + QBuffer buffer(&job.data); buffer.open(QIODevice::ReadOnly); query.bindVariable(QLatin1String("src"), &buffer); - query.setQuery(m_namespaces + m_query); + query.setQuery(job.namespaces + job.query); query.evaluateTo(&r); //qDebug() << r; @@ -231,9 +262,9 @@ void QDeclarativeXmlQuery::doQueryJob() b.open(QIODevice::ReadOnly); //qDebug() << xml; - QString namespaces = QLatin1String("declare namespace dummy=\"http://qtsotware.com/dummy\";\n") + m_namespaces; + QString namespaces = QLatin1String("declare namespace dummy=\"http://qtsotware.com/dummy\";\n") + job.namespaces; QString prefix = QLatin1String("doc($inputDocument)/dummy:items") + - m_query.mid(m_query.lastIndexOf(QLatin1Char('/'))); + job.query.mid(job.query.lastIndexOf(QLatin1Char('/'))); //figure out how many items we are dealing with int count = -1; @@ -249,19 +280,18 @@ void QDeclarativeXmlQuery::doQueryJob() } //qDebug() << count; + job.data = xml; m_prefix = namespaces + prefix + QLatin1Char('/'); - m_data = xml; + m_size = 0; if (count > 0) m_size = count; } void QDeclarativeXmlQuery::getValuesOfKeyRoles(QStringList *values, QXmlQuery *query) const { - QStringList keysQueries; - for (int i=0; i<m_roleObjects->count(); i++) { - if (m_roleObjects->at(i)->isKey()) - keysQueries << m_roleObjects->at(i)->query(); - } + Q_ASSERT(!m_jobs.isEmpty()); + + const QStringList &keysQueries = m_jobs.head().keyRoleQueries; QString keysQuery; if (keysQueries.count() == 1) keysQuery = m_prefix + keysQueries[0]; @@ -291,54 +321,58 @@ void QDeclarativeXmlQuery::addIndexToRangeList(QList<QDeclarativeXmlListRange> * void QDeclarativeXmlQuery::doSubQueryJob() { + Q_ASSERT(!m_jobs.isEmpty()); + XmlQueryJob &job = m_jobs.head(); m_modelData.clear(); - QBuffer b(&m_data); + QBuffer b(&job.data); b.open(QIODevice::ReadOnly); QXmlQuery subquery; subquery.bindVariable(QLatin1String("inputDocument"), &b); - QStringList keysValues; - getValuesOfKeyRoles(&keysValues, &subquery); + QStringList keyRoleResults; + getValuesOfKeyRoles(&keyRoleResults, &subquery); // See if any values of key roles have been inserted or removed. + m_insertedItemRanges.clear(); m_removedItemRanges.clear(); - if (m_keysValues.isEmpty()) { + if (job.keyRoleResultsCache.isEmpty()) { m_insertedItemRanges << qMakePair(0, m_size); } else { - if (keysValues != m_keysValues) { + if (keyRoleResults != job.keyRoleResultsCache) { QStringList temp; - for (int i=0; i<m_keysValues.count(); i++) { - if (!keysValues.contains(m_keysValues[i])) + for (int i=0; i<job.keyRoleResultsCache.count(); i++) { + if (!keyRoleResults.contains(job.keyRoleResultsCache[i])) addIndexToRangeList(&m_removedItemRanges, i); else - temp << m_keysValues[i]; + temp << job.keyRoleResultsCache[i]; } - for (int i=0; i<keysValues.count(); i++) { - if (temp.count() == i || keysValues[i] != temp[i]) { - temp.insert(i, keysValues[i]); + for (int i=0; i<keyRoleResults.count(); i++) { + if (temp.count() == i || keyRoleResults[i] != temp[i]) { + temp.insert(i, keyRoleResults[i]); addIndexToRangeList(&m_insertedItemRanges, i); } } } } - m_keysValues = keysValues; + job.keyRoleResultsCache = keyRoleResults; + // Get the new values for each role. //### we might be able to condense even further (query for everything in one go) - for (int i = 0; i < m_roleObjects->size(); ++i) { - QDeclarativeXmlListModelRole *role = m_roleObjects->at(i); - if (!role->isValid()) { + const QStringList &queries = job.roleQueries; + for (int i = 0; i < queries.size(); ++i) { + if (queries[i].isEmpty()) { QList<QVariant> resultList; for (int j = 0; j < m_size; ++j) resultList << QVariant(); m_modelData << resultList; continue; } - subquery.setQuery(m_prefix + QLatin1String("(let $v := ") + role->query() + QLatin1String(" return if ($v) then ") + role->query() + QLatin1String(" else \"\")")); + subquery.setQuery(m_prefix + QLatin1String("(let $v := ") + queries[i] + QLatin1String(" return if ($v) then ") + queries[i] + QLatin1String(" else \"\")")); QXmlResultItems resultItems; subquery.evaluateTo(&resultItems); QXmlItem item(resultItems.next()); @@ -404,8 +438,8 @@ public: QNetworkReply *reply; QDeclarativeXmlListModel::Status status; qreal progress; - QDeclarativeXmlQuery qmlXmlQuery; int queryId; + QStringList keyRoleResultsCache; QList<QDeclarativeXmlListModelRole *> roleObjects; static void append_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list, QDeclarativeXmlListModelRole *role); static void clear_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list); @@ -489,9 +523,8 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla QDeclarativeXmlListModel::QDeclarativeXmlListModel(QObject *parent) : QListModelInterface(*(new QDeclarativeXmlListModelPrivate), parent) { - Q_D(QDeclarativeXmlListModel); - connect(&d->qmlXmlQuery, SIGNAL(queryCompleted(int,int)), - this, SLOT(queryCompleted(int,int))); + connect(globalXmlQuery(), SIGNAL(queryCompleted(QDeclarativeXmlQueryResult)), + this, SLOT(queryCompleted(QDeclarativeXmlQueryResult))); } QDeclarativeXmlListModel::~QDeclarativeXmlListModel() @@ -723,7 +756,7 @@ void QDeclarativeXmlListModel::reload() if (!d->isComponentComplete) return; - d->qmlXmlQuery.abort(); + globalXmlQuery()->abort(d->queryId); d->queryId = -1; int count = d->size; @@ -755,7 +788,7 @@ void QDeclarativeXmlListModel::reload() } if (!d->xml.isEmpty()) { - d->queryId = d->qmlXmlQuery.doQuery(d->query, d->namespaces, d->xml.toUtf8(), &d->roleObjects); + d->queryId = globalXmlQuery()->doQuery(d->query, d->namespaces, d->xml.toUtf8(), &d->roleObjects, d->keyRoleResultsCache); d->progress = 1.0; d->status = Ready; emit progressChanged(d->progress); @@ -802,7 +835,7 @@ void QDeclarativeXmlListModel::requestFinished() } else { d->status = Ready; QByteArray data = d->reply->readAll(); - d->queryId = d->qmlXmlQuery.doQuery(d->query, d->namespaces, data, &d->roleObjects); + d->queryId = globalXmlQuery()->doQuery(d->query, d->namespaces, data, &d->roleObjects, d->keyRoleResultsCache); disconnect(d->reply, 0, this, 0); d->reply->deleteLater(); d->reply = 0; @@ -821,22 +854,20 @@ void QDeclarativeXmlListModel::requestProgress(qint64 received, qint64 total) } } -void QDeclarativeXmlListModel::queryCompleted(int id, int size) +void QDeclarativeXmlListModel::queryCompleted(const QDeclarativeXmlQueryResult &result) { Q_D(QDeclarativeXmlListModel); - if (id != d->queryId) + if (result.queryId != d->queryId) return; - bool sizeChanged = size != d->size; - d->size = size; - d->data = d->qmlXmlQuery.modelData(); - - QList<QDeclarativeXmlListRange> removed = d->qmlXmlQuery.removedItemRanges(); - QList<QDeclarativeXmlListRange> inserted = d->qmlXmlQuery.insertedItemRanges(); - - for (int i=0; i<removed.count(); i++) - emit itemsRemoved(removed[i].first, removed[i].second); - for (int i=0; i<inserted.count(); i++) - emit itemsInserted(inserted[i].first, inserted[i].second); + bool sizeChanged = result.size != d->size; + d->size = result.size; + d->data = result.data; + d->keyRoleResultsCache = result.keyRoleResultsCache; + + for (int i=0; i<result.removed.count(); i++) + emit itemsRemoved(result.removed[i].first, result.removed[i].second); + for (int i=0; i<result.inserted.count(); i++) + emit itemsInserted(result.inserted[i].first, result.inserted[i].second); if (sizeChanged) emit countChanged(); diff --git a/src/declarative/util/qdeclarativexmllistmodel_p.h b/src/declarative/util/qdeclarativexmllistmodel_p.h index 23ff7ce..7bb0f0e 100644 --- a/src/declarative/util/qdeclarativexmllistmodel_p.h +++ b/src/declarative/util/qdeclarativexmllistmodel_p.h @@ -46,6 +46,7 @@ #include <qdeclarativeinfo.h> #include <QtCore/qurl.h> +#include <QtCore/qstringlist.h> #include <private/qlistmodelinterface_p.h> @@ -56,10 +57,18 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeContext; - class QDeclarativeXmlListModelRole; - class QDeclarativeXmlListModelPrivate; + +struct QDeclarativeXmlQueryResult { + int queryId; + int size; + QList<QList<QVariant> > data; + QList<QPair<int, int> > inserted; + QList<QPair<int, int> > removed; + QStringList keyRoleResultsCache; +}; + class Q_DECLARATIVE_EXPORT QDeclarativeXmlListModel : public QListModelInterface, public QDeclarativeParserStatus { Q_OBJECT @@ -126,7 +135,7 @@ public Q_SLOTS: private Q_SLOTS: void requestFinished(); void requestProgress(qint64,qint64); - void queryCompleted(int,int); + void queryCompleted(const QDeclarativeXmlQueryResult &); private: Q_DECLARE_PRIVATE(QDeclarativeXmlListModel) diff --git a/src/declarative/util/qfxperf.cpp b/src/declarative/util/qfxperf.cpp deleted file mode 100644 index 5611c49..0000000 --- a/src/declarative/util/qfxperf.cpp +++ /dev/null @@ -1,67 +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 "qfxperf_p_p.h" - -QT_BEGIN_NAMESPACE - -Q_DEFINE_PERFORMANCE_LOG(QDeclarativePerf, "QDeclarativeGraphics") { - Q_DEFINE_PERFORMANCE_METRIC(QDeclarativeParsing, "Compilation: QML Parsing") - Q_DEFINE_PERFORMANCE_METRIC(Compilation, " QML Compilation") - Q_DEFINE_PERFORMANCE_METRIC(VMEExecution, "Execution: QML VME Execution") - Q_DEFINE_PERFORMANCE_METRIC(BindInit, "BindValue Initialization") - Q_DEFINE_PERFORMANCE_METRIC(BindValue, "BindValue execution") - Q_DEFINE_PERFORMANCE_METRIC(BindValueSSE, "BindValue execution SSE") - Q_DEFINE_PERFORMANCE_METRIC(BindValueQt, "BindValue execution QtScript") - Q_DEFINE_PERFORMANCE_METRIC(BindableValueUpdate, "QDeclarativeBinding::update") - Q_DEFINE_PERFORMANCE_METRIC(PixmapLoad, "Pixmap loading") - Q_DEFINE_PERFORMANCE_METRIC(FontDatabase, "Font database creation") - Q_DEFINE_PERFORMANCE_METRIC(QDeclarativePathViewPathCache, "FX Items: QDeclarativePathView: Path cache") - Q_DEFINE_PERFORMANCE_METRIC(CreateParticle, " QDeclarativeParticles: Particle creation") - Q_DEFINE_PERFORMANCE_METRIC(ItemComponentComplete, " QDeclarativeItem::componentComplete") - Q_DEFINE_PERFORMANCE_METRIC(ImageComponentComplete, " QDeclarativeImage::componentComplete") - Q_DEFINE_PERFORMANCE_METRIC(BaseLayoutComponentComplete, " QDeclarativeBasePositioner::componentComplete") - Q_DEFINE_PERFORMANCE_METRIC(TextComponentComplete, " QDeclarativeText::componentComplete") - Q_DEFINE_PERFORMANCE_METRIC(QDeclarativeText_setText, " QDeclarativeText::setText") - Q_DEFINE_PERFORMANCE_METRIC(AddScript, "QDeclarativeScript::addScriptToEngine") -} - -QT_END_NAMESPACE diff --git a/src/declarative/util/qfxperf_p_p.h b/src/declarative/util/qfxperf_p_p.h deleted file mode 100644 index 8b65821..0000000 --- a/src/declarative/util/qfxperf_p_p.h +++ /dev/null @@ -1,90 +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 QFXPERF_H -#define QFXPERF_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qperformancelog_p_p.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -Q_DECLARE_PERFORMANCE_LOG(QDeclarativePerf) { - Q_DECLARE_PERFORMANCE_METRIC(QDeclarativeParsing) - - Q_DECLARE_PERFORMANCE_METRIC(Compilation) - Q_DECLARE_PERFORMANCE_METRIC(VMEExecution) - - Q_DECLARE_PERFORMANCE_METRIC(BindInit) - Q_DECLARE_PERFORMANCE_METRIC(BindValue) - Q_DECLARE_PERFORMANCE_METRIC(BindValueSSE) - Q_DECLARE_PERFORMANCE_METRIC(BindValueQt) - Q_DECLARE_PERFORMANCE_METRIC(BindableValueUpdate) - Q_DECLARE_PERFORMANCE_METRIC(PixmapLoad) - Q_DECLARE_PERFORMANCE_METRIC(FontDatabase) - Q_DECLARE_PERFORMANCE_METRIC(QDeclarativePathViewPathCache) - Q_DECLARE_PERFORMANCE_METRIC(CreateParticle) - Q_DECLARE_PERFORMANCE_METRIC(ItemComponentComplete) - Q_DECLARE_PERFORMANCE_METRIC(ImageComponentComplete) - Q_DECLARE_PERFORMANCE_METRIC(BaseLayoutComponentComplete) - Q_DECLARE_PERFORMANCE_METRIC(TextComponentComplete) - Q_DECLARE_PERFORMANCE_METRIC(QDeclarativeText_setText) - Q_DECLARE_PERFORMANCE_METRIC(AddScript) -} - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QFXPERF_H diff --git a/src/declarative/util/qperformancelog.cpp b/src/declarative/util/qperformancelog.cpp deleted file mode 100644 index 83cc919..0000000 --- a/src/declarative/util/qperformancelog.cpp +++ /dev/null @@ -1,181 +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 "qperformancelog_p_p.h" - -#include <QHash> -#include <QDebug> - -QT_BEGIN_NAMESPACE - -#ifdef Q_ENABLE_PERFORMANCE_LOG - -struct QPerformanceLogData -{ - struct Log - { - Log() - : logDescription(0), maxId(-1) {} - - QHash<int, const char *> descriptions; - const char *logDescription; - int maxId; - }; - - typedef QHash<QPerformanceLog::LogData *, Log> Logs; - Logs logs; -}; -Q_GLOBAL_STATIC(QPerformanceLogData, performanceLogData); - -QPerformanceLog::LogData::LogData(const char *desc) -: sumTime(0), data(0) -{ - QPerformanceLogData *logData = performanceLogData(); - - QPerformanceLogData::Log log; - log.logDescription = desc; - logData->logs.insert(this, log); - - timer.start(); -} - -QPerformanceLog::LogMetric::LogMetric(LogData *l, int id, const char *desc) -{ - if (id < 0) - qFatal("QPerformanceLog: Invalid log id %d ('%s')", id, desc); - - QPerformanceLogData *logData = performanceLogData(); - - QPerformanceLogData::Logs::Iterator logIter = logData->logs.find(l); - if (logIter == logData->logs.end()) - qFatal("QPerformanceLog: Unable to locate log for metric '%s'", desc); - QPerformanceLogData::Log &log = *logIter; - if (log.descriptions.contains(id)) - qFatal("QPerformanceLog: Duplicate log metric %d ('%s')", id, desc); - log.descriptions.insert(id, desc); - - if (log.maxId < id) { - log.maxId = id; - if (l->data) delete [] l->data; - l->data = new unsigned int[2 * (log.maxId + 1)]; - ::memset(l->data, 0, 2 * (log.maxId + 1) * sizeof(unsigned int)); - } -} - -static void QPerformanceLog_clear(QPerformanceLog::LogData *l, const QPerformanceLogData::Log *pl) -{ - ::memset(l->data, 0, 2 * (pl->maxId + 1) * sizeof(unsigned int)); -} - -static void QPerformanceLog_displayData(const QPerformanceLog::LogData *l, const QPerformanceLogData::Log *pl) -{ - qWarning() << pl->logDescription << "performance data"; - unsigned int total = 0; - for (QHash<int, const char *>::ConstIterator iter = pl->descriptions.begin(); - iter != pl->descriptions.end(); - ++iter) { - - int id = iter.key(); - unsigned int ms = l->data[id * 2]; - total += ms; - unsigned int inst = l->data[id * 2 + 1]; - float pi = float(ms) / float(inst); - qWarning().nospace() << " " << *iter << ": " << ms << " ms over " - << inst << " instances (" << pi << " ms/instance)"; - } - qWarning().nospace() << " TOTAL: " << total; -} - -void QPerformanceLog::displayData() -{ - QPerformanceLogData *logData = performanceLogData(); - - for (QPerformanceLogData::Logs::ConstIterator iter = logData->logs.begin(); - iter != logData->logs.end(); - ++iter) { - QPerformanceLog_displayData(iter.key(), &(*iter)); - } -} - -void QPerformanceLog::clear() -{ - QPerformanceLogData *logData = performanceLogData(); - - for (QPerformanceLogData::Logs::ConstIterator iter = logData->logs.begin(); - iter != logData->logs.end(); - ++iter) { - QPerformanceLog_clear(iter.key(), &(*iter)); - } -} - -void QPerformanceLog::displayData(LogData *l) -{ - QPerformanceLogData *logData = performanceLogData(); - QPerformanceLogData::Logs::ConstIterator iter = logData->logs.find(l); - if (iter == logData->logs.end()) - qFatal("QPerformanceLog: Internal corruption - unable to locate log"); - - QPerformanceLog_displayData(iter.key(), &(*iter)); -} - -void QPerformanceLog::clear(LogData *l) -{ - QPerformanceLogData *logData = performanceLogData(); - QPerformanceLogData::Logs::ConstIterator iter = logData->logs.find(l); - if (iter == logData->logs.end()) - qFatal("QPerformanceLog: Internal corruption - unable to locate log"); - - QPerformanceLog_clear(iter.key(), &(*iter)); -} - -#else // Q_ENABLE_PERFORMANCE_LOG - -void QPerformanceLog::displayData() -{ -} - -void QPerformanceLog::clear() -{ -} - -#endif // Q_ENABLE_PERFORMANCE_LOG - -QT_END_NAMESPACE diff --git a/src/declarative/util/qperformancelog_p_p.h b/src/declarative/util/qperformancelog_p_p.h deleted file mode 100644 index a212f28..0000000 --- a/src/declarative/util/qperformancelog_p_p.h +++ /dev/null @@ -1,141 +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 QPERFORMANCELOG_H -#define QPERFORMANCELOG_H - -#include <QtCore/qdatetime.h> - -QT_BEGIN_NAMESPACE - -namespace QPerformanceLog -{ - Q_DECLARATIVE_EXPORT void displayData(); - Q_DECLARATIVE_EXPORT void clear(); - -#ifdef Q_ENABLE_PERFORMANCE_LOG - struct LogData { - LogData(const char *); - QTime timer; - int sumTime; - unsigned int *data; - }; - - struct LogMetric { - LogMetric(LogData *, int, const char *); - }; - - // Internal - void displayData(LogData *); - void clear(LogData *); -#endif -} - -#ifdef Q_ENABLE_PERFORMANCE_LOG - -#define Q_DECLARE_PERFORMANCE_METRIC(name) \ - enum { name = ValueChoice<0, ValueTracker<0, __LINE__>::value, __LINE__>::value }; \ - template<int L> \ - struct ValueTracker<name, L> \ - { \ - enum { value = name }; \ - }; \ - extern QPerformanceLog::LogMetric metric ## name; - -#define Q_DECLARE_PERFORMANCE_LOG(name) \ - namespace name { \ - extern QPerformanceLog::LogData log; \ - inline void displayData() { QPerformanceLog::displayData(&log); } \ - inline void clear() { QPerformanceLog::clear(&log); } \ - } \ - template<int N> \ - class name ## Timer { \ - public: \ - name ## Timer() { \ - lastSum = name::log.sumTime + name::log.timer.restart(); \ - name::log.sumTime = 0; \ - } \ - ~ name ## Timer() { \ - name::log.data[2 * N] += name::log.sumTime + name::log.timer.restart(); \ - ++name::log.data[2 * N + 1]; \ - name::log.sumTime = lastSum; \ - } \ - private: \ - int lastSum; \ - }; \ - namespace name { \ - template<int N, int L> \ - struct ValueTracker \ - { \ - enum { value = -1 }; \ - }; \ - template<int DefNextValue, int NextValue, int L> \ - struct ValueChoice \ - { \ - enum { value = ValueChoice<DefNextValue + 1, ValueTracker<DefNextValue + 1, L>::value, L>::value }; \ - }; \ - template<int DefNextValue, int L> \ - struct ValueChoice<DefNextValue, -1, L> \ - { \ - enum { value = DefNextValue }; \ - }; \ - } \ - namespace name - -#define Q_DEFINE_PERFORMANCE_LOG(name, desc) \ - QPerformanceLog::LogData name::log(desc); \ - namespace name - -#define Q_DEFINE_PERFORMANCE_METRIC(name, desc) \ - QPerformanceLog::LogMetric metrix ## name(&log, name, desc); - -#else // Q_ENABLE_PERFORMANCE_LOG - -#define Q_DECLARE_PERFORMANCE_METRIC(name) -#define Q_DECLARE_PERFORMANCE_LOG(name) namespace name -#define Q_DEFINE_PERFORMANCE_LOG(name, desc) namespace name -#define Q_DEFINE_PERFORMANCE_METRIC(name, desc) - -#endif // Q_ENABLE_PERFORMANCE_LOG - -QT_END_NAMESPACE - -#endif // QPERFORMANCELOG_H diff --git a/src/declarative/util/util.pri b/src/declarative/util/util.pri index f455870..f537806 100644 --- a/src/declarative/util/util.pri +++ b/src/declarative/util/util.pri @@ -3,8 +3,6 @@ INCLUDEPATH += $$PWD SOURCES += \ $$PWD/qdeclarativeutilmodule.cpp\ $$PWD/qdeclarativeview.cpp \ - $$PWD/qfxperf.cpp \ - $$PWD/qperformancelog.cpp \ $$PWD/qdeclarativeconnections.cpp \ $$PWD/qdeclarativepackage.cpp \ $$PWD/qdeclarativeanimation.cpp \ @@ -33,8 +31,6 @@ SOURCES += \ HEADERS += \ $$PWD/qdeclarativeutilmodule_p.h\ $$PWD/qdeclarativeview.h \ - $$PWD/qfxperf_p_p.h \ - $$PWD/qperformancelog_p_p.h \ $$PWD/qdeclarativeconnections_p.h \ $$PWD/qdeclarativepackage_p.h \ $$PWD/qdeclarativeanimation_p.h \ |