diff --git a/share/qtcreator/qml/qmljsdebugger/editor/abstractformeditortool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/abstractformeditortool.cpp index 557a3011120..dea47b7e998 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/abstractformeditortool.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/abstractformeditortool.cpp @@ -29,7 +29,7 @@ #include "abstractformeditortool.h" #include "qdeclarativeviewobserver.h" -#include "qdeclarativeviewobserver_p.h" +#include "../qdeclarativeviewobserver_p.h" #include diff --git a/share/qtcreator/qml/qmljsdebugger/editor/rubberbandselectionmanipulator.cpp b/share/qtcreator/qml/qmljsdebugger/editor/rubberbandselectionmanipulator.cpp index 379ba98c44d..43e3575470c 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/rubberbandselectionmanipulator.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/rubberbandselectionmanipulator.cpp @@ -28,7 +28,7 @@ **************************************************************************/ #include "rubberbandselectionmanipulator.h" -#include "qdeclarativeviewobserver_p.h" +#include "../qdeclarativeviewobserver_p.h" #include diff --git a/share/qtcreator/qml/qmljsdebugger/editor/selectionindicator.cpp b/share/qtcreator/qml/qmljsdebugger/editor/selectionindicator.cpp index 49ed137b57e..d6ba81bd736 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/selectionindicator.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/selectionindicator.cpp @@ -28,7 +28,7 @@ **************************************************************************/ #include "selectionindicator.h" -#include "qdeclarativeviewobserver_p.h" +#include "../qdeclarativeviewobserver_p.h" #include "qmlobserverconstants.h" #include diff --git a/share/qtcreator/qml/qmljsdebugger/editor/selectiontool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/selectiontool.cpp index b677a105771..fdc8b2dc2e6 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/selectiontool.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/selectiontool.cpp @@ -31,7 +31,7 @@ #include "layeritem.h" //#include "resizehandleitem.h" -#include "qdeclarativeviewobserver_p.h" +#include "../qdeclarativeviewobserver_p.h" #include diff --git a/share/qtcreator/qml/qmljsdebugger/editor/singleselectionmanipulator.cpp b/share/qtcreator/qml/qmljsdebugger/editor/singleselectionmanipulator.cpp index d0064815496..e982385650c 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/singleselectionmanipulator.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/singleselectionmanipulator.cpp @@ -29,7 +29,7 @@ #include "singleselectionmanipulator.h" #include "qdeclarativeviewobserver.h" -#include "qdeclarativeviewobserver_p.h" +#include "../qdeclarativeviewobserver_p.h" #include namespace QmlJSDebugger { diff --git a/share/qtcreator/qml/qmljsdebugger/editor/subcomponenteditortool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/subcomponenteditortool.cpp index 5089944ddba..700c0ecf2e5 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/subcomponenteditortool.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/subcomponenteditortool.cpp @@ -1,5 +1,5 @@ #include "subcomponenteditortool.h" -#include "qdeclarativeviewobserver_p.h" +#include "../qdeclarativeviewobserver_p.h" #include "subcomponentmasklayeritem.h" #include "layeritem.h" diff --git a/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.cpp index 2bb152e2d63..c1d310002b2 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.cpp @@ -1,5 +1,5 @@ #include "zoomtool.h" -#include "qdeclarativeviewobserver_p.h" +#include "../qdeclarativeviewobserver_p.h" #include #include diff --git a/share/qtcreator/qml/qmljsdebugger/include/jsdebuggeragent.h b/share/qtcreator/qml/qmljsdebugger/include/jsdebuggeragent.h index 47b17c409cd..5c0fb017231 100644 --- a/share/qtcreator/qml/qmljsdebugger/include/jsdebuggeragent.h +++ b/share/qtcreator/qml/qmljsdebugger/include/jsdebuggeragent.h @@ -57,9 +57,10 @@ #include #include #include -#include #include +#include "qt_private/qdeclarativedebugservice_p.h" + #include "qmljsdebugger_global.h" QT_FORWARD_DECLARE_CLASS(QScriptContext); diff --git a/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeobserverservice.h b/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeobserverservice.h index 9120c51e849..0711348bbec 100644 --- a/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeobserverservice.h +++ b/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeobserverservice.h @@ -42,7 +42,7 @@ #ifndef QDECLARATIVEDESIGNDEBUGSERVER_H #define QDECLARATIVEDESIGNDEBUGSERVER_H -#include +#include "qt_private/qdeclarativedebugservice_p.h" #include "qmlobserverconstants.h" #include "qmljsdebugger_global.h" diff --git a/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebughelper_p.h b/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebughelper_p.h new file mode 100644 index 00000000000..c9cb8391212 --- /dev/null +++ b/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebughelper_p.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** 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 QDECLARATIVEDEBUGHELPER_P_H +#define QDECLARATIVEDEBUGHELPER_P_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QScriptEngine; +class QDeclarativeEngine; + +// Helper methods to access private API through a stable interface +// This is used in the qmljsdebugger library of QtCreator. +class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper +{ +public: + static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine); + static void setAnimationSlowDownFactor(qreal factor); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEDEBUGHELPER_P_H diff --git a/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebugservice_p.h b/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebugservice_p.h new file mode 100644 index 00000000000..0cadbe5b585 --- /dev/null +++ b/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebugservice_p.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** 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 QDECLARATIVEDEBUGSERVICE_H +#define QDECLARATIVEDEBUGSERVICE_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeDebugServicePrivate; +class Q_DECLARATIVE_EXPORT QDeclarativeDebugService : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QDeclarativeDebugService) + Q_DISABLE_COPY(QDeclarativeDebugService) + +public: + explicit QDeclarativeDebugService(const QString &, QObject *parent = 0); + ~QDeclarativeDebugService(); + + QString name() const; + + enum Status { NotConnected, Unavailable, Enabled }; + Status status() const; + + void sendMessage(const QByteArray &); + + static int idForObject(QObject *); + static QObject *objectForId(int); + + static QString objectToString(QObject *obj); + + static bool isDebuggingEnabled(); + static bool hasDebuggingClient(); + +protected: + virtual void statusChanged(Status); + virtual void messageReceived(const QByteArray &); + +private: + friend class QDeclarativeDebugServer; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEDEBUGSERVICE_H + diff --git a/share/qtcreator/qml/qmljsdebugger/jsdebuggeragent.cpp b/share/qtcreator/qml/qmljsdebugger/jsdebuggeragent.cpp index d398150720f..00b6ea27489 100644 --- a/share/qtcreator/qml/qmljsdebugger/jsdebuggeragent.cpp +++ b/share/qtcreator/qml/qmljsdebugger/jsdebuggeragent.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "jsdebuggeragent.h" +#include "qt_private/qdeclarativedebughelper_p.h" #include #include @@ -49,7 +50,6 @@ #include #include #include -#include namespace QmlJSDebugger { @@ -193,7 +193,7 @@ JSDebuggerAgent::JSDebuggerAgent(QScriptEngine *engine) JSDebuggerAgent::JSDebuggerAgent(QDeclarativeEngine *engine) : QDeclarativeDebugService("JSDebugger") - , QScriptEngineAgent(QDeclarativeEnginePrivate::getScriptEngine(engine)) + , QScriptEngineAgent(QDeclarativeDebugHelper::getScriptEngine(engine)) , state(NoState) {} @@ -513,7 +513,6 @@ void JSDebuggerAgent::continueExec() void JSDebuggerAgent::statusChanged(Status status) { - engine()->setAgent(on ? this : 0); engine()->setAgent((status == QDeclarativeDebugService::Enabled) ? this : 0); } diff --git a/share/qtcreator/qml/qmljsdebugger/private_headers.pri b/share/qtcreator/qml/qmljsdebugger/private_headers.pri deleted file mode 100644 index fc353961781..00000000000 --- a/share/qtcreator/qml/qmljsdebugger/private_headers.pri +++ /dev/null @@ -1,17 +0,0 @@ -# Try to find location of Qt private headers (see README) -isEmpty(QT_PRIVATE_HEADERS) { - QT_PRIVATE_HEADERS = $$[QT_INSTALL_HEADERS] -} - -INCLUDEPATH += \ - $${QT_PRIVATE_HEADERS} \ - $${QT_PRIVATE_HEADERS}/QtCore \ - $${QT_PRIVATE_HEADERS}/QtGui \ - $${QT_PRIVATE_HEADERS}/QtScript \ - $${QT_PRIVATE_HEADERS}/QtDeclarative -DEPENDPATH += \ - $${QT_PRIVATE_HEADERS} \ - $${QT_PRIVATE_HEADERS}/QtCore \ - $${QT_PRIVATE_HEADERS}/QtGui \ - $${QT_PRIVATE_HEADERS}/QtScript \ - $${QT_PRIVATE_HEADERS}/QtDeclarative diff --git a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp index 81cd9b018ba..39e3f2a11c9 100644 --- a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp +++ b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp @@ -39,6 +39,8 @@ #include "qmltoolbar.h" #include "jsdebuggeragent.h" +#include "qt_private/qdeclarativedebughelper_p.h" + #include #include #include @@ -47,10 +49,7 @@ #include #include #include - #include -#include -#include namespace QmlJSDebugger { @@ -626,11 +625,13 @@ void QDeclarativeViewObserver::continueExecution(qreal slowdownFactor) data->slowdownFactor = slowdownFactor; static const qreal animSpeedSnapDelta = 0.01f; - bool useStandardSpeed = (qAbs(1.0f - data->slowdownFactor) < animSpeedSnapDelta); - QUnifiedTimer *timer = QUnifiedTimer::instance(); - timer->setSlowdownFactor(data->slowdownFactor); - timer->setSlowModeEnabled(!useStandardSpeed); + qreal slowDownFactor = data->slowdownFactor; + if (qAbs(1.0f - slowDownFactor) < animSpeedSnapDelta) { + slowDownFactor = 1.0f; + } + + QDeclarativeDebugHelper::setAnimationSlowDownFactor(slowDownFactor); data->executionPaused = false; emit executionStarted(data->slowdownFactor); @@ -639,9 +640,7 @@ void QDeclarativeViewObserver::continueExecution(qreal slowdownFactor) void QDeclarativeViewObserver::pauseExecution() { - QUnifiedTimer *timer = QUnifiedTimer::instance(); - timer->setSlowdownFactor(0); - timer->setSlowModeEnabled(true); + QDeclarativeDebugHelper::setAnimationSlowDownFactor(0.0f); data->executionPaused = true; emit executionPaused(); @@ -796,7 +795,7 @@ void QDeclarativeViewObserverPrivate::createToolbar() void QDeclarativeViewObserver::setDebugMode(bool isDebugMode) { if (isDebugMode && !data->jsDebuggerAgent) - data->jsDebuggerAgent = new JSDebuggerAgent(QDeclarativeEnginePrivate::getScriptEngine(data->view->engine())); + data->jsDebuggerAgent = new JSDebuggerAgent(data->view->engine()); } } //namespace QmlJSDebugger diff --git a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver_p.h b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver_p.h index a276c4350e2..516877dd586 100644 --- a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver_p.h +++ b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver_p.h @@ -27,8 +27,8 @@ ** **************************************************************************/ -#ifndef QDECLARATIVEDESIGNVIEW_P_H -#define QDECLARATIVEDESIGNVIEW_P_H +#ifndef QDECLARATIVEVIEWOBSERVER_P_H +#define QDECLARATIVEVIEWOBSERVER_P_H #include #include @@ -138,4 +138,4 @@ public: } // namespace QmlJSDebugger -#endif // QDECLARATIVEDESIGNVIEW_P_H +#endif // QDECLARATIVEVIEWOBSERVER_P_H diff --git a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri index f8e482e38c7..ec99cd06cc5 100644 --- a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri +++ b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri @@ -1,6 +1,6 @@ QT += declarative script -INCLUDEPATH += $$PWD $$PWD/include editor -DEPENDPATH += $$PWD $$PWD/include editor +INCLUDEPATH += $$PWD/include +DEPENDPATH += $$PWD $$PWD/include editor $$PWD/qt-private contains(CONFIG, dll) { DEFINES += BUILD_QMLJSDEBUGGER_LIB @@ -8,28 +8,28 @@ contains(CONFIG, dll) { DEFINES += BUILD_QMLJSDEBUGGER_STATIC_LIB } -include($$PWD/private_headers.pri) - ## Input HEADERS += \ - $$PWD/include/jsdebuggeragent.h \ - $$PWD/include/qmljsdebugger_global.h + include/jsdebuggeragent.h \ + include/qmljsdebugger_global.h \ + include/qt_private/qdeclarativedebughelper_p.h \ + include/qt_private/qdeclarativedebugservice_p.h SOURCES += \ - $$PWD/jsdebuggeragent.cpp + jsdebuggeragent.cpp contains(DEFINES, QMLOBSERVER) { include($$PWD/editor/editor.pri) HEADERS += \ - $$PWD/include/qdeclarativeviewobserver.h \ - $$PWD/include/qdeclarativeobserverservice.h \ - $$PWD/include/qmlobserverconstants.h \ - $$PWD/qdeclarativeviewobserver_p.h + include/qdeclarativeviewobserver.h \ + include/qdeclarativeobserverservice.h \ + include/qmlobserverconstants.h \ + qdeclarativeviewobserver_p.h SOURCES += \ - $$PWD/qdeclarativeviewobserver.cpp \ - $$PWD/qdeclarativeobserverservice.cpp + qdeclarativeviewobserver.cpp \ + qdeclarativeobserverservice.cpp } -OTHER_FILES += $$PWD/qmljsdebugger.pri +OTHER_FILES += qmljsdebugger.pri diff --git a/src/plugins/qt4projectmanager/qmlobservertool.cpp b/src/plugins/qt4projectmanager/qmlobservertool.cpp index 7b556f2a313..1a456062af0 100644 --- a/src/plugins/qt4projectmanager/qmlobservertool.cpp +++ b/src/plugins/qt4projectmanager/qmlobservertool.cpp @@ -139,13 +139,15 @@ QString QmlObserverTool::copy(const QString &qtInstallData, QString *errorMessag << QLatin1String("LICENSE.LGPL") << QLatin1String("LGPL_EXCEPTION.TXT"); QStringList debuggerLibFiles; - debuggerLibFiles << QLatin1String("jsdebuggeragent.cpp") << QLatin1String("private_headers.pri") + debuggerLibFiles << QLatin1String("jsdebuggeragent.cpp") << QLatin1String("qdeclarativeobserverservice.cpp") << QLatin1String("qdeclarativeviewobserver.cpp") << QLatin1String("qdeclarativeviewobserver_p.h") << QLatin1String("qmljsdebugger.pri") << QLatin1String("qmljsdebugger.pro") << QLatin1String("qmljsdebugger-lib.pri") << QLatin1String("include/jsdebuggeragent.h") << QLatin1String("include/qdeclarativeobserverservice.h") << QLatin1String("include/qdeclarativeviewobserver.h") << QLatin1String("include/qmljsdebugger_global.h") - << QLatin1String("include/qmlobserverconstants.h"); + << QLatin1String("include/qmlobserverconstants.h") + << QLatin1String("include/qt_private/qdeclarativedebughelper_p.h") + << QLatin1String("include/qt_private/qdeclarativedebugservice_p.h"); QStringList debuggerLibEditorFiles; debuggerLibEditorFiles << QLatin1String("abstractformeditortool.cpp") << QLatin1String("abstractformeditortool.h") @@ -183,7 +185,8 @@ QString QmlObserverTool::copy(const QString &qtInstallData, QString *errorMessag foreach(const QString &directory, directories) { if (!mkpath(directory + QLatin1String("/content/images"), errorMessage) || !mkpath(directory + QLatin1String("/qmljsdebugger/editor/images"), errorMessage) - || !mkpath(directory + QLatin1String("/qmljsdebugger/include"), errorMessage)) + || !mkpath(directory + QLatin1String("/qmljsdebugger/include"), errorMessage) + || !mkpath(directory + QLatin1String("/qmljsdebugger/include/qt_private"), errorMessage)) { continue; } else {