diff options
author | Jerome Pasion <jerome.pasion@nokia.com> | 2011-10-19 08:55:43 (GMT) |
---|---|---|
committer | Jerome Pasion <jerome.pasion@nokia.com> | 2011-10-19 08:55:43 (GMT) |
commit | c6ae57e89021d44bbce71d3dd21ee1b833b9d0e2 (patch) | |
tree | d99496ae00c9e9cddb5df85b372065a2c44135cb /src/declarative | |
parent | f90c18e09e8b2e275230080cb51656e3f8a31fba (diff) | |
parent | 8051a73be276995adfc4508a0cb5ad6451e8ab45 (diff) | |
download | Qt-c6ae57e89021d44bbce71d3dd21ee1b833b9d0e2.zip Qt-c6ae57e89021d44bbce71d3dd21ee1b833b9d0e2.tar.gz Qt-c6ae57e89021d44bbce71d3dd21ee1b833b9d0e2.tar.bz2 |
Merge branch '4.8' of scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/declarative')
26 files changed, 219 insertions, 141 deletions
diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri index 3134c79..c81968e 100644 --- a/src/declarative/debugger/debugger.pri +++ b/src/declarative/debugger/debugger.pri @@ -5,13 +5,14 @@ SOURCES += \ $$PWD/qpacketprotocol.cpp \ $$PWD/qdeclarativedebugservice.cpp \ $$PWD/qdeclarativedebugclient.cpp \ - $$PWD/qdeclarativedebug.cpp \ + $$PWD/qdeclarativeenginedebug.cpp \ $$PWD/qdeclarativedebugtrace.cpp \ $$PWD/qdeclarativedebughelper.cpp \ $$PWD/qdeclarativedebugserver.cpp \ $$PWD/qdeclarativeinspectorservice.cpp \ $$PWD/qjsdebuggeragent.cpp \ - $$PWD/qjsdebugservice.cpp + $$PWD/qjsdebugservice.cpp \ + $$PWD/qdeclarativeenginedebugservice.cpp HEADERS += \ $$PWD/qdeclarativedebuggerstatus_p.h \ @@ -19,7 +20,7 @@ HEADERS += \ $$PWD/qdeclarativedebugservice_p.h \ $$PWD/qdeclarativedebugservice_p_p.h \ $$PWD/qdeclarativedebugclient_p.h \ - $$PWD/qdeclarativedebug_p.h \ + $$PWD/qdeclarativeenginedebug_p.h \ $$PWD/qdeclarativedebugtrace_p.h \ $$PWD/qdeclarativedebughelper_p.h \ $$PWD/qdeclarativedebugserver_p.h \ @@ -27,4 +28,6 @@ HEADERS += \ $$PWD/qdeclarativeinspectorservice_p.h \ $$PWD/qdeclarativeinspectorinterface_p.h \ $$PWD/qjsdebuggeragent_p.h \ - $$PWD/qjsdebugservice_p.h + $$PWD/qjsdebugservice_p.h \ + $$PWD/qdeclarativedebug.h \ + $$PWD/qdeclarativeenginedebugservice_p.h diff --git a/src/declarative/debugger/qdeclarativedebug.h b/src/declarative/debugger/qdeclarativedebug.h new file mode 100644 index 0000000..b7930b2 --- /dev/null +++ b/src/declarative/debugger/qdeclarativedebug.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEDEBUG_H +#define QDECLARATIVEDEBUG_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +struct Q_DECLARATIVE_EXPORT QDeclarativeDebuggingEnabler +{ + QDeclarativeDebuggingEnabler(); +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +#if defined(QT_DECLARATIVE_DEBUG) +static QDeclarativeDebuggingEnabler qmlEnableDebuggingHelper; +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEDEBUG_H diff --git a/src/declarative/debugger/qdeclarativedebugserver.cpp b/src/declarative/debugger/qdeclarativedebugserver.cpp index 12691b2..3e0c326 100644 --- a/src/declarative/debugger/qdeclarativedebugserver.cpp +++ b/src/declarative/debugger/qdeclarativedebugserver.cpp @@ -91,6 +91,7 @@ public: QStringList clientPlugins; bool gotHello; QString waitingForMsgFromService; + bool waitingForMsgSucceeded; private: // private slot @@ -100,7 +101,8 @@ private: QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() : connection(0), - gotHello(false) + gotHello(false), + waitingForMsgSucceeded(false) { } @@ -315,7 +317,7 @@ void QDeclarativeDebugServer::receiveMessage(const QByteArray &message) if (d->waitingForMsgFromService == name) { // deliver directly so that it is delivered before waitForMessage is returning. d->_q_deliverMessage(name, message); - d->waitingForMsgFromService.clear(); + d->waitingForMsgSucceeded = true; } else { // deliver message in next event loop run. // Fixes the case that the service does start it's own event loop ..., @@ -409,7 +411,9 @@ bool QDeclarativeDebugServer::waitForMessage(QDeclarativeDebugService *service) do { d->connection->waitForMessage(); - } while (!d->waitingForMsgFromService.isEmpty()); + } while (!d->waitingForMsgSucceeded); + d->waitingForMsgSucceeded = false; + d->waitingForMsgFromService.clear(); return true; } diff --git a/src/declarative/debugger/qdeclarativedebug.cpp b/src/declarative/debugger/qdeclarativeenginedebug.cpp index 620ee1d..85ce710 100644 --- a/src/declarative/debugger/qdeclarativedebug.cpp +++ b/src/declarative/debugger/qdeclarativeenginedebug.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#include "private/qdeclarativedebug_p.h" +#include "private/qdeclarativeenginedebug_p.h" #include "private/qdeclarativedebugclient_p.h" -#include <qdeclarativeenginedebug_p.h> +#include <qdeclarativeenginedebugservice_p.h> #include <private/qobject_p.h> @@ -207,7 +207,7 @@ void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c, QDeclara void QDeclarativeEngineDebugPrivate::decode(QDataStream &ds, QDeclarativeDebugObjectReference &o, bool simple) { - QDeclarativeEngineDebugServer::QDeclarativeObjectData data; + QDeclarativeEngineDebugService::QDeclarativeObjectData data; ds >> data; o.m_debugId = data.objectId; o.m_class = data.objectType; @@ -234,7 +234,7 @@ void QDeclarativeEngineDebugPrivate::decode(QDataStream &ds, QDeclarativeDebugOb ds >> propCount; for (int ii = 0; ii < propCount; ++ii) { - QDeclarativeEngineDebugServer::QDeclarativeObjectProperty data; + QDeclarativeEngineDebugService::QDeclarativeObjectProperty data; ds >> data; QDeclarativeDebugPropertyReference prop; prop.m_objectDebugId = o.m_debugId; @@ -243,21 +243,21 @@ void QDeclarativeEngineDebugPrivate::decode(QDataStream &ds, QDeclarativeDebugOb prop.m_hasNotifySignal = data.hasNotifySignal; prop.m_valueTypeName = data.valueTypeName; switch (data.type) { - case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Basic: - case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::List: - case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::SignalProperty: + case QDeclarativeEngineDebugService::QDeclarativeObjectProperty::Basic: + case QDeclarativeEngineDebugService::QDeclarativeObjectProperty::List: + case QDeclarativeEngineDebugService::QDeclarativeObjectProperty::SignalProperty: { prop.m_value = data.value; break; } - case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Object: + case QDeclarativeEngineDebugService::QDeclarativeObjectProperty::Object: { QDeclarativeDebugObjectReference obj; obj.m_debugId = prop.m_value.toInt(); prop.m_value = QVariant::fromValue(obj); break; } - case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Unknown: + case QDeclarativeEngineDebugService::QDeclarativeObjectProperty::Unknown: break; } o.m_properties << prop; diff --git a/src/declarative/debugger/qdeclarativedebug_p.h b/src/declarative/debugger/qdeclarativeenginedebug_p.h index f822637..9b70e1c 100644 --- a/src/declarative/debugger/qdeclarativedebug_p.h +++ b/src/declarative/debugger/qdeclarativeenginedebug_p.h @@ -38,8 +38,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef QDECLARATIVEDEBUG_H -#define QDECLARATIVEDEBUG_H +#ifndef QDECLARATIVEENGINEDEBUG_H +#define QDECLARATIVEENGINEDEBUG_H #include <QtCore/qobject.h> #include <QtCore/qurl.h> @@ -384,4 +384,4 @@ Q_DECLARE_METATYPE(QDeclarativeDebugPropertyReference) QT_END_HEADER -#endif // QDECLARATIVEDEBUG_H +#endif // QDECLARATIVEENGINEDEBUG_H diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/debugger/qdeclarativeenginedebugservice.cpp index 8707a7f..7683733 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/debugger/qdeclarativeenginedebugservice.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "private/qdeclarativeenginedebug_p.h" +#include "private/qdeclarativeenginedebugservice_p.h" #include "private/qdeclarativeboundsignal_p.h" #include "qdeclarativeengine.h" @@ -59,14 +59,14 @@ QT_BEGIN_NAMESPACE -Q_GLOBAL_STATIC(QDeclarativeEngineDebugServer, qmlEngineDebugServer); +Q_GLOBAL_STATIC(QDeclarativeEngineDebugService, qmlEngineDebugService); -QDeclarativeEngineDebugServer *QDeclarativeEngineDebugServer::instance() +QDeclarativeEngineDebugService *QDeclarativeEngineDebugService::instance() { - return qmlEngineDebugServer(); + return qmlEngineDebugService(); } -QDeclarativeEngineDebugServer::QDeclarativeEngineDebugServer(QObject *parent) +QDeclarativeEngineDebugService::QDeclarativeEngineDebugService(QObject *parent) : QDeclarativeDebugService(QLatin1String("QDeclarativeEngine"), parent), m_watch(new QDeclarativeWatcher(this)) { @@ -75,7 +75,7 @@ QDeclarativeEngineDebugServer::QDeclarativeEngineDebugServer(QObject *parent) } QDataStream &operator<<(QDataStream &ds, - const QDeclarativeEngineDebugServer::QDeclarativeObjectData &data) + const QDeclarativeEngineDebugService::QDeclarativeObjectData &data) { ds << data.url << data.lineNumber << data.columnNumber << data.idString << data.objectName << data.objectType << data.objectId << data.contextId; @@ -83,7 +83,7 @@ QDataStream &operator<<(QDataStream &ds, } QDataStream &operator>>(QDataStream &ds, - QDeclarativeEngineDebugServer::QDeclarativeObjectData &data) + QDeclarativeEngineDebugService::QDeclarativeObjectData &data) { ds >> data.url >> data.lineNumber >> data.columnNumber >> data.idString >> data.objectName >> data.objectType >> data.objectId >> data.contextId; @@ -91,7 +91,7 @@ QDataStream &operator>>(QDataStream &ds, } QDataStream &operator<<(QDataStream &ds, - const QDeclarativeEngineDebugServer::QDeclarativeObjectProperty &data) + const QDeclarativeEngineDebugService::QDeclarativeObjectProperty &data) { ds << (int)data.type << data.name << data.value << data.valueTypeName << data.binding << data.hasNotifySignal; @@ -99,12 +99,12 @@ QDataStream &operator<<(QDataStream &ds, } QDataStream &operator>>(QDataStream &ds, - QDeclarativeEngineDebugServer::QDeclarativeObjectProperty &data) + QDeclarativeEngineDebugService::QDeclarativeObjectProperty &data) { int type; ds >> type >> data.name >> data.value >> data.valueTypeName >> data.binding >> data.hasNotifySignal; - data.type = (QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Type)type; + data.type = (QDeclarativeEngineDebugService::QDeclarativeObjectProperty::Type)type; return ds; } @@ -131,8 +131,8 @@ static bool hasValidSignal(QObject *object, const QString &propertyName) return true; } -QDeclarativeEngineDebugServer::QDeclarativeObjectProperty -QDeclarativeEngineDebugServer::propertyData(QObject *obj, int propIdx) +QDeclarativeEngineDebugService::QDeclarativeObjectProperty +QDeclarativeEngineDebugService::propertyData(QObject *obj, int propIdx) { QDeclarativeObjectProperty rv; @@ -164,7 +164,7 @@ QDeclarativeEngineDebugServer::propertyData(QObject *obj, int propIdx) return rv; } -QVariant QDeclarativeEngineDebugServer::valueContents(const QVariant &value) const +QVariant QDeclarativeEngineDebugService::valueContents(const QVariant &value) const { int userType = value.userType(); @@ -193,7 +193,7 @@ QVariant QDeclarativeEngineDebugServer::valueContents(const QVariant &value) con return QLatin1String("<unknown value>"); } -void QDeclarativeEngineDebugServer::buildObjectDump(QDataStream &message, +void QDeclarativeEngineDebugService::buildObjectDump(QDataStream &message, QObject *object, bool recur, bool dumpProperties) { message << objectData(object); @@ -264,7 +264,7 @@ void QDeclarativeEngineDebugServer::buildObjectDump(QDataStream &message, message << fakeProperties[ii]; } -void QDeclarativeEngineDebugServer::prepareDeferredObjects(QObject *obj) +void QDeclarativeEngineDebugService::prepareDeferredObjects(QObject *obj) { qmlExecuteDeferred(obj); @@ -276,7 +276,7 @@ void QDeclarativeEngineDebugServer::prepareDeferredObjects(QObject *obj) } -void QDeclarativeEngineDebugServer::buildObjectList(QDataStream &message, QDeclarativeContext *ctxt) +void QDeclarativeEngineDebugService::buildObjectList(QDataStream &message, QDeclarativeContext *ctxt) { QDeclarativeContextData *p = QDeclarativeContextData::get(ctxt); @@ -316,7 +316,7 @@ void QDeclarativeEngineDebugServer::buildObjectList(QDataStream &message, QDecla } } -void QDeclarativeEngineDebugServer::buildStatesList(QDeclarativeContext *ctxt, bool cleanList=false) +void QDeclarativeEngineDebugService::buildStatesList(QDeclarativeContext *ctxt, bool cleanList=false) { if (cleanList) m_allStates.clear(); @@ -333,7 +333,7 @@ void QDeclarativeEngineDebugServer::buildStatesList(QDeclarativeContext *ctxt, b } } -void QDeclarativeEngineDebugServer::buildStatesList(QObject *obj) +void QDeclarativeEngineDebugService::buildStatesList(QObject *obj) { if (QDeclarativeState *state = qobject_cast<QDeclarativeState *>(obj)) { m_allStates.append(state); @@ -345,8 +345,8 @@ void QDeclarativeEngineDebugServer::buildStatesList(QObject *obj) } } -QDeclarativeEngineDebugServer::QDeclarativeObjectData -QDeclarativeEngineDebugServer::objectData(QObject *object) +QDeclarativeEngineDebugService::QDeclarativeObjectData +QDeclarativeEngineDebugService::objectData(QObject *object) { QDeclarativeData *ddata = QDeclarativeData::get(object); QDeclarativeObjectData rv; @@ -385,7 +385,7 @@ QDeclarativeEngineDebugServer::objectData(QObject *object) return rv; } -void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message) +void QDeclarativeEngineDebugService::messageReceived(const QByteArray &message) { QDataStream ds(message); @@ -545,7 +545,7 @@ void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message) } } -void QDeclarativeEngineDebugServer::setBinding(int objectId, +void QDeclarativeEngineDebugService::setBinding(int objectId, const QString &propertyName, const QVariant &expression, bool isLiteralValue, @@ -600,7 +600,7 @@ void QDeclarativeEngineDebugServer::setBinding(int objectId, oldBinding->destroy(); binding->update(); } else { - qWarning() << "QDeclarativeEngineDebugServer::setBinding: unable to set property" << propertyName << "on object" << object; + qWarning() << "QDeclarativeEngineDebugService::setBinding: unable to set property" << propertyName << "on object" << object; } } @@ -613,13 +613,13 @@ void QDeclarativeEngineDebugServer::setBinding(int objectId, propertyChanges->changeExpression(propertyName, expression.toString()); } } else { - qWarning() << "QDeclarativeEngineDebugServer::setBinding: unable to set property" << propertyName << "on object" << object; + qWarning() << "QDeclarativeEngineDebugService::setBinding: unable to set property" << propertyName << "on object" << object; } } } } -void QDeclarativeEngineDebugServer::resetBinding(int objectId, const QString &propertyName) +void QDeclarativeEngineDebugService::resetBinding(int objectId, const QString &propertyName) { QObject *object = objectForId(objectId); QDeclarativeContext *context = qmlContext(object); @@ -664,7 +664,7 @@ void QDeclarativeEngineDebugServer::resetBinding(int objectId, const QString &pr } } -void QDeclarativeEngineDebugServer::setMethodBody(int objectId, const QString &method, const QString &body) +void QDeclarativeEngineDebugService::setMethodBody(int objectId, const QString &method, const QString &body) { QObject *object = objectForId(objectId); QDeclarativeContext *context = qmlContext(object); @@ -703,7 +703,7 @@ void QDeclarativeEngineDebugServer::setMethodBody(int objectId, const QString &m vmeMetaObject->setVmeMethod(prop->coreIndex, QDeclarativeExpressionPrivate::evalInObjectScope(contextData, object, jsfunction, contextData->url.toString(), lineNumber, 0)); } -void QDeclarativeEngineDebugServer::propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value) +void QDeclarativeEngineDebugService::propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value) { QByteArray reply; QDataStream rs(&reply, QIODevice::WriteOnly); @@ -713,7 +713,7 @@ void QDeclarativeEngineDebugServer::propertyChanged(int id, int objectId, const sendMessage(reply); } -void QDeclarativeEngineDebugServer::addEngine(QDeclarativeEngine *engine) +void QDeclarativeEngineDebugService::addEngine(QDeclarativeEngine *engine) { Q_ASSERT(engine); Q_ASSERT(!m_engines.contains(engine)); @@ -721,7 +721,7 @@ void QDeclarativeEngineDebugServer::addEngine(QDeclarativeEngine *engine) m_engines.append(engine); } -void QDeclarativeEngineDebugServer::remEngine(QDeclarativeEngine *engine) +void QDeclarativeEngineDebugService::remEngine(QDeclarativeEngine *engine) { Q_ASSERT(engine); Q_ASSERT(m_engines.contains(engine)); @@ -729,7 +729,7 @@ void QDeclarativeEngineDebugServer::remEngine(QDeclarativeEngine *engine) m_engines.removeAll(engine); } -void QDeclarativeEngineDebugServer::objectCreated(QDeclarativeEngine *engine, QObject *object) +void QDeclarativeEngineDebugService::objectCreated(QDeclarativeEngine *engine, QObject *object) { Q_ASSERT(engine); Q_ASSERT(m_engines.contains(engine)); diff --git a/src/declarative/qml/qdeclarativeenginedebug_p.h b/src/declarative/debugger/qdeclarativeenginedebugservice_p.h index 804a043..3674b83 100644 --- a/src/declarative/qml/qdeclarativeenginedebug_p.h +++ b/src/declarative/debugger/qdeclarativeenginedebugservice_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QDECLARATIVEENGINEDEBUG_P_H -#define QDECLARATIVEENGINEDEBUG_P_H +#ifndef QDECLARATIVEENGINEDEBUGSERVICE_P_H +#define QDECLARATIVEENGINEDEBUGSERVICE_P_H // // W A R N I N G @@ -67,11 +67,11 @@ class QDeclarativeWatcher; class QDataStream; class QDeclarativeState; -class QDeclarativeEngineDebugServer : public QDeclarativeDebugService +class QDeclarativeEngineDebugService : public QDeclarativeDebugService { Q_OBJECT public: - QDeclarativeEngineDebugServer(QObject * = 0); + QDeclarativeEngineDebugService(QObject * = 0); struct QDeclarativeObjectData { QUrl url; @@ -98,7 +98,7 @@ public: void remEngine(QDeclarativeEngine *); void objectCreated(QDeclarativeEngine *, QObject *); - static QDeclarativeEngineDebugServer *instance(); + static QDeclarativeEngineDebugService *instance(); protected: virtual void messageReceived(const QByteArray &); @@ -123,12 +123,12 @@ private: QDeclarativeWatcher *m_watch; QList<QWeakPointer<QDeclarativeState> > m_allStates; }; -Q_DECLARATIVE_PRIVATE_EXPORT QDataStream &operator<<(QDataStream &, const QDeclarativeEngineDebugServer::QDeclarativeObjectData &); -Q_DECLARATIVE_PRIVATE_EXPORT QDataStream &operator>>(QDataStream &, QDeclarativeEngineDebugServer::QDeclarativeObjectData &); -Q_DECLARATIVE_PRIVATE_EXPORT QDataStream &operator<<(QDataStream &, const QDeclarativeEngineDebugServer::QDeclarativeObjectProperty &); -Q_DECLARATIVE_PRIVATE_EXPORT QDataStream &operator>>(QDataStream &, QDeclarativeEngineDebugServer::QDeclarativeObjectProperty &); +Q_DECLARATIVE_PRIVATE_EXPORT QDataStream &operator<<(QDataStream &, const QDeclarativeEngineDebugService::QDeclarativeObjectData &); +Q_DECLARATIVE_PRIVATE_EXPORT QDataStream &operator>>(QDataStream &, QDeclarativeEngineDebugService::QDeclarativeObjectData &); +Q_DECLARATIVE_PRIVATE_EXPORT QDataStream &operator<<(QDataStream &, const QDeclarativeEngineDebugService::QDeclarativeObjectProperty &); +Q_DECLARATIVE_PRIVATE_EXPORT QDataStream &operator>>(QDataStream &, QDeclarativeEngineDebugService::QDeclarativeObjectProperty &); QT_END_NAMESPACE -#endif // QDECLARATIVEENGINEDEBUG_P_H +#endif // QDECLARATIVEENGINEDEBUGSERVICE_P_H diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp index 70fc702..4dcf17c 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp @@ -228,9 +228,9 @@ void QDeclarativeFlipablePrivate::updateSceneTransformFromParent() if (current == QDeclarativeFlipable::Back && back) setBackTransform(); if (front) - front->setOpacity((current==QDeclarativeFlipable::Front)?1.:0.); + front->setOpacity((current==QDeclarativeFlipable::Front)?qreal(1.):qreal(0.)); if (back) - back->setOpacity((current==QDeclarativeFlipable::Back)?1.:0.); + back->setOpacity((current==QDeclarativeFlipable::Back)?qreal(1.):qreal(0.)); emit q->sideChanged(); } } diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 023737d..a7d593a 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1212,10 +1212,10 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m } qreal accel = deceleration; qreal v2 = v * v; - qreal overshootDist = 0.0; - if ((maxDistance > 0.0 && v2 / (2.0f * maxDistance) < accel) || snapMode == QDeclarativeGridView::SnapOneRow) { + qreal overshootDist = qreal(0.0); + if ((maxDistance > qreal(0.0) && v2 / (2.0f * maxDistance) < accel) || snapMode == QDeclarativeGridView::SnapOneRow) { // + rowSize()/4 to encourage moving at least one item in the flick direction - qreal dist = v2 / (accel * 2.0) + rowSize()/4; + qreal dist = v2 / (accel * qreal(2.0)) + rowSize()/4; dist = qMin(dist, maxDistance); if (v > 0) dist = -dist; diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 6a91e5f..44d6a1a 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1457,14 +1457,14 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m // the initial flick - estimate boundary qreal accel = deceleration; qreal v2 = v * v; - overshootDist = 0.0; + overshootDist = qreal(0.0); // + averageSize/4 to encourage moving at least one item in the flick direction - qreal dist = v2 / (accel * 2.0) + averageSize/4; + qreal dist = v2 / (accel * qreal(2.0)) + averageSize/4; if (maxDistance > 0) dist = qMin(dist, maxDistance); if (v > 0) dist = -dist; - if ((maxDistance > 0.0 && v2 / (2.0f * maxDistance) < accel) || snapMode == QDeclarativeListView::SnapOneItem) { + if ((maxDistance > qreal(0.0) && v2 / (2.0f * maxDistance) < accel) || snapMode == QDeclarativeListView::SnapOneItem) { if (snapMode != QDeclarativeListView::SnapOneItem) { qreal distTemp = isRightToLeft() ? -dist : dist; data.flickTarget = -snapPosAt(-(dataValue - highlightStart) + distTemp) + highlightStart; diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 94f128d..ecd8982 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -246,7 +246,7 @@ void QDeclarativePathViewPrivate::updateHighlight() } else { qreal target = currentIndex; - offsetAdj = 0.0; + offsetAdj = qreal(0.0); tl.reset(moveHighlight); moveHighlight.setValue(highlightPosition); @@ -255,14 +255,14 @@ void QDeclarativePathViewPrivate::updateHighlight() if (target - highlightPosition > modelCount/2) { highlightUp = false; qreal distance = modelCount - target + highlightPosition; - tl.move(moveHighlight, 0.0, QEasingCurve(QEasingCurve::InQuad), int(duration * highlightPosition / distance)); - tl.set(moveHighlight, modelCount-0.01); + tl.move(moveHighlight, qreal(0.0), QEasingCurve(QEasingCurve::InQuad), int(duration * highlightPosition / distance)); + tl.set(moveHighlight, modelCount-qreal(0.01)); tl.move(moveHighlight, target, QEasingCurve(QEasingCurve::OutQuad), int(duration * (modelCount-target) / distance)); } else if (target - highlightPosition <= -modelCount/2) { highlightUp = true; qreal distance = modelCount - highlightPosition + target; - tl.move(moveHighlight, modelCount-0.01, QEasingCurve(QEasingCurve::InQuad), int(duration * (modelCount-highlightPosition) / distance)); - tl.set(moveHighlight, 0.0); + tl.move(moveHighlight, modelCount-qreal(0.01), QEasingCurve(QEasingCurve::InQuad), int(duration * (modelCount-highlightPosition) / distance)); + tl.set(moveHighlight, qreal(0.0)); tl.move(moveHighlight, target, QEasingCurve(QEasingCurve::OutQuad), int(duration * target / distance)); } else { highlightUp = highlightPosition - target < 0; @@ -287,18 +287,18 @@ void QDeclarativePathViewPrivate::setHighlightPosition(qreal pos) qreal relativeHighlight = qmlMod(pos + offset, range) / range; if (!highlightUp && relativeHighlight > end * mappedRange) { - qreal diff = 1.0 - relativeHighlight; + qreal diff = qreal(1.0) - relativeHighlight; setOffset(offset + diff * range); } else if (highlightUp && relativeHighlight >= (end - start) * mappedRange) { qreal diff = relativeHighlight - (end - start) * mappedRange; - setOffset(offset - diff * range - 0.00001); + setOffset(offset - diff * range - qreal(0.00001)); } highlightPosition = pos; qreal pathPos = positionOfIndex(pos); updateItem(highlightItem, pathPos); if (QDeclarativePathViewAttached *att = attached(highlightItem)) - att->setOnPath(pathPos != -1.0); + att->setOnPath(pathPos != qreal(-1.0)); } } @@ -1200,7 +1200,7 @@ void QDeclarativePathViewPrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEve qreal elapsed = qreal(lastElapsed + QDeclarativeItemPrivate::elapsed(lastPosTime)) / 1000.; qreal velocity = elapsed > 0. ? lastDist / elapsed : 0; - if (model && modelCount && qAbs(velocity) > 1.) { + if (model && modelCount && qAbs(velocity) > qreal(1.)) { qreal count = pathItems == -1 ? modelCount : pathItems; if (qAbs(velocity) > count * 2) // limit velocity velocity = (velocity > 0 ? count : -count) * 2; @@ -1208,7 +1208,7 @@ void QDeclarativePathViewPrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEve qreal v2 = velocity*velocity; qreal accel = deceleration/10; // + 0.25 to encourage moving at least one item in the flick direction - qreal dist = qMin(qreal(modelCount-1), qreal(v2 / (accel * 2.0) + 0.25)); + qreal dist = qMin(qreal(modelCount-1), qreal(v2 / (accel * qreal(2.0)) + qreal(0.25))); if (haveHighlightRange && highlightRangeMode == QDeclarativePathView::StrictlyEnforceRange) { // round to nearest item. if (velocity > 0.) @@ -1217,13 +1217,13 @@ void QDeclarativePathViewPrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEve dist = qRound(dist - offset) + offset; // Calculate accel required to stop on item boundary if (dist <= 0.) { - dist = 0.; - accel = 0.; + dist = qreal(0.); + accel = qreal(0.); } else { accel = v2 / (2.0f * qAbs(dist)); } } - offsetAdj = 0.0; + offsetAdj = qreal(0.0); moveOffset.setValue(offset); tl.accel(moveOffset, velocity, accel, dist); tl.callback(QDeclarativeTimeLineCallback(&moveOffset, fixOffsetCallback, this)); @@ -1588,7 +1588,7 @@ void QDeclarativePathView::createdItem(int index, QDeclarativeItem *item) att->setOnPath(false); } item->setParentItem(this); - d->updateItem(item, index < d->firstIndex ? 0.0 : 1.0); + d->updateItem(item, index < d->firstIndex ? qreal(0.0) : qreal(1.0)); } } diff --git a/src/declarative/qml/qdeclarative.h b/src/declarative/qml/qdeclarative.h index 5e8d0f4..399c207 100644 --- a/src/declarative/qml/qdeclarative.h +++ b/src/declarative/qml/qdeclarative.h @@ -405,17 +405,6 @@ QObject *qmlAttachedPropertiesObject(const QObject *obj, bool create = true) return qmlAttachedPropertiesObject(&idx, obj, &T::staticMetaObject, create); } -// Enable debugging before any QDeclarativeEngine is created -struct Q_DECLARATIVE_EXPORT QDeclarativeDebuggingEnabler -{ - QDeclarativeDebuggingEnabler(); -}; - -// Execute code in constructor before first QDeclarativeEngine is instantiated -#if defined(QT_DECLARATIVE_DEBUG) -static QDeclarativeDebuggingEnabler qmlEnableDebuggingHelper; -#endif - QT_END_NAMESPACE QML_DECLARE_TYPE(QObject) diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index d9f291b..f423f50 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -53,7 +53,7 @@ #include "private/qdeclarativeglobal_p.h" #include "private/qdeclarativescriptparser_p.h" #include "private/qdeclarativedebugtrace_p.h" -#include "private/qdeclarativeenginedebug_p.h" +#include "private/qdeclarativeenginedebugservice_p.h" #include <QtScript/qscriptvalueiterator.h> #include <QStack> @@ -896,7 +896,7 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentCon if (enginePriv->isDebugging && rv) { if (!parentContext->isInternal) parentContext->asQDeclarativeContextPrivate()->instances.append(rv); - QDeclarativeEngineDebugServer::instance()->objectCreated(parentContext->engine, rv); + QDeclarativeEngineDebugService::instance()->objectCreated(parentContext->engine, rv); } return rv; diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 34014f7..1417b78 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -51,7 +51,7 @@ #include "qdeclarativecomponent.h" #include "private/qdeclarativebinding_p_p.h" #include "private/qdeclarativevme_p.h" -#include "private/qdeclarativeenginedebug_p.h" +#include "private/qdeclarativeenginedebugservice_p.h" #include "private/qdeclarativestringconverters_p.h" #include "private/qdeclarativexmlhttprequest_p.h" #include "private/qdeclarativesqldatabase_p.h" @@ -581,9 +581,9 @@ void QDeclarativeEnginePrivate::init() scriptEngine.globalObject().property(QLatin1String("Qt")).setProperty(QLatin1String("application"), applicationObject); if (QCoreApplication::instance()->thread() == q->thread() && - QDeclarativeEngineDebugServer::isDebuggingEnabled()) { + QDeclarativeEngineDebugService::isDebuggingEnabled()) { isDebugging = true; - QDeclarativeEngineDebugServer::instance()->addEngine(q); + QDeclarativeEngineDebugService::instance()->addEngine(q); QJSDebugService::instance()->addEngine(q); } } @@ -648,7 +648,7 @@ QDeclarativeEngine::~QDeclarativeEngine() { Q_D(QDeclarativeEngine); if (d->isDebugging) { - QDeclarativeEngineDebugServer::instance()->remEngine(this); + QDeclarativeEngineDebugService::instance()->remEngine(this); QJSDebugService::instance()->removeEngine(this); } } diff --git a/src/declarative/qml/qdeclarativeengine.h b/src/declarative/qml/qdeclarativeengine.h index 61ab2b2..4d6887f 100644 --- a/src/declarative/qml/qdeclarativeengine.h +++ b/src/declarative/qml/qdeclarativeengine.h @@ -47,6 +47,7 @@ #include <QtCore/qmap.h> #include <QtScript/qscriptvalue.h> #include <QtDeclarative/qdeclarativeerror.h> +#include <QtDeclarative/qdeclarativedebug.h> QT_BEGIN_HEADER diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp index bf261ef..c2f0086 100644 --- a/src/declarative/qml/qdeclarativeimport.cpp +++ b/src/declarative/qml/qdeclarativeimport.cpp @@ -46,6 +46,7 @@ #include <QtCore/qfileinfo.h> #include <QtCore/qpluginloader.h> #include <QtCore/qlibraryinfo.h> +#include <QtCore/qalgorithms.h> #include <QtDeclarative/qdeclarativeextensioninterface.h> #include <private/qdeclarativeglobal_p.h> #include <private/qdeclarativetypenamecache_p.h> @@ -734,8 +735,12 @@ QDeclarativeImportDatabase::QDeclarativeImportDatabase(QDeclarativeEngine *e) } RFs& fs = qt_s60GetRFs(); TPtrC tempPathPtr(reinterpret_cast<const TText*> (tempPath.constData())); + // Symbian searches should start from Y:. Fix start drive otherwise TFindFile starts from the session drive + _LIT(KStartDir, "Y:"); + TFileName dirPath(KStartDir); + dirPath.Append(tempPathPtr); TFindFile finder(fs); - TInt err = finder.FindByDir(tempPathPtr, tempPathPtr); + TInt err = finder.FindByDir(tempPathPtr, dirPath); while (err == KErrNone) { QString foundDir(reinterpret_cast<const QChar *>(finder.File().Ptr()), finder.File().Length()); @@ -743,6 +748,9 @@ QDeclarativeImportDatabase::QDeclarativeImportDatabase(QDeclarativeEngine *e) addImportPath(foundDir); err = finder.Find(); } + // TFindFile found the directories in the order we want, but addImportPath reverses it. + // Reverse the order again to get it right. + QAlgorithmsPrivate::qReverse(fileImportPath.begin(), fileImportPath.end()); } else { addImportPath(installImportsPath); } diff --git a/src/declarative/qml/qdeclarativenotifier_p.h b/src/declarative/qml/qdeclarativenotifier_p.h index 5f70f7d..14a7f82 100644 --- a/src/declarative/qml/qdeclarativenotifier_p.h +++ b/src/declarative/qml/qdeclarativenotifier_p.h @@ -99,8 +99,15 @@ private: enum { InvalidType, SignalType, NotifierType } type; union { - char signalData[sizeof(Signal)]; - char notifierData[sizeof(Notifier)]; + struct { + Signal *signal; + union { + char signalData[sizeof(Signal)]; + qint64 q_for_alignment_1; + double q_for_alignment_2; + }; + } signal; + Notifier notifier; }; inline Notifier *toNotifier(); @@ -194,7 +201,7 @@ void QDeclarativeNotifierEndpoint::connect(QDeclarativeNotifier *notifier) void QDeclarativeNotifierEndpoint::disconnect() { if (type == SignalType) { - Signal *s = (Signal *)&signalData; + Signal *s = asSignal(); if (s->source) { QMetaObject::disconnectOne(s->source, s->sourceSignal, target, targetMethod); s->source = 0; @@ -223,18 +230,19 @@ QDeclarativeNotifierEndpoint::Notifier *QDeclarativeNotifierEndpoint::toNotifier s->~Signal(); } + type = NotifierType; Notifier *n = asNotifier(); n->next = 0; n->prev = 0; n->disconnected = 0; n->notifier = 0; - type = NotifierType; return n; } QDeclarativeNotifierEndpoint::Notifier *QDeclarativeNotifierEndpoint::asNotifier() { - return (Notifier *)(¬ifierData); + Q_ASSERT(type == NotifierType); + return ¬ifier; } QDeclarativeNotifierEndpoint::Signal *QDeclarativeNotifierEndpoint::toSignal() @@ -243,16 +251,15 @@ QDeclarativeNotifierEndpoint::Signal *QDeclarativeNotifierEndpoint::toSignal() return asSignal(); disconnect(); - Signal *s = asSignal(); - new (s) Signal; + signal.signal = new (&signal.signalData) Signal; type = SignalType; - - return s; + return signal.signal; } QDeclarativeNotifierEndpoint::Signal *QDeclarativeNotifierEndpoint::asSignal() { - return (Signal *)(&signalData); + Q_ASSERT(type == SignalType); + return signal.signal; } QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativepropertycache_p.h b/src/declarative/qml/qdeclarativepropertycache_p.h index 581f519..c648d25 100644 --- a/src/declarative/qml/qdeclarativepropertycache_p.h +++ b/src/declarative/qml/qdeclarativepropertycache_p.h @@ -111,7 +111,7 @@ public: int relatedIndex; // When IsFunction }; uint overrideIndexIsProperty : 1; - int overrideIndex : 31; + signed int overrideIndex : 31; int revision; int metaObjectOffset; diff --git a/src/declarative/qml/qdeclarativesqldatabase.cpp b/src/declarative/qml/qdeclarativesqldatabase.cpp index 588b6bf..513cae2 100644 --- a/src/declarative/qml/qdeclarativesqldatabase.cpp +++ b/src/declarative/qml/qdeclarativesqldatabase.cpp @@ -175,7 +175,7 @@ static const char* sqlerror[] = { static QString qmlsqldatabase_databasesPath(QScriptEngine *engine) { QDeclarativeScriptEngine *qmlengine = static_cast<QDeclarativeScriptEngine*>(engine); - return qmlengine->offlineStoragePath + return QDir::toNativeSeparators(qmlengine->offlineStoragePath) + QDir::separator() + QLatin1String("Databases"); } diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri index bf9e54a..5d171bf 100644 --- a/src/declarative/qml/qml.pri +++ b/src/declarative/qml/qml.pri @@ -27,7 +27,6 @@ SOURCES += \ $$PWD/qdeclarativeinfo.cpp \ $$PWD/qdeclarativeerror.cpp \ $$PWD/qdeclarativescriptparser.cpp \ - $$PWD/qdeclarativeenginedebug.cpp \ $$PWD/qdeclarativerewrite.cpp \ $$PWD/qdeclarativevaluetype.cpp \ $$PWD/qdeclarativecompiledbindings.cpp \ @@ -99,7 +98,6 @@ HEADERS += \ $$PWD/qdeclarativedata_p.h \ $$PWD/qdeclarativeerror.h \ $$PWD/qdeclarativescriptparser_p.h \ - $$PWD/qdeclarativeenginedebug_p.h \ $$PWD/qdeclarativerewrite_p.h \ $$PWD/qpodvector_p.h \ $$PWD/qbitfield_p.h \ diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index ce21bcd..455c4f6 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -2719,7 +2719,7 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, } if (scale != 0) - rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI; + rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/qreal(M_PI); else { qmlInfo(this) << QDeclarativeParentAnimation::tr("Unable to preserve appearance under scale of 0"); ok = false; diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp index b77db89..e905d0a 100644 --- a/src/declarative/util/qdeclarativesmoothedanimation.cpp +++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp @@ -51,7 +51,7 @@ #include <QtCore/qdebug.h> -#include <math.h> +#include <QtCore/qmath.h> #define DELAY_STOP_TIMER_INTERVAL 32 @@ -98,20 +98,20 @@ bool QSmoothedAnimation::recalc() s = to - initialValue; vi = initialVelocity; - s = (invert? -1.0: 1.0) * s; + s = (invert? qreal(-1.0): qreal(1.0)) * s; if (userDuration > 0 && velocity > 0) { tf = s / velocity; - if (tf > (userDuration / 1000.)) tf = (userDuration / 1000.); + if (tf > (userDuration / qreal(1000.))) tf = (userDuration / qreal(1000.)); } else if (userDuration > 0) { - tf = userDuration / 1000.; + tf = userDuration / qreal(1000.); } else if (velocity > 0) { tf = s / velocity; } else { return false; } - finalDuration = ceil(tf * 1000.0); + finalDuration = ceil(tf * qreal(1000.0)); if (maximumEasingTime == 0) { a = 0; @@ -121,33 +121,33 @@ bool QSmoothedAnimation::recalc() vp = velocity; sp = 0; sd = s; - } else if (maximumEasingTime != -1 && tf > (maximumEasingTime / 1000.)) { - qreal met = maximumEasingTime / 1000.; + } else if (maximumEasingTime != -1 && tf > (maximumEasingTime / qreal(1000.))) { + qreal met = maximumEasingTime / qreal(1000.); td = tf - met; qreal c1 = td; qreal c2 = (tf - td) * vi - tf * velocity; - qreal c3 = -0.5 * (tf - td) * vi * vi; + qreal c3 = qreal(-0.5) * (tf - td) * vi * vi; - qreal vp1 = (-c2 + sqrt(c2 * c2 - 4 * c1 * c3)) / (2. * c1); + qreal vp1 = (-c2 + qSqrt(c2 * c2 - 4 * c1 * c3)) / (qreal(2.) * c1); vp = vp1; a = vp / met; d = a; tp = (vp - vi) / a; - sp = vi * tp + 0.5 * a * tp * tp; + sp = vi * tp + qreal(0.5) * a * tp * tp; sd = sp + (td - tp) * vp; } else { - qreal c1 = 0.25 * tf * tf; - qreal c2 = 0.5 * vi * tf - s; - qreal c3 = -0.25 * vi * vi; + qreal c1 = qreal(0.25) * tf * tf; + qreal c2 = qreal(0.5) * vi * tf - s; + qreal c3 = qreal(-0.25) * vi * vi; - qreal a1 = (-c2 + sqrt(c2 * c2 - 4 * c1 * c3)) / (2. * c1); + qreal a1 = (-c2 + qSqrt(c2 * c2 - 4 * c1 * c3)) / (qreal(2.) * c1); - qreal tp1 = 0.5 * tf - 0.5 * vi / a1; + qreal tp1 = qreal(0.5) * tf - qreal(0.5) * vi / a1; qreal vp1 = a1 * tp1 + vi; - qreal sp1 = 0.5 * a1 * tp1 * tp1 + vi * tp1; + qreal sp1 = qreal(0.5) * a1 * tp1 * tp1 + vi * tp1; a = a1; d = a1; @@ -165,7 +165,7 @@ qreal QSmoothedAnimation::easeFollow(qreal time_seconds) qreal value; if (time_seconds < tp) { trackVelocity = vi + time_seconds * a; - value = 0.5 * a * time_seconds * time_seconds + vi * time_seconds; + value = qreal(0.5) * a * time_seconds * time_seconds + vi * time_seconds; } else if (time_seconds < td) { time_seconds -= tp; trackVelocity = vp; @@ -173,7 +173,7 @@ qreal QSmoothedAnimation::easeFollow(qreal time_seconds) } else if (time_seconds < tf) { time_seconds -= td; trackVelocity = vp - time_seconds * a; - value = sd - 0.5 * d * time_seconds * time_seconds + vp * time_seconds; + value = sd - qreal(0.5) * d * time_seconds * time_seconds + vp * time_seconds; } else { trackVelocity = 0; value = s; @@ -186,10 +186,10 @@ qreal QSmoothedAnimation::easeFollow(qreal time_seconds) void QSmoothedAnimation::updateCurrentTime(int t) { - qreal time_seconds = qreal(t - lastTime) / 1000.; + qreal time_seconds = qreal(t - lastTime) / qreal(1000.); qreal value = easeFollow(time_seconds); - value *= (invert? -1.0: 1.0); + value *= (invert? qreal(-1.0): qreal(1.0)); QDeclarativePropertyPrivate::write(target, initialValue + value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); @@ -213,7 +213,7 @@ void QSmoothedAnimation::init() return; } - bool hasReversed = trackVelocity != 0. && + bool hasReversed = trackVelocity != qreal(0.) && ((!invert) == ((initialValue - to) > 0)); if (hasReversed) { diff --git a/src/declarative/util/qdeclarativespringanimation.cpp b/src/declarative/util/qdeclarativespringanimation.cpp index 2c6058c..0b453ee 100644 --- a/src/declarative/util/qdeclarativespringanimation.cpp +++ b/src/declarative/util/qdeclarativespringanimation.cpp @@ -161,17 +161,17 @@ bool QDeclarativeSpringAnimationPrivate::animate(const QDeclarativeProperty &pro animation.velocity = animation.velocity + (spring * diff - damping * animation.velocity) / mass; else animation.velocity = animation.velocity + spring * diff - damping * animation.velocity; - if (maxVelocity > 0.) { + if (maxVelocity > qreal(0.)) { // limit velocity if (animation.velocity > maxVelocity) animation.velocity = maxVelocity; else if (animation.velocity < -maxVelocity) animation.velocity = -maxVelocity; } - animation.currentValue += animation.velocity * 16.0 / 1000.0; + animation.currentValue += animation.velocity * qreal(16.0) / qreal(1000.0); if (haveModulus) { animation.currentValue = fmod(animation.currentValue, modulus); - if (animation.currentValue < 0.0) + if (animation.currentValue < qreal(0.0)) animation.currentValue += modulus; } } @@ -195,7 +195,7 @@ bool QDeclarativeSpringAnimationPrivate::animate(const QDeclarativeProperty &pro animation.currentValue = fmod(animation.currentValue, modulus); } else { animation.currentValue -= moveBy; - if (haveModulus && animation.currentValue < 0.0) + if (haveModulus && animation.currentValue < qreal(0.0)) animation.currentValue = fmod(animation.currentValue, modulus) + modulus; } if (lastTime - animation.start >= animation.duration) { diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp index c260684..8f613b0 100644 --- a/src/declarative/util/qdeclarativestateoperations.cpp +++ b/src/declarative/util/qdeclarativestateoperations.cpp @@ -123,7 +123,7 @@ void QDeclarativeParentChangePrivate::doChange(QDeclarativeItem *targetParent, Q } if (scale != 0) - rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI; + rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/qreal(M_PI); else { qmlInfo(q) << QDeclarativeParentChange::tr("Unable to preserve appearance under scale of 0"); ok = false; diff --git a/src/declarative/util/qdeclarativeview.h b/src/declarative/util/qdeclarativeview.h index b3854fc..ef51934 100644 --- a/src/declarative/util/qdeclarativeview.h +++ b/src/declarative/util/qdeclarativeview.h @@ -47,6 +47,7 @@ #include <QtGui/qgraphicssceneevent.h> #include <QtGui/qgraphicsview.h> #include <QtGui/qwidget.h> +#include <QtDeclarative/qdeclarativedebug.h> QT_BEGIN_HEADER diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 658dcad..980568e 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -530,7 +530,7 @@ public: void notifyQueryStarted(bool remoteSource) { Q_Q(QDeclarativeXmlListModel); - progress = remoteSource ? 0.0 : 1.0; + progress = remoteSource ? qreal(0.0) : qreal(1.0); status = QDeclarativeXmlListModel::Loading; errorString.clear(); emit q->progressChanged(progress); |