aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmltooling/qmldbg_inspector
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@nokia.com>2011-10-26 15:52:48 +0200
committerQt by Nokia <qt-info@nokia.com>2011-11-01 17:03:29 +0100
commit1695f0622b4673c49ccb6b127f1a7d9b24611d80 (patch)
tree011ef84395cc5440fc537ae9b21cb6891b55db45 /src/plugins/qmltooling/qmldbg_inspector
parent3c8ea4c9151045d95dd0b0df72f6f680ce57c1fc (diff)
Debugger: Split inspector plugin into a qtquick1 and a qtquick2 plugin
This allows the inspector to be used also when e.g. qtquick1 and widgets libraries are not available. Change-Id: Id8510ea2a1a9c2a776d67e6d7732a4e40363d5a3 Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_inspector')
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/abstracttool.cpp54
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/abstracttool.h85
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp507
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.h166
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp85
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h71
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorprotocol.h137
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro57
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants.h77
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/abstractliveedittool.cpp196
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/abstractliveedittool.h104
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/boundingrecthighlighter.cpp240
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/boundingrecthighlighter.h115
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/colorpickertool.cpp98
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/colorpickertool.h92
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/livelayeritem.cpp92
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/livelayeritem.h67
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/liverubberbandselectionmanipulator.cpp165
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/liverubberbandselectionmanipulator.h96
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectionindicator.cpp118
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectionindicator.h80
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectionrectangle.cpp113
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectionrectangle.h77
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectiontool.cpp423
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectiontool.h120
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/livesingleselectionmanipulator.cpp151
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/livesingleselectionmanipulator.h89
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/qdeclarativeviewinspector.cpp445
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/qdeclarativeviewinspector.h100
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/qdeclarativeviewinspector_p.h119
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/subcomponentmasklayeritem.cpp130
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/subcomponentmasklayeritem.h71
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/zoomtool.cpp328
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qtquick1/zoomtool.h107
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/sghighlight.cpp98
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/sghighlight.h97
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/sgselectiontool.cpp135
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/sgselectiontool.h91
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/sgviewinspector.cpp330
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/sgviewinspector.h110
40 files changed, 0 insertions, 5836 deletions
diff --git a/src/plugins/qmltooling/qmldbg_inspector/abstracttool.cpp b/src/plugins/qmltooling/qmldbg_inspector/abstracttool.cpp
deleted file mode 100644
index 39ced2a9d0..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/abstracttool.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "abstracttool.h"
-
-#include "abstractviewinspector.h"
-
-namespace QmlJSDebugger {
-
-AbstractTool::AbstractTool(AbstractViewInspector *inspector) :
- QObject(inspector),
- m_inspector(inspector)
-{
-}
-
-} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/abstracttool.h b/src/plugins/qmltooling/qmldbg_inspector/abstracttool.h
deleted file mode 100644
index 0a216bfa83..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/abstracttool.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ABSTRACTTOOL_H
-#define ABSTRACTTOOL_H
-
-#include <QtCore/QObject>
-
-QT_BEGIN_NAMESPACE
-class QMouseEvent;
-class QKeyEvent;
-class QWheelEvent;
-QT_END_NAMESPACE
-
-namespace QmlJSDebugger {
-
-class AbstractViewInspector;
-
-class AbstractTool : public QObject
-{
- Q_OBJECT
-
-public:
- explicit AbstractTool(AbstractViewInspector *inspector);
-
- AbstractViewInspector *inspector() const { return m_inspector; }
-
- virtual void leaveEvent(QEvent *event) = 0;
-
- virtual void mousePressEvent(QMouseEvent *event) = 0;
- virtual void mouseMoveEvent(QMouseEvent *event) = 0;
- virtual void mouseReleaseEvent(QMouseEvent *event) = 0;
- virtual void mouseDoubleClickEvent(QMouseEvent *event) = 0;
-
- virtual void hoverMoveEvent(QMouseEvent *event) = 0;
- virtual void wheelEvent(QWheelEvent *event) = 0;
-
- virtual void keyPressEvent(QKeyEvent *event) = 0;
- virtual void keyReleaseEvent(QKeyEvent *keyEvent) = 0;
-
-private:
- AbstractViewInspector *m_inspector;
-};
-
-} // namespace QmlJSDebugger
-
-#endif // ABSTRACTTOOL_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp
deleted file mode 100644
index 1cebbd4283..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp
+++ /dev/null
@@ -1,507 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "abstractviewinspector.h"
-
-#include "abstracttool.h"
-#include "qdeclarativeinspectorprotocol.h"
-
-#include <QtDeclarative/QDeclarativeEngine>
-#include <QtDeclarative/QDeclarativeComponent>
-#include <QtCore/private/qabstractanimation_p.h>
-#include <QtDeclarative/private/qdeclarativeinspectorservice_p.h>
-
-#include <QtGui/QMouseEvent>
-
-namespace QmlJSDebugger {
-
-
-AbstractViewInspector::AbstractViewInspector(QObject *parent) :
- QObject(parent),
- m_currentTool(0),
- m_showAppOnTop(false),
- m_designModeBehavior(false),
- m_animationPaused(false),
- m_slowDownFactor(1.0),
- m_debugService(0)
-{
- m_debugService = QDeclarativeInspectorService::instance();
- connect(m_debugService, SIGNAL(gotMessage(QByteArray)),
- this, SLOT(handleMessage(QByteArray)));
-}
-
-void AbstractViewInspector::createQmlObject(const QString &qml, QObject *parent,
- const QStringList &importList,
- const QString &filename)
-{
- if (!parent)
- return;
-
- QString imports;
- foreach (const QString &s, importList) {
- imports += s;
- imports += QLatin1Char('\n');
- }
-
- QDeclarativeContext *parentContext = declarativeEngine()->contextForObject(parent);
- QDeclarativeComponent component(declarativeEngine());
- QByteArray constructedQml = QString(imports + qml).toLatin1();
-
- component.setData(constructedQml, QUrl::fromLocalFile(filename));
- QObject *newObject = component.create(parentContext);
- if (newObject)
- reparentQmlObject(newObject, parent);
-}
-
-void AbstractViewInspector::clearComponentCache()
-{
- declarativeEngine()->clearComponentCache();
-}
-
-void AbstractViewInspector::setDesignModeBehavior(bool value)
-{
- if (m_designModeBehavior == value)
- return;
-
- m_designModeBehavior = value;
- emit designModeBehaviorChanged(value);
- sendDesignModeBehavior(value);
-}
-
-void AbstractViewInspector::setAnimationSpeed(qreal slowDownFactor)
-{
- Q_ASSERT(slowDownFactor > 0);
- if (m_slowDownFactor == slowDownFactor)
- return;
-
- animationSpeedChangeRequested(slowDownFactor);
- sendAnimationSpeed(slowDownFactor);
-}
-
-void AbstractViewInspector::setAnimationPaused(bool paused)
-{
- if (m_animationPaused == paused)
- return;
-
- animationPausedChangeRequested(paused);
- sendAnimationPaused(paused);
-}
-
-void AbstractViewInspector::animationSpeedChangeRequested(qreal factor)
-{
- if (m_slowDownFactor != factor) {
- m_slowDownFactor = factor;
- emit animationSpeedChanged(factor);
- }
-
- const float effectiveFactor = m_animationPaused ? 0 : factor;
- QUnifiedTimer::instance()->setSlowModeEnabled(effectiveFactor != 1.0);
- QUnifiedTimer::instance()->setSlowdownFactor(effectiveFactor);
-}
-
-void AbstractViewInspector::animationPausedChangeRequested(bool paused)
-{
- if (m_animationPaused != paused) {
- m_animationPaused = paused;
- emit animationPausedChanged(paused);
- }
-
- const float effectiveFactor = paused ? 0 : m_slowDownFactor;
- QUnifiedTimer::instance()->setSlowModeEnabled(effectiveFactor != 1.0);
- QUnifiedTimer::instance()->setSlowdownFactor(effectiveFactor);
-}
-
-void AbstractViewInspector::setShowAppOnTop(bool appOnTop)
-{
- Qt::WindowFlags flags = windowFlags();
- if (appOnTop)
- flags |= Qt::WindowStaysOnTopHint;
- else
- flags &= ~Qt::WindowStaysOnTopHint;
-
- setWindowFlags(flags);
-
- m_showAppOnTop = appOnTop;
- sendShowAppOnTop(appOnTop);
-
- emit showAppOnTopChanged(appOnTop);
-}
-
-void AbstractViewInspector::changeToColorPickerTool()
-{
- changeTool(InspectorProtocol::ColorPickerTool);
-}
-
-void AbstractViewInspector::changeToZoomTool()
-{
- changeTool(InspectorProtocol::ZoomTool);
-}
-
-void AbstractViewInspector::changeToSingleSelectTool()
-{
- changeTool(InspectorProtocol::SelectTool);
-}
-
-void AbstractViewInspector::changeToMarqueeSelectTool()
-{
- changeTool(InspectorProtocol::SelectMarqueeTool);
-}
-
-bool AbstractViewInspector::eventFilter(QObject *obj, QEvent *event)
-{
- if (!designModeBehavior())
- return QObject::eventFilter(obj, event);
-
- switch (event->type()) {
- case QEvent::Leave:
- if (leaveEvent(event))
- return true;
- break;
- case QEvent::MouseButtonPress:
- if (mousePressEvent(static_cast<QMouseEvent*>(event)))
- return true;
- break;
- case QEvent::MouseMove:
- if (mouseMoveEvent(static_cast<QMouseEvent*>(event)))
- return true;
- break;
- case QEvent::MouseButtonRelease:
- if (mouseReleaseEvent(static_cast<QMouseEvent*>(event)))
- return true;
- break;
- case QEvent::KeyPress:
- if (keyPressEvent(static_cast<QKeyEvent*>(event)))
- return true;
- break;
- case QEvent::KeyRelease:
- if (keyReleaseEvent(static_cast<QKeyEvent*>(event)))
- return true;
- break;
- case QEvent::MouseButtonDblClick:
- if (mouseDoubleClickEvent(static_cast<QMouseEvent*>(event)))
- return true;
- break;
- case QEvent::Wheel:
- if (wheelEvent(static_cast<QWheelEvent*>(event)))
- return true;
- break;
- default:
- break;
- }
-
- return QObject::eventFilter(obj, event);
-}
-
-bool AbstractViewInspector::leaveEvent(QEvent *event)
-{
- m_currentTool->leaveEvent(event);
- return true;
-}
-
-bool AbstractViewInspector::mousePressEvent(QMouseEvent *event)
-{
- m_currentTool->mousePressEvent(event);
- return true;
-}
-
-bool AbstractViewInspector::mouseMoveEvent(QMouseEvent *event)
-{
- if (event->buttons()) {
- m_currentTool->mouseMoveEvent(event);
- } else {
- m_currentTool->hoverMoveEvent(event);
- }
- return true;
-}
-
-bool AbstractViewInspector::mouseReleaseEvent(QMouseEvent *event)
-{
- m_currentTool->mouseReleaseEvent(event);
- return true;
-}
-
-bool AbstractViewInspector::keyPressEvent(QKeyEvent *event)
-{
- m_currentTool->keyPressEvent(event);
- return true;
-}
-
-bool AbstractViewInspector::keyReleaseEvent(QKeyEvent *event)
-{
- switch (event->key()) {
- case Qt::Key_V:
- changeTool(InspectorProtocol::SelectTool);
- break;
-// disabled because multiselection does not do anything useful without design mode
-// case Qt::Key_M:
-// changeTool(InspectorProtocol::SelectMarqueeTool);
-// break;
- case Qt::Key_I:
- changeTool(InspectorProtocol::ColorPickerTool);
- break;
- case Qt::Key_Z:
- changeTool(InspectorProtocol::ZoomTool);
- break;
- case Qt::Key_Space:
- setAnimationPaused(!animationPaused());
- break;
- default:
- break;
- }
-
- m_currentTool->keyReleaseEvent(event);
- return true;
-}
-
-bool AbstractViewInspector::mouseDoubleClickEvent(QMouseEvent *event)
-{
- m_currentTool->mouseDoubleClickEvent(event);
- return true;
-}
-
-bool AbstractViewInspector::wheelEvent(QWheelEvent *event)
-{
- m_currentTool->wheelEvent(event);
- return true;
-}
-
-void AbstractViewInspector::handleMessage(const QByteArray &message)
-{
- QDataStream ds(message);
-
- InspectorProtocol::Message type;
- ds >> type;
-
- switch (type) {
- case InspectorProtocol::SetCurrentObjects: {
- int itemCount = 0;
- ds >> itemCount;
-
- QList<QObject*> selectedObjects;
- for (int i = 0; i < itemCount; ++i) {
- int debugId = -1;
- ds >> debugId;
- if (QObject *obj = QDeclarativeDebugService::objectForId(debugId))
- selectedObjects << obj;
- }
-
- changeCurrentObjects(selectedObjects);
- break;
- }
- case InspectorProtocol::Reload: {
- reloadView();
- break;
- }
- case InspectorProtocol::SetAnimationSpeed: {
- qreal speed;
- ds >> speed;
- animationSpeedChangeRequested(speed);
- break;
- }
- case InspectorProtocol::SetAnimationPaused: {
- bool paused;
- ds >> paused;
- animationPausedChangeRequested(paused);
- break;
- }
- case InspectorProtocol::ChangeTool: {
- InspectorProtocol::Tool tool;
- ds >> tool;
- changeTool(tool);
- break;
- }
- case InspectorProtocol::SetDesignMode: {
- bool inDesignMode;
- ds >> inDesignMode;
- setDesignModeBehavior(inDesignMode);
- break;
- }
- case InspectorProtocol::ShowAppOnTop: {
- bool showOnTop;
- ds >> showOnTop;
- setShowAppOnTop(showOnTop);
- break;
- }
- case InspectorProtocol::CreateObject: {
- QString qml;
- int parentId;
- QString filename;
- QStringList imports;
- ds >> qml >> parentId >> imports >> filename;
- createQmlObject(qml, QDeclarativeDebugService::objectForId(parentId),
- imports, filename);
- break;
- }
- case InspectorProtocol::DestroyObject: {
- int debugId;
- ds >> debugId;
- if (QObject *obj = QDeclarativeDebugService::objectForId(debugId))
- obj->deleteLater();
- break;
- }
- case InspectorProtocol::MoveObject: {
- int debugId, newParent;
- ds >> debugId >> newParent;
- reparentQmlObject(QDeclarativeDebugService::objectForId(debugId),
- QDeclarativeDebugService::objectForId(newParent));
- break;
- }
- case InspectorProtocol::ObjectIdList: {
- int itemCount;
- ds >> itemCount;
- m_stringIdForObjectId.clear();
- for (int i = 0; i < itemCount; ++i) {
- int itemDebugId;
- QString itemIdString;
- ds >> itemDebugId
- >> itemIdString;
-
- m_stringIdForObjectId.insert(itemDebugId, itemIdString);
- }
- break;
- }
- case InspectorProtocol::ClearComponentCache: {
- clearComponentCache();
- break;
- }
- default:
- qWarning() << "Warning: Not handling message:" << type;
- }
-}
-
-void AbstractViewInspector::sendDesignModeBehavior(bool inDesignMode)
-{
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
-
- ds << InspectorProtocol::SetDesignMode
- << inDesignMode;
-
- m_debugService->sendMessage(message);
-}
-
-void AbstractViewInspector::sendCurrentObjects(const QList<QObject*> &objects)
-{
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
-
- ds << InspectorProtocol::CurrentObjectsChanged
- << objects.length();
-
- foreach (QObject *object, objects) {
- int id = QDeclarativeDebugService::idForObject(object);
- ds << id;
- }
-
- m_debugService->sendMessage(message);
-}
-
-void AbstractViewInspector::sendCurrentTool(Constants::DesignTool toolId)
-{
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
-
- ds << InspectorProtocol::ToolChanged
- << toolId;
-
- m_debugService->sendMessage(message);
-}
-
-void AbstractViewInspector::sendAnimationSpeed(qreal slowDownFactor)
-{
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
-
- ds << InspectorProtocol::AnimationSpeedChanged
- << slowDownFactor;
-
- m_debugService->sendMessage(message);
-}
-
-void AbstractViewInspector::sendAnimationPaused(bool paused)
-{
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
-
- ds << InspectorProtocol::AnimationPausedChanged
- << paused;
-
- m_debugService->sendMessage(message);
-}
-
-void AbstractViewInspector::sendReloaded()
-{
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
-
- ds << InspectorProtocol::Reloaded;
-
- m_debugService->sendMessage(message);
-}
-
-void AbstractViewInspector::sendShowAppOnTop(bool showAppOnTop)
-{
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
-
- ds << InspectorProtocol::ShowAppOnTop << showAppOnTop;
-
- m_debugService->sendMessage(message);
-}
-
-void AbstractViewInspector::sendColorChanged(const QColor &color)
-{
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
-
- ds << InspectorProtocol::ColorChanged
- << color;
-
- m_debugService->sendMessage(message);
-}
-
-QString AbstractViewInspector::idStringForObject(QObject *obj) const
-{
- const int id = QDeclarativeDebugService::idForObject(obj);
- return m_stringIdForObjectId.value(id);
-}
-
-} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.h b/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.h
deleted file mode 100644
index ee6eea5aee..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ABSTRACTVIEWINSPECTOR_H
-#define ABSTRACTVIEWINSPECTOR_H
-
-#include <QtCore/QHash>
-#include <QtCore/QObject>
-#include <QtCore/QStringList>
-#include <QtGui/QColor>
-
-#include "qdeclarativeinspectorprotocol.h"
-#include "qmlinspectorconstants.h"
-
-QT_BEGIN_NAMESPACE
-class QDeclarativeEngine;
-class QDeclarativeInspectorService;
-class QKeyEvent;
-class QMouseEvent;
-class QWheelEvent;
-QT_END_NAMESPACE
-
-namespace QmlJSDebugger {
-
-class AbstractTool;
-
-/*
- * The common code between QQuickView and QDeclarativeView inspectors lives here,
- */
-class AbstractViewInspector : public QObject
-{
- Q_OBJECT
-
-public:
- explicit AbstractViewInspector(QObject *parent = 0);
-
- void createQmlObject(const QString &qml, QObject *parent,
- const QStringList &importList,
- const QString &filename = QString());
- void clearComponentCache();
-
- bool showAppOnTop() const { return m_showAppOnTop; }
- bool designModeBehavior() const { return m_designModeBehavior; }
-
- bool animationPaused() const { return m_animationPaused; }
- qreal slowDownFactor() const { return m_slowDownFactor; }
-
- void sendCurrentObjects(const QList<QObject*> &);
- void sendAnimationSpeed(qreal slowDownFactor);
- void sendAnimationPaused(bool paused);
- void sendCurrentTool(Constants::DesignTool toolId);
- void sendReloaded();
- void sendShowAppOnTop(bool showAppOnTop);
-
- QString idStringForObject(QObject *obj) const;
-
- virtual void changeCurrentObjects(const QList<QObject*> &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);
- void showAppOnTopChanged(bool showAppOnTop);
- void reloadRequested();
- void marqueeSelectToolActivated();
- void selectToolActivated();
- void zoomToolActivated();
- void colorPickerActivated();
- void selectedColorChanged(const QColor &color);
-
- void animationSpeedChanged(qreal factor);
- 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 *);
- virtual bool mousePressEvent(QMouseEvent *event);
- virtual bool mouseMoveEvent(QMouseEvent *event);
- virtual bool mouseReleaseEvent(QMouseEvent *event);
- virtual bool keyPressEvent(QKeyEvent *event);
- virtual bool keyReleaseEvent(QKeyEvent *keyEvent);
- virtual bool mouseDoubleClickEvent(QMouseEvent *event);
- virtual bool wheelEvent(QWheelEvent *event);
-
-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);
-
- AbstractTool *m_currentTool;
-
- bool m_showAppOnTop;
- bool m_designModeBehavior;
-
- bool m_animationPaused;
- qreal m_slowDownFactor;
-
- QHash<int, QString> m_stringIdForObjectId;
- QDeclarativeInspectorService *m_debugService;
-};
-
-} // namespace QmlJSDebugger
-
-#endif // ABSTRACTVIEWINSPECTOR_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp
deleted file mode 100644
index f4eec5011d..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativeinspectorplugin.h"
-
-#include "qtquick1/qdeclarativeviewinspector_p.h"
-#include "sgviewinspector.h"
-
-#include <QtCore/qplugin.h>
-#include <QtDeclarative/private/qdeclarativeinspectorservice_p.h>
-#include <QtDeclarative/QQuickView>
-
-namespace QmlJSDebugger {
-
-QDeclarativeInspectorPlugin::QDeclarativeInspectorPlugin() :
- m_inspector(0)
-{
-}
-
-QDeclarativeInspectorPlugin::~QDeclarativeInspectorPlugin()
-{
- delete m_inspector;
-}
-
-void QDeclarativeInspectorPlugin::activate()
-{
- QDeclarativeInspectorService *service = QDeclarativeInspectorService::instance();
- QList<QObject*> views = service->views();
- if (views.isEmpty())
- return;
-
- // TODO: Support multiple views
- QObject *firstView = views.first();
- if (QDeclarativeView *declarativeView = qobject_cast<QDeclarativeView*>(firstView))
- m_inspector = new QDeclarativeViewInspector(declarativeView, declarativeView);
- else if (QQuickView *sgView = qobject_cast<QQuickView*>(firstView))
- m_inspector = new SGViewInspector(sgView, sgView);
-}
-
-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 542925366c..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorplugin.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVEINSPECTORPLUGIN_H
-#define QDECLARATIVEINSPECTORPLUGIN_H
-
-#include <QtCore/QPointer>
-#include <QtDeclarative/private/qdeclarativeinspectorinterface_p.h>
-
-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<AbstractViewInspector> m_inspector;
-};
-
-} // namespace QmlJSDebugger
-
-#endif // QDECLARATIVEINSPECTORPLUGIN_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorprotocol.h b/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorprotocol.h
deleted file mode 100644
index 082abeb9bd..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qdeclarativeinspectorprotocol.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVEINSPECTORPROTOCOL_H
-#define QDECLARATIVEINSPECTORPROTOCOL_H
-
-#include <QtCore/QDebug>
-#include <QtCore/QMetaType>
-#include <QtCore/QMetaEnum>
-#include <QtCore/QObject>
-
-namespace QmlJSDebugger {
-
-class InspectorProtocol : public QObject
-{
- Q_OBJECT
- Q_ENUMS(Message Tool)
-
-public:
- enum Message {
- AnimationSpeedChanged = 0,
- AnimationPausedChanged = 19, // highest value
- ChangeTool = 1,
- ClearComponentCache = 2,
- ColorChanged = 3,
- CreateObject = 5,
- CurrentObjectsChanged = 6,
- DestroyObject = 7,
- MoveObject = 8,
- ObjectIdList = 9,
- Reload = 10,
- Reloaded = 11,
- SetAnimationSpeed = 12,
- SetAnimationPaused = 18,
- SetCurrentObjects = 14,
- SetDesignMode = 15,
- ShowAppOnTop = 16,
- ToolChanged = 17
- };
-
- enum Tool {
- ColorPickerTool,
- SelectMarqueeTool,
- SelectTool,
- ZoomTool
- };
-
- static inline QString toString(Message message)
- {
- return QLatin1String(staticMetaObject.enumerator(0).valueToKey(message));
- }
-
- static inline QString toString(Tool tool)
- {
- return QLatin1String(staticMetaObject.enumerator(1).valueToKey(tool));
- }
-};
-
-inline QDataStream & operator<< (QDataStream &stream, InspectorProtocol::Message message)
-{
- return stream << static_cast<quint32>(message);
-}
-
-inline QDataStream & operator>> (QDataStream &stream, InspectorProtocol::Message &message)
-{
- quint32 i;
- stream >> i;
- message = static_cast<InspectorProtocol::Message>(i);
- return stream;
-}
-
-inline QDebug operator<< (QDebug dbg, InspectorProtocol::Message message)
-{
- dbg << InspectorProtocol::toString(message);
- return dbg;
-}
-
-inline QDataStream & operator<< (QDataStream &stream, InspectorProtocol::Tool tool)
-{
- return stream << static_cast<quint32>(tool);
-}
-
-inline QDataStream & operator>> (QDataStream &stream, InspectorProtocol::Tool &tool)
-{
- quint32 i;
- stream >> i;
- tool = static_cast<InspectorProtocol::Tool>(i);
- return stream;
-}
-
-inline QDebug operator<< (QDebug dbg, InspectorProtocol::Tool tool)
-{
- dbg << InspectorProtocol::toString(tool);
- return dbg;
-}
-
-} // namespace QmlJSDebugger
-
-#endif // QDECLARATIVEINSPECTORPROTOCOL_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro b/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro
deleted file mode 100644
index 0c870bbf2d..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro
+++ /dev/null
@@ -1,57 +0,0 @@
-load(qt_module)
-
-TARGET = qmldbg_inspector
-QT += declarative-private core-private gui-private opengl-private qtquick1 widgets widgets-private v8-private
-
-load(qt_plugin)
-
-DESTDIR = $$QT.declarative.plugins/qmltooling
-QTDIR_build:REQUIRES += "contains(QT_CONFIG, declarative)"
-
-INCLUDEPATH *= $$PWD
-
-SOURCES += \
- abstractviewinspector.cpp \
- qdeclarativeinspectorplugin.cpp \
- qtquick1/qdeclarativeviewinspector.cpp \
- qtquick1/abstractliveedittool.cpp \
- qtquick1/liveselectiontool.cpp \
- qtquick1/livelayeritem.cpp \
- qtquick1/livesingleselectionmanipulator.cpp \
- qtquick1/liverubberbandselectionmanipulator.cpp \
- qtquick1/liveselectionrectangle.cpp \
- qtquick1/liveselectionindicator.cpp \
- qtquick1/boundingrecthighlighter.cpp \
- qtquick1/subcomponentmasklayeritem.cpp \
- qtquick1/zoomtool.cpp \
- qtquick1/colorpickertool.cpp \
- abstracttool.cpp \
- sgviewinspector.cpp \
- sgselectiontool.cpp \
- sghighlight.cpp
-
-HEADERS += \
- abstractviewinspector.h \
- qdeclarativeinspectorplugin.h \
- qdeclarativeinspectorprotocol.h \
- qmlinspectorconstants.h \
- qtquick1/qdeclarativeviewinspector.h \
- qtquick1/qdeclarativeviewinspector_p.h \
- qtquick1/abstractliveedittool.h \
- qtquick1/liveselectiontool.h \
- qtquick1/livelayeritem.h \
- qtquick1/livesingleselectionmanipulator.h \
- qtquick1/liverubberbandselectionmanipulator.h \
- qtquick1/liveselectionrectangle.h \
- qtquick1/liveselectionindicator.h \
- qtquick1/boundingrecthighlighter.h \
- qtquick1/subcomponentmasklayeritem.h \
- qtquick1/zoomtool.h \
- qtquick1/colorpickertool.h \
- abstracttool.h \
- sgviewinspector.h \
- sgselectiontool.h \
- sghighlight.h
-
-target.path += $$[QT_INSTALL_PLUGINS]/qmltooling
-INSTALLS += target
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants.h b/src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants.h
deleted file mode 100644
index 5335222865..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qmlinspectorconstants.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMLINSPECTORCONSTANTS_H
-#define QMLINSPECTORCONSTANTS_H
-
-#include <QtDeclarative/private/qdeclarativeglobal_p.h>
-
-namespace QmlJSDebugger {
-namespace Constants {
-
-enum DesignTool {
- NoTool = 0,
- SelectionToolMode = 1,
- MarqueeSelectionToolMode = 2,
- MoveToolMode = 3,
- ResizeToolMode = 4,
- ColorPickerMode = 5,
- ZoomMode = 6
-};
-
-static const int DragStartTime = 50;
-
-static const int DragStartDistance = 20;
-
-static const double ZoomSnapDelta = 0.04;
-
-static const int EditorItemDataKey = 1000;
-
-enum GraphicsItemTypes {
- EditorItemType = 0xEAAA,
- ResizeHandleItemType = 0xEAEA
-};
-
-
-} // namespace Constants
-} // namespace QmlJSDebugger
-
-#endif // QMLINSPECTORCONSTANTS_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/abstractliveedittool.cpp b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/abstractliveedittool.cpp
deleted file mode 100644
index c2482929ca..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/abstractliveedittool.cpp
+++ /dev/null
@@ -1,196 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "abstractliveedittool.h"
-#include "qdeclarativeviewinspector_p.h"
-
-#include <QDeclarativeEngine>
-
-#include <QtDebug>
-#include <QGraphicsItem>
-#include <QDeclarativeItem>
-
-namespace QmlJSDebugger {
-
-AbstractLiveEditTool::AbstractLiveEditTool(QDeclarativeViewInspector *editorView)
- : AbstractTool(editorView)
-{
-}
-
-
-AbstractLiveEditTool::~AbstractLiveEditTool()
-{
-}
-
-QDeclarativeViewInspector *AbstractLiveEditTool::inspector() const
-{
- return static_cast<QDeclarativeViewInspector*>(AbstractTool::inspector());
-}
-
-QDeclarativeView *AbstractLiveEditTool::view() const
-{
- return inspector()->declarativeView();
-}
-
-QGraphicsScene* AbstractLiveEditTool::scene() const
-{
- return view()->scene();
-}
-
-void AbstractLiveEditTool::updateSelectedItems()
-{
- selectedItemsChanged(items());
-}
-
-QList<QGraphicsItem*> AbstractLiveEditTool::items() const
-{
- return inspector()->selectedItems();
-}
-
-bool AbstractLiveEditTool::topItemIsMovable(const QList<QGraphicsItem*> & itemList)
-{
- QGraphicsItem *firstSelectableItem = topMovableGraphicsItem(itemList);
- if (firstSelectableItem == 0)
- return false;
- if (toQDeclarativeItem(firstSelectableItem) != 0)
- return true;
-
- return false;
-
-}
-
-bool AbstractLiveEditTool::topSelectedItemIsMovable(const QList<QGraphicsItem*> &itemList)
-{
- QList<QGraphicsItem*> selectedItems = inspector()->selectedItems();
-
- foreach (QGraphicsItem *item, itemList) {
- QDeclarativeItem *declarativeItem = toQDeclarativeItem(item);
- if (declarativeItem
- && selectedItems.contains(declarativeItem)
- /*&& (declarativeItem->qmlItemNode().hasShowContent() || selectNonContentItems)*/)
- return true;
- }
-
- return false;
-
-}
-
-bool AbstractLiveEditTool::topItemIsResizeHandle(const QList<QGraphicsItem*> &/*itemList*/)
-{
- return false;
-}
-
-QDeclarativeItem *AbstractLiveEditTool::toQDeclarativeItem(QGraphicsItem *item)
-{
- return qobject_cast<QDeclarativeItem*>(item->toGraphicsObject());
-}
-
-QGraphicsItem *AbstractLiveEditTool::topMovableGraphicsItem(const QList<QGraphicsItem*> &itemList)
-{
- foreach (QGraphicsItem *item, itemList) {
- if (item->flags().testFlag(QGraphicsItem::ItemIsMovable))
- return item;
- }
- return 0;
-}
-
-QDeclarativeItem *AbstractLiveEditTool::topMovableDeclarativeItem(const QList<QGraphicsItem*>
- &itemList)
-{
- foreach (QGraphicsItem *item, itemList) {
- QDeclarativeItem *declarativeItem = toQDeclarativeItem(item);
- if (declarativeItem /*&& (declarativeItem->qmlItemNode().hasShowContent())*/)
- return declarativeItem;
- }
-
- return 0;
-}
-
-QList<QGraphicsObject*> AbstractLiveEditTool::toGraphicsObjectList(const QList<QGraphicsItem*>
- &itemList)
-{
- QList<QGraphicsObject*> gfxObjects;
- foreach (QGraphicsItem *item, itemList) {
- QGraphicsObject *obj = item->toGraphicsObject();
- if (obj)
- gfxObjects << obj;
- }
-
- return gfxObjects;
-}
-
-QString AbstractLiveEditTool::titleForItem(QGraphicsItem *item)
-{
- QString className(QLatin1String("QGraphicsItem"));
- QString objectStringId;
-
- QString constructedName;
-
- QGraphicsObject *gfxObject = item->toGraphicsObject();
- if (gfxObject) {
- className = QLatin1String(gfxObject->metaObject()->className());
-
- className.remove(QRegExp(QLatin1String("_QMLTYPE_\\d+")));
- className.remove(QRegExp(QLatin1String("_QML_\\d+")));
- if (className.startsWith(QLatin1String("QDeclarative")))
- className = className.remove(QLatin1String("QDeclarative"));
-
- QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem*>(gfxObject);
- if (declarativeItem) {
- objectStringId = inspector()->idStringForObject(declarativeItem);
- }
-
- if (!objectStringId.isEmpty()) {
- constructedName = objectStringId + QLatin1String(" (") + className + QLatin1Char(')');
- } else {
- if (!gfxObject->objectName().isEmpty()) {
- constructedName = gfxObject->objectName() + QLatin1String(" (") + className + QLatin1Char(')');
- } else {
- constructedName = className;
- }
- }
- }
-
- return constructedName;
-}
-
-
-} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/abstractliveedittool.h b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/abstractliveedittool.h
deleted file mode 100644
index 04b5f4e46e..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/abstractliveedittool.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ABSTRACTLIVEEDITTOOL_H
-#define ABSTRACTLIVEEDITTOOL_H
-
-#include <QtCore/QList>
-#include "../abstracttool.h"
-
-QT_BEGIN_NAMESPACE
-class QMouseEvent;
-class QGraphicsItem;
-class QDeclarativeItem;
-class QKeyEvent;
-class QGraphicsScene;
-class QGraphicsObject;
-class QWheelEvent;
-class QDeclarativeView;
-QT_END_NAMESPACE
-
-namespace QmlJSDebugger {
-
-class QDeclarativeViewInspector;
-
-class AbstractLiveEditTool : public AbstractTool
-{
- Q_OBJECT
-public:
- AbstractLiveEditTool(QDeclarativeViewInspector *inspector);
-
- virtual ~AbstractLiveEditTool();
-
- void leaveEvent(QEvent *) {}
-
- virtual void itemsAboutToRemoved(const QList<QGraphicsItem*> &itemList) = 0;
-
- virtual void clear() = 0;
-
- void updateSelectedItems();
- QList<QGraphicsItem*> items() const;
-
- bool topItemIsMovable(const QList<QGraphicsItem*> &itemList);
- bool topItemIsResizeHandle(const QList<QGraphicsItem*> &itemList);
- bool topSelectedItemIsMovable(const QList<QGraphicsItem*> &itemList);
-
- QString titleForItem(QGraphicsItem *item);
-
- static QList<QGraphicsObject*> toGraphicsObjectList(const QList<QGraphicsItem*> &itemList);
- static QGraphicsItem* topMovableGraphicsItem(const QList<QGraphicsItem*> &itemList);
- static QDeclarativeItem* topMovableDeclarativeItem(const QList<QGraphicsItem*> &itemList);
- static QDeclarativeItem *toQDeclarativeItem(QGraphicsItem *item);
-
-protected:
- virtual void selectedItemsChanged(const QList<QGraphicsItem*> &objectList) = 0;
-
- QDeclarativeViewInspector *inspector() const;
- QDeclarativeView *view() const;
- QGraphicsScene *scene() const;
-
-private:
- QList<QGraphicsItem*> m_itemList;
-};
-
-}
-
-#endif // ABSTRACTLIVEEDITTOOL_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/boundingrecthighlighter.cpp b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/boundingrecthighlighter.cpp
deleted file mode 100644
index e097d3cd77..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/boundingrecthighlighter.cpp
+++ /dev/null
@@ -1,240 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "boundingrecthighlighter.h"
-
-#include "qdeclarativeviewinspector.h"
-#include "../qmlinspectorconstants.h"
-
-#include <QtWidgets/QGraphicsPolygonItem>
-
-#include <QtCore/QTimer>
-#include <QtCore/QObject>
-#include <QtCore/QDebug>
-
-namespace QmlJSDebugger {
-
-BoundingBox::BoundingBox(QGraphicsObject *itemToHighlight, QGraphicsItem *parentItem,
- QObject *parent)
- : QObject(parent),
- highlightedObject(itemToHighlight),
- highlightPolygon(0),
- highlightPolygonEdge(0)
-{
- highlightPolygon = new BoundingBoxPolygonItem(parentItem);
- highlightPolygonEdge = new BoundingBoxPolygonItem(parentItem);
-
- highlightPolygon->setPen(QPen(QColor(0, 22, 159)));
- highlightPolygonEdge->setPen(QPen(QColor(158, 199, 255)));
-
- highlightPolygon->setFlag(QGraphicsItem::ItemIsSelectable, false);
- highlightPolygonEdge->setFlag(QGraphicsItem::ItemIsSelectable, false);
-}
-
-BoundingBox::~BoundingBox()
-{
- highlightedObject.clear();
-}
-
-BoundingBoxPolygonItem::BoundingBoxPolygonItem(QGraphicsItem *item) : QGraphicsPolygonItem(item)
-{
- QPen pen;
- pen.setColor(QColor(108, 141, 221));
- pen.setWidth(1);
- setPen(pen);
-}
-
-int BoundingBoxPolygonItem::type() const
-{
- return Constants::EditorItemType;
-}
-
-BoundingRectHighlighter::BoundingRectHighlighter(QDeclarativeViewInspector *view) :
- LiveLayerItem(view->declarativeView()->scene()),
- m_view(view)
-{
-}
-
-BoundingRectHighlighter::~BoundingRectHighlighter()
-{
-
-}
-
-void BoundingRectHighlighter::clear()
-{
- foreach (BoundingBox *box, m_boxes)
- freeBoundingBox(box);
-}
-
-BoundingBox *BoundingRectHighlighter::boxFor(QGraphicsObject *item) const
-{
- foreach (BoundingBox *box, m_boxes) {
- if (box->highlightedObject.data() == item)
- return box;
- }
- return 0;
-}
-
-void BoundingRectHighlighter::highlight(QList<QGraphicsObject*> items)
-{
- if (items.isEmpty())
- return;
-
- QList<BoundingBox *> newBoxes;
- foreach (QGraphicsObject *itemToHighlight, items) {
- BoundingBox *box = boxFor(itemToHighlight);
- if (!box)
- box = createBoundingBox(itemToHighlight);
-
- newBoxes << box;
- }
- qSort(newBoxes);
-
- if (newBoxes != m_boxes) {
- clear();
- m_boxes << newBoxes;
- }
-
- highlightAll();
-}
-
-void BoundingRectHighlighter::highlight(QGraphicsObject* itemToHighlight)
-{
- if (!itemToHighlight)
- return;
-
- BoundingBox *box = boxFor(itemToHighlight);
- if (!box) {
- box = createBoundingBox(itemToHighlight);
- m_boxes << box;
- qSort(m_boxes);
- }
-
- highlightAll();
-}
-
-BoundingBox *BoundingRectHighlighter::createBoundingBox(QGraphicsObject *itemToHighlight)
-{
- if (!m_freeBoxes.isEmpty()) {
- BoundingBox *box = m_freeBoxes.last();
- if (box->highlightedObject.isNull()) {
- box->highlightedObject = itemToHighlight;
- box->highlightPolygon->show();
- box->highlightPolygonEdge->show();
- m_freeBoxes.removeLast();
- return box;
- }
- }
-
- BoundingBox *box = new BoundingBox(itemToHighlight, this, this);
-
- connect(itemToHighlight, SIGNAL(xChanged()), this, SLOT(refresh()));
- connect(itemToHighlight, SIGNAL(yChanged()), this, SLOT(refresh()));
- connect(itemToHighlight, SIGNAL(widthChanged()), this, SLOT(refresh()));
- connect(itemToHighlight, SIGNAL(heightChanged()), this, SLOT(refresh()));
- connect(itemToHighlight, SIGNAL(rotationChanged()), this, SLOT(refresh()));
- connect(itemToHighlight, SIGNAL(destroyed(QObject*)), this, SLOT(itemDestroyed(QObject*)));
-
- return box;
-}
-
-void BoundingRectHighlighter::removeBoundingBox(BoundingBox *box)
-{
- delete box;
- box = 0;
-}
-
-void BoundingRectHighlighter::freeBoundingBox(BoundingBox *box)
-{
- if (!box->highlightedObject.isNull()) {
- disconnect(box->highlightedObject.data(), SIGNAL(xChanged()), this, SLOT(refresh()));
- disconnect(box->highlightedObject.data(), SIGNAL(yChanged()), this, SLOT(refresh()));
- disconnect(box->highlightedObject.data(), SIGNAL(widthChanged()), this, SLOT(refresh()));
- disconnect(box->highlightedObject.data(), SIGNAL(heightChanged()), this, SLOT(refresh()));
- disconnect(box->highlightedObject.data(), SIGNAL(rotationChanged()), this, SLOT(refresh()));
- }
-
- box->highlightedObject.clear();
- box->highlightPolygon->hide();
- box->highlightPolygonEdge->hide();
- m_boxes.removeOne(box);
- m_freeBoxes << box;
-}
-
-void BoundingRectHighlighter::itemDestroyed(QObject *obj)
-{
- foreach (BoundingBox *box, m_boxes) {
- if (box->highlightedObject.data() == obj) {
- freeBoundingBox(box);
- break;
- }
- }
-}
-
-void BoundingRectHighlighter::highlightAll()
-{
- foreach (BoundingBox *box, m_boxes) {
- if (box && box->highlightedObject.isNull()) {
- // clear all highlights
- clear();
- return;
- }
- QGraphicsObject *item = box->highlightedObject.data();
-
- QRectF boundingRectInSceneSpace(item->mapToScene(item->boundingRect()).boundingRect());
- QRectF boundingRectInLayerItemSpace = mapRectFromScene(boundingRectInSceneSpace);
- QRectF bboxRect = m_view->adjustToScreenBoundaries(boundingRectInLayerItemSpace);
- QRectF edgeRect = bboxRect;
- edgeRect.adjust(-1, -1, 1, 1);
-
- box->highlightPolygon->setPolygon(QPolygonF(bboxRect));
- box->highlightPolygonEdge->setPolygon(QPolygonF(edgeRect));
- }
-}
-
-void BoundingRectHighlighter::refresh()
-{
- if (!m_boxes.isEmpty())
- highlightAll();
-}
-
-
-} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/boundingrecthighlighter.h b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/boundingrecthighlighter.h
deleted file mode 100644
index 81883ee0aa..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/boundingrecthighlighter.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef BOUNDINGRECTHIGHLIGHTER_H
-#define BOUNDINGRECTHIGHLIGHTER_H
-
-#include "livelayeritem.h"
-
-#include <QtCore/QObject>
-#include <QtCore/QWeakPointer>
-
-QT_FORWARD_DECLARE_CLASS(QGraphicsItem)
-QT_FORWARD_DECLARE_CLASS(QPainter)
-QT_FORWARD_DECLARE_CLASS(QWidget)
-QT_FORWARD_DECLARE_CLASS(QStyleOptionGraphicsItem)
-QT_FORWARD_DECLARE_CLASS(QTimer)
-
-namespace QmlJSDebugger {
-
-class QDeclarativeViewInspector;
-class BoundingBox;
-
-class BoundingRectHighlighter : public LiveLayerItem
-{
- Q_OBJECT
-public:
- explicit BoundingRectHighlighter(QDeclarativeViewInspector *view);
- ~BoundingRectHighlighter();
- void clear();
- void highlight(QList<QGraphicsObject*> items);
- void highlight(QGraphicsObject* item);
-
-private slots:
- void refresh();
- void itemDestroyed(QObject *);
-
-private:
- BoundingBox *boxFor(QGraphicsObject *item) const;
- void highlightAll();
- BoundingBox *createBoundingBox(QGraphicsObject *itemToHighlight);
- void removeBoundingBox(BoundingBox *box);
- void freeBoundingBox(BoundingBox *box);
-
-private:
- Q_DISABLE_COPY(BoundingRectHighlighter)
-
- QDeclarativeViewInspector *m_view;
- QList<BoundingBox* > m_boxes;
- QList<BoundingBox* > m_freeBoxes;
-};
-
-class BoundingBox : public QObject
-{
- Q_OBJECT
-public:
- explicit BoundingBox(QGraphicsObject *itemToHighlight, QGraphicsItem *parentItem,
- QObject *parent = 0);
- ~BoundingBox();
- QWeakPointer<QGraphicsObject> highlightedObject;
- QGraphicsPolygonItem *highlightPolygon;
- QGraphicsPolygonItem *highlightPolygonEdge;
-
-private:
- Q_DISABLE_COPY(BoundingBox)
-
-};
-
-class BoundingBoxPolygonItem : public QGraphicsPolygonItem
-{
-public:
- explicit BoundingBoxPolygonItem(QGraphicsItem *item);
- int type() const;
-};
-
-} // namespace QmlJSDebugger
-
-#endif // BOUNDINGRECTHIGHLIGHTER_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/colorpickertool.cpp b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/colorpickertool.cpp
deleted file mode 100644
index 581c1f5b1a..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/colorpickertool.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "colorpickertool.h"
-
-#include "qdeclarativeviewinspector.h"
-
-#include <QtGui/QMouseEvent>
-#include <QtGui/QKeyEvent>
-#include <QtCore/QRectF>
-#include <QtGui/QRgb>
-#include <QtGui/QImage>
-#include <QtWidgets/QApplication>
-#include <QtGui/QPalette>
-
-namespace QmlJSDebugger {
-
-ColorPickerTool::ColorPickerTool(QDeclarativeViewInspector *view) :
- AbstractLiveEditTool(view)
-{
- m_selectedColor.setRgb(0,0,0);
-}
-
-ColorPickerTool::~ColorPickerTool()
-{
-}
-
-void ColorPickerTool::mousePressEvent(QMouseEvent *event)
-{
- pickColor(event->pos());
-}
-
-void ColorPickerTool::mouseMoveEvent(QMouseEvent *event)
-{
- pickColor(event->pos());
-}
-
-void ColorPickerTool::clear()
-{
- view()->setCursor(Qt::CrossCursor);
-}
-
-void ColorPickerTool::pickColor(const QPoint &pos)
-{
- QRgb fillColor = view()->backgroundBrush().color().rgb();
- if (view()->backgroundBrush().style() == Qt::NoBrush)
- fillColor = view()->palette().color(QPalette::Base).rgb();
-
- QRectF target(0,0, 1, 1);
- QRect source(pos.x(), pos.y(), 1, 1);
- QImage img(1, 1, QImage::Format_ARGB32);
- img.fill(fillColor);
- QPainter painter(&img);
- view()->render(&painter, target, source);
- m_selectedColor = QColor::fromRgb(img.pixel(0, 0));
-
- emit selectedColorChanged(m_selectedColor);
-}
-
-} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/colorpickertool.h b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/colorpickertool.h
deleted file mode 100644
index a28ffea63a..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/colorpickertool.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef COLORPICKERTOOL_H
-#define COLORPICKERTOOL_H
-
-#include "abstractliveedittool.h"
-
-#include <QtGui/QColor>
-
-QT_FORWARD_DECLARE_CLASS(QPoint)
-
-namespace QmlJSDebugger {
-
-class ColorPickerTool : public AbstractLiveEditTool
-{
- Q_OBJECT
-public:
- explicit ColorPickerTool(QDeclarativeViewInspector *view);
-
- virtual ~ColorPickerTool();
-
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *) {}
- void mouseDoubleClickEvent(QMouseEvent *) {}
-
- void hoverMoveEvent(QMouseEvent *) {}
-
- void keyPressEvent(QKeyEvent *) {}
- void keyReleaseEvent(QKeyEvent *) {}
-
- void wheelEvent(QWheelEvent *) {}
-
- void itemsAboutToRemoved(const QList<QGraphicsItem*> &) {}
-
- void clear();
-
-signals:
- void selectedColorChanged(const QColor &color);
-
-protected:
- void selectedItemsChanged(const QList<QGraphicsItem*> &) {}
-
-private:
- void pickColor(const QPoint &pos);
-
-private:
- QColor m_selectedColor;
-};
-
-} // namespace QmlJSDebugger
-
-#endif // COLORPICKERTOOL_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/livelayeritem.cpp b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/livelayeritem.cpp
deleted file mode 100644
index fb7118fbc2..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/livelayeritem.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "livelayeritem.h"
-
-#include "../qmlinspectorconstants.h"
-
-#include <QGraphicsScene>
-
-namespace QmlJSDebugger {
-
-LiveLayerItem::LiveLayerItem(QGraphicsScene* scene)
- : QGraphicsObject()
-{
- scene->addItem(this);
- setZValue(1);
- setFlag(QGraphicsItem::ItemIsMovable, false);
-}
-
-LiveLayerItem::~LiveLayerItem()
-{
-}
-
-void LiveLayerItem::paint(QPainter * /*painter*/, const QStyleOptionGraphicsItem * /*option*/,
- QWidget * /*widget*/)
-{
-}
-
-int LiveLayerItem::type() const
-{
- return Constants::EditorItemType;
-}
-
-QRectF LiveLayerItem::boundingRect() const
-{
- return childrenBoundingRect();
-}
-
-QList<QGraphicsItem*> LiveLayerItem::findAllChildItems() const
-{
- return findAllChildItems(this);
-}
-
-QList<QGraphicsItem*> LiveLayerItem::findAllChildItems(const QGraphicsItem *item) const
-{
- QList<QGraphicsItem*> itemList(item->childItems());
-
- foreach (QGraphicsItem *childItem, item->childItems())
- itemList += findAllChildItems(childItem);
-
- return itemList;
-}
-
-} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/livelayeritem.h b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/livelayeritem.h
deleted file mode 100644
index 15f9a27fa4..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/livelayeritem.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LIVELAYERITEM_H
-#define LIVELAYERITEM_H
-
-#include <QtWidgets/QGraphicsObject>
-
-namespace QmlJSDebugger {
-
-class LiveLayerItem : public QGraphicsObject
-{
-public:
- LiveLayerItem(QGraphicsScene *scene);
- ~LiveLayerItem();
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget = 0);
- QRectF boundingRect() const;
- int type() const;
-
- QList<QGraphicsItem*> findAllChildItems() const;
-
-protected:
- QList<QGraphicsItem*> findAllChildItems(const QGraphicsItem *item) const;
-};
-
-}
-
-#endif // LIVELAYERITEM_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liverubberbandselectionmanipulator.cpp b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liverubberbandselectionmanipulator.cpp
deleted file mode 100644
index 4987237f89..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liverubberbandselectionmanipulator.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "liverubberbandselectionmanipulator.h"
-
-#include "qdeclarativeviewinspector_p.h"
-
-#include <QtWidgets/QGraphicsItem>
-
-#include <QtCore/QDebug>
-
-namespace QmlJSDebugger {
-
-LiveRubberBandSelectionManipulator::LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem,
- QDeclarativeViewInspector *editorView)
- : m_selectionRectangleElement(layerItem),
- m_editorView(editorView),
- m_beginFormEditorItem(0),
- m_isActive(false)
-{
- m_selectionRectangleElement.hide();
-}
-
-void LiveRubberBandSelectionManipulator::clear()
-{
- m_selectionRectangleElement.clear();
- m_isActive = false;
- m_beginPoint = QPointF();
- m_itemList.clear();
- m_oldSelectionList.clear();
-}
-
-QGraphicsItem *LiveRubberBandSelectionManipulator::topFormEditorItem(const QList<QGraphicsItem*>
- &itemList)
-{
- if (itemList.isEmpty())
- return 0;
-
- return itemList.first();
-}
-
-void LiveRubberBandSelectionManipulator::begin(const QPointF &beginPoint)
-{
- m_beginPoint = beginPoint;
- m_selectionRectangleElement.setRect(m_beginPoint, m_beginPoint);
- m_selectionRectangleElement.show();
- m_isActive = true;
- QDeclarativeViewInspectorPrivate *inspectorPrivate
- = QDeclarativeViewInspectorPrivate::get(m_editorView);
- m_beginFormEditorItem = topFormEditorItem(inspectorPrivate->selectableItems(beginPoint));
- m_oldSelectionList = m_editorView->selectedItems();
-}
-
-void LiveRubberBandSelectionManipulator::update(const QPointF &updatePoint)
-{
- m_selectionRectangleElement.setRect(m_beginPoint, updatePoint);
-}
-
-void LiveRubberBandSelectionManipulator::end()
-{
- m_oldSelectionList.clear();
- m_selectionRectangleElement.hide();
- m_isActive = false;
-}
-
-void LiveRubberBandSelectionManipulator::select(SelectionType selectionType)
-{
- QDeclarativeViewInspectorPrivate *inspectorPrivate
- = QDeclarativeViewInspectorPrivate::get(m_editorView);
- QList<QGraphicsItem*> itemList
- = inspectorPrivate->selectableItems(m_selectionRectangleElement.rect(),
- Qt::IntersectsItemShape);
- QList<QGraphicsItem*> newSelectionList;
-
- foreach (QGraphicsItem* item, itemList) {
- if (item
- && item->parentItem()
- && !newSelectionList.contains(item)
- //&& m_beginFormEditorItem->childItems().contains(item) // TODO activate this test
- )
- {
- newSelectionList.append(item);
- }
- }
-
- if (newSelectionList.isEmpty() && m_beginFormEditorItem)
- newSelectionList.append(m_beginFormEditorItem);
-
- QList<QGraphicsItem*> resultList;
-
- switch (selectionType) {
- case AddToSelection: {
- resultList.append(m_oldSelectionList);
- resultList.append(newSelectionList);
- }
- break;
- case ReplaceSelection: {
- resultList.append(newSelectionList);
- }
- break;
- case RemoveFromSelection: {
- QSet<QGraphicsItem*> oldSelectionSet(m_oldSelectionList.toSet());
- QSet<QGraphicsItem*> newSelectionSet(newSelectionList.toSet());
- resultList.append(oldSelectionSet.subtract(newSelectionSet).toList());
- }
- }
-
- m_editorView->setSelectedItems(resultList);
-}
-
-
-void LiveRubberBandSelectionManipulator::setItems(const QList<QGraphicsItem*> &itemList)
-{
- m_itemList = itemList;
-}
-
-QPointF LiveRubberBandSelectionManipulator::beginPoint() const
-{
- return m_beginPoint;
-}
-
-bool LiveRubberBandSelectionManipulator::isActive() const
-{
- return m_isActive;
-}
-
-} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liverubberbandselectionmanipulator.h b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liverubberbandselectionmanipulator.h
deleted file mode 100644
index aa15a34730..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liverubberbandselectionmanipulator.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef RUBBERBANDSELECTIONMANIPULATOR_H
-#define RUBBERBANDSELECTIONMANIPULATOR_H
-
-#include "liveselectionrectangle.h"
-
-#include <QtCore/QPointF>
-
-QT_FORWARD_DECLARE_CLASS(QGraphicsItem)
-
-namespace QmlJSDebugger {
-
-class QDeclarativeViewInspector;
-
-class LiveRubberBandSelectionManipulator
-{
-public:
- enum SelectionType {
- ReplaceSelection,
- AddToSelection,
- RemoveFromSelection
- };
-
- LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem,
- QDeclarativeViewInspector *editorView);
-
- void setItems(const QList<QGraphicsItem*> &itemList);
-
- void begin(const QPointF& beginPoint);
- void update(const QPointF& updatePoint);
- void end();
-
- void clear();
-
- void select(SelectionType selectionType);
-
- QPointF beginPoint() const;
-
- bool isActive() const;
-
-protected:
- QGraphicsItem *topFormEditorItem(const QList<QGraphicsItem*> &itemList);
-
-private:
- QList<QGraphicsItem*> m_itemList;
- QList<QGraphicsItem*> m_oldSelectionList;
- LiveSelectionRectangle m_selectionRectangleElement;
- QPointF m_beginPoint;
- QDeclarativeViewInspector *m_editorView;
- QGraphicsItem *m_beginFormEditorItem;
- bool m_isActive;
-};
-
-}
-
-#endif // RUBBERBANDSELECTIONMANIPULATOR_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectionindicator.cpp b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectionindicator.cpp
deleted file mode 100644
index 744cbf527e..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectionindicator.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "liveselectionindicator.h"
-
-#include "qdeclarativeviewinspector_p.h"
-#include "../qmlinspectorconstants.h"
-
-#include <QtWidgets/QGraphicsRectItem>
-#include <QtWidgets/QGraphicsObject>
-#include <QtWidgets/QGraphicsScene>
-#include <QtGui/QPen>
-
-namespace QmlJSDebugger {
-
-LiveSelectionIndicator::LiveSelectionIndicator(QDeclarativeViewInspector *viewInspector,
- QGraphicsObject *layerItem)
- : m_layerItem(layerItem)
- , m_view(viewInspector)
-{
-}
-
-LiveSelectionIndicator::~LiveSelectionIndicator()
-{
- clear();
-}
-
-void LiveSelectionIndicator::show()
-{
- foreach (QGraphicsRectItem *item, m_indicatorShapeHash)
- item->show();
-}
-
-void LiveSelectionIndicator::hide()
-{
- foreach (QGraphicsRectItem *item, m_indicatorShapeHash)
- item->hide();
-}
-
-void LiveSelectionIndicator::clear()
-{
- if (!m_layerItem.isNull()) {
- QGraphicsScene *scene = m_layerItem.data()->scene();
- foreach (QGraphicsRectItem *item, m_indicatorShapeHash) {
- scene->removeItem(item);
- delete item;
- }
- }
-
- m_indicatorShapeHash.clear();
-
-}
-
-void LiveSelectionIndicator::setItems(const QList<QWeakPointer<QGraphicsObject> > &itemList)
-{
- clear();
-
- foreach (const QWeakPointer<QGraphicsObject> &object, itemList) {
- if (object.isNull())
- continue;
-
- QGraphicsItem *item = object.data();
-
- if (!m_indicatorShapeHash.contains(item)) {
- QGraphicsRectItem *selectionIndicator = new QGraphicsRectItem(m_layerItem.data());
- m_indicatorShapeHash.insert(item, selectionIndicator);
-
- const QRectF boundingRect = m_view->adjustToScreenBoundaries(item->mapRectToScene(item->boundingRect()));
- const QRectF boundingRectInLayerItemSpace = m_layerItem.data()->mapRectFromScene(boundingRect);
-
- selectionIndicator->setData(Constants::EditorItemDataKey, true);
- selectionIndicator->setFlag(QGraphicsItem::ItemIsSelectable, false);
- selectionIndicator->setRect(boundingRectInLayerItemSpace);
- selectionIndicator->setPen(QColor(108, 141, 221));
- }
- }
-}
-
-} //namespace QmlJSDebugger
-
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectionindicator.h b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectionindicator.h
deleted file mode 100644
index 7b8cc12e62..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectionindicator.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LIVESELECTIONINDICATOR_H
-#define LIVESELECTIONINDICATOR_H
-
-#include <QtCore/QWeakPointer>
-#include <QtCore/QHash>
-
-QT_BEGIN_NAMESPACE
-class QGraphicsObject;
-class QGraphicsRectItem;
-class QGraphicsItem;
-class QPolygonF;
-QT_END_NAMESPACE
-
-namespace QmlJSDebugger {
-
-class QDeclarativeViewInspector;
-
-class LiveSelectionIndicator
-{
-public:
- LiveSelectionIndicator(QDeclarativeViewInspector *viewInspector, QGraphicsObject *layerItem);
- ~LiveSelectionIndicator();
-
- void show();
- void hide();
-
- void clear();
-
- void setItems(const QList<QWeakPointer<QGraphicsObject> > &itemList);
-
-private:
- QHash<QGraphicsItem*, QGraphicsRectItem *> m_indicatorShapeHash;
- QWeakPointer<QGraphicsObject> m_layerItem;
- QDeclarativeViewInspector *m_view;
-};
-
-}
-
-#endif // LIVESELECTIONINDICATOR_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectionrectangle.cpp b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectionrectangle.cpp
deleted file mode 100644
index 23577561a4..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectionrectangle.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "liveselectionrectangle.h"
-
-#include "../qmlinspectorconstants.h"
-
-#include <QtGui/QPen>
-#include <QtWidgets/QGraphicsRectItem>
-#include <QtWidgets/QGraphicsObject>
-#include <QtWidgets/QGraphicsScene>
-
-#include <QtCore/QtDebug>
-
-#include <cmath>
-
-namespace QmlJSDebugger {
-
-class SelectionRectShape : public QGraphicsRectItem
-{
-public:
- SelectionRectShape(QGraphicsItem *parent = 0) : QGraphicsRectItem(parent) {}
- int type() const { return Constants::EditorItemType; }
-};
-
-LiveSelectionRectangle::LiveSelectionRectangle(QGraphicsObject *layerItem)
- : m_controlShape(new SelectionRectShape(layerItem)),
- m_layerItem(layerItem)
-{
- m_controlShape->setPen(QPen(Qt::black));
- m_controlShape->setBrush(QColor(128, 128, 128, 50));
-}
-
-LiveSelectionRectangle::~LiveSelectionRectangle()
-{
- if (m_layerItem)
- m_layerItem.data()->scene()->removeItem(m_controlShape);
-}
-
-void LiveSelectionRectangle::clear()
-{
- hide();
-}
-void LiveSelectionRectangle::show()
-{
- m_controlShape->show();
-}
-
-void LiveSelectionRectangle::hide()
-{
- m_controlShape->hide();
-}
-
-QRectF LiveSelectionRectangle::rect() const
-{
- return m_controlShape->mapFromScene(m_controlShape->rect()).boundingRect();
-}
-
-void LiveSelectionRectangle::setRect(const QPointF &firstPoint,
- const QPointF &secondPoint)
-{
- double firstX = std::floor(firstPoint.x()) + 0.5;
- double firstY = std::floor(firstPoint.y()) + 0.5;
- double secondX = std::floor(secondPoint.x()) + 0.5;
- double secondY = std::floor(secondPoint.y()) + 0.5;
- QPointF topLeftPoint(firstX < secondX ? firstX : secondX,
- firstY < secondY ? firstY : secondY);
- QPointF bottomRightPoint(firstX > secondX ? firstX : secondX,
- firstY > secondY ? firstY : secondY);
-
- QRectF rect(topLeftPoint, bottomRightPoint);
- m_controlShape->setRect(rect);
-}
-
-}
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectionrectangle.h b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectionrectangle.h
deleted file mode 100644
index 730cca52d5..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectionrectangle.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LIVESELECTIONRECTANGLE_H
-#define LIVESELECTIONRECTANGLE_H
-
-#include <QtCore/QWeakPointer>
-
-QT_FORWARD_DECLARE_CLASS(QGraphicsObject)
-QT_FORWARD_DECLARE_CLASS(QGraphicsRectItem)
-QT_FORWARD_DECLARE_CLASS(QPointF)
-QT_FORWARD_DECLARE_CLASS(QRectF)
-
-namespace QmlJSDebugger {
-
-class LiveSelectionRectangle
-{
-public:
- LiveSelectionRectangle(QGraphicsObject *layerItem);
- ~LiveSelectionRectangle();
-
- void show();
- void hide();
-
- void clear();
-
- void setRect(const QPointF &firstPoint,
- const QPointF &secondPoint);
-
- QRectF rect() const;
-
-private:
- QGraphicsRectItem *m_controlShape;
- QWeakPointer<QGraphicsObject> m_layerItem;
-};
-
-} // namespace QmlJSDebugger
-
-#endif // LIVESELECTIONRECTANGLE_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectiontool.cpp b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectiontool.cpp
deleted file mode 100644
index dc51a1f595..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectiontool.cpp
+++ /dev/null
@@ -1,423 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "liveselectiontool.h"
-#include "livelayeritem.h"
-
-#include "qdeclarativeviewinspector_p.h"
-
-#include <QtWidgets/QApplication>
-#include <QtGui/QWheelEvent>
-#include <QtGui/QMouseEvent>
-#include <QtGui/QClipboard>
-#include <QtWidgets/QMenu>
-#include <QtWidgets/QAction>
-#include <QtWidgets/QGraphicsObject>
-
-#include <QtQuick1/QDeclarativeItem>
-#include <QtDeclarative/QDeclarativeEngine>
-
-#include <QtCore/QDebug>
-
-namespace QmlJSDebugger {
-
-LiveSelectionTool::LiveSelectionTool(QDeclarativeViewInspector *editorView) :
- AbstractLiveEditTool(editorView),
- m_rubberbandSelectionMode(false),
- m_rubberbandSelectionManipulator(
- QDeclarativeViewInspectorPrivate::get(editorView)->manipulatorLayer, editorView),
- m_singleSelectionManipulator(editorView),
- m_selectionIndicator(editorView,
- QDeclarativeViewInspectorPrivate::get(editorView)->manipulatorLayer),
- //m_resizeIndicator(editorView->manipulatorLayer()),
- m_selectOnlyContentItems(true)
-{
-
-}
-
-LiveSelectionTool::~LiveSelectionTool()
-{
-}
-
-void LiveSelectionTool::setRubberbandSelectionMode(bool value)
-{
- m_rubberbandSelectionMode = value;
-}
-
-LiveSingleSelectionManipulator::SelectionType LiveSelectionTool::getSelectionType(Qt::KeyboardModifiers
- modifiers)
-{
- LiveSingleSelectionManipulator::SelectionType selectionType
- = LiveSingleSelectionManipulator::ReplaceSelection;
- if (modifiers.testFlag(Qt::ControlModifier)) {
- selectionType = LiveSingleSelectionManipulator::RemoveFromSelection;
- } else if (modifiers.testFlag(Qt::ShiftModifier)) {
- selectionType = LiveSingleSelectionManipulator::AddToSelection;
- }
- return selectionType;
-}
-
-bool LiveSelectionTool::alreadySelected(const QList<QGraphicsItem*> &itemList) const
-{
- QDeclarativeViewInspectorPrivate *inspectorPrivate
- = QDeclarativeViewInspectorPrivate::get(inspector());
- const QList<QGraphicsItem*> selectedItems = inspectorPrivate->selectedItems();
-
- if (selectedItems.isEmpty())
- return false;
-
- foreach (QGraphicsItem *item, itemList)
- if (selectedItems.contains(item))
- return true;
-
- return false;
-}
-
-void LiveSelectionTool::mousePressEvent(QMouseEvent *event)
-{
- QDeclarativeViewInspectorPrivate *inspectorPrivate
- = QDeclarativeViewInspectorPrivate::get(inspector());
- QList<QGraphicsItem*> itemList = inspectorPrivate->selectableItems(event->pos());
- LiveSingleSelectionManipulator::SelectionType selectionType = getSelectionType(event->modifiers());
-
- if (event->buttons() & Qt::LeftButton) {
- m_mousePressTimer.start();
-
- if (m_rubberbandSelectionMode) {
- m_rubberbandSelectionManipulator.begin(event->pos());
- } else {
- m_singleSelectionManipulator.begin(event->pos());
- m_singleSelectionManipulator.select(selectionType, m_selectOnlyContentItems);
- }
- } else if (event->buttons() & Qt::RightButton) {
- createContextMenu(itemList, event->globalPos());
- }
-}
-
-void LiveSelectionTool::createContextMenu(const QList<QGraphicsItem*> &itemList, QPoint globalPos)
-{
- QMenu contextMenu;
- connect(&contextMenu, SIGNAL(hovered(QAction*)),
- this, SLOT(contextMenuElementHovered(QAction*)));
-
- m_contextMenuItemList = itemList;
-
- contextMenu.addAction(tr("Items"));
- contextMenu.addSeparator();
- int shortcutKey = Qt::Key_1;
- int i = 0;
-
- foreach (QGraphicsItem * const item, itemList) {
- QString itemTitle = titleForItem(item);
- QAction *elementAction = contextMenu.addAction(itemTitle, this,
- SLOT(contextMenuElementSelected()));
-
- if (inspector()->selectedItems().contains(item)) {
- QFont boldFont = elementAction->font();
- boldFont.setBold(true);
- elementAction->setFont(boldFont);
- }
-
- elementAction->setData(i);
-
- if (shortcutKey <= Qt::Key_9) {
- elementAction->setShortcut(QKeySequence(shortcutKey));
- shortcutKey++;
- }
-
- ++i;
- }
- // add root item separately
- // QString itemTitle = QString(tr("%1")).arg(titleForItem(view()->currentRootItem()));
- // contextMenu.addAction(itemTitle, this, SLOT(contextMenuElementSelected()));
- // m_contextMenuItemList.append(view()->currentRootItem());
-
- contextMenu.exec(globalPos);
- m_contextMenuItemList.clear();
-}
-
-void LiveSelectionTool::contextMenuElementSelected()
-{
- QAction *senderAction = static_cast<QAction*>(sender());
- int itemListIndex = senderAction->data().toInt();
- if (itemListIndex >= 0 && itemListIndex < m_contextMenuItemList.length()) {
-
- QPointF updatePt(0, 0);
- QGraphicsItem *item = m_contextMenuItemList.at(itemListIndex);
- m_singleSelectionManipulator.begin(updatePt);
- m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::InvertSelection,
- QList<QGraphicsItem*>() << item,
- false);
- m_singleSelectionManipulator.end(updatePt);
- }
-}
-
-void LiveSelectionTool::contextMenuElementHovered(QAction *action)
-{
- int itemListIndex = action->data().toInt();
- if (itemListIndex >= 0 && itemListIndex < m_contextMenuItemList.length()) {
- QGraphicsObject *item = m_contextMenuItemList.at(itemListIndex)->toGraphicsObject();
- QDeclarativeViewInspectorPrivate::get(inspector())->highlight(item);
- }
-}
-
-void LiveSelectionTool::mouseMoveEvent(QMouseEvent *event)
-{
- if (m_singleSelectionManipulator.isActive()) {
- QPointF mouseMovementVector = m_singleSelectionManipulator.beginPoint() - event->pos();
-
- if ((mouseMovementVector.toPoint().manhattanLength() > Constants::DragStartDistance)
- && (m_mousePressTimer.elapsed() > Constants::DragStartTime))
- {
- m_singleSelectionManipulator.end(event->pos());
- //view()->changeToMoveTool(m_singleSelectionManipulator.beginPoint());
- return;
- }
- } else if (m_rubberbandSelectionManipulator.isActive()) {
- QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->pos();
-
- if ((mouseMovementVector.toPoint().manhattanLength() > Constants::DragStartDistance)
- && (m_mousePressTimer.elapsed() > Constants::DragStartTime)) {
- m_rubberbandSelectionManipulator.update(event->pos());
-
- if (event->modifiers().testFlag(Qt::ControlModifier))
- m_rubberbandSelectionManipulator.select(
- LiveRubberBandSelectionManipulator::RemoveFromSelection);
- else if (event->modifiers().testFlag(Qt::ShiftModifier))
- m_rubberbandSelectionManipulator.select(
- LiveRubberBandSelectionManipulator::AddToSelection);
- else
- m_rubberbandSelectionManipulator.select(
- LiveRubberBandSelectionManipulator::ReplaceSelection);
- }
- }
-}
-
-void LiveSelectionTool::hoverMoveEvent(QMouseEvent * event)
-{
-// ### commented out until move tool is re-enabled
-// QList<QGraphicsItem*> itemList = view()->items(event->pos());
-// if (!itemList.isEmpty() && !m_rubberbandSelectionMode) {
-//
-// foreach (QGraphicsItem *item, itemList) {
-// if (item->type() == Constants::ResizeHandleItemType) {
-// ResizeHandleItem* resizeHandle = ResizeHandleItem::fromGraphicsItem(item);
-// if (resizeHandle)
-// view()->changeTool(Constants::ResizeToolMode);
-// return;
-// }
-// }
-// if (topSelectedItemIsMovable(itemList))
-// view()->changeTool(Constants::MoveToolMode);
-// }
- QDeclarativeViewInspectorPrivate *inspectorPrivate
- = QDeclarativeViewInspectorPrivate::get(inspector());
-
- QList<QGraphicsItem*> selectableItemList = inspectorPrivate->selectableItems(event->pos());
- if (!selectableItemList.isEmpty()) {
- QGraphicsObject *item = selectableItemList.first()->toGraphicsObject();
- if (item)
- QDeclarativeViewInspectorPrivate::get(inspector())->highlight(item);
-
- return;
- }
-
- QDeclarativeViewInspectorPrivate::get(inspector())->clearHighlight();
-}
-
-void LiveSelectionTool::mouseReleaseEvent(QMouseEvent *event)
-{
- if (m_singleSelectionManipulator.isActive()) {
- m_singleSelectionManipulator.end(event->pos());
- }
- else if (m_rubberbandSelectionManipulator.isActive()) {
-
- QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->pos();
- if (mouseMovementVector.toPoint().manhattanLength() < Constants::DragStartDistance) {
- m_singleSelectionManipulator.begin(event->pos());
-
- if (event->modifiers().testFlag(Qt::ControlModifier))
- m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::RemoveFromSelection,
- m_selectOnlyContentItems);
- else if (event->modifiers().testFlag(Qt::ShiftModifier))
- m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::AddToSelection,
- m_selectOnlyContentItems);
- else
- m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::InvertSelection,
- m_selectOnlyContentItems);
-
- m_singleSelectionManipulator.end(event->pos());
- } else {
- m_rubberbandSelectionManipulator.update(event->pos());
-
- if (event->modifiers().testFlag(Qt::ControlModifier))
- m_rubberbandSelectionManipulator.select(
- LiveRubberBandSelectionManipulator::RemoveFromSelection);
- else if (event->modifiers().testFlag(Qt::ShiftModifier))
- m_rubberbandSelectionManipulator.select(
- LiveRubberBandSelectionManipulator::AddToSelection);
- else
- m_rubberbandSelectionManipulator.select(
- LiveRubberBandSelectionManipulator::ReplaceSelection);
-
- m_rubberbandSelectionManipulator.end();
- }
- }
-}
-
-void LiveSelectionTool::keyPressEvent(QKeyEvent *event)
-{
- switch (event->key()) {
- case Qt::Key_Left:
- case Qt::Key_Right:
- case Qt::Key_Up:
- case Qt::Key_Down:
- // disabled for now, cannot move stuff yet.
- //view()->changeTool(Constants::MoveToolMode);
- //view()->currentTool()->keyPressEvent(event);
- break;
- }
-}
-
-void LiveSelectionTool::wheelEvent(QWheelEvent *event)
-{
- if (event->orientation() == Qt::Horizontal || m_rubberbandSelectionMode)
- return;
-
- QDeclarativeViewInspectorPrivate *inspectorPrivate
- = QDeclarativeViewInspectorPrivate::get(inspector());
- QList<QGraphicsItem*> itemList = inspectorPrivate->selectableItems(event->pos());
-
- if (itemList.isEmpty())
- return;
-
- int selectedIdx = 0;
- if (!inspector()->selectedItems().isEmpty()) {
- selectedIdx = itemList.indexOf(inspector()->selectedItems().first());
- if (selectedIdx >= 0) {
- if (event->delta() > 0) {
- selectedIdx++;
- if (selectedIdx == itemList.length())
- selectedIdx = 0;
- } else if (event->delta() < 0) {
- selectedIdx--;
- if (selectedIdx == -1)
- selectedIdx = itemList.length() - 1;
- }
- } else {
- selectedIdx = 0;
- }
- }
-
- QPointF updatePt(0, 0);
- m_singleSelectionManipulator.begin(updatePt);
- m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::ReplaceSelection,
- QList<QGraphicsItem*>() << itemList.at(selectedIdx),
- false);
- m_singleSelectionManipulator.end(updatePt);
-
-}
-
-void LiveSelectionTool::setSelectOnlyContentItems(bool selectOnlyContentItems)
-{
- m_selectOnlyContentItems = selectOnlyContentItems;
-}
-
-void LiveSelectionTool::clear()
-{
- view()->setCursor(Qt::ArrowCursor);
- m_rubberbandSelectionManipulator.clear(),
- m_singleSelectionManipulator.clear();
- m_selectionIndicator.clear();
- //m_resizeIndicator.clear();
-}
-
-void LiveSelectionTool::selectedItemsChanged(const QList<QGraphicsItem*> &itemList)
-{
- foreach (const QWeakPointer<QGraphicsObject> &obj, m_selectedItemList) {
- if (!obj.isNull()) {
- disconnect(obj.data(), SIGNAL(xChanged()), this, SLOT(repaintBoundingRects()));
- disconnect(obj.data(), SIGNAL(yChanged()), this, SLOT(repaintBoundingRects()));
- disconnect(obj.data(), SIGNAL(widthChanged()), this, SLOT(repaintBoundingRects()));
- disconnect(obj.data(), SIGNAL(heightChanged()), this, SLOT(repaintBoundingRects()));
- disconnect(obj.data(), SIGNAL(rotationChanged()), this, SLOT(repaintBoundingRects()));
- }
- }
-
- QList<QGraphicsObject*> objects = toGraphicsObjectList(itemList);
- m_selectedItemList.clear();
-
- foreach (QGraphicsObject *obj, objects) {
- m_selectedItemList.append(obj);
- connect(obj, SIGNAL(xChanged()), this, SLOT(repaintBoundingRects()));
- connect(obj, SIGNAL(yChanged()), this, SLOT(repaintBoundingRects()));
- connect(obj, SIGNAL(widthChanged()), this, SLOT(repaintBoundingRects()));
- connect(obj, SIGNAL(heightChanged()), this, SLOT(repaintBoundingRects()));
- connect(obj, SIGNAL(rotationChanged()), this, SLOT(repaintBoundingRects()));
- }
-
- m_selectionIndicator.setItems(m_selectedItemList);
- //m_resizeIndicator.setItems(toGraphicsObjectList(itemList));
-}
-
-void LiveSelectionTool::repaintBoundingRects()
-{
- m_selectionIndicator.setItems(m_selectedItemList);
-}
-
-void LiveSelectionTool::selectUnderPoint(QMouseEvent *event)
-{
- m_singleSelectionManipulator.begin(event->pos());
-
- if (event->modifiers().testFlag(Qt::ControlModifier))
- m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::RemoveFromSelection,
- m_selectOnlyContentItems);
- else if (event->modifiers().testFlag(Qt::ShiftModifier))
- m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::AddToSelection,
- m_selectOnlyContentItems);
- else
- m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::InvertSelection,
- m_selectOnlyContentItems);
-
- m_singleSelectionManipulator.end(event->pos());
-}
-
-} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectiontool.h b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectiontool.h
deleted file mode 100644
index 2c281cda3c..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/liveselectiontool.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LIVESELECTIONTOOL_H
-#define LIVESELECTIONTOOL_H
-
-#include "abstractliveedittool.h"
-#include "liverubberbandselectionmanipulator.h"
-#include "livesingleselectionmanipulator.h"
-#include "liveselectionindicator.h"
-
-#include <QtCore/QList>
-#include <QtCore/QTime>
-
-QT_FORWARD_DECLARE_CLASS(QGraphicsItem)
-QT_FORWARD_DECLARE_CLASS(QMouseEvent)
-QT_FORWARD_DECLARE_CLASS(QKeyEvent)
-QT_FORWARD_DECLARE_CLASS(QAction)
-
-namespace QmlJSDebugger {
-
-class LiveSelectionTool : public AbstractLiveEditTool
-{
- Q_OBJECT
-
-public:
- LiveSelectionTool(QDeclarativeViewInspector* editorView);
- ~LiveSelectionTool();
-
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void mouseDoubleClickEvent(QMouseEvent *) {}
- void hoverMoveEvent(QMouseEvent *event);
- void keyPressEvent(QKeyEvent *event);
- void keyReleaseEvent(QKeyEvent *) {}
- void wheelEvent(QWheelEvent *event);
-
- void itemsAboutToRemoved(const QList<QGraphicsItem*> &) {}
-// QVariant itemChange(const QList<QGraphicsItem*> &itemList,
-// QGraphicsItem::GraphicsItemChange change,
-// const QVariant &value );
-
-// void update();
-
- void clear();
-
- void selectedItemsChanged(const QList<QGraphicsItem*> &itemList);
-
- void selectUnderPoint(QMouseEvent *event);
-
- void setSelectOnlyContentItems(bool selectOnlyContentItems);
-
- void setRubberbandSelectionMode(bool value);
-
-private slots:
- void contextMenuElementSelected();
- void contextMenuElementHovered(QAction *action);
- void repaintBoundingRects();
-
-private:
- void createContextMenu(const QList<QGraphicsItem*> &itemList, QPoint globalPos);
- LiveSingleSelectionManipulator::SelectionType getSelectionType(Qt::KeyboardModifiers modifiers);
- bool alreadySelected(const QList<QGraphicsItem*> &itemList) const;
-
-private:
- bool m_rubberbandSelectionMode;
- LiveRubberBandSelectionManipulator m_rubberbandSelectionManipulator;
- LiveSingleSelectionManipulator m_singleSelectionManipulator;
- LiveSelectionIndicator m_selectionIndicator;
- //ResizeIndicator m_resizeIndicator;
- QTime m_mousePressTimer;
- bool m_selectOnlyContentItems;
-
- QList<QWeakPointer<QGraphicsObject> > m_selectedItemList;
-
- QList<QGraphicsItem*> m_contextMenuItemList;
-};
-
-} // namespace QmlJSDebugger
-
-#endif // LIVESELECTIONTOOL_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/livesingleselectionmanipulator.cpp b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/livesingleselectionmanipulator.cpp
deleted file mode 100644
index 9c78018ef9..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/livesingleselectionmanipulator.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "livesingleselectionmanipulator.h"
-
-#include "qdeclarativeviewinspector_p.h"
-
-#include <QtDebug>
-
-namespace QmlJSDebugger {
-
-LiveSingleSelectionManipulator::LiveSingleSelectionManipulator(QDeclarativeViewInspector *editorView)
- : m_editorView(editorView),
- m_isActive(false)
-{
-}
-
-
-void LiveSingleSelectionManipulator::begin(const QPointF &beginPoint)
-{
- m_beginPoint = beginPoint;
- m_isActive = true;
- m_oldSelectionList = QDeclarativeViewInspectorPrivate::get(m_editorView)->selectedItems();
-}
-
-void LiveSingleSelectionManipulator::update(const QPointF &/*updatePoint*/)
-{
- m_oldSelectionList.clear();
-}
-
-void LiveSingleSelectionManipulator::clear()
-{
- m_beginPoint = QPointF();
- m_oldSelectionList.clear();
-}
-
-
-void LiveSingleSelectionManipulator::end(const QPointF &/*updatePoint*/)
-{
- m_oldSelectionList.clear();
- m_isActive = false;
-}
-
-void LiveSingleSelectionManipulator::select(SelectionType selectionType,
- const QList<QGraphicsItem*> &items,
- bool /*selectOnlyContentItems*/)
-{
- QGraphicsItem *selectedItem = 0;
-
- foreach (QGraphicsItem* item, items)
- {
- //FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item);
- if (item
- /*&& !formEditorItem->qmlItemNode().isRootNode()
- && (formEditorItem->qmlItemNode().hasShowContent() || !selectOnlyContentItems)*/)
- {
- selectedItem = item;
- break;
- }
- }
-
- QList<QGraphicsItem*> resultList;
-
- switch (selectionType) {
- case AddToSelection: {
- resultList.append(m_oldSelectionList);
- if (selectedItem && !m_oldSelectionList.contains(selectedItem))
- resultList.append(selectedItem);
- }
- break;
- case ReplaceSelection: {
- if (selectedItem)
- resultList.append(selectedItem);
- }
- break;
- case RemoveFromSelection: {
- resultList.append(m_oldSelectionList);
- if (selectedItem)
- resultList.removeAll(selectedItem);
- }
- break;
- case InvertSelection: {
- if (selectedItem
- && !m_oldSelectionList.contains(selectedItem))
- {
- resultList.append(selectedItem);
- }
- }
- }
-
- m_editorView->setSelectedItems(resultList);
-}
-
-void LiveSingleSelectionManipulator::select(SelectionType selectionType, bool selectOnlyContentItems)
-{
- QDeclarativeViewInspectorPrivate *inspectorPrivate =
- QDeclarativeViewInspectorPrivate::get(m_editorView);
- QList<QGraphicsItem*> itemList = inspectorPrivate->selectableItems(m_beginPoint);
- select(selectionType, itemList, selectOnlyContentItems);
-}
-
-
-bool LiveSingleSelectionManipulator::isActive() const
-{
- return m_isActive;
-}
-
-QPointF LiveSingleSelectionManipulator::beginPoint() const
-{
- return m_beginPoint;
-}
-
-} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/livesingleselectionmanipulator.h b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/livesingleselectionmanipulator.h
deleted file mode 100644
index ac65711a91..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/livesingleselectionmanipulator.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LIVESINGLESELECTIONMANIPULATOR_H
-#define LIVESINGLESELECTIONMANIPULATOR_H
-
-#include <QtCore/QPointF>
-#include <QtCore/QList>
-
-QT_FORWARD_DECLARE_CLASS(QGraphicsItem)
-
-namespace QmlJSDebugger {
-
-class QDeclarativeViewInspector;
-
-class LiveSingleSelectionManipulator
-{
-public:
- LiveSingleSelectionManipulator(QDeclarativeViewInspector *editorView);
-
- enum SelectionType {
- ReplaceSelection,
- AddToSelection,
- RemoveFromSelection,
- InvertSelection
- };
-
- void begin(const QPointF& beginPoint);
- void update(const QPointF& updatePoint);
- void end(const QPointF& updatePoint);
-
- void select(SelectionType selectionType, const QList<QGraphicsItem*> &items,
- bool selectOnlyContentItems);
- void select(SelectionType selectionType, bool selectOnlyContentItems);
-
- void clear();
-
- QPointF beginPoint() const;
-
- bool isActive() const;
-
-private:
- QList<QGraphicsItem*> m_oldSelectionList;
- QPointF m_beginPoint;
- QDeclarativeViewInspector *m_editorView;
- bool m_isActive;
-};
-
-} // namespace QmlJSDebugger
-
-#endif // LIVESINGLESELECTIONMANIPULATOR_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/qdeclarativeviewinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/qdeclarativeviewinspector.cpp
deleted file mode 100644
index ca34f9e029..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/qdeclarativeviewinspector.cpp
+++ /dev/null
@@ -1,445 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativeviewinspector.h"
-#include "qdeclarativeviewinspector_p.h"
-
-#include "liveselectiontool.h"
-#include "zoomtool.h"
-#include "colorpickertool.h"
-#include "livelayeritem.h"
-#include "boundingrecthighlighter.h"
-
-#include <QtQuick1/QDeclarativeItem>
-#include <QtGui/QMouseEvent>
-
-namespace QmlJSDebugger {
-
-QDeclarativeViewInspectorPrivate::QDeclarativeViewInspectorPrivate(QDeclarativeViewInspector *q) :
- q(q)
-{
-}
-
-QDeclarativeViewInspectorPrivate::~QDeclarativeViewInspectorPrivate()
-{
-}
-
-QDeclarativeViewInspector::QDeclarativeViewInspector(QDeclarativeView *view,
- QObject *parent) :
- AbstractViewInspector(parent),
- data(new QDeclarativeViewInspectorPrivate(this))
-{
- data->view = view;
- data->manipulatorLayer = new LiveLayerItem(view->scene());
- data->selectionTool = new LiveSelectionTool(this);
- data->zoomTool = new ZoomTool(this);
- data->colorPickerTool = new ColorPickerTool(this);
- data->boundingRectHighlighter = new BoundingRectHighlighter(this);
- setCurrentTool(data->selectionTool);
-
- // to capture ChildRemoved event when viewport changes
- data->view->installEventFilter(this);
-
- data->setViewport(data->view->viewport());
-
- connect(data->view, SIGNAL(statusChanged(QDeclarativeView::Status)),
- data.data(), SLOT(_q_onStatusChanged(QDeclarativeView::Status)));
-
- connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)),
- SIGNAL(selectedColorChanged(QColor)));
- connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)),
- this, SLOT(sendColorChanged(QColor)));
-
- changeTool(InspectorProtocol::SelectTool);
-}
-
-QDeclarativeViewInspector::~QDeclarativeViewInspector()
-{
-}
-
-void QDeclarativeViewInspector::changeCurrentObjects(const QList<QObject*> &objects)
-{
- QList<QGraphicsItem*> items;
- QList<QGraphicsObject*> gfxObjects;
- foreach (QObject *obj, objects) {
- if (QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem*>(obj)) {
- items << declarativeItem;
- gfxObjects << declarativeItem;
- }
- }
- if (designModeBehavior()) {
- data->setSelectedItemsForTools(items);
- data->clearHighlight();
- data->highlight(gfxObjects);
- }
-}
-
-void QDeclarativeViewInspector::reloadView()
-{
- data->clearHighlight();
- emit reloadRequested();
-}
-
-void QDeclarativeViewInspector::changeTool(InspectorProtocol::Tool tool)
-{
- switch (tool) {
- case InspectorProtocol::ColorPickerTool:
- data->changeToColorPickerTool();
- break;
- case InspectorProtocol::SelectMarqueeTool:
- data->changeToMarqueeSelectTool();
- break;
- case InspectorProtocol::SelectTool:
- data->changeToSingleSelectTool();
- break;
- case InspectorProtocol::ZoomTool:
- data->changeToZoomTool();
- break;
- }
-}
-
-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<AbstractLiveEditTool*>(AbstractViewInspector::currentTool());
-}
-
-QDeclarativeEngine *QDeclarativeViewInspector::declarativeEngine() const
-{
- return data->view->engine();
-}
-
-void QDeclarativeViewInspectorPrivate::setViewport(QWidget *widget)
-{
- if (viewport.data() == widget)
- return;
-
- if (viewport)
- viewport.data()->removeEventFilter(q);
-
- viewport = widget;
- if (viewport) {
- // make sure we get mouse move events
- viewport.data()->setMouseTracking(true);
- viewport.data()->installEventFilter(q);
- }
-}
-
-void QDeclarativeViewInspectorPrivate::clearEditorItems()
-{
- clearHighlight();
- setSelectedItems(QList<QGraphicsItem*>());
-}
-
-bool QDeclarativeViewInspector::eventFilter(QObject *obj, QEvent *event)
-{
- if (obj == data->view) {
- // Event from view
- if (event->type() == QEvent::ChildRemoved) {
- // Might mean that viewport has changed
- if (data->view->viewport() != data->viewport.data())
- data->setViewport(data->view->viewport());
- }
- return QObject::eventFilter(obj, event);
- }
-
- return AbstractViewInspector::eventFilter(obj, event);
-}
-
-bool QDeclarativeViewInspector::leaveEvent(QEvent *event)
-{
- data->clearHighlight();
- return AbstractViewInspector::leaveEvent(event);
-}
-
-bool QDeclarativeViewInspector::mouseMoveEvent(QMouseEvent *event)
-{
- QList<QGraphicsItem*> selItems = data->selectableItems(event->pos());
- if (!selItems.isEmpty()) {
- declarativeView()->setToolTip(currentTool()->titleForItem(selItems.first()));
- } else {
- declarativeView()->setToolTip(QString());
- }
-
- return AbstractViewInspector::mouseMoveEvent(event);
-}
-
-void QDeclarativeViewInspector::reparentQmlObject(QObject *object, QObject *newParent)
-{
- if (!newParent)
- return;
-
- object->setParent(newParent);
- QDeclarativeItem *newParentItem = qobject_cast<QDeclarativeItem*>(newParent);
- QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(object);
- if (newParentItem && item)
- item->setParentItem(newParentItem);
-}
-
-void QDeclarativeViewInspectorPrivate::_q_removeFromSelection(QObject *obj)
-{
- QList<QGraphicsItem*> items = selectedItems();
- if (QGraphicsItem *item = qobject_cast<QGraphicsObject*>(obj))
- items.removeOne(item);
- setSelectedItems(items);
-}
-
-void QDeclarativeViewInspectorPrivate::setSelectedItemsForTools(const QList<QGraphicsItem *> &items)
-{
- foreach (const QWeakPointer<QGraphicsObject> &obj, currentSelection) {
- if (QGraphicsItem *item = obj.data()) {
- if (!items.contains(item)) {
- QObject::disconnect(obj.data(), SIGNAL(destroyed(QObject*)),
- this, SLOT(_q_removeFromSelection(QObject*)));
- currentSelection.removeOne(obj);
- }
- }
- }
-
- foreach (QGraphicsItem *item, items) {
- if (QGraphicsObject *obj = item->toGraphicsObject()) {
- if (!currentSelection.contains(obj)) {
- QObject::connect(obj, SIGNAL(destroyed(QObject*)),
- this, SLOT(_q_removeFromSelection(QObject*)));
- currentSelection.append(obj);
- }
- }
- }
-
- q->currentTool()->updateSelectedItems();
-}
-
-void QDeclarativeViewInspectorPrivate::setSelectedItems(const QList<QGraphicsItem *> &items)
-{
- QList<QWeakPointer<QGraphicsObject> > oldList = currentSelection;
- setSelectedItemsForTools(items);
- if (oldList != currentSelection) {
- QList<QObject*> objectList;
- foreach (const QWeakPointer<QGraphicsObject> &graphicsObject, currentSelection) {
- if (graphicsObject)
- objectList << graphicsObject.data();
- }
-
- q->sendCurrentObjects(objectList);
- }
-}
-
-QList<QGraphicsItem *> QDeclarativeViewInspectorPrivate::selectedItems() const
-{
- QList<QGraphicsItem *> selection;
- foreach (const QWeakPointer<QGraphicsObject> &selectedObject, currentSelection) {
- if (selectedObject.data())
- selection << selectedObject.data();
- }
-
- return selection;
-}
-
-void QDeclarativeViewInspector::setSelectedItems(QList<QGraphicsItem *> items)
-{
- data->setSelectedItems(items);
-}
-
-QList<QGraphicsItem *> QDeclarativeViewInspector::selectedItems() const
-{
- return data->selectedItems();
-}
-
-QDeclarativeView *QDeclarativeViewInspector::declarativeView() const
-{
- return data->view;
-}
-
-void QDeclarativeViewInspectorPrivate::clearHighlight()
-{
- boundingRectHighlighter->clear();
-}
-
-void QDeclarativeViewInspectorPrivate::highlight(const QList<QGraphicsObject *> &items)
-{
- if (items.isEmpty())
- return;
-
- QList<QGraphicsObject*> objectList;
- foreach (QGraphicsItem *item, items) {
- QGraphicsItem *child = item;
-
- if (child) {
- QGraphicsObject *childObject = child->toGraphicsObject();
- if (childObject)
- objectList << childObject;
- }
- }
-
- boundingRectHighlighter->highlight(objectList);
-}
-
-QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::selectableItems(
- const QPointF &scenePos) const
-{
- QList<QGraphicsItem*> itemlist = view->scene()->items(scenePos);
- return filterForSelection(itemlist);
-}
-
-QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::selectableItems(const QPoint &pos) const
-{
- QList<QGraphicsItem*> itemlist = view->items(pos);
- return filterForSelection(itemlist);
-}
-
-QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::selectableItems(
- const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const
-{
- QList<QGraphicsItem*> itemlist = view->scene()->items(sceneRect, selectionMode);
- return filterForSelection(itemlist);
-}
-
-void QDeclarativeViewInspectorPrivate::changeToSingleSelectTool()
-{
- selectionTool->setRubberbandSelectionMode(false);
-
- changeToSelectTool();
-
- emit q->selectToolActivated();
- q->sendCurrentTool(Constants::SelectionToolMode);
-}
-
-void QDeclarativeViewInspectorPrivate::changeToSelectTool()
-{
- if (q->currentTool() == selectionTool)
- return;
-
- q->currentTool()->clear();
- q->setCurrentTool(selectionTool);
- q->currentTool()->clear();
- q->currentTool()->updateSelectedItems();
-}
-
-void QDeclarativeViewInspectorPrivate::changeToMarqueeSelectTool()
-{
- changeToSelectTool();
- selectionTool->setRubberbandSelectionMode(true);
-
- emit q->marqueeSelectToolActivated();
- q->sendCurrentTool(Constants::MarqueeSelectionToolMode);
-}
-
-void QDeclarativeViewInspectorPrivate::changeToZoomTool()
-{
- q->currentTool()->clear();
- q->setCurrentTool(zoomTool);
- q->currentTool()->clear();
-
- emit q->zoomToolActivated();
- q->sendCurrentTool(Constants::ZoomMode);
-}
-
-void QDeclarativeViewInspectorPrivate::changeToColorPickerTool()
-{
- if (q->currentTool() == colorPickerTool)
- return;
-
- q->currentTool()->clear();
- q->setCurrentTool(colorPickerTool);
- q->currentTool()->clear();
-
- emit q->colorPickerActivated();
- q->sendCurrentTool(Constants::ColorPickerMode);
-}
-
-
-static bool isEditorItem(QGraphicsItem *item)
-{
- return (item->type() == Constants::EditorItemType
- || item->type() == Constants::ResizeHandleItemType
- || item->data(Constants::EditorItemDataKey).toBool());
-}
-
-QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::filterForSelection(
- QList<QGraphicsItem*> &itemlist) const
-{
- foreach (QGraphicsItem *item, itemlist) {
- if (isEditorItem(item))
- itemlist.removeOne(item);
- }
-
- return itemlist;
-}
-
-void QDeclarativeViewInspectorPrivate::_q_onStatusChanged(QDeclarativeView::Status status)
-{
- if (status == QDeclarativeView::Ready)
- q->sendReloaded();
-}
-
-// adjusts bounding boxes on edges of screen to be visible
-QRectF QDeclarativeViewInspector::adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace)
-{
- int marginFromEdge = 1;
- QRectF boundingRect(boundingRectInSceneSpace);
- if (qAbs(boundingRect.left()) - 1 < 2)
- boundingRect.setLeft(marginFromEdge);
-
- QRect rect = data->view->rect();
-
- if (boundingRect.right() >= rect.right())
- boundingRect.setRight(rect.right() - marginFromEdge);
-
- if (qAbs(boundingRect.top()) - 1 < 2)
- boundingRect.setTop(marginFromEdge);
-
- if (boundingRect.bottom() >= rect.bottom())
- boundingRect.setBottom(rect.bottom() - marginFromEdge);
-
- return boundingRect;
-}
-
-} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/qdeclarativeviewinspector.h b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/qdeclarativeviewinspector.h
deleted file mode 100644
index 5ac6b42eef..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/qdeclarativeviewinspector.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVEVIEWINSPECTOR_H
-#define QDECLARATIVEVIEWINSPECTOR_H
-
-#include <private/qdeclarativeglobal_p.h>
-
-#include "abstractviewinspector.h"
-
-#include <QtCore/QScopedPointer>
-#include <QtQuick1/QDeclarativeView>
-
-namespace QmlJSDebugger {
-
-class AbstractLiveEditTool;
-class QDeclarativeViewInspectorPrivate;
-
-class QDeclarativeViewInspector : public AbstractViewInspector
-{
- Q_OBJECT
-
-public:
- explicit QDeclarativeViewInspector(QDeclarativeView *view, QObject *parent = 0);
- ~QDeclarativeViewInspector();
-
- // AbstractViewInspector
- void changeCurrentObjects(const QList<QObject*> &objects);
- void reloadView();
- void reparentQmlObject(QObject *object, QObject *newParent);
- void changeTool(InspectorProtocol::Tool tool);
- Qt::WindowFlags windowFlags() const;
- void setWindowFlags(Qt::WindowFlags flags);
- QDeclarativeEngine *declarativeEngine() const;
-
- void setSelectedItems(QList<QGraphicsItem *> items);
- QList<QGraphicsItem *> selectedItems() const;
-
- QDeclarativeView *declarativeView() const;
-
- QRectF adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace);
-
-protected:
- bool eventFilter(QObject *obj, QEvent *event);
-
- bool leaveEvent(QEvent *);
- bool mouseMoveEvent(QMouseEvent *event);
-
- AbstractLiveEditTool *currentTool() const;
-
-private:
- Q_DISABLE_COPY(QDeclarativeViewInspector)
-
- inline QDeclarativeViewInspectorPrivate *d_func() { return data.data(); }
- QScopedPointer<QDeclarativeViewInspectorPrivate> data;
- friend class QDeclarativeViewInspectorPrivate;
- friend class AbstractLiveEditTool;
-};
-
-} // namespace QmlJSDebugger
-
-#endif // QDECLARATIVEVIEWINSPECTOR_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/qdeclarativeviewinspector_p.h b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/qdeclarativeviewinspector_p.h
deleted file mode 100644
index a51f155404..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/qdeclarativeviewinspector_p.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVEVIEWINSPECTOR_P_H
-#define QDECLARATIVEVIEWINSPECTOR_P_H
-
-#include "qdeclarativeviewinspector.h"
-
-#include <QtCore/QScopedPointer>
-#include <QtQuick1/QDeclarativeView>
-#include <QtCore/QWeakPointer>
-#include <QtCore/QPointF>
-
-#include "QtDeclarative/private/qdeclarativeinspectorservice_p.h"
-
-namespace QmlJSDebugger {
-
-class QDeclarativeViewInspector;
-class LiveSelectionTool;
-class ZoomTool;
-class ColorPickerTool;
-class LiveLayerItem;
-class BoundingRectHighlighter;
-class AbstractLiveEditTool;
-
-class QDeclarativeViewInspectorPrivate : public QObject
-{
- Q_OBJECT
-public:
- QDeclarativeViewInspectorPrivate(QDeclarativeViewInspector *);
- ~QDeclarativeViewInspectorPrivate();
-
- QDeclarativeView *view;
- QDeclarativeViewInspector *q;
- QWeakPointer<QWidget> viewport;
-
- QList<QWeakPointer<QGraphicsObject> > currentSelection;
-
- LiveSelectionTool *selectionTool;
- ZoomTool *zoomTool;
- ColorPickerTool *colorPickerTool;
- LiveLayerItem *manipulatorLayer;
-
- BoundingRectHighlighter *boundingRectHighlighter;
-
- void setViewport(QWidget *widget);
-
- void clearEditorItems();
- void changeToSelectTool();
- QList<QGraphicsItem*> filterForSelection(QList<QGraphicsItem*> &itemlist) const;
-
- QList<QGraphicsItem*> selectableItems(const QPoint &pos) const;
- QList<QGraphicsItem*> selectableItems(const QPointF &scenePos) const;
- QList<QGraphicsItem*> selectableItems(const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const;
-
- void setSelectedItemsForTools(const QList<QGraphicsItem *> &items);
- void setSelectedItems(const QList<QGraphicsItem *> &items);
- QList<QGraphicsItem *> selectedItems() const;
-
- void clearHighlight();
- void highlight(const QList<QGraphicsObject *> &item);
- inline void highlight(QGraphicsObject *item)
- { highlight(QList<QGraphicsObject*>() << item); }
-
- void changeToSingleSelectTool();
- void changeToMarqueeSelectTool();
- void changeToZoomTool();
- void changeToColorPickerTool();
-
-public slots:
- void _q_onStatusChanged(QDeclarativeView::Status status);
-
- void _q_removeFromSelection(QObject *);
-
-public:
- static QDeclarativeViewInspectorPrivate *get(QDeclarativeViewInspector *v) { return v->d_func(); }
-};
-
-} // namespace QmlJSDebugger
-
-#endif // QDECLARATIVEVIEWINSPECTOR_P_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/subcomponentmasklayeritem.cpp b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/subcomponentmasklayeritem.cpp
deleted file mode 100644
index 4e3aed2fb4..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/subcomponentmasklayeritem.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "subcomponentmasklayeritem.h"
-
-#include "../qmlinspectorconstants.h"
-#include "qdeclarativeviewinspector.h"
-
-#include <QtGui/QPolygonF>
-
-namespace QmlJSDebugger {
-
-SubcomponentMaskLayerItem::SubcomponentMaskLayerItem(QDeclarativeViewInspector *inspector,
- QGraphicsItem *parentItem) :
- QGraphicsPolygonItem(parentItem),
- m_inspector(inspector),
- m_currentItem(0),
- m_borderRect(new QGraphicsRectItem(this))
-{
- m_borderRect->setRect(0,0,0,0);
- m_borderRect->setPen(QPen(QColor(60, 60, 60), 1));
- m_borderRect->setData(Constants::EditorItemDataKey, QVariant(true));
-
- setBrush(QBrush(QColor(160,160,160)));
- setPen(Qt::NoPen);
-}
-
-int SubcomponentMaskLayerItem::type() const
-{
- return Constants::EditorItemType;
-}
-
-static QRectF resizeRect(const QRectF &newRect, const QRectF &oldRect)
-{
- QRectF result = newRect;
- if (oldRect.left() < newRect.left())
- result.setLeft(oldRect.left());
-
- if (oldRect.top() < newRect.top())
- result.setTop(oldRect.top());
-
- if (oldRect.right() > newRect.right())
- result.setRight(oldRect.right());
-
- if (oldRect.bottom() > newRect.bottom())
- result.setBottom(oldRect.bottom());
-
- return result;
-}
-
-static QPolygonF regionToPolygon(const QRegion &region)
-{
- QPainterPath path;
- foreach (const QRect &rect, region.rects())
- path.addRect(rect);
- return path.toFillPolygon();
-}
-
-void SubcomponentMaskLayerItem::setCurrentItem(QGraphicsItem *item)
-{
- QGraphicsItem *prevItem = m_currentItem;
- m_currentItem = item;
-
- if (!m_currentItem)
- return;
-
- QRect viewRect = m_inspector->declarativeView()->rect();
- viewRect = m_inspector->declarativeView()->mapToScene(viewRect).boundingRect().toRect();
-
- QRectF itemRect = item->boundingRect() | item->childrenBoundingRect();
- itemRect = item->mapRectToScene(itemRect);
-
- // if updating the same item as before, resize the rectangle only bigger, not smaller.
- if (prevItem == item && prevItem != 0) {
- m_itemPolyRect = resizeRect(itemRect, m_itemPolyRect);
- } else {
- m_itemPolyRect = itemRect;
- }
- QRectF borderRect = m_itemPolyRect;
- borderRect.adjust(-1, -1, 1, 1);
- m_borderRect->setRect(borderRect);
-
- const QRegion externalRegion = QRegion(viewRect).subtracted(m_itemPolyRect.toRect());
- setPolygon(regionToPolygon(externalRegion));
-}
-
-QGraphicsItem *SubcomponentMaskLayerItem::currentItem() const
-{
- return m_currentItem;
-}
-
-} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/subcomponentmasklayeritem.h b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/subcomponentmasklayeritem.h
deleted file mode 100644
index 72c74663a1..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/subcomponentmasklayeritem.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SUBCOMPONENTMASKLAYERITEM_H
-#define SUBCOMPONENTMASKLAYERITEM_H
-
-#include <QtWidgets/QGraphicsPolygonItem>
-
-namespace QmlJSDebugger {
-
-class QDeclarativeViewInspector;
-
-class SubcomponentMaskLayerItem : public QGraphicsPolygonItem
-{
-public:
- explicit SubcomponentMaskLayerItem(QDeclarativeViewInspector *inspector,
- QGraphicsItem *parentItem = 0);
- int type() const;
- void setCurrentItem(QGraphicsItem *item);
- void setBoundingBox(const QRectF &boundingBox);
- QGraphicsItem *currentItem() const;
- QRectF itemRect() const;
-
-private:
- QDeclarativeViewInspector *m_inspector;
- QGraphicsItem *m_currentItem;
- QGraphicsRectItem *m_borderRect;
- QRectF m_itemPolyRect;
-};
-
-} // namespace QmlJSDebugger
-
-#endif // SUBCOMPONENTMASKLAYERITEM_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/zoomtool.cpp b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/zoomtool.cpp
deleted file mode 100644
index 92f34b36e8..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/zoomtool.cpp
+++ /dev/null
@@ -1,328 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "zoomtool.h"
-
-#include "qdeclarativeviewinspector_p.h"
-
-#include <QtGui/QMouseEvent>
-#include <QtGui/QWheelEvent>
-#include <QtGui/QKeyEvent>
-#include <QtWidgets/QMenu>
-#include <QtWidgets/QAction>
-
-#include <QtCore/QRectF>
-#include <QtCore/QDebug>
-
-namespace QmlJSDebugger {
-
-ZoomTool::ZoomTool(QDeclarativeViewInspector *view) :
- AbstractLiveEditTool(view),
- m_rubberbandManipulator(),
- m_smoothZoomMultiplier(0.05f),
- m_currentScale(1.0f)
-{
- m_zoomTo100Action = new QAction(tr("Zoom to &100%"), this);
- m_zoomInAction = new QAction(tr("Zoom In"), this);
- m_zoomOutAction = new QAction(tr("Zoom Out"), this);
- m_zoomInAction->setShortcut(QKeySequence(Qt::Key_Plus));
- m_zoomOutAction->setShortcut(QKeySequence(Qt::Key_Minus));
-
-
- LiveLayerItem *layerItem = QDeclarativeViewInspectorPrivate::get(view)->manipulatorLayer;
- QGraphicsObject *layerObject = reinterpret_cast<QGraphicsObject *>(layerItem);
- m_rubberbandManipulator = new LiveRubberBandSelectionManipulator(layerObject, view);
-
-
- connect(m_zoomTo100Action, SIGNAL(triggered()), SLOT(zoomTo100()));
- connect(m_zoomInAction, SIGNAL(triggered()), SLOT(zoomIn()));
- connect(m_zoomOutAction, SIGNAL(triggered()), SLOT(zoomOut()));
-}
-
-ZoomTool::~ZoomTool()
-{
- delete m_rubberbandManipulator;
-}
-
-void ZoomTool::mousePressEvent(QMouseEvent *event)
-{
- m_mousePos = event->pos();
-
- QPointF scenePos = view()->mapToScene(event->pos());
-
- if (event->buttons() & Qt::RightButton) {
- QMenu contextMenu;
- contextMenu.addAction(m_zoomTo100Action);
- contextMenu.addSeparator();
- contextMenu.addAction(m_zoomInAction);
- contextMenu.addAction(m_zoomOutAction);
- contextMenu.exec(event->globalPos());
- } else if (event->buttons() & Qt::LeftButton) {
- m_dragBeginPos = scenePos;
- m_dragStarted = false;
- }
-}
-
-void ZoomTool::mouseMoveEvent(QMouseEvent *event)
-{
- m_mousePos = event->pos();
-
- QPointF scenePos = view()->mapToScene(event->pos());
-
- if (event->buttons() & Qt::LeftButton
- && (QPointF(scenePos - m_dragBeginPos).manhattanLength()
- > Constants::DragStartDistance / 3)
- && !m_dragStarted)
- {
- m_dragStarted = true;
- m_rubberbandManipulator->begin(m_dragBeginPos);
- return;
- }
-
- if (m_dragStarted)
- m_rubberbandManipulator->update(scenePos);
-
-}
-
-void ZoomTool::mouseReleaseEvent(QMouseEvent *event)
-{
- m_mousePos = event->pos();
- QPointF scenePos = view()->mapToScene(event->pos());
-
- if (m_dragStarted) {
- m_rubberbandManipulator->end();
-
- int x1 = qMin(scenePos.x(), m_rubberbandManipulator->beginPoint().x());
- int x2 = qMax(scenePos.x(), m_rubberbandManipulator->beginPoint().x());
- int y1 = qMin(scenePos.y(), m_rubberbandManipulator->beginPoint().y());
- int y2 = qMax(scenePos.y(), m_rubberbandManipulator->beginPoint().y());
-
- QPointF scenePosTopLeft = QPoint(x1, y1);
- QPointF scenePosBottomRight = QPoint(x2, y2);
-
- QRectF sceneArea(scenePosTopLeft, scenePosBottomRight);
-
- m_currentScale = qMin(view()->rect().width() / sceneArea.width(),
- view()->rect().height() / sceneArea.height());
-
-
- QTransform transform;
- transform.scale(m_currentScale, m_currentScale);
-
- view()->setTransform(transform);
- view()->setSceneRect(sceneArea);
- } else {
- Qt::KeyboardModifier modifierKey = Qt::ControlModifier;
-#ifdef Q_OS_MAC
- modifierKey = Qt::AltModifier;
-#endif
- if (event->modifiers() & modifierKey) {
- zoomOut();
- } else {
- zoomIn();
- }
- }
-}
-
-void ZoomTool::zoomIn()
-{
- m_currentScale = nextZoomScale(ZoomIn);
- scaleView(view()->mapToScene(m_mousePos));
-}
-
-void ZoomTool::zoomOut()
-{
- m_currentScale = nextZoomScale(ZoomOut);
- scaleView(view()->mapToScene(m_mousePos));
-}
-
-void ZoomTool::mouseDoubleClickEvent(QMouseEvent *event)
-{
- m_mousePos = event->pos();
-}
-
-
-void ZoomTool::hoverMoveEvent(QMouseEvent *event)
-{
- m_mousePos = event->pos();
-}
-
-
-void ZoomTool::keyPressEvent(QKeyEvent * /*event*/)
-{
-}
-
-void ZoomTool::wheelEvent(QWheelEvent *event)
-{
- if (event->orientation() != Qt::Vertical)
- return;
-
- Qt::KeyboardModifier smoothZoomModifier = Qt::ControlModifier;
- if (event->modifiers() & smoothZoomModifier) {
- int numDegrees = event->delta() / 8;
- m_currentScale += m_smoothZoomMultiplier * (numDegrees / 15.0f);
-
- scaleView(view()->mapToScene(m_mousePos));
-
- } else if (!event->modifiers()) {
- if (event->delta() > 0) {
- m_currentScale = nextZoomScale(ZoomIn);
- } else if (event->delta() < 0) {
- m_currentScale = nextZoomScale(ZoomOut);
- }
- scaleView(view()->mapToScene(m_mousePos));
- }
-}
-
-void ZoomTool::keyReleaseEvent(QKeyEvent *event)
-{
- switch (event->key()) {
- case Qt::Key_Plus:
- zoomIn();
- break;
- case Qt::Key_Minus:
- zoomOut();
- break;
- case Qt::Key_1:
- case Qt::Key_2:
- case Qt::Key_3:
- case Qt::Key_4:
- case Qt::Key_5:
- case Qt::Key_6:
- case Qt::Key_7:
- case Qt::Key_8:
- case Qt::Key_9:
- {
- m_currentScale = ((event->key() - Qt::Key_0) * 1.0f);
- scaleView(view()->mapToScene(m_mousePos)); // view()->mapToScene(view()->rect().center())
- break;
- }
-
- default:
- break;
- }
-
-}
-
-void ZoomTool::clear()
-{
- view()->setCursor(Qt::ArrowCursor);
-}
-
-void ZoomTool::scaleView(const QPointF &centerPos)
-{
-
- QTransform transform;
- transform.scale(m_currentScale, m_currentScale);
- view()->setTransform(transform);
-
- QPointF adjustedCenterPos = centerPos;
- QSize rectSize(view()->rect().width() / m_currentScale,
- view()->rect().height() / m_currentScale);
-
- QRectF sceneRect;
- if (qAbs(m_currentScale - 1.0f) < Constants::ZoomSnapDelta) {
- adjustedCenterPos.rx() = rectSize.width() / 2;
- adjustedCenterPos.ry() = rectSize.height() / 2;
- }
-
- if (m_currentScale < 1.0f) {
- adjustedCenterPos.rx() = rectSize.width() / 2;
- adjustedCenterPos.ry() = rectSize.height() / 2;
- sceneRect.setRect(view()->rect().width() / 2 -rectSize.width() / 2,
- view()->rect().height() / 2 -rectSize.height() / 2,
- rectSize.width(),
- rectSize.height());
- } else {
- sceneRect.setRect(adjustedCenterPos.x() - rectSize.width() / 2,
- adjustedCenterPos.y() - rectSize.height() / 2,
- rectSize.width(),
- rectSize.height());
- }
-
- view()->setSceneRect(sceneRect);
-}
-
-void ZoomTool::zoomTo100()
-{
- m_currentScale = 1.0f;
- scaleView(view()->mapToScene(view()->rect().center()));
-}
-
-qreal ZoomTool::nextZoomScale(ZoomDirection direction) const
-{
- static QList<qreal> zoomScales =
- QList<qreal>()
- << 0.125f
- << 1.0f / 6.0f
- << 0.25f
- << 1.0f / 3.0f
- << 0.5f
- << 2.0f / 3.0f
- << 1.0f
- << 2.0f
- << 3.0f
- << 4.0f
- << 5.0f
- << 6.0f
- << 7.0f
- << 8.0f
- << 12.0f
- << 16.0f
- << 32.0f
- << 48.0f;
-
- if (direction == ZoomIn) {
- for (int i = 0; i < zoomScales.length(); ++i) {
- if (zoomScales[i] > m_currentScale || i == zoomScales.length() - 1)
- return zoomScales[i];
- }
- } else {
- for (int i = zoomScales.length() - 1; i >= 0; --i) {
- if (zoomScales[i] < m_currentScale || i == 0)
- return zoomScales[i];
- }
- }
-
- return 1.0f;
-}
-
-} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/zoomtool.h b/src/plugins/qmltooling/qmldbg_inspector/qtquick1/zoomtool.h
deleted file mode 100644
index de935591cb..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/qtquick1/zoomtool.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ZOOMTOOL_H
-#define ZOOMTOOL_H
-
-#include "abstractliveedittool.h"
-#include "liverubberbandselectionmanipulator.h"
-
-QT_FORWARD_DECLARE_CLASS(QAction)
-
-namespace QmlJSDebugger {
-
-class ZoomTool : public AbstractLiveEditTool
-{
- Q_OBJECT
-
-public:
- enum ZoomDirection {
- ZoomIn,
- ZoomOut
- };
-
- explicit ZoomTool(QDeclarativeViewInspector *view);
-
- virtual ~ZoomTool();
-
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void mouseDoubleClickEvent(QMouseEvent *event);
-
- void hoverMoveEvent(QMouseEvent *event);
- void wheelEvent(QWheelEvent *event);
-
- void keyPressEvent(QKeyEvent *event);
- void keyReleaseEvent(QKeyEvent *keyEvent);
- void itemsAboutToRemoved(const QList<QGraphicsItem*> &) {}
-
- void clear();
-
-protected:
- void selectedItemsChanged(const QList<QGraphicsItem*> &) {}
-
-private slots:
- void zoomTo100();
- void zoomIn();
- void zoomOut();
-
-private:
- qreal nextZoomScale(ZoomDirection direction) const;
- void scaleView(const QPointF &centerPos);
-
-private:
- bool m_dragStarted;
- QPoint m_mousePos; // in view coords
- QPointF m_dragBeginPos;
- QAction *m_zoomTo100Action;
- QAction *m_zoomInAction;
- QAction *m_zoomOutAction;
- LiveRubberBandSelectionManipulator *m_rubberbandManipulator;
-
- qreal m_smoothZoomMultiplier;
- qreal m_currentScale;
-};
-
-} // namespace QmlJSDebugger
-
-#endif // ZOOMTOOL_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/sghighlight.cpp b/src/plugins/qmltooling/qmldbg_inspector/sghighlight.cpp
deleted file mode 100644
index 1af789d389..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/sghighlight.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "sghighlight.h"
-
-#include <QtGui/QPainter>
-
-namespace QmlJSDebugger {
-
-SGHighlight::SGHighlight(QQuickItem *item, QQuickItem *parent)
- : QQuickPaintedItem(parent)
-{
- setItem(item);
-}
-
-void SGHighlight::setItem(QQuickItem *item)
-{
- if (m_item)
- m_item.data()->disconnect(this);
-
- if (item) {
- connect(item, SIGNAL(xChanged()), SLOT(adjust()));
- connect(item, SIGNAL(yChanged()), SLOT(adjust()));
- connect(item, SIGNAL(widthChanged()), SLOT(adjust()));
- connect(item, SIGNAL(heightChanged()), SLOT(adjust()));
- connect(item, SIGNAL(rotationChanged()), SLOT(adjust()));
- connect(item, SIGNAL(transformOriginChanged(TransformOrigin)),
- SLOT(adjust()));
- }
-
- m_item = item;
- adjust();
-}
-
-void SGHighlight::adjust()
-{
- const QQuickItem *item = m_item.data();
- setSize(QSizeF(item->width(), item->height()));
- setPos(parentItem()->mapFromItem(item->parentItem(), item->pos()));
- setRotation(item->rotation());
- setTransformOrigin(item->transformOrigin());
-}
-
-
-void SGSelectionHighlight::paint(QPainter *painter)
-{
- painter->setPen(QColor(108, 141, 221));
- painter->drawRect(QRect(0, 0, width() - 1, height() - 1));
-}
-
-
-void SGHoverHighlight::paint(QPainter *painter)
-{
- painter->setPen(QPen(QColor(0, 22, 159)));
- painter->drawRect(QRect(1, 1, width() - 3, height() - 3));
- painter->setPen(QColor(158, 199, 255));
- painter->drawRect(QRect(0, 0, width() - 1, height() - 1));
-}
-
-} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/sghighlight.h b/src/plugins/qmltooling/qmldbg_inspector/sghighlight.h
deleted file mode 100644
index 8d5659cc5d..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/sghighlight.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SGHIGHLIGHT_H
-#define SGHIGHLIGHT_H
-
-#include <QtCore/QWeakPointer>
-#include <QtDeclarative/QQuickPaintedItem>
-
-namespace QmlJSDebugger {
-
-class SGHighlight : public QQuickPaintedItem
-{
- Q_OBJECT
-
-public:
- SGHighlight(QQuickItem *parent) : QQuickPaintedItem(parent) {}
- SGHighlight(QQuickItem *item, QQuickItem *parent);
-
- void setItem(QQuickItem *item);
-
-private slots:
- void adjust();
-
-private:
- QWeakPointer<QQuickItem> m_item;
-};
-
-/**
- * A highlight suitable for indicating selection.
- */
-class SGSelectionHighlight : public SGHighlight
-{
-public:
- SGSelectionHighlight(QQuickItem *item, QQuickItem *parent)
- : SGHighlight(item, parent)
- {}
-
- void paint(QPainter *painter);
-};
-
-/**
- * A highlight suitable for indicating hover.
- */
-class SGHoverHighlight : public SGHighlight
-{
-public:
- SGHoverHighlight(QQuickItem *parent)
- : SGHighlight(parent)
- {
- setZ(1); // hover highlight on top of selection highlight
- }
-
- void paint(QPainter *painter);
-};
-
-} // namespace QmlJSDebugger
-
-#endif // SGHIGHLIGHT_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/sgselectiontool.cpp b/src/plugins/qmltooling/qmldbg_inspector/sgselectiontool.cpp
deleted file mode 100644
index bdfc28f5ec..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/sgselectiontool.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "sgselectiontool.h"
-
-#include "sghighlight.h"
-#include "sgviewinspector.h"
-
-#include <QtWidgets/QMenu>
-#include <QtGui/QMouseEvent>
-#include <QtDeclarative/QQuickView>
-#include <QtDeclarative/QQuickItem>
-
-namespace QmlJSDebugger {
-
-SGSelectionTool::SGSelectionTool(SGViewInspector *inspector) :
- AbstractTool(inspector),
- m_hoverHighlight(new SGHoverHighlight(inspector->overlay()))
-{
-}
-
-void SGSelectionTool::leaveEvent(QEvent *)
-{
- m_hoverHighlight->setVisible(false);
-}
-
-void SGSelectionTool::mousePressEvent(QMouseEvent *event)
-{
- if (event->button() == Qt::LeftButton) {
- if (QQuickItem *item = inspector()->topVisibleItemAt(event->pos()))
- inspector()->setSelectedItems(QList<QQuickItem*>() << item);
- } else if (event->button() == Qt::RightButton) {
- QList<QQuickItem*> items = inspector()->itemsAt(event->pos());
- createContextMenu(items, event->globalPos());
- }
-}
-
-void SGSelectionTool::hoverMoveEvent(QMouseEvent *event)
-{
- QQuickItem *item = inspector()->topVisibleItemAt(event->pos());
- if (!item) {
- m_hoverHighlight->setVisible(false);
- } else {
- m_hoverHighlight->setItem(item);
- m_hoverHighlight->setVisible(true);
- }
-}
-
-void SGSelectionTool::createContextMenu(const QList<QQuickItem *> &items, QPoint pos)
-{
- QMenu contextMenu;
- connect(&contextMenu, SIGNAL(hovered(QAction*)),
- this, SLOT(contextMenuElementHovered(QAction*)));
-
- const QList<QQuickItem*> selectedItems = inspector()->selectedItems();
- int shortcutKey = Qt::Key_1;
-
- foreach (QQuickItem *item, items) {
- const QString title = inspector()->titleForItem(item);
- QAction *elementAction = contextMenu.addAction(title);
- elementAction->setData(QVariant::fromValue(item));
-
- connect(elementAction, SIGNAL(triggered()), this, SLOT(contextMenuElementSelected()));
-
- if (selectedItems.contains(item)) {
- QFont font = elementAction->font();
- font.setBold(true);
- elementAction->setFont(font);
- }
-
- if (shortcutKey <= Qt::Key_9) {
- elementAction->setShortcut(QKeySequence(shortcutKey));
- shortcutKey++;
- }
- }
-
- contextMenu.exec(pos);
-}
-
-void SGSelectionTool::contextMenuElementHovered(QAction *action)
-{
- if (QQuickItem *item = action->data().value<QQuickItem*>())
- m_hoverHighlight->setItem(item);
-}
-
-void SGSelectionTool::contextMenuElementSelected()
-{
- if (QQuickItem *item = static_cast<QAction*>(sender())->data().value<QQuickItem*>())
- inspector()->setSelectedItems(QList<QQuickItem*>() << item);
-}
-
-SGViewInspector *SGSelectionTool::inspector() const
-{
- return static_cast<SGViewInspector*>(AbstractTool::inspector());
-}
-
-} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/sgselectiontool.h b/src/plugins/qmltooling/qmldbg_inspector/sgselectiontool.h
deleted file mode 100644
index 587701733d..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/sgselectiontool.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SGSELECTIONTOOL_H
-#define SGSELECTIONTOOL_H
-
-#include "abstracttool.h"
-
-#include <QtCore/QList>
-#include <QtCore/QPoint>
-
-QT_FORWARD_DECLARE_CLASS(QAction)
-QT_FORWARD_DECLARE_CLASS(QQuickItem)
-
-namespace QmlJSDebugger {
-
-class SGViewInspector;
-class SGHoverHighlight;
-
-class SGSelectionTool : public AbstractTool
-{
- Q_OBJECT
-public:
- explicit SGSelectionTool(SGViewInspector *inspector);
-
- void leaveEvent(QEvent *);
-
- void mousePressEvent(QMouseEvent *);
- void mouseMoveEvent(QMouseEvent *) {}
- void mouseReleaseEvent(QMouseEvent *) {}
- void mouseDoubleClickEvent(QMouseEvent *) {}
-
- void hoverMoveEvent(QMouseEvent *);
- void wheelEvent(QWheelEvent *) {}
-
- void keyPressEvent(QKeyEvent *) {}
- void keyReleaseEvent(QKeyEvent *) {}
-
-private slots:
- void contextMenuElementHovered(QAction *action);
- void contextMenuElementSelected();
-
-private:
- void createContextMenu(const QList<QQuickItem*> &items, QPoint pos);
-
- SGViewInspector *inspector() const;
-
- SGHoverHighlight *m_hoverHighlight;
-};
-
-} // namespace QmlJSDebugger
-
-#endif // SGSELECTIONTOOL_H
diff --git a/src/plugins/qmltooling/qmldbg_inspector/sgviewinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/sgviewinspector.cpp
deleted file mode 100644
index 7b573cab27..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/sgviewinspector.cpp
+++ /dev/null
@@ -1,330 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "sgviewinspector.h"
-
-#include "qdeclarativeinspectorprotocol.h"
-#include "sghighlight.h"
-#include "sgselectiontool.h"
-
-#include <QtDeclarative/private/qquickitem_p.h>
-
-#include <QtDeclarative/QQuickView>
-#include <QtDeclarative/QQuickItem>
-
-#include <cfloat>
-
-namespace QmlJSDebugger {
-
-/*
- * Collects all the items at the given position, from top to bottom.
- */
-static void collectItemsAt(QQuickItem *item, const QPointF &pos, QQuickItem *overlay,
- QList<QQuickItem *> &resultList)
-{
- if (item == overlay)
- return;
-
- if (item->flags() & QQuickItem::ItemClipsChildrenToShape) {
- if (!QRectF(0, 0, item->width(), item->height()).contains(pos))
- return;
- }
-
- QList<QQuickItem *> children = QQuickItemPrivate::get(item)->paintOrderChildItems();
- for (int i = children.count() - 1; i >= 0; --i) {
- QQuickItem *child = children.at(i);
- collectItemsAt(child, item->mapToItem(child, pos), overlay, resultList);
- }
-
- if (!QRectF(0, 0, item->width(), item->height()).contains(pos))
- return;
-
- resultList.append(item);
-}
-
-/*
- * Returns the first visible item at the given position, or 0 when no such
- * child exists.
- */
-static QQuickItem *itemAt(QQuickItem *item, const QPointF &pos, QQuickItem *overlay)
-{
- if (item == overlay)
- return 0;
-
- if (!item->isVisible() || item->opacity() == 0.0)
- return 0;
-
- if (item->flags() & QQuickItem::ItemClipsChildrenToShape) {
- if (!QRectF(0, 0, item->width(), item->height()).contains(pos))
- return 0;
- }
-
- QList<QQuickItem *> children = QQuickItemPrivate::get(item)->paintOrderChildItems();
- for (int i = children.count() - 1; i >= 0; --i) {
- QQuickItem *child = children.at(i);
- if (QQuickItem *betterCandidate = itemAt(child, item->mapToItem(child, pos), overlay))
- return betterCandidate;
- }
-
- if (!(item->flags() & QQuickItem::ItemHasContents))
- return 0;
-
- if (!QRectF(0, 0, item->width(), item->height()).contains(pos))
- return 0;
-
- return item;
-}
-
-
-SGViewInspector::SGViewInspector(QQuickView *view, QObject *parent) :
- AbstractViewInspector(parent),
- m_view(view),
- m_overlay(new QQuickItem),
- m_selectionTool(new SGSelectionTool(this)),
- m_designMode(true)
-{
- // Try to make sure the overlay is always on top
- m_overlay->setZ(FLT_MAX);
-
- if (QQuickItem *root = view->rootItem())
- m_overlay->setParentItem(root);
-
- view->installEventFilter(this);
- setCurrentTool(m_selectionTool);
-}
-
-void SGViewInspector::changeCurrentObjects(const QList<QObject*> &objects)
-{
- QList<QQuickItem*> items;
- foreach (QObject *obj, objects)
- if (QQuickItem *item = qobject_cast<QQuickItem*>(obj))
- items << item;
-
- syncSelectedItems(items);
-}
-
-void SGViewInspector::reloadView()
-{
- // TODO
- emit reloadRequested();
-}
-
-void SGViewInspector::reparentQmlObject(QObject *object, QObject *newParent)
-{
- if (!newParent)
- return;
-
- object->setParent(newParent);
- QQuickItem *newParentItem = qobject_cast<QQuickItem*>(newParent);
- QQuickItem *item = qobject_cast<QQuickItem*>(object);
- if (newParentItem && item)
- item->setParentItem(newParentItem);
-}
-
-void SGViewInspector::changeTool(InspectorProtocol::Tool tool)
-{
- switch (tool) {
- case InspectorProtocol::ColorPickerTool:
- // TODO
- emit colorPickerActivated();
- break;
- case InspectorProtocol::SelectMarqueeTool:
- // TODO
- emit marqueeSelectToolActivated();
- break;
- case InspectorProtocol::SelectTool:
- setCurrentTool(m_selectionTool);
- emit selectToolActivated();
- break;
- case InspectorProtocol::ZoomTool:
- // TODO
- emit zoomToolActivated();
- break;
- }
-}
-
-QWindow *getMasterWindow(QWindow *w)
-{
- QWindow *p = w->parent();
- while (p) {
- w = p;
- p = p->parent();
- }
- return w;
-}
-
-Qt::WindowFlags SGViewInspector::windowFlags() const
-{
- return getMasterWindow(m_view)->windowFlags();
-}
-
-void SGViewInspector::setWindowFlags(Qt::WindowFlags flags)
-{
- QWindow *w = getMasterWindow(m_view);
- w->setWindowFlags(flags);
- // make flags are applied
- w->setVisible(false);
- w->setVisible(true);
-}
-
-QDeclarativeEngine *SGViewInspector::declarativeEngine() const
-{
- return m_view->engine();
-}
-
-QQuickItem *SGViewInspector::topVisibleItemAt(const QPointF &pos) const
-{
- QQuickItem *root = m_view->rootItem();
- return itemAt(root, root->mapFromScene(pos), m_overlay);
-}
-
-QList<QQuickItem *> SGViewInspector::itemsAt(const QPointF &pos) const
-{
- QQuickItem *root = m_view->rootItem();
- QList<QQuickItem *> resultList;
- collectItemsAt(root, root->mapFromScene(pos), m_overlay, resultList);
- return resultList;
-}
-
-QList<QQuickItem*> SGViewInspector::selectedItems() const
-{
- QList<QQuickItem *> selection;
- foreach (const QWeakPointer<QQuickItem> &selectedItem, m_selectedItems) {
- if (selectedItem)
- selection << selectedItem.data();
- }
- return selection;
-}
-
-void SGViewInspector::setSelectedItems(const QList<QQuickItem *> &items)
-{
- if (!syncSelectedItems(items))
- return;
-
- QList<QObject*> objectList;
- foreach (QQuickItem *item, items)
- objectList << item;
-
- sendCurrentObjects(objectList);
-}
-
-bool SGViewInspector::syncSelectedItems(const QList<QQuickItem *> &items)
-{
- bool selectionChanged = false;
-
- // Disconnect and remove items that are no longer selected
- foreach (const QWeakPointer<QQuickItem> &item, m_selectedItems) {
- if (!item) // Don't see how this can happen due to handling of destroyed()
- continue;
- if (items.contains(item.data()))
- continue;
-
- selectionChanged = true;
- item.data()->disconnect(this);
- m_selectedItems.removeOne(item);
- delete m_highlightItems.take(item.data());
- }
-
- // Connect and add newly selected items
- foreach (QQuickItem *item, items) {
- if (m_selectedItems.contains(item))
- continue;
-
- selectionChanged = true;
- connect(item, SIGNAL(destroyed(QObject*)), this, SLOT(removeFromSelectedItems(QObject*)));
- m_selectedItems.append(item);
- m_highlightItems.insert(item, new SGSelectionHighlight(item, m_overlay));
- }
-
- return selectionChanged;
-}
-
-void SGViewInspector::removeFromSelectedItems(QObject *object)
-{
- if (QQuickItem *item = qobject_cast<QQuickItem*>(object)) {
- if (m_selectedItems.removeOne(item))
- delete m_highlightItems.take(item);
- }
-}
-
-bool SGViewInspector::eventFilter(QObject *obj, QEvent *event)
-{
- if (obj != m_view)
- return QObject::eventFilter(obj, event);
-
- return AbstractViewInspector::eventFilter(obj, event);
-}
-
-bool SGViewInspector::mouseMoveEvent(QMouseEvent *event)
-{
- // TODO
-// if (QQuickItem *item = topVisibleItemAt(event->pos()))
-// m_view->setToolTip(titleForItem(item));
-// else
-// m_view->setToolTip(QString());
-
- return AbstractViewInspector::mouseMoveEvent(event);
-}
-
-QString SGViewInspector::titleForItem(QQuickItem *item) const
-{
- QString className = QLatin1String(item->metaObject()->className());
- QString objectStringId = idStringForObject(item);
-
- className.remove(QRegExp(QLatin1String("_QMLTYPE_\\d+")));
- className.remove(QRegExp(QLatin1String("_QML_\\d+")));
- if (className.startsWith(QLatin1String("QQuick")))
- className = className.mid(6);
-
- QString constructedName;
-
- if (!objectStringId.isEmpty()) {
- constructedName = objectStringId + QLatin1String(" (") + className + QLatin1Char(')');
- } else if (!item->objectName().isEmpty()) {
- constructedName = item->objectName() + QLatin1String(" (") + className + QLatin1Char(')');
- } else {
- constructedName = className;
- }
-
- return constructedName;
-}
-
-} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/sgviewinspector.h b/src/plugins/qmltooling/qmldbg_inspector/sgviewinspector.h
deleted file mode 100644
index 788d6a0924..0000000000
--- a/src/plugins/qmltooling/qmldbg_inspector/sgviewinspector.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSGVIEWINSPECTOR_H
-#define QSGVIEWINSPECTOR_H
-
-#include "abstractviewinspector.h"
-
-#include <QtCore/QWeakPointer>
-#include <QtCore/QHash>
-
-QT_BEGIN_NAMESPACE
-class QQuickView;
-class QQuickItem;
-QT_END_NAMESPACE
-
-namespace QmlJSDebugger {
-
-class SGSelectionTool;
-class SGSelectionHighlight;
-
-class SGViewInspector : public AbstractViewInspector
-{
- Q_OBJECT
-public:
- explicit SGViewInspector(QQuickView *view, QObject *parent = 0);
-
- // AbstractViewInspector
- void changeCurrentObjects(const QList<QObject*> &objects);
- void reloadView();
- void reparentQmlObject(QObject *object, QObject *newParent);
- void changeTool(InspectorProtocol::Tool tool);
- Qt::WindowFlags windowFlags() const;
- void setWindowFlags(Qt::WindowFlags flags);
- QDeclarativeEngine *declarativeEngine() const;
-
- QQuickView *view() const { return m_view; }
- QQuickItem *overlay() const { return m_overlay; }
-
- QQuickItem *topVisibleItemAt(const QPointF &pos) const;
- QList<QQuickItem *> itemsAt(const QPointF &pos) const;
-
- QList<QQuickItem *> selectedItems() const;
- void setSelectedItems(const QList<QQuickItem*> &items);
-
- QString titleForItem(QQuickItem *item) const;
-
-protected:
- bool eventFilter(QObject *obj, QEvent *event);
-
- bool mouseMoveEvent(QMouseEvent *);
-
-private slots:
- void removeFromSelectedItems(QObject *);
-
-private:
- bool syncSelectedItems(const QList<QQuickItem*> &items);
-
- QQuickView *m_view;
- QQuickItem *m_overlay;
-
- SGSelectionTool *m_selectionTool;
-
- QList<QWeakPointer<QQuickItem> > m_selectedItems;
- QHash<QQuickItem*, SGSelectionHighlight*> m_highlightItems;
-
- bool m_designMode;
-};
-
-} // namespace QmlJSDebugger
-
-#endif // QSGVIEWINSPECTOR_H