From dbf35e498db723ae9850686e462ec4f45bc7b67c Mon Sep 17 00:00:00 2001 From: Matthew Vogt Date: Tue, 31 Jan 2012 11:22:08 +1000 Subject: Modify QtQuick1 to build in Qt5 Change-Id: I1c5ccaef420e8f119e761f50b969127f430df7ba Reviewed-by: Martin Jones --- .../qmltest/qmltest.xcodeproj/project.pbxproj | 21 +- .../qmlapplicationviewer/qmlapplicationviewer.cpp | 47 +-- .../qmlapplicationviewer/qmlapplicationviewer.h | 2 +- src/plugins/plugins.pro | 15 +- .../qmldbg_inspector/abstractviewinspector.cpp | 39 +-- .../qmldbg_inspector/abstractviewinspector.h | 58 ++-- .../editor/abstractliveedittool.cpp | 5 +- .../qmldbg_inspector/editor/abstractliveedittool.h | 6 +- .../editor/boundingrecthighlighter.cpp | 9 +- .../editor/boundingrecthighlighter.h | 2 + .../qmldbg_inspector/editor/colorpickertool.cpp | 8 +- .../qmldbg_inspector/editor/colorpickertool.h | 2 + .../qmldbg_inspector/editor/livelayeritem.cpp | 4 +- .../qmldbg_inspector/editor/livelayeritem.h | 6 +- .../editor/liverubberbandselectionmanipulator.cpp | 6 +- .../editor/liverubberbandselectionmanipulator.h | 4 +- .../editor/liveselectionindicator.cpp | 14 +- .../editor/liveselectionindicator.h | 4 +- .../editor/liveselectionrectangle.cpp | 12 +- .../editor/liveselectionrectangle.h | 2 + .../qmldbg_inspector/editor/liveselectiontool.cpp | 18 +- .../qmldbg_inspector/editor/liveselectiontool.h | 2 + .../editor/livesingleselectionmanipulator.cpp | 4 +- .../editor/livesingleselectionmanipulator.h | 2 + .../qmldbg_inspector/editor/qmltoolbar.cpp | 328 --------------------- .../qmldbg_inspector/editor/qmltoolbar.h | 132 --------- .../editor/subcomponentmasklayeritem.cpp | 6 +- .../editor/subcomponentmasklayeritem.h | 4 +- .../qmldbg_inspector/editor/toolbarcolorbox.cpp | 134 --------- .../qmldbg_inspector/editor/toolbarcolorbox.h | 81 ----- .../qmldbg_inspector/editor/zoomtool.cpp | 12 +- .../qmltooling/qmldbg_inspector/editor/zoomtool.h | 2 + .../qdeclarativeinspectorplugin.cpp | 80 ----- .../qmldbg_inspector/qdeclarativeinspectorplugin.h | 71 ----- .../qmldbg_inspector/qdeclarativeviewinspector.cpp | 17 +- .../qmldbg_inspector/qdeclarativeviewinspector.h | 8 +- .../qmldbg_inspector/qdeclarativeviewinspector_p.h | 6 +- .../qmldbg_inspector/qmldbg_inspector.pro | 8 +- .../qmldbg_inspector/qmlinspectorconstants.h | 2 +- .../qmltooling/qmldbg_inspector/qtquick1plugin.cpp | 93 ++++++ .../qmltooling/qmldbg_inspector/qtquick1plugin.h | 77 +++++ src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro | 21 -- src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp | 149 ---------- src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h | 82 ------ src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp | 220 -------------- src/plugins/qmltooling/qmldbg_ost/qostdevice.h | 77 ----- src/plugins/qmltooling/qmldbg_ost/usbostcomm.h | 191 ------------ src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro | 18 -- .../qmltooling/qmldbg_tcp/qtcpserverconnection.cpp | 198 ------------- .../qmltooling/qmldbg_tcp/qtcpserverconnection.h | 84 ------ src/plugins/qmltooling/qmltooling.pro | 3 +- src/plugins/qpluginbase.pri | 2 +- 52 files changed, 345 insertions(+), 2053 deletions(-) delete mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.h delete mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.h delete mode 100644 src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h create mode 100644 src/plugins/qmltooling/qmldbg_inspector/qtquick1plugin.cpp create mode 100644 src/plugins/qmltooling/qmldbg_inspector/qtquick1plugin.h delete mode 100644 src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro delete mode 100644 src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h delete mode 100644 src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_ost/qostdevice.h delete mode 100644 src/plugins/qmltooling/qmldbg_ost/usbostcomm.h delete mode 100644 src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro delete mode 100644 src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h (limited to 'src/plugins') diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj b/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj index e513030d..021eed24 100644 --- a/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj +++ b/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 45; objects = { /* Begin PBXBuildFile section */ @@ -35,8 +35,8 @@ D3CAA7F013264F52008BB877 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; D3CAA7F113264F52008BB877 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; D3CAA7F213264F52008BB877 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; - D3CAA7FA13264F8A008BB877 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7F913264F8A008BB877 /* libz.dylib */; }; - D3CAA81113264FF0008BB877 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7F913264F8A008BB877 /* libz.dylib */; }; + D3CAA7FA13264F8A008BB877 /* libz.1.2.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */; }; + D3CAA81113264FF0008BB877 /* libz.1.2.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */; }; D3CAA89113265310008BB877 /* qml in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA88E13265310008BB877 /* qml */; }; D3CAA89213265310008BB877 /* qml in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA88E13265310008BB877 /* qml */; }; D3D817B2132A2CFD00CDE422 /* libQtCore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817AA132A2CFD00CDE422 /* libQtCore.a */; }; @@ -75,7 +75,7 @@ D3578435134A09990046D202 /* libQtOpenGL.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtOpenGL.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtOpenGL.a"; sourceTree = ""; }; D3CAA7C713264AAD008BB877 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = ""; }; D3CAA7F613264F52008BB877 /* qmltest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = qmltest.app; sourceTree = BUILT_PRODUCTS_DIR; }; - D3CAA7F913264F8A008BB877 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; + D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.1.2.3.dylib; path = usr/lib/libz.1.2.3.dylib; sourceTree = SDKROOT; }; D3CAA88E13265310008BB877 /* qml */ = {isa = PBXFileReference; lastKnownFileType = folder; path = qml; sourceTree = SOURCE_ROOT; }; D3D817AA132A2CFD00CDE422 /* libQtCore.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtCore.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtCore.a"; sourceTree = SOURCE_ROOT; }; D3D817AB132A2CFD00CDE422 /* libQtDeclarative.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtDeclarative.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtDeclarative.a"; sourceTree = SOURCE_ROOT; }; @@ -98,7 +98,7 @@ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, D35784261345D9940046D202 /* OpenGLES.framework in Frameworks */, - D3CAA7FA13264F8A008BB877 /* libz.dylib in Frameworks */, + D3CAA7FA13264F8A008BB877 /* libz.1.2.3.dylib in Frameworks */, D307DECF13EBD05900399BD4 /* libQtCore.a in Frameworks */, D307DED013EBD05900399BD4 /* libQtDeclarative.a in Frameworks */, D307DED113EBD05900399BD4 /* libQtGui.a in Frameworks */, @@ -121,7 +121,7 @@ D3CAA7F013264F52008BB877 /* Foundation.framework in Frameworks */, D3CAA7F113264F52008BB877 /* UIKit.framework in Frameworks */, D3CAA7F213264F52008BB877 /* CoreGraphics.framework in Frameworks */, - D3CAA81113264FF0008BB877 /* libz.dylib in Frameworks */, + D3CAA81113264FF0008BB877 /* libz.1.2.3.dylib in Frameworks */, D3D817B2132A2CFD00CDE422 /* libQtCore.a in Frameworks */, D3D817B3132A2CFD00CDE422 /* libQtDeclarative.a in Frameworks */, D3D817B4132A2CFD00CDE422 /* libQtGui.a in Frameworks */, @@ -188,7 +188,7 @@ D35784251345D9940046D202 /* OpenGLES.framework */, D35784271345D9E00046D202 /* QuartzCore.framework */, D34F290613F29B0300E4F9AC /* CoreText.framework */, - D3CAA7F913264F8A008BB877 /* libz.dylib */, + D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */, ); name = Frameworks; sourceTree = ""; @@ -277,11 +277,8 @@ /* Begin PBXProject section */ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; - attributes = { - LastUpgradeCheck = 0420; - }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "qmltest" */; - compatibilityVersion = "Xcode 3.2"; + compatibilityVersion = "Xcode 3.1"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( @@ -396,6 +393,7 @@ GCC_C_LANGUAGE_STANDARD = c99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; SDKROOT = iphoneos; }; name = Debug; @@ -409,6 +407,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + PREBINDING = NO; SDKROOT = iphoneos; }; name = Release; diff --git a/src/plugins/platforms/uikit/examples/share/qmlapplicationviewer/qmlapplicationviewer.cpp b/src/plugins/platforms/uikit/examples/share/qmlapplicationviewer/qmlapplicationviewer.cpp index 3a1850ff..746b4ab6 100644 --- a/src/plugins/platforms/uikit/examples/share/qmlapplicationviewer/qmlapplicationviewer.cpp +++ b/src/plugins/platforms/uikit/examples/share/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -54,9 +54,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 @@ -145,45 +145,8 @@ void QmlApplicationViewer::addImportPath(const QString &path) void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) { -//#if defined(Q_OS_SYMBIAN) -// // If the version of Qt on the device is < 4.7.2, that attribute won't work -// if (orientation != ScreenOrientationAuto) { -// const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); -// if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { -// qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); -// return; -// } -// } -//#endif // Q_OS_SYMBIAN - -// Qt::WidgetAttribute attribute; -// switch (orientation) { -//#if QT_VERSION < 0x040702 -// // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes -// case ScreenOrientationLockPortrait: -// attribute = static_cast(128); -// break; -// case ScreenOrientationLockLandscape: -// attribute = static_cast(129); -// break; -// default: -// case ScreenOrientationAuto: -// attribute = static_cast(130); -// break; -//#else // QT_VERSION < 0x040702 -// case ScreenOrientationLockPortrait: -// attribute = Qt::WA_LockPortraitOrientation; -// break; -// case ScreenOrientationLockLandscape: -// attribute = Qt::WA_LockLandscapeOrientation; -// break; -// default: -// case ScreenOrientationAuto: -// attribute = Qt::WA_AutoOrientation; -// break; -//#endif // QT_VERSION < 0x040702 -// }; -// setAttribute(attribute, true); + // TODO: Needs a Qt5 implmentation + Q_UNUSED(orientation) } void QmlApplicationViewer::showExpanded() diff --git a/src/plugins/platforms/uikit/examples/share/qmlapplicationviewer/qmlapplicationviewer.h b/src/plugins/platforms/uikit/examples/share/qmlapplicationviewer/qmlapplicationviewer.h index f6a7900c..9a32678b 100644 --- a/src/plugins/platforms/uikit/examples/share/qmlapplicationviewer/qmlapplicationviewer.h +++ b/src/plugins/platforms/uikit/examples/share/qmlapplicationviewer/qmlapplicationviewer.h @@ -52,7 +52,7 @@ #ifndef QMLAPPLICATIONVIEWER_H #define QMLAPPLICATIONVIEWER_H -#include +#include class QmlApplicationViewer : public QDeclarativeView { diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 94ce675f..21d41c18 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -1,16 +1,3 @@ TEMPLATE = subdirs +SUBDIRS += qmltooling -SUBDIRS *= sqldrivers script bearer -unix:!symbian { - contains(QT_CONFIG,iconv)|contains(QT_CONFIG,gnu-libiconv)|contains(QT_CONFIG,sun-libiconv):SUBDIRS *= codecs -} else { - SUBDIRS *= codecs -} -!contains(QT_CONFIG, no-gui): SUBDIRS *= imageformats iconengines -!embedded:!qpa:!contains(QT_CONFIG, no-gui):SUBDIRS *= graphicssystems -embedded:SUBDIRS *= gfxdrivers decorations mousedrivers kbddrivers -!win32:!embedded:!mac:!symbian:!contains(QT_CONFIG, no-gui):SUBDIRS *= inputmethods -!symbian:!contains(QT_CONFIG, no-gui):SUBDIRS += accessible -contains(QT_CONFIG, phonon): SUBDIRS *= phonon -qpa:SUBDIRS += platforms -contains(QT_CONFIG, declarative): SUBDIRS *= qmltooling diff --git a/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp index c5e127c1..72f55ebf 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp @@ -44,17 +44,16 @@ #include "abstracttool.h" #include "qdeclarativeinspectorprotocol.h" -#include -#include -#include -#include "QtDeclarative/private/qdeclarativeinspectorservice_p.h" +#include +#include +#include +#include -#include #include -#include namespace QmlJSDebugger { + AbstractViewInspector::AbstractViewInspector(QObject *parent) : QObject(parent), m_currentTool(0), @@ -62,11 +61,8 @@ AbstractViewInspector::AbstractViewInspector(QObject *parent) : m_designModeBehavior(false), m_animationPaused(false), m_slowDownFactor(1.0), - m_debugService(0) + m_debugService(QDeclarativeInspectorService::instance()) { - m_debugService = QDeclarativeInspectorService::instance(); - connect(m_debugService, SIGNAL(gotMessage(QByteArray)), - this, SLOT(handleMessage(QByteArray))); } void AbstractViewInspector::createQmlObject(const QString &qml, QObject *parent, @@ -134,7 +130,8 @@ void AbstractViewInspector::animationSpeedChangeRequested(qreal factor) } const float effectiveFactor = m_animationPaused ? 0 : factor; - QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor); + QUnifiedTimer::instance()->setSlowModeEnabled(effectiveFactor != 1.0); + QUnifiedTimer::instance()->setSlowdownFactor(effectiveFactor); } void AbstractViewInspector::animationPausedChangeRequested(bool paused) @@ -145,22 +142,19 @@ void AbstractViewInspector::animationPausedChangeRequested(bool paused) } const float effectiveFactor = paused ? 0 : m_slowDownFactor; - QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor); + QUnifiedTimer::instance()->setSlowModeEnabled(effectiveFactor != 1.0); + QUnifiedTimer::instance()->setSlowdownFactor(effectiveFactor); } void AbstractViewInspector::setShowAppOnTop(bool appOnTop) { - if (viewWidget()) { - QWidget *window = viewWidget()->window(); - Qt::WindowFlags flags = window->windowFlags(); - if (appOnTop) - flags |= Qt::WindowStaysOnTopHint; - else - flags &= ~Qt::WindowStaysOnTopHint; + Qt::WindowFlags flags = windowFlags(); + if (appOnTop) + flags |= Qt::WindowStaysOnTopHint; + else + flags &= ~Qt::WindowStaysOnTopHint; - window->setWindowFlags(flags); - window->show(); - } + setWindowFlags(flags); m_showAppOnTop = appOnTop; sendShowAppOnTop(appOnTop); @@ -508,4 +502,3 @@ QString AbstractViewInspector::idStringForObject(QObject *obj) const } } // namespace QmlJSDebugger - diff --git a/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.h b/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.h index 700476f9..7fbe4446 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.h +++ b/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.h @@ -63,7 +63,7 @@ namespace QmlJSDebugger { class AbstractTool; /* - * The common code between QSGView and QDeclarativeView inspectors lives here, + * The common code between QQuickView and QDeclarativeView inspectors lives here, */ class AbstractViewInspector : public QObject { @@ -72,24 +72,13 @@ class AbstractViewInspector : public QObject public: explicit AbstractViewInspector(QObject *parent = 0); - virtual void changeCurrentObjects(const QList &objects) = 0; - - virtual void reloadView() = 0; + void handleMessage(const QByteArray &message); void createQmlObject(const QString &qml, QObject *parent, const QStringList &importList, const QString &filename = QString()); - - virtual void reparentQmlObject(QObject *object, QObject *newParent) = 0; - - virtual void changeTool(InspectorProtocol::Tool tool) = 0; - void clearComponentCache(); - virtual QWidget *viewWidget() const = 0; - virtual QDeclarativeEngine *declarativeEngine() const = 0; - - bool showAppOnTop() const { return m_showAppOnTop; } bool designModeBehavior() const { return m_designModeBehavior; } @@ -105,21 +94,13 @@ public: QString idStringForObject(QObject *obj) const; -public slots: - void sendDesignModeBehavior(bool inDesignMode); - void sendColorChanged(const QColor &color); - - void changeToColorPickerTool(); - void changeToZoomTool(); - void changeToSingleSelectTool(); - void changeToMarqueeSelectTool(); - - virtual void setDesignModeBehavior(bool value); - - void setShowAppOnTop(bool appOnTop); - - void setAnimationSpeed(qreal factor); - void setAnimationPaused(bool paused); + virtual void changeCurrentObjects(const QList &objects) = 0; + virtual void reloadView() = 0; + virtual void reparentQmlObject(QObject *object, QObject *newParent) = 0; + virtual void changeTool(InspectorProtocol::Tool tool) = 0; + virtual Qt::WindowFlags windowFlags() const = 0; + virtual void setWindowFlags(Qt::WindowFlags flags) = 0; + virtual QDeclarativeEngine *declarativeEngine() const = 0; signals: void designModeBehaviorChanged(bool inDesignMode); @@ -135,6 +116,8 @@ signals: void animationPausedChanged(bool paused); protected: + AbstractTool *currentTool() const { return m_currentTool; } + void setCurrentTool(AbstractTool *tool) { m_currentTool = tool; } bool eventFilter(QObject *, QEvent *); virtual bool leaveEvent(QEvent *); @@ -146,13 +129,24 @@ protected: virtual bool mouseDoubleClickEvent(QMouseEvent *event); virtual bool wheelEvent(QWheelEvent *event); - AbstractTool *currentTool() const { return m_currentTool; } - void setCurrentTool(AbstractTool *tool) { m_currentTool = tool; } - private slots: - void handleMessage(const QByteArray &message); + void sendColorChanged(const QColor &color); private: + void sendDesignModeBehavior(bool inDesignMode); + + void changeToColorPickerTool(); + void changeToZoomTool(); + void changeToSingleSelectTool(); + void changeToMarqueeSelectTool(); + + virtual void setDesignModeBehavior(bool value); + + void setShowAppOnTop(bool appOnTop); + + void setAnimationSpeed(qreal factor); + void setAnimationPaused(bool paused); + void animationSpeedChangeRequested(qreal factor); void animationPausedChangeRequested(bool paused); diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.cpp index 9c2f70c4..8d6d3b33 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "abstractliveedittool.h" -#include "../qdeclarativeviewinspector_p.h" +#include "qdeclarativeviewinspector_p.h" #include @@ -49,6 +49,7 @@ #include namespace QmlJSDebugger { +namespace QtQuick1 { AbstractLiveEditTool::AbstractLiveEditTool(QDeclarativeViewInspector *editorView) : AbstractTool(editorView) @@ -192,5 +193,5 @@ QString AbstractLiveEditTool::titleForItem(QGraphicsItem *item) return constructedName; } - +} // namespace QtQuick1 } // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.h b/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.h index f2996a10..83a3073b 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/abstractliveedittool.h @@ -43,7 +43,7 @@ #define ABSTRACTLIVEEDITTOOL_H #include -#include "../abstracttool.h" +#include "abstracttool.h" QT_BEGIN_NAMESPACE class QMouseEvent; @@ -57,6 +57,7 @@ class QDeclarativeView; QT_END_NAMESPACE namespace QmlJSDebugger { +namespace QtQuick1 { class QDeclarativeViewInspector; @@ -99,6 +100,7 @@ private: QList m_itemList; }; -} +} // namespace QtQuick1 +} // namesacpe QmlJSDebugger #endif // ABSTRACTLIVEEDITTOOL_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp index f6305698..cace52a3 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.cpp @@ -41,16 +41,17 @@ #include "boundingrecthighlighter.h" -#include "../qdeclarativeviewinspector.h" -#include "../qmlinspectorconstants.h" +#include "qdeclarativeviewinspector.h" +#include "qmlinspectorconstants.h" -#include +#include #include #include #include namespace QmlJSDebugger { +namespace QtQuick1 { BoundingBox::BoundingBox(QGraphicsObject *itemToHighlight, QGraphicsItem *parentItem, QObject *parent) @@ -236,5 +237,5 @@ void BoundingRectHighlighter::refresh() highlightAll(); } - +} // namespace QtQuick1 } // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.h b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.h index aef4e4ee..45f1b44a 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/boundingrecthighlighter.h @@ -54,6 +54,7 @@ QT_FORWARD_DECLARE_CLASS(QStyleOptionGraphicsItem) QT_FORWARD_DECLARE_CLASS(QTimer) namespace QmlJSDebugger { +namespace QtQuick1 { class QDeclarativeViewInspector; class BoundingBox; @@ -110,6 +111,7 @@ public: int type() const; }; +} // namespace QtQuick1 } // namespace QmlJSDebugger #endif // BOUNDINGRECTHIGHLIGHTER_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.cpp index 9fe40fbf..b9e77f6e 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.cpp @@ -41,17 +41,18 @@ #include "colorpickertool.h" -#include "../qdeclarativeviewinspector.h" +#include "qdeclarativeviewinspector.h" #include #include #include #include #include -#include +#include #include namespace QmlJSDebugger { +namespace QtQuick1 { ColorPickerTool::ColorPickerTool(QDeclarativeViewInspector *view) : AbstractLiveEditTool(view) @@ -75,9 +76,7 @@ void ColorPickerTool::mouseMoveEvent(QMouseEvent *event) void ColorPickerTool::clear() { -#ifndef QT_NO_CURSOR view()->setCursor(Qt::CrossCursor); -#endif } void ColorPickerTool::pickColor(const QPoint &pos) @@ -97,4 +96,5 @@ void ColorPickerTool::pickColor(const QPoint &pos) emit selectedColorChanged(m_selectedColor); } +} // namespace QtQuick1 } // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.h b/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.h index dda147bc..b61b2bb4 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/colorpickertool.h @@ -49,6 +49,7 @@ QT_FORWARD_DECLARE_CLASS(QPoint) namespace QmlJSDebugger { +namespace QtQuick1 { class ColorPickerTool : public AbstractLiveEditTool { @@ -87,6 +88,7 @@ private: QColor m_selectedColor; }; +} // namespace QtQuick1 } // namespace QmlJSDebugger #endif // COLORPICKERTOOL_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.cpp index fd52b0eb..a177185d 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.cpp @@ -41,11 +41,12 @@ #include "livelayeritem.h" -#include "../qmlinspectorconstants.h" +#include "qmlinspectorconstants.h" #include namespace QmlJSDebugger { +namespace QtQuick1 { LiveLayerItem::LiveLayerItem(QGraphicsScene* scene) : QGraphicsObject() @@ -89,4 +90,5 @@ QList LiveLayerItem::findAllChildItems(const QGraphicsItem *item return itemList; } +} // namespace QtQuick1 } // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.h b/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.h index bfff002e..61c0c2dc 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/livelayeritem.h @@ -42,9 +42,10 @@ #ifndef LIVELAYERITEM_H #define LIVELAYERITEM_H -#include +#include namespace QmlJSDebugger { +namespace QtQuick1 { class LiveLayerItem : public QGraphicsObject { @@ -62,6 +63,7 @@ protected: QList findAllChildItems(const QGraphicsItem *item) const; }; -} +} // namespace QtQuick1 +} // namespace QmlJSDebugger #endif // LIVELAYERITEM_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.cpp index 7c04f62c..7c259d53 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.cpp @@ -41,13 +41,14 @@ #include "liverubberbandselectionmanipulator.h" -#include "../qdeclarativeviewinspector_p.h" +#include "qdeclarativeviewinspector_p.h" -#include +#include #include namespace QmlJSDebugger { +namespace QtQuick1 { LiveRubberBandSelectionManipulator::LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem, QDeclarativeViewInspector *editorView) @@ -162,4 +163,5 @@ bool LiveRubberBandSelectionManipulator::isActive() const return m_isActive; } +} // namespace QtQuick1 } // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.h b/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.h index c1609ea3..8db8a87e 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liverubberbandselectionmanipulator.h @@ -49,6 +49,7 @@ QT_FORWARD_DECLARE_CLASS(QGraphicsItem) namespace QmlJSDebugger { +namespace QtQuick1 { class QDeclarativeViewInspector; @@ -91,6 +92,7 @@ private: bool m_isActive; }; -} +} // namespace QtQuick1 +} // namespace QmlJSDebugger #endif // RUBBERBANDSELECTIONMANIPULATOR_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.cpp index 9545651d..5715d6e8 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.cpp @@ -41,15 +41,16 @@ #include "liveselectionindicator.h" -#include "../qdeclarativeviewinspector_p.h" -#include "../qmlinspectorconstants.h" +#include "qdeclarativeviewinspector_p.h" +#include "qmlinspectorconstants.h" -#include -#include -#include +#include +#include +#include #include namespace QmlJSDebugger { +namespace QtQuick1 { LiveSelectionIndicator::LiveSelectionIndicator(QDeclarativeViewInspector *viewInspector, QGraphicsObject *layerItem) @@ -114,5 +115,6 @@ void LiveSelectionIndicator::setItems(const QList } } -} //namespace QmlJSDebugger +} // namespace QtQuick1 +} // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.h b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.h index db386288..7effc3a9 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionindicator.h @@ -53,6 +53,7 @@ class QPolygonF; QT_END_NAMESPACE namespace QmlJSDebugger { +namespace QtQuick1 { class QDeclarativeViewInspector; @@ -75,6 +76,7 @@ private: QDeclarativeViewInspector *m_view; }; -} +} // namespace QtQuick1 +} // namespace QmlJSDebugger #endif // LIVESELECTIONINDICATOR_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.cpp index 91db2866..e03cc594 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.cpp @@ -41,18 +41,19 @@ #include "liveselectionrectangle.h" -#include "../qmlinspectorconstants.h" +#include "qmlinspectorconstants.h" #include -#include -#include -#include +#include +#include +#include #include #include namespace QmlJSDebugger { +namespace QtQuick1 { class SelectionRectShape : public QGraphicsRectItem { @@ -110,4 +111,5 @@ void LiveSelectionRectangle::setRect(const QPointF &firstPoint, m_controlShape->setRect(rect); } -} +} // namespace QtQuick1 +} // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.h b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.h index 5fe42a00..cb1487e6 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectionrectangle.h @@ -50,6 +50,7 @@ QT_FORWARD_DECLARE_CLASS(QPointF) QT_FORWARD_DECLARE_CLASS(QRectF) namespace QmlJSDebugger { +namespace QtQuick1 { class LiveSelectionRectangle { @@ -72,6 +73,7 @@ private: QWeakPointer m_layerItem; }; +} // namespace QtQuick1 } // namespace QmlJSDebugger #endif // LIVESELECTIONRECTANGLE_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.cpp index 288f1ec5..55489243 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.cpp @@ -42,22 +42,23 @@ #include "liveselectiontool.h" #include "livelayeritem.h" -#include "../qdeclarativeviewinspector_p.h" +#include "qdeclarativeviewinspector_p.h" -#include +#include #include #include #include -#include -#include -#include +#include +#include +#include -#include -#include +#include +#include #include namespace QmlJSDebugger { +namespace QtQuick1 { LiveSelectionTool::LiveSelectionTool(QDeclarativeViewInspector *editorView) : AbstractLiveEditTool(editorView), @@ -363,9 +364,7 @@ void LiveSelectionTool::setSelectOnlyContentItems(bool selectOnlyContentItems) void LiveSelectionTool::clear() { -#ifndef QT_NO_CURSOR view()->setCursor(Qt::ArrowCursor); -#endif m_rubberbandSelectionManipulator.clear(), m_singleSelectionManipulator.clear(); m_selectionIndicator.clear(); @@ -422,4 +421,5 @@ void LiveSelectionTool::selectUnderPoint(QMouseEvent *event) m_singleSelectionManipulator.end(event->pos()); } +} // namespace QtQuick1 } // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.h b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.h index eb3c63df..f271aa8e 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/liveselectiontool.h @@ -56,6 +56,7 @@ QT_FORWARD_DECLARE_CLASS(QKeyEvent) QT_FORWARD_DECLARE_CLASS(QAction) namespace QmlJSDebugger { +namespace QtQuick1 { class LiveSelectionTool : public AbstractLiveEditTool { @@ -115,6 +116,7 @@ private: QList m_contextMenuItemList; }; +} // namespace QtQuick1 } // namespace QmlJSDebugger #endif // LIVESELECTIONTOOL_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.cpp index 67583943..dbdcde28 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.cpp @@ -41,11 +41,12 @@ #include "livesingleselectionmanipulator.h" -#include "../qdeclarativeviewinspector_p.h" +#include "qdeclarativeviewinspector_p.h" #include namespace QmlJSDebugger { +namespace QtQuick1 { LiveSingleSelectionManipulator::LiveSingleSelectionManipulator(QDeclarativeViewInspector *editorView) : m_editorView(editorView), @@ -148,4 +149,5 @@ QPointF LiveSingleSelectionManipulator::beginPoint() const return m_beginPoint; } +} // namespace QtQuick1 } // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.h b/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.h index 256a6ead..e0b4a69c 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/livesingleselectionmanipulator.h @@ -48,6 +48,7 @@ QT_FORWARD_DECLARE_CLASS(QGraphicsItem) namespace QmlJSDebugger { +namespace QtQuick1 { class QDeclarativeViewInspector; @@ -84,6 +85,7 @@ private: bool m_isActive; }; +} // namespace QtQuick1 } // namespace QmlJSDebugger #endif // LIVESINGLESELECTIONMANIPULATOR_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp deleted file mode 100644 index ead0e166..00000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp +++ /dev/null @@ -1,328 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 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$ -** -****************************************************************************/ - -#include "qmltoolbar.h" -#include "toolbarcolorbox.h" - -#include -#include -#include -#include - -#include - -namespace QmlJSDebugger { - -QmlToolBar::QmlToolBar(QWidget *parent) - : QToolBar(parent) - , m_emitSignals(true) - , m_paused(false) - , m_animationSpeed(1.0f) - , ui(new Ui) -{ - ui->playIcon = QIcon(QLatin1String(":/qml/images/play-24.png")); - ui->pauseIcon = QIcon(QLatin1String(":/qml/images/pause-24.png")); - - ui->designmode = new QAction(QIcon(QLatin1String(":/qml/images/inspectormode-24.png")), - tr("Inspector Mode"), this); - ui->play = new QAction(ui->pauseIcon, tr("Play/Pause Animations"), this); - ui->select = new QAction(QIcon(QLatin1String(":/qml/images/select-24.png")), tr("Select"), this); - ui->selectMarquee = new QAction(QIcon(QLatin1String(":/qml/images/select-marquee-24.png")), - tr("Select (Marquee)"), this); - ui->zoom = new QAction(QIcon(QLatin1String(":/qml/images/zoom-24.png")), tr("Zoom"), this); - ui->colorPicker = new QAction(QIcon(QLatin1String(":/qml/images/color-picker-24.png")), - tr("Color Picker"), this); - ui->toQml = new QAction(QIcon(QLatin1String(":/qml/images/to-qml-24.png")), - tr("Apply Changes to QML Viewer"), this); - ui->fromQml = new QAction(QIcon(QLatin1String(":/qml/images/from-qml-24.png")), - tr("Apply Changes to Document"), this); - ui->designmode->setCheckable(true); - ui->designmode->setChecked(false); - - ui->play->setCheckable(false); - ui->select->setCheckable(true); - ui->selectMarquee->setCheckable(true); - ui->zoom->setCheckable(true); - ui->colorPicker->setCheckable(true); - - setWindowTitle(tr("Tools")); - - addAction(ui->designmode); - addAction(ui->play); - addSeparator(); - - addAction(ui->select); - // disabled because multi selection does not do anything useful without design mode - //addAction(ui->selectMarquee); - addSeparator(); - addAction(ui->zoom); - addAction(ui->colorPicker); - //addAction(ui->fromQml); - - ui->colorBox = new ToolBarColorBox(this); - ui->colorBox->setMinimumSize(24, 24); - ui->colorBox->setMaximumSize(28, 28); - ui->colorBox->setColor(Qt::black); - addWidget(ui->colorBox); - - setWindowFlags(Qt::Tool); - - QMenu *playSpeedMenu = new QMenu(this); - ui->playSpeedMenuActions = new QActionGroup(this); - ui->playSpeedMenuActions->setExclusive(true); - - QAction *speedAction = playSpeedMenu->addAction(tr("1x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setChecked(true); - speedAction->setData(1.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.5x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(2.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.25x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(4.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.125x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(8.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.1x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(10.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - ui->play->setMenu(playSpeedMenu); - - connect(ui->designmode, SIGNAL(toggled(bool)), SLOT(setDesignModeBehaviorOnClick(bool))); - - connect(ui->colorPicker, SIGNAL(triggered()), SLOT(activateColorPickerOnClick())); - - connect(ui->play, SIGNAL(triggered()), SLOT(activatePlayOnClick())); - - connect(ui->zoom, SIGNAL(triggered()), SLOT(activateZoomOnClick())); - connect(ui->colorPicker, SIGNAL(triggered()), SLOT(activateColorPickerOnClick())); - connect(ui->select, SIGNAL(triggered()), SLOT(activateSelectToolOnClick())); - connect(ui->selectMarquee, SIGNAL(triggered()), SLOT(activateMarqueeSelectToolOnClick())); - - connect(ui->toQml, SIGNAL(triggered()), SLOT(activateToQml())); - connect(ui->fromQml, SIGNAL(triggered()), SLOT(activateFromQml())); -} - -QmlToolBar::~QmlToolBar() -{ - delete ui; -} - -void QmlToolBar::activateColorPicker() -{ - m_emitSignals = false; - activateColorPickerOnClick(); - m_emitSignals = true; -} - -void QmlToolBar::activateSelectTool() -{ - m_emitSignals = false; - activateSelectToolOnClick(); - m_emitSignals = true; -} - -void QmlToolBar::activateMarqueeSelectTool() -{ - m_emitSignals = false; - activateMarqueeSelectToolOnClick(); - m_emitSignals = true; -} - -void QmlToolBar::activateZoom() -{ - m_emitSignals = false; - activateZoomOnClick(); - m_emitSignals = true; -} - -void QmlToolBar::setAnimationSpeed(qreal slowDownFactor) -{ - if (m_animationSpeed == slowDownFactor) - return; - - m_emitSignals = false; - m_animationSpeed = slowDownFactor; - - foreach (QAction *action, ui->playSpeedMenuActions->actions()) { - if (action->data().toReal() == slowDownFactor) { - action->setChecked(true); - break; - } - } - - m_emitSignals = true; -} - -void QmlToolBar::setAnimationPaused(bool paused) -{ - if (m_paused == paused) - return; - - m_paused = paused; - updatePlayAction(); -} - -void QmlToolBar::changeAnimationSpeed() -{ - QAction *action = qobject_cast(sender()); - m_animationSpeed = action->data().toReal(); - emit animationSpeedChanged(m_animationSpeed); -} - -void QmlToolBar::setDesignModeBehavior(bool inDesignMode) -{ - m_emitSignals = false; - ui->designmode->setChecked(inDesignMode); - setDesignModeBehaviorOnClick(inDesignMode); - m_emitSignals = true; -} - -void QmlToolBar::setDesignModeBehaviorOnClick(bool checked) -{ - ui->select->setEnabled(checked); - ui->selectMarquee->setEnabled(checked); - ui->zoom->setEnabled(checked); - ui->colorPicker->setEnabled(checked); - ui->toQml->setEnabled(checked); - ui->fromQml->setEnabled(checked); - - if (m_emitSignals) - emit designModeBehaviorChanged(checked); -} - -void QmlToolBar::setColorBoxColor(const QColor &color) -{ - ui->colorBox->setColor(color); -} - -void QmlToolBar::activatePlayOnClick() -{ - m_paused = !m_paused; - emit animationPausedChanged(m_paused); - updatePlayAction(); -} - -void QmlToolBar::updatePlayAction() -{ - ui->play->setIcon(m_paused ? ui->playIcon : ui->pauseIcon); -} - -void QmlToolBar::activateColorPickerOnClick() -{ - ui->zoom->setChecked(false); - ui->select->setChecked(false); - ui->selectMarquee->setChecked(false); - - ui->colorPicker->setChecked(true); - if (m_activeTool != Constants::ColorPickerMode) { - m_activeTool = Constants::ColorPickerMode; - if (m_emitSignals) - emit colorPickerSelected(); - } -} - -void QmlToolBar::activateSelectToolOnClick() -{ - ui->zoom->setChecked(false); - ui->selectMarquee->setChecked(false); - ui->colorPicker->setChecked(false); - - ui->select->setChecked(true); - if (m_activeTool != Constants::SelectionToolMode) { - m_activeTool = Constants::SelectionToolMode; - if (m_emitSignals) - emit selectToolSelected(); - } -} - -void QmlToolBar::activateMarqueeSelectToolOnClick() -{ - ui->zoom->setChecked(false); - ui->select->setChecked(false); - ui->colorPicker->setChecked(false); - - ui->selectMarquee->setChecked(true); - if (m_activeTool != Constants::MarqueeSelectionToolMode) { - m_activeTool = Constants::MarqueeSelectionToolMode; - if (m_emitSignals) - emit marqueeSelectToolSelected(); - } -} - -void QmlToolBar::activateZoomOnClick() -{ - ui->select->setChecked(false); - ui->selectMarquee->setChecked(false); - ui->colorPicker->setChecked(false); - - ui->zoom->setChecked(true); - if (m_activeTool != Constants::ZoomMode) { - m_activeTool = Constants::ZoomMode; - if (m_emitSignals) - emit zoomToolSelected(); - } -} - -void QmlToolBar::activateFromQml() -{ - if (m_emitSignals) - emit applyChangesFromQmlFileSelected(); -} - -void QmlToolBar::activateToQml() -{ - if (m_emitSignals) - emit applyChangesToQmlFileSelected(); -} - -} // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.h b/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.h deleted file mode 100644 index 3833ff28..00000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.h +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 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 QMLTOOLBAR_H -#define QMLTOOLBAR_H - -#include -#include - -#include "../qmlinspectorconstants.h" - -QT_FORWARD_DECLARE_CLASS(QActionGroup) - -namespace QmlJSDebugger { - -class ToolBarColorBox; - -class QmlToolBar : public QToolBar -{ - Q_OBJECT - -public: - explicit QmlToolBar(QWidget *parent = 0); - ~QmlToolBar(); - -public slots: - void setDesignModeBehavior(bool inDesignMode); - void setColorBoxColor(const QColor &color); - void activateColorPicker(); - void activateSelectTool(); - void activateMarqueeSelectTool(); - void activateZoom(); - - void setAnimationSpeed(qreal slowDownFactor); - void setAnimationPaused(bool paused); - -signals: - void animationSpeedChanged(qreal factor); - void animationPausedChanged(bool paused); - - void designModeBehaviorChanged(bool inDesignMode); - void colorPickerSelected(); - void selectToolSelected(); - void marqueeSelectToolSelected(); - void zoomToolSelected(); - - void applyChangesToQmlFileSelected(); - void applyChangesFromQmlFileSelected(); - -private slots: - void setDesignModeBehaviorOnClick(bool inDesignMode); - void activatePlayOnClick(); - void activateColorPickerOnClick(); - void activateSelectToolOnClick(); - void activateMarqueeSelectToolOnClick(); - void activateZoomOnClick(); - - void activateFromQml(); - void activateToQml(); - - void changeAnimationSpeed(); - - void updatePlayAction(); - -private: - class Ui { - public: - QAction *designmode; - QAction *play; - QAction *select; - QAction *selectMarquee; - QAction *zoom; - QAction *colorPicker; - QAction *toQml; - QAction *fromQml; - QIcon playIcon; - QIcon pauseIcon; - ToolBarColorBox *colorBox; - - QActionGroup *playSpeedMenuActions; - }; - - bool m_emitSignals; - bool m_paused; - qreal m_animationSpeed; - - Constants::DesignTool m_activeTool; - - Ui *ui; -}; - -} - -#endif // QMLTOOLBAR_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp index 62b2799b..4e9e91fb 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp @@ -41,12 +41,13 @@ #include "subcomponentmasklayeritem.h" -#include "../qmlinspectorconstants.h" -#include "../qdeclarativeviewinspector.h" +#include "qmlinspectorconstants.h" +#include "qdeclarativeviewinspector.h" #include namespace QmlJSDebugger { +namespace QtQuick1 { SubcomponentMaskLayerItem::SubcomponentMaskLayerItem(QDeclarativeViewInspector *inspector, QGraphicsItem *parentItem) : @@ -127,4 +128,5 @@ QGraphicsItem *SubcomponentMaskLayerItem::currentItem() const return m_currentItem; } +} // namespace QtQuick1 } // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.h b/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.h index 53864cc0..f9099f9e 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.h @@ -42,9 +42,10 @@ #ifndef SUBCOMPONENTMASKLAYERITEM_H #define SUBCOMPONENTMASKLAYERITEM_H -#include +#include namespace QmlJSDebugger { +namespace QtQuick1 { class QDeclarativeViewInspector; @@ -66,6 +67,7 @@ private: QRectF m_itemPolyRect; }; +} // namespace QtQuick1 } // namespace QmlJSDebugger #endif // SUBCOMPONENTMASKLAYERITEM_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp deleted file mode 100644 index 6c56acd0..00000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 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$ -** -****************************************************************************/ - -#include "toolbarcolorbox.h" - -#include "../qmlinspectorconstants.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace QmlJSDebugger { - -ToolBarColorBox::ToolBarColorBox(QWidget *parent) : - QLabel(parent) -{ - m_copyHexColor = new QAction(QIcon(QLatin1String(":/qml/images/color-picker-hicontrast.png")), - tr("Copy Color"), this); - connect(m_copyHexColor, SIGNAL(triggered()), SLOT(copyColorToClipboard())); - setScaledContents(false); -} - -void ToolBarColorBox::setColor(const QColor &color) -{ - m_color = color; - - QPixmap pix = createDragPixmap(width()); - setPixmap(pix); - update(); -} - -void ToolBarColorBox::mousePressEvent(QMouseEvent *event) -{ - m_dragBeginPoint = event->pos(); - m_dragStarted = false; -} - -void ToolBarColorBox::mouseMoveEvent(QMouseEvent *event) -{ - - if (event->buttons() & Qt::LeftButton - && (QPoint(event->pos() - m_dragBeginPoint).manhattanLength() - > Constants::DragStartDistance) - && !m_dragStarted) - { - m_dragStarted = true; - QDrag *drag = new QDrag(this); - QMimeData *mimeData = new QMimeData; - - mimeData->setText(m_color.name()); - drag->setMimeData(mimeData); - drag->setPixmap(createDragPixmap()); - - drag->exec(); - } -} - -QPixmap ToolBarColorBox::createDragPixmap(int size) const -{ - QPixmap pix(size, size); - QPainter p(&pix); - - QColor borderColor1 = QColor(143, 143 ,143); - QColor borderColor2 = QColor(43, 43, 43); - - p.setBrush(QBrush(m_color)); - p.setPen(QPen(QBrush(borderColor2),1)); - - p.fillRect(0, 0, size, size, borderColor1); - p.drawRect(1,1, size - 3, size - 3); - return pix; -} - -void ToolBarColorBox::contextMenuEvent(QContextMenuEvent *ev) -{ - QMenu contextMenu; - contextMenu.addAction(m_copyHexColor); - contextMenu.exec(ev->globalPos()); -} - -void ToolBarColorBox::copyColorToClipboard() -{ - QClipboard *clipboard = QApplication::clipboard(); - clipboard->setText(m_color.name()); -} - -} // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.h b/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.h deleted file mode 100644 index bc39fb4a..00000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 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 TOOLBARCOLORBOX_H -#define TOOLBARCOLORBOX_H - -#include -#include -#include - -QT_FORWARD_DECLARE_CLASS(QContextMenuEvent) -QT_FORWARD_DECLARE_CLASS(QAction) - -namespace QmlJSDebugger { - -class ToolBarColorBox : public QLabel -{ - Q_OBJECT - -public: - explicit ToolBarColorBox(QWidget *parent = 0); - void setColor(const QColor &color); - -protected: - void contextMenuEvent(QContextMenuEvent *ev); - void mousePressEvent(QMouseEvent *ev); - void mouseMoveEvent(QMouseEvent *ev); -private slots: - void copyColorToClipboard(); - -private: - QPixmap createDragPixmap(int size = 24) const; - -private: - bool m_dragStarted; - QPoint m_dragBeginPoint; - QAction *m_copyHexColor; - QColor m_color; -}; - -} // namespace QmlJSDebugger - -#endif // TOOLBARCOLORBOX_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.cpp index 3e41b3be..69d1f489 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.cpp @@ -41,18 +41,19 @@ #include "zoomtool.h" -#include "../qdeclarativeviewinspector_p.h" +#include "qdeclarativeviewinspector_p.h" #include #include #include -#include -#include +#include +#include #include #include namespace QmlJSDebugger { +namespace QtQuick1 { ZoomTool::ZoomTool(QDeclarativeViewInspector *view) : AbstractLiveEditTool(view), @@ -151,7 +152,7 @@ void ZoomTool::mouseReleaseEvent(QMouseEvent *event) view()->setSceneRect(sceneArea); } else { Qt::KeyboardModifier modifierKey = Qt::ControlModifier; -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC modifierKey = Qt::AltModifier; #endif if (event->modifiers() & modifierKey) { @@ -244,9 +245,7 @@ void ZoomTool::keyReleaseEvent(QKeyEvent *event) void ZoomTool::clear() { -#ifndef QT_NO_CURSOR view()->setCursor(Qt::ArrowCursor); -#endif } void ZoomTool::scaleView(const QPointF ¢erPos) @@ -327,4 +326,5 @@ qreal ZoomTool::nextZoomScale(ZoomDirection direction) const return 1.0f; } +} // namespace QtQuick1 } // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.h b/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.h index d5c40553..76bf1892 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.h +++ b/src/plugins/qmltooling/qmldbg_inspector/editor/zoomtool.h @@ -48,6 +48,7 @@ QT_FORWARD_DECLARE_CLASS(QAction) namespace QmlJSDebugger { +namespace QtQuick1 { class ZoomTool : public AbstractLiveEditTool { @@ -102,6 +103,7 @@ private: qreal m_currentScale; }; +} // namespace QtQuick1 } // namespace QmlJSDebugger #endif // ZOOMTOOL_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp deleted file mode 100644 index 1b74caf7..00000000 --- a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 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$ -** -****************************************************************************/ - -#include "qdeclarativeinspectorplugin.h" - -#include "qdeclarativeviewinspector_p.h" - -#include -#include - -namespace QmlJSDebugger { - -QDeclarativeInspectorPlugin::QDeclarativeInspectorPlugin() : - m_inspector(0) -{ -} - -QDeclarativeInspectorPlugin::~QDeclarativeInspectorPlugin() -{ - delete m_inspector; -} - -void QDeclarativeInspectorPlugin::activate() -{ - QDeclarativeInspectorService *service = QDeclarativeInspectorService::instance(); - QList views = service->views(); - if (views.isEmpty()) - return; - - // TODO: Support multiple views - QDeclarativeView *view = service->views().at(0); - m_inspector = new QDeclarativeViewInspector(view, view); -} - -void QDeclarativeInspectorPlugin::deactivate() -{ - delete m_inspector; -} - -} // namespace QmlJSDebugger - -Q_EXPORT_PLUGIN2(declarativeinspector, QmlJSDebugger::QDeclarativeInspectorPlugin) diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h deleted file mode 100644 index a910edcb..00000000 --- a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 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 QDECLARATIVEINSPECTORPLUGIN_H -#define QDECLARATIVEINSPECTORPLUGIN_H - -#include -#include - -namespace QmlJSDebugger { - -class AbstractViewInspector; - -class QDeclarativeInspectorPlugin : public QObject, public QDeclarativeInspectorInterface -{ - Q_OBJECT - Q_DISABLE_COPY(QDeclarativeInspectorPlugin) - Q_INTERFACES(QDeclarativeInspectorInterface) - -public: - QDeclarativeInspectorPlugin(); - ~QDeclarativeInspectorPlugin(); - - void activate(); - void deactivate(); - -private: - QPointer m_inspector; -}; - -} // namespace QmlJSDebugger - -#endif // QDECLARATIVEINSPECTORPLUGIN_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.cpp index d8696c5f..0293b727 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.cpp @@ -48,12 +48,11 @@ #include "editor/livelayeritem.h" #include "editor/boundingrecthighlighter.h" -#include -#include +#include #include -#include namespace QmlJSDebugger { +namespace QtQuick1 { QDeclarativeViewInspectorPrivate::QDeclarativeViewInspectorPrivate(QDeclarativeViewInspector *q) : q(q) @@ -138,6 +137,17 @@ void QDeclarativeViewInspector::changeTool(InspectorProtocol::Tool tool) } } +Qt::WindowFlags QDeclarativeViewInspector::windowFlags() const +{ + return declarativeView()->window()->windowFlags(); +} + +void QDeclarativeViewInspector::setWindowFlags(Qt::WindowFlags flags) +{ + declarativeView()->window()->setWindowFlags(flags); + declarativeView()->window()->show(); +} + AbstractLiveEditTool *QDeclarativeViewInspector::currentTool() const { return static_cast(AbstractViewInspector::currentTool()); @@ -433,4 +443,5 @@ QRectF QDeclarativeViewInspector::adjustToScreenBoundaries(const QRectF &boundin return boundingRect; } +} // namespace QtQuick1 } // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.h b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.h index 5fbf6c6a..398ae889 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.h +++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector.h @@ -44,13 +44,13 @@ #include -#include "qmlinspectorconstants.h" #include "abstractviewinspector.h" #include -#include +#include namespace QmlJSDebugger { +namespace QtQuick1 { class AbstractLiveEditTool; class QDeclarativeViewInspectorPrivate; @@ -68,7 +68,8 @@ public: void reloadView(); void reparentQmlObject(QObject *object, QObject *newParent); void changeTool(InspectorProtocol::Tool tool); - QWidget *viewWidget() const { return declarativeView(); } + Qt::WindowFlags windowFlags() const; + void setWindowFlags(Qt::WindowFlags flags); QDeclarativeEngine *declarativeEngine() const; void setSelectedItems(QList items); @@ -95,6 +96,7 @@ private: friend class AbstractLiveEditTool; }; +} // namespace QtQuick1 } // namespace QmlJSDebugger #endif // QDECLARATIVEVIEWINSPECTOR_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p.h b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p.h index 7093e4fc..48c09aa8 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p.h +++ b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeviewinspector_p.h @@ -44,12 +44,15 @@ #include "qdeclarativeviewinspector.h" +#include +#include #include #include -#include "QtDeclarative/private/qdeclarativeinspectorservice_p.h" +#include namespace QmlJSDebugger { +namespace QtQuick1 { class QDeclarativeViewInspector; class LiveSelectionTool; @@ -112,6 +115,7 @@ public: static QDeclarativeViewInspectorPrivate *get(QDeclarativeViewInspector *v) { return v->d_func(); } }; +} // namespace QtQuick1 } // namespace QmlJSDebugger #endif // QDECLARATIVEVIEWINSPECTOR_P_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro b/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro index e441a781..629cade1 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro +++ b/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro @@ -1,14 +1,14 @@ TARGET = qmldbg_inspector -QT += declarative +QT += quick1 quick1-private gui widgets core-private include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/qmltooling -QTDIR_build:REQUIRES += "contains(QT_CONFIG, declarative)" +QTDIR_build:REQUIRES += "contains(QT_CONFIG, quick1)" SOURCES += \ + qtquick1plugin.cpp \ abstractviewinspector.cpp \ - qdeclarativeinspectorplugin.cpp \ qdeclarativeviewinspector.cpp \ editor/abstractliveedittool.cpp \ editor/liveselectiontool.cpp \ @@ -24,8 +24,8 @@ SOURCES += \ abstracttool.cpp HEADERS += \ + qtquick1plugin.h \ abstractviewinspector.h \ - qdeclarativeinspectorplugin.h \ qdeclarativeinspectorprotocol.h \ qdeclarativeviewinspector.h \ qdeclarativeviewinspector_p.h \ diff --git a/src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants.h b/src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants.h index 7377bc65..93c12ea8 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants.h +++ b/src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants.h @@ -42,7 +42,7 @@ #ifndef QMLINSPECTORCONSTANTS_H #define QMLINSPECTORCONSTANTS_H -#include +#include namespace QmlJSDebugger { namespace Constants { diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1plugin.cpp b/src/plugins/qmltooling/qmldbg_inspector/qtquick1plugin.cpp new file mode 100644 index 00000000..2008338a --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/qtquick1plugin.cpp @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2012 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$ +** +****************************************************************************/ + +#include "qtquick1plugin.h" +#include "qdeclarativeviewinspector.h" + +#include +#include +#include + +namespace QmlJSDebugger { +namespace QtQuick1 { + +QtQuick1Plugin::QtQuick1Plugin() : + m_inspector(0) +{ +} + +QtQuick1Plugin::~QtQuick1Plugin() +{ + delete m_inspector; +} + +bool QtQuick1Plugin::canHandleView(QObject *view) +{ + return qobject_cast(view); +} + +void QtQuick1Plugin::activate() +{ + QDeclarativeInspectorService *service = QDeclarativeInspectorService::instance(); + QList views = service->views(); + if (views.isEmpty()) + return; + + // TODO: Support multiple views + QDeclarativeView *view = service->views().at(0); + m_inspector = new QDeclarativeViewInspector(view, view); +} + +void QtQuick1Plugin::deactivate() +{ + delete m_inspector; +} + +void QtQuick1Plugin::clientMessage(const QByteArray &message) +{ + if (m_inspector) + m_inspector->handleMessage(message); +} + +} // namespace QtQuick1 +} // namespace QmlJSDebugger + +Q_EXPORT_PLUGIN2(qmldbg_qtquick1, QmlJSDebugger::QtQuick1::QtQuick1Plugin) diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1plugin.h b/src/plugins/qmltooling/qmldbg_inspector/qtquick1plugin.h new file mode 100644 index 00000000..902306b2 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_inspector/qtquick1plugin.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2012 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 QDECLARATIVEINSPECTORPLUGIN_H +#define QDECLARATIVEINSPECTORPLUGIN_H + +#include +#include + +namespace QmlJSDebugger { + +class AbstractViewInspector; + +namespace QtQuick1 { + +class QtQuick1Plugin : public QObject, public QDeclarativeInspectorInterface +{ + Q_OBJECT + Q_DISABLE_COPY(QtQuick1Plugin) + Q_INTERFACES(QDeclarativeInspectorInterface) + +public: + QtQuick1Plugin(); + ~QtQuick1Plugin(); + + // QDeclarativeInspectorInterface + bool canHandleView(QObject *view); + void activate(); + void deactivate(); + void clientMessage(const QByteArray &message); + +private: + QPointer m_inspector; +}; + +} // namespace QtQuick1 +} // namespace QmlJSDebugger + +#endif // QDECLARATIVEINSPECTORPLUGIN_H diff --git a/src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro b/src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro deleted file mode 100644 index 27488894..00000000 --- a/src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro +++ /dev/null @@ -1,21 +0,0 @@ -TARGET = qmldbg_ost -QT += declarative network - -include(../../qpluginbase.pri) - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/qmltooling -QTDIR_build:REQUIRES += "contains(QT_CONFIG, declarative)" - -SOURCES += \ - qmlostplugin.cpp \ - qostdevice.cpp - -HEADERS += \ - qmlostplugin.h \ - qostdevice.h \ - usbostcomm.h - -target.path += $$[QT_INSTALL_PLUGINS]/qmltooling -INSTALLS += target - -symbian:TARGET.UID3=0x20031E92 diff --git a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp deleted file mode 100644 index d999de43..00000000 --- a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 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$ -** -****************************************************************************/ - -#include "qmlostplugin.h" -#include "qostdevice.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -static const TInt KQmlOstProtocolId = 0x94; - -class QmlOstPluginPrivate { -public: - QmlOstPluginPrivate(); - - QOstDevice *ost; - QPacketProtocol *protocol; - QDeclarativeDebugServer *debugServer; -}; - -QmlOstPluginPrivate::QmlOstPluginPrivate() : - ost(0), - protocol(0), - debugServer(0) -{ -} - -QmlOstPlugin::QmlOstPlugin() : - d_ptr(new QmlOstPluginPrivate) -{ -} - -QmlOstPlugin::~QmlOstPlugin() -{ - delete d_ptr; -} - -void QmlOstPlugin::setServer(QDeclarativeDebugServer *server) -{ - Q_D(QmlOstPlugin); - d->debugServer = server; -} - -bool QmlOstPlugin::isConnected() const -{ - Q_D(const QmlOstPlugin); - return d->ost && d->ost->isOpen(); -} - -void QmlOstPlugin::send(const QByteArray &message) -{ - Q_D(QmlOstPlugin); - - if (!isConnected()) - return; - - QPacket pack; - pack.writeRawData(message.data(), message.length()); - - d->protocol->send(pack); - //d->socket->flush(); -} - -void QmlOstPlugin::disconnect() -{ - Q_D(QmlOstPlugin); - - delete d->protocol; - d->protocol = 0; -} - -bool QmlOstPlugin::waitForMessage() -{ - Q_D(QmlOstPlugin); - return d->protocol->waitForReadyRead(-1); -} - -void QmlOstPlugin::setPort(int port, bool block) -{ - Q_UNUSED(port); - Q_UNUSED(block); - - Q_D(QmlOstPlugin); - - d->ost = new QOstDevice(this); - bool ok = d->ost->open(KQmlOstProtocolId); - if (!ok) { - if (d->ost->errorString().length()) - qDebug("Error from QOstDevice: %s", qPrintable(d->ost->errorString())); - qWarning("QDeclarativeDebugServer: Unable to listen on OST"); // This message is part of the signalling - do not change the format! - return; - } - d->protocol = new QPacketProtocol(d->ost, this); - QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); - qWarning("QDeclarativeDebugServer: Waiting for connection via OST"); // This message is part of the signalling - do not change the format! -} - -void QmlOstPlugin::readyRead() -{ - Q_D(QmlOstPlugin); - QPacket packet = d->protocol->read(); - - QByteArray content = packet.data(); - d->debugServer->receiveMessage(content); -} - -Q_EXPORT_PLUGIN2(qmlostplugin, QmlOstPlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h deleted file mode 100644 index dc32e2e7..00000000 --- a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 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 QMLOSTPLUGIN_H -#define QMLOSTPLUGIN_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class QDeclarativeDebugServer; -class QmlOstPluginPrivate; - -class QmlOstPlugin : public QObject, public QDeclarativeDebugServerConnection -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlOstPlugin) - Q_DISABLE_COPY(QmlOstPlugin) - Q_INTERFACES(QDeclarativeDebugServerConnection) - - -public: - QmlOstPlugin(); - ~QmlOstPlugin(); - - void setServer(QDeclarativeDebugServer *server); - void setPort(int port, bool bock); - - bool isConnected() const; - void send(const QByteArray &message); - void disconnect(); - bool waitForMessage(); - -private Q_SLOTS: - void readyRead(); - -private: - QmlOstPluginPrivate *d_ptr; -}; - -QT_END_NAMESPACE - -#endif // QMLOSTPLUGIN_H diff --git a/src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp b/src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp deleted file mode 100644 index 31030585..00000000 --- a/src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 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$ -** -****************************************************************************/ - -#include "qostdevice.h" -#include - -#include "usbostcomm.h" - -class QOstDevicePrivate : public CActive -{ - QOstDevice* q_ptr; - Q_DECLARE_PUBLIC(QOstDevice) - -public: - QOstDevicePrivate() : CActive(CActive::EPriorityStandard) { - CActiveScheduler::Add(this); - } - ~QOstDevicePrivate() { - Cancel(); - } - - TInt& AoFlags() { return ((TInt*)&iStatus)[1]; } - -private: - void RunL(); - void DoCancel(); - -private: - RUsbOstComm ost; - TBuf8<4096> readBuf; - QByteArray dataBuf; - TBool inReadyRead; -}; - -QOstDevice::QOstDevice(QObject *parent) : - QIODevice(parent), d_ptr(new QOstDevicePrivate) -{ - d_ptr->q_ptr = this; -} - -QOstDevice::~QOstDevice() -{ - close(); - delete d_ptr; -} - -bool QOstDevice::open(int ostProtocolId) -{ - if (isOpen()) - return false; - - Q_D(QOstDevice); - TInt err = d->ost.Connect(); - if (!err) err = d->ost.Open(); - const TVersion KRequiredVersion(1,1,0); - TVersion version = d->ost.Version(); - if (version.iMajor < KRequiredVersion.iMajor || - (version.iMajor == KRequiredVersion.iMajor && version.iMinor < KRequiredVersion.iMinor)) { - setErrorString("CODA version too old. At least version 4.0.18 (without TRK) is required."); - return false; - } - - if (!err) err = d->ost.RegisterProtocolID((TOstProtIds)ostProtocolId, EFalse); - if (!err) { - d->ost.ReadMessage(d->iStatus, d->readBuf); - d->SetActive(); - return QIODevice::open(ReadWrite | Unbuffered); - } - return false; -} - -void QOstDevicePrivate::RunL() -{ - Q_Q(QOstDevice); - //qDebug("QOstDevice received %d bytes q=%x", readBuf.Size(), q); - if (iStatus == KErrNone) { - QByteArray data = QByteArray::fromRawData((const char*)readBuf.Ptr(), readBuf.Size()); - dataBuf.append(data); - - readBuf.Zero(); - ost.ReadMessage(iStatus, readBuf); - SetActive(); - - if (!inReadyRead) { - inReadyRead = true; - emit q->readyRead(); - inReadyRead = false; - } - } else { - q->setErrorString(QString("Error %1 from RUsbOstComm::ReadMessage()").arg(iStatus.Int())); - } - //qDebug("-QOstDevicePrivate RunL"); -} - -void QOstDevicePrivate::DoCancel() -{ - ost.ReadCancel(); -} - -void QOstDevice::close() -{ - Q_D(QOstDevice); - QIODevice::close(); - d->Cancel(); - // RDbgTrcComm::Close isn't safe to call when not open, sigh - if (d->ost.Handle()) { - d->ost.Close(); - } -} - -qint64 QOstDevice::readData(char *data, qint64 maxSize) -{ - Q_D(QOstDevice); - if (d->dataBuf.length() == 0 && !d->IsActive()) - return -1; - qint64 available = qMin(maxSize, (qint64)d->dataBuf.length()); - memcpy(data, d->dataBuf.constData(), available); - d->dataBuf.remove(0, available); - return available; -} - -static const TInt KMaxOstPacketLen = 4096; - -qint64 QOstDevice::writeData(const char *data, qint64 maxSize) -{ - Q_D(QOstDevice); - TPtrC8 ptr((const TUint8*)data, (TInt)maxSize); - while (ptr.Length()) { - TPtrC8 fragment = ptr.Left(qMin(ptr.Length(), KMaxOstPacketLen)); - //qDebug("QOstDevice writing %d bytes", fragment.Length()); - TRequestStatus stat; - d->ost.WriteMessage(stat, fragment); - User::WaitForRequest(stat); - if (stat.Int() != KErrNone) { - setErrorString(QString("Error %1 from RUsbOstComm::WriteMessage()").arg(stat.Int())); - return -1; - } - ptr.Set(ptr.Mid(fragment.Length())); - } - emit bytesWritten(maxSize); //TODO does it matter this is emitted synchronously? - //qDebug("QOstDevice wrote %d bytes", ptr.Size()); - return maxSize; -} - -qint64 QOstDevice::bytesAvailable() const -{ - Q_D(const QOstDevice); - return d->dataBuf.length(); -} - -bool QOstDevice::waitForReadyRead(int msecs) -{ - Q_D(QOstDevice); - if (msecs >= 0) { - RTimer timer; - TInt err = timer.CreateLocal(); - if (err) return false; - TRequestStatus timeoutStat; - timer.After(timeoutStat, msecs*1000); - User::WaitForRequest(timeoutStat, d->iStatus); - if (timeoutStat != KRequestPending) { - // Timed out - timer.Close(); - return false; - } else { - // We got data, so cancel timer - timer.Cancel(); - User::WaitForRequest(timeoutStat); - timer.Close(); - // And drop through - } - } else { - // Just wait forever for data - User::WaitForRequest(d->iStatus); - } - - // If we get here we have data - TInt err = d->iStatus.Int(); - d->AoFlags() &= ~3; // This is necessary to clean up the scheduler as you're not supposed to bypass it like this - TRAP_IGNORE(d->RunL()); - return err == KErrNone; -} diff --git a/src/plugins/qmltooling/qmldbg_ost/qostdevice.h b/src/plugins/qmltooling/qmldbg_ost/qostdevice.h deleted file mode 100644 index 0601bc3b..00000000 --- a/src/plugins/qmltooling/qmldbg_ost/qostdevice.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 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 QOSTDEVICE_H -#define QOSTDEVICE_H - -#include - -QT_BEGIN_NAMESPACE - -class QOstDevicePrivate; - -class QOstDevice : public QIODevice -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QOstDevice) - Q_DISABLE_COPY(QOstDevice) - -public: - explicit QOstDevice(QObject *parent=0); - ~QOstDevice(); - - bool open(int ostProtocolId); - void close(); - - bool waitForReadyRead(int msecs); - qint64 bytesAvailable() const; - -protected: - qint64 readData(char *data, qint64 maxSize); - qint64 writeData(const char *data, qint64 maxSize); - -private: - QOstDevicePrivate* d_ptr; -}; - -QT_END_NAMESPACE - -#endif // QOSTDEVICE_H diff --git a/src/plugins/qmltooling/qmldbg_ost/usbostcomm.h b/src/plugins/qmltooling/qmldbg_ost/usbostcomm.h deleted file mode 100644 index 552543bf..00000000 --- a/src/plugins/qmltooling/qmldbg_ost/usbostcomm.h +++ /dev/null @@ -1,191 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 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 USBHOSTCOMM_H -#define USBHOSTCOMM_H - -// Based on the official usbostrouter header, modified to remove dependancy on -// the client DLL - -#include - -typedef int TOstProtIds; - -class RUsbOstComm : public RSessionBase -{ -public: - RUsbOstComm(); - TInt Connect(); - TInt Disconnect(); - TInt Open(); - TInt Close(); - TInt RegisterProtocolID(TOstProtIds aId, TBool aNeedHeader); - void ReadMessage(TRequestStatus& aStatus, TDes8& aDes); - TInt ReadCancel(); - void WriteMessage(TRequestStatus& aStatus, const TDesC8& aDes, TBool aHasHeader=EFalse); - TVersion Version() const; - -private: - enum TUsbOstCmdCode - { - EUsbOstCmdCodeFirst, - EUsbOstCmdConnect, - EUsbOstCmdDisconnect, - EUsbOstCmdCodeGetAcmConfig, - EUsbOstCmdCodeSetAcmConfig, - EUsbOstCmdCodeOpen, - EUsbOstCmdCodeClose, - EUsbOstCmdCodeRegisterId, - EUsbOstCmdCodeRegisterIds, - EUsbOstCmdCodeUnRegisterId, - EUsbOstCmdCodeUnRegisterIds, - EUsbOstCmdCodeReadMsg, - EUsbOstCmdCodeReadCancel, - EUsbOstCmdCodeWriteMsg, - EUsbOstCmdCodeWriteCancel, - EUsbOstCmdCodeLast - }; -}; - -RUsbOstComm::RUsbOstComm() -{ -} - -TInt RUsbOstComm::Connect() -{ - _LIT(KUsbOstServerName, "!UsbOstRouter"); - _LIT(KUsbOstServerImageName, "usbostrouter"); - const TUid KUsbOstServerUid = { 0x200170BE }; - TInt startupAttempts = 2; - for(;;) { - TInt ret = CreateSession(KUsbOstServerName, TVersion(1,0,0)); - if (ret != KErrNotFound && ret != KErrServerTerminated) { - return ret; - } - - if (startupAttempts-- == 0) { - return ret; - } - - RProcess server; - ret = server.Create(KUsbOstServerImageName, KNullDesC, KUsbOstServerUid); - if (ret != KErrNone) - return ret; - - TRequestStatus serverDiedRequestStatus; - server.Rendezvous(serverDiedRequestStatus); - - if (serverDiedRequestStatus != KRequestPending) { - // Abort startup - server.Kill(KErrNone); - } else { - // Logon OK - start the server - server.Resume(); - } - User::WaitForRequest(serverDiedRequestStatus); - ret = (server.ExitType() == EExitPanic) ? KErrGeneral : serverDiedRequestStatus.Int(); - server.Close(); - - if (ret != KErrNone && ret != KErrAlreadyExists) { - return ret; - } - } -} - -TInt RUsbOstComm::Disconnect() -{ - return SendReceive(EUsbOstCmdDisconnect); -} - -TInt RUsbOstComm::Open() -{ - return SendReceive(EUsbOstCmdCodeOpen); -} - -TInt RUsbOstComm::Close() -{ - TInt err = SendReceive(EUsbOstCmdCodeClose); - RHandleBase::Close(); - return err; -} - -TInt RUsbOstComm::RegisterProtocolID(const TOstProtIds aId, TBool aNeedHeader) -{ - TIpcArgs args(aId, aNeedHeader); - return SendReceive(EUsbOstCmdCodeRegisterId, args); -} - -void RUsbOstComm::ReadMessage(TRequestStatus& aStatus, TDes8& aDes) -{ - TIpcArgs args(aDes.MaxLength(), &aDes); - SendReceive(EUsbOstCmdCodeReadMsg, args, aStatus); -} - -TInt RUsbOstComm::ReadCancel() -{ - return SendReceive(EUsbOstCmdCodeReadCancel); -} - -void RUsbOstComm::WriteMessage(TRequestStatus& aStatus, const TDesC8& aDes, TBool aHasHeader) -{ - TIpcArgs args(aHasHeader, aDes.Length(), &aDes); - SendReceive(EUsbOstCmdCodeWriteMsg, args, aStatus); -} - -typedef TVersion (*TVersionFunction)(const RUsbOstComm*); -const TInt KVersionOrdinal = 17; - -TVersion RUsbOstComm::Version() const -{ - // This function has to go to the DLL, unfortunately - TVersion result; // Return 0.0.0 on any error - RLibrary lib; - TInt err = lib.Load(_L("usbostcomm")); - if (err) return result; - - TLibraryFunction fn = lib.Lookup(KVersionOrdinal); - if (fn) - result = ((TVersionFunction)fn)(this); - lib.Close(); - return result; -} - -#endif //USBHOSTCOMM_H diff --git a/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro b/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro deleted file mode 100644 index e8ab962d..00000000 --- a/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro +++ /dev/null @@ -1,18 +0,0 @@ -TARGET = qmldbg_tcp -QT += declarative network - -include(../../qpluginbase.pri) - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/qmltooling -QTDIR_build:REQUIRES += "contains(QT_CONFIG, declarative)" - -SOURCES += \ - qtcpserverconnection.cpp - -HEADERS += \ - qtcpserverconnection.h - -target.path += $$[QT_INSTALL_PLUGINS]/qmltooling -INSTALLS += target - -symbian:TARGET.UID3=0x20031E90 diff --git a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp deleted file mode 100644 index 01aa97a3..00000000 --- a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp +++ /dev/null @@ -1,198 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 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$ -** -****************************************************************************/ - -#include "qtcpserverconnection.h" - -#include -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -class QTcpServerConnectionPrivate { -public: - QTcpServerConnectionPrivate(); - - int port; - bool block; - QTcpSocket *socket; - QPacketProtocol *protocol; - QTcpServer *tcpServer; - - QDeclarativeDebugServer *debugServer; -}; - -QTcpServerConnectionPrivate::QTcpServerConnectionPrivate() : - port(0), - block(false), - socket(0), - protocol(0), - tcpServer(0), - debugServer(0) -{ -} - -QTcpServerConnection::QTcpServerConnection() : - d_ptr(new QTcpServerConnectionPrivate) -{ - -} - -QTcpServerConnection::~QTcpServerConnection() -{ - delete d_ptr; -} - -void QTcpServerConnection::setServer(QDeclarativeDebugServer *server) -{ - Q_D(QTcpServerConnection); - d->debugServer = server; -} - -bool QTcpServerConnection::isConnected() const -{ - Q_D(const QTcpServerConnection); - return d->socket && d->socket->state() == QTcpSocket::ConnectedState; -} - -void QTcpServerConnection::send(const QByteArray &message) -{ - Q_D(QTcpServerConnection); - - if (!isConnected() - || !d->protocol || !d->socket) - return; - - QPacket pack; - pack.writeRawData(message.data(), message.length()); - - d->protocol->send(pack); - d->socket->flush(); -} - -void QTcpServerConnection::disconnect() -{ - Q_D(QTcpServerConnection); - - // protocol might still be processing packages at this point - d->protocol->deleteLater(); - d->protocol = 0; - d->socket->deleteLater(); - d->socket = 0; -} - -bool QTcpServerConnection::waitForMessage() -{ - Q_D(QTcpServerConnection); - if (d->protocol->packetsAvailable() > 0) { - QPacket packet = d->protocol->read(); - d->debugServer->receiveMessage(packet.data()); - return true; - } else { - return d->protocol->waitForReadyRead(-1); - } -} - -void QTcpServerConnection::setPort(int port, bool block) -{ - Q_D(QTcpServerConnection); - d->port = port; - d->block = block; - - listen(); - if (block) - d->tcpServer->waitForNewConnection(-1); -} - -void QTcpServerConnection::listen() -{ - Q_D(QTcpServerConnection); - - d->tcpServer = new QTcpServer(this); - QObject::connect(d->tcpServer, SIGNAL(newConnection()), this, SLOT(newConnection())); - if (d->tcpServer->listen(QHostAddress::Any, d->port)) { - qDebug("QDeclarativeDebugServer: Waiting for connection on port %d...", d->port); - } else { - qWarning("QDeclarativeDebugServer: Unable to listen on port %d", d->port); - } -} - - -void QTcpServerConnection::readyRead() -{ - Q_D(QTcpServerConnection); - if (!d->protocol) - return; - - while (d->protocol->packetsAvailable() > 0) { - QPacket packet = d->protocol->read(); - d->debugServer->receiveMessage(packet.data()); - } -} - -void QTcpServerConnection::newConnection() -{ - Q_D(QTcpServerConnection); - - if (d->socket) { - qWarning("QDeclarativeDebugServer: Another client is already connected"); - QTcpSocket *faultyConnection = d->tcpServer->nextPendingConnection(); - delete faultyConnection; - return; - } - - d->socket = d->tcpServer->nextPendingConnection(); - d->socket->setParent(this); - d->protocol = new QPacketProtocol(d->socket, this); - QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); - - if (d->block) { - d->protocol->waitForReadyRead(-1); - } -} - -Q_EXPORT_PLUGIN2(tcpserver, QTcpServerConnection) - -QT_END_NAMESPACE - diff --git a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h deleted file mode 100644 index d3b23336..00000000 --- a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 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 QTCPSERVERCONNECTION_H -#define QTCPSERVERCONNECTION_H - -#include - -QT_BEGIN_NAMESPACE - -class QDeclarativeDebugServer; -class QTcpServerConnectionPrivate; -class QTcpServerConnection : public QObject, public QDeclarativeDebugServerConnection -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QTcpServerConnection) - Q_DISABLE_COPY(QTcpServerConnection) - Q_INTERFACES(QDeclarativeDebugServerConnection) - - -public: - QTcpServerConnection(); - ~QTcpServerConnection(); - - void setServer(QDeclarativeDebugServer *server); - void setPort(int port, bool bock); - - bool isConnected() const; - void send(const QByteArray &message); - void disconnect(); - bool waitForMessage(); - - void listen(); - void waitForConnection(); - -private Q_SLOTS: - void readyRead(); - void newConnection(); - -private: - QTcpServerConnectionPrivate *d_ptr; -}; - -QT_END_NAMESPACE - -#endif // QTCPSERVERCONNECTION_H diff --git a/src/plugins/qmltooling/qmltooling.pro b/src/plugins/qmltooling/qmltooling.pro index 8220109e..6d76f8c7 100644 --- a/src/plugins/qmltooling/qmltooling.pro +++ b/src/plugins/qmltooling/qmltooling.pro @@ -1,4 +1,3 @@ TEMPLATE = subdirs -SUBDIRS = qmldbg_tcp qmldbg_inspector -symbian:SUBDIRS += qmldbg_ost +SUBDIRS = qmldbg_inspector diff --git a/src/plugins/qpluginbase.pri b/src/plugins/qpluginbase.pri index b2a7cf29..bcf473f1 100644 --- a/src/plugins/qpluginbase.pri +++ b/src/plugins/qpluginbase.pri @@ -33,7 +33,7 @@ symbian: { else: PARTIAL_UPGRADE_UID = 0xE001E61C pu_header = "; Partial upgrade package for testing $${TARGET} changes without reinstalling everything" \ - "$${LITERAL_HASH}{\"$${TARGET}\"}, ($$PARTIAL_UPGRADE_UID), $${QT_MAJOR_VERSION},$${QT_MINOR_VERSION},$${QT_PATCH_VERSION}, TYPE=PU,RU" + "$${LITERAL_HASH}{\"$${TARGET}\"}, ($$PARTIAL_UPGRADE_UID), $${QT_MAJOR_VERSION},$${QT_MINOR_VERSION},$${QT_PATCH_VERSION}, TYPE=PU" partial_upgrade.pkg_prerules = pu_header vendorinfo partial_upgrade.files = $$QMAKE_LIBDIR_QT/$${TARGET}.dll partial_upgrade.path = c:/sys/bin -- cgit v1.2.3