From 01dc7e2ea476e0e6dcdce2e72979bbc858f4057d Mon Sep 17 00:00:00 2001 From: Matthew Vogt Date: Tue, 31 Jan 2012 16:52:36 +1000 Subject: Remove QtQuick1 elements from qtdeclarative QtQuick1 is now contained in a separate repository. Task-number: QTBUG-23737 Change-Id: I09eae67af5693a22b896b916f816f73ccc3a89b1 Reviewed-by: Martin Jones --- src/plugins/accessible/accessible.pro | 1 - src/plugins/accessible/qtquick1/main.cpp | 106 ----- .../qtquick1/qaccessibledeclarativeitem.cpp | 235 ----------- .../qtquick1/qaccessibledeclarativeitem.h | 82 ---- .../qtquick1/qaccessibledeclarativeview.cpp | 90 ----- .../qtquick1/qaccessibledeclarativeview.h | 74 ---- src/plugins/accessible/qtquick1/qtquick1.pro | 22 - .../qmldbg_qtquick1/abstractliveedittool.cpp | 197 --------- .../qmldbg_qtquick1/abstractliveedittool.h | 106 ----- .../qmldbg_qtquick1/boundingrecthighlighter.cpp | 241 ----------- .../qmldbg_qtquick1/boundingrecthighlighter.h | 117 ------ .../qmltooling/qmldbg_qtquick1/colorpickertool.cpp | 100 ----- .../qmltooling/qmldbg_qtquick1/colorpickertool.h | 94 ----- .../qmltooling/qmldbg_qtquick1/livelayeritem.cpp | 94 ----- .../qmltooling/qmldbg_qtquick1/livelayeritem.h | 69 ---- .../liverubberbandselectionmanipulator.cpp | 167 -------- .../liverubberbandselectionmanipulator.h | 98 ----- .../qmldbg_qtquick1/liveselectionindicator.cpp | 120 ------ .../qmldbg_qtquick1/liveselectionindicator.h | 82 ---- .../qmldbg_qtquick1/liveselectionrectangle.cpp | 115 ------ .../qmldbg_qtquick1/liveselectionrectangle.h | 79 ---- .../qmldbg_qtquick1/liveselectiontool.cpp | 425 -------------------- .../qmltooling/qmldbg_qtquick1/liveselectiontool.h | 122 ------ .../livesingleselectionmanipulator.cpp | 153 ------- .../livesingleselectionmanipulator.h | 91 ----- .../qmldbg_qtquick1/qdeclarativeviewinspector.cpp | 447 --------------------- .../qmldbg_qtquick1/qdeclarativeviewinspector.h | 102 ----- .../qmldbg_qtquick1/qdeclarativeviewinspector_p.h | 121 ------ .../qmltooling/qmldbg_qtquick1/qmldbg_qtquick1.pro | 50 --- .../qmltooling/qmldbg_qtquick1/qtquick1plugin.cpp | 88 ---- .../qmltooling/qmldbg_qtquick1/qtquick1plugin.h | 77 ---- .../qmldbg_qtquick1/subcomponentmasklayeritem.cpp | 132 ------ .../qmldbg_qtquick1/subcomponentmasklayeritem.h | 73 ---- .../qmltooling/qmldbg_qtquick1/zoomtool.cpp | 330 --------------- src/plugins/qmltooling/qmldbg_qtquick1/zoomtool.h | 109 ----- src/plugins/qmltooling/qmltooling.pro | 1 - 36 files changed, 4610 deletions(-) delete mode 100644 src/plugins/accessible/qtquick1/main.cpp delete mode 100644 src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.cpp delete mode 100644 src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.h delete mode 100644 src/plugins/accessible/qtquick1/qaccessibledeclarativeview.cpp delete mode 100644 src/plugins/accessible/qtquick1/qaccessibledeclarativeview.h delete mode 100644 src/plugins/accessible/qtquick1/qtquick1.pro delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/abstractliveedittool.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/abstractliveedittool.h delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/boundingrecthighlighter.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/boundingrecthighlighter.h delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/colorpickertool.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/colorpickertool.h delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/livelayeritem.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/livelayeritem.h delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/liverubberbandselectionmanipulator.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/liverubberbandselectionmanipulator.h delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/liveselectionindicator.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/liveselectionindicator.h delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/liveselectionrectangle.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/liveselectionrectangle.h delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/liveselectiontool.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/liveselectiontool.h delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/livesingleselectionmanipulator.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/livesingleselectionmanipulator.h delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/qdeclarativeviewinspector.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/qdeclarativeviewinspector.h delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/qdeclarativeviewinspector_p.h delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/qmldbg_qtquick1.pro delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/qtquick1plugin.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/qtquick1plugin.h delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/subcomponentmasklayeritem.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/subcomponentmasklayeritem.h delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/zoomtool.cpp delete mode 100644 src/plugins/qmltooling/qmldbg_qtquick1/zoomtool.h (limited to 'src/plugins') diff --git a/src/plugins/accessible/accessible.pro b/src/plugins/accessible/accessible.pro index 71165af784..77cba71ace 100644 --- a/src/plugins/accessible/accessible.pro +++ b/src/plugins/accessible/accessible.pro @@ -1,3 +1,2 @@ TEMPLATE = subdirs SUBDIRS += quick -SUBDIRS += qtquick1 diff --git a/src/plugins/accessible/qtquick1/main.cpp b/src/plugins/accessible/qtquick1/main.cpp deleted file mode 100644 index 12c6fcdc3a..0000000000 --- a/src/plugins/accessible/qtquick1/main.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 "qdeclarativeaccessible.h" -#include "qaccessibledeclarativeview.h" -#include "qaccessibledeclarativeitem.h" - -#include -#include - -#include -#include -#include -#include - -#ifndef QT_NO_ACCESSIBILITY - -QT_BEGIN_NAMESPACE - -class AccessibleQtQuick1Factory : public QAccessiblePlugin -{ -public: - AccessibleQtQuick1Factory(); - - QStringList keys() const; - QAccessibleInterface *create(const QString &classname, QObject *object); -}; - -AccessibleQtQuick1Factory::AccessibleQtQuick1Factory() -{ -} - -QStringList AccessibleQtQuick1Factory::keys() const -{ - QStringList list; - list << QLatin1String("QDeclarativeView"); - list << QLatin1String("QDeclarativeItem"); - return list; -} - -QAccessibleInterface *AccessibleQtQuick1Factory::create(const QString &classname, QObject *object) -{ - if (classname == QLatin1String("QDeclarativeView")) { - QWidget *widget = qobject_cast(object); - if (qobject_cast(widget) != 0) - return new QAccessibleDeclarativeView(widget); - } else if (classname == QLatin1String("QDeclarativeItem")) { - QDeclarativeItem *item = qobject_cast(object); - if (!item->scene()) - return 0; - - QList views = item->scene()->views(); - if (views.isEmpty()) - return 0; - QGraphicsView *view = views.at(0); // Accessibility support for the first view only. - // (Not a problem for QDeclarative) - return new QAccessibleDeclarativeItem(item, view); - } - - return 0; -} - -Q_EXPORT_STATIC_PLUGIN(AccessibleQtQuick1Factory) -Q_EXPORT_PLUGIN2(qtaccessibleqtquick1, AccessibleQtQuick1Factory) - -QT_END_NAMESPACE - -#endif // QT_NO_ACCESSIBILITY diff --git a/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.cpp b/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.cpp deleted file mode 100644 index 6748e2602f..0000000000 --- a/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.cpp +++ /dev/null @@ -1,235 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 "qaccessibledeclarativeitem.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -QAccessibleDeclarativeItem::QAccessibleDeclarativeItem(QGraphicsObject *item, QGraphicsView *view) - :QDeclarativeAccessible(item) - ,m_item(item) - ,m_view(view) -{ - -} - -int QAccessibleDeclarativeItem::childCount() const -{ - QList children = m_item->childItems(); - return children.count(); -} - -QRect QAccessibleDeclarativeItem::rect() const -{ - QRectF sceneRect = m_item->sceneTransform().mapRect(m_item->boundingRect()); - QPoint pos = m_view->mapFromScene(m_view->mapToGlobal(sceneRect.topLeft().toPoint())); - QSize size = sceneRect.size().toSize(); - return QRect(pos, size); -} - -QRect QAccessibleDeclarativeItem::viewRect() const -{ - QPoint screenPos = m_view->mapToGlobal(m_view->pos()); - return QRect(screenPos, m_view->size()); -} - -bool QAccessibleDeclarativeItem::clipsChildren() const -{ - return static_cast(m_item)->clip(); -} - -static inline bool isAncestor(const QObject *ancestorCandidate, const QObject *child) -{ - while (child) { - if (child == ancestorCandidate) - return true; - child = child->parent(); - } - return false; -} - - -QAccessibleInterface *QAccessibleDeclarativeItem::parent() const -{ - QGraphicsItem *parent = m_item->parentItem(); - QGraphicsObject *parentObj = parent ? parent->toGraphicsObject() : 0; - if (parent && !parentObj) - qWarning("Can not make QGraphicsItems accessible"); - QAccessibleInterface *ancestor = (parentObj - ? new QAccessibleDeclarativeItem(parentObj, m_view) - : QAccessible::queryAccessibleInterface(m_view)); - return ancestor; -} - -QAccessibleInterface *QAccessibleDeclarativeItem::child(int index) const -{ - QList children = m_item->childItems(); - - if (index >= children.count()) - return 0; - - QGraphicsItem *child = children.at(index); - QGraphicsObject *childObject = qobject_cast(child); - if (!childObject) - return 0; - - return new QAccessibleDeclarativeItem(childObject, m_view); -} - -int QAccessibleDeclarativeItem::navigate(QAccessible::RelationFlag rel, int entry, QAccessibleInterface **target) const -{ - Q_UNUSED(rel); - Q_UNUSED(entry); - *target = 0; - return -1; -} - -/*! \reimp */ -QAccessibleInterface *QAccessibleDeclarativeItem::focusChild() const -{ - QGraphicsObject *focusObject = 0; - if (m_item->hasFocus()) { - focusObject = m_item->toGraphicsObject(); - } else { - if (QGraphicsScene *scene = m_view->scene()) { - if (QGraphicsItem *focusItem = scene->focusItem()) { - if (m_item->isAncestorOf(focusItem)) { - focusObject = focusItem->toGraphicsObject(); - } - } - } - } - if (focusObject) - return new QAccessibleDeclarativeItem(focusObject, m_view); //###queryAccessibleInterface? - return 0; -} - -int QAccessibleDeclarativeItem::indexOfChild(const QAccessibleInterface *iface) const -{ - // ### No QAccessibleInterfaces are created with a QGraphicsItem. - // However, we want to support QML, not QGraphicsView in general. - // And since the UI is written in QML, this means we can assume that *all* - // QGraphicsItems are actually QGraphicsObjects - - const QGraphicsObject *childObj = static_cast(iface->object()); - if (m_item == childObj) - return 0; - - QList kids = m_item->childItems(); - int index = kids.indexOf(const_cast(static_cast(childObj))); - if (index != -1) { - ++index; - } - return index; -} - -QAccessible::State QAccessibleDeclarativeItem::state() const -{ - QAccessible::State state; - state.focused = m_item->hasFocus(); - return state; -} - -QAccessible::Role QAccessibleDeclarativeItem::role() const -{ - // ### Workaround for setAccessibleRole() not working. - // Text items are special since they are defined - // entirely from C++ (setting the role from QML works.) -// if (qobject_cast(m_item)) -// return QAccessible::StaticText; - - QVariant v = QDeclarativeAccessibleAttached::property(m_item, "role"); - bool ok; - QAccessible::Role role = (QAccessible::Role)v.toInt(&ok); - if (!ok) // Not sure if this check is needed. - role = QAccessible::Pane; - return role; -} - -bool QAccessibleDeclarativeItem::isAccessible() const -{ - return true; -} - -QString QAccessibleDeclarativeItem::text(QAccessible::Text textType) const -{ - // handles generic behaviour not specific to an item - switch (textType) { - case QAccessible::Name: { - QVariant accessibleName = QDeclarativeAccessibleAttached::property(object(), "name"); - if (!accessibleName.isNull()) - return accessibleName.toString(); - break;} - case QAccessible::Description: { - QVariant accessibleDecription = QDeclarativeAccessibleAttached::property(object(), "description"); - if (!accessibleDecription.isNull()) - return accessibleDecription.toString(); - break;} - case QAccessible::Value: - case QAccessible::Help: - case QAccessible::Accelerator: - default: - break; - } - - // the following blocks handles item-specific behaviour - if (role() == QAccessible::EditableText) { - if (textType == QAccessible::Value) { - QVariant text = object()->property("text"); - return text.toString(); - } else if (textType == QAccessible::Name) { - return object()->objectName(); - } - } else { - if (textType == QAccessible::Name) { - QVariant text = object()->property("text"); - return text.toString(); - } - } - - - return QString(); -} - -QT_END_NAMESPACE diff --git a/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.h b/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.h deleted file mode 100644 index 45bf6f941a..0000000000 --- a/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 QACCESSIBLEDECLARATIVEITEM_H -#define QACCESSIBLEDECLARATIVEITEM_H - -#include "qdeclarativeaccessible.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -class QAccessibleDeclarativeItem : public QDeclarativeAccessible -{ -public: - QAccessibleDeclarativeItem(QGraphicsObject *item, QGraphicsView *view); - - QRect rect() const; - QRect viewRect() const; - - bool clipsChildren() const; - - QAccessibleInterface *focusChild() const; - - QAccessibleInterface *parent() const; - QAccessibleInterface *child(int index) const; - int childCount() const; - int navigate(QAccessible::RelationFlag rel, int entry, QAccessibleInterface **target) const; - int indexOfChild(const QAccessibleInterface *iface) const; - - QAccessible::State state() const; - QAccessible::Role role() const; - QString text(QAccessible::Text) const; - - virtual bool isAccessible() const; -private: - QGraphicsObject *m_item; - QGraphicsView *m_view; -}; - -QT_END_NAMESPACE - -#endif // QACCESSIBLEGRAPHICSVIEWIMPLEMENTATION_H diff --git a/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.cpp b/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.cpp deleted file mode 100644 index e5b78a4517..0000000000 --- a/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 "qaccessibledeclarativeview.h" -#include "qdeclarativeaccessible.h" -#include "qaccessibledeclarativeitem.h" - - -#ifndef QT_NO_ACCESSIBILITY - -QT_BEGIN_NAMESPACE - -QAccessibleDeclarativeView::QAccessibleDeclarativeView(QWidget *widget) - :QAccessibleWidget(widget) -{ - m_view = static_cast(widget); -} - -int QAccessibleDeclarativeView::childCount() const -{ - return 1; -} - -QAccessibleInterface *QAccessibleDeclarativeView::child(int index) const -{ - if (index == 0) { - QDeclarativeItem *declarativeRoot = m_view->accessibleRootItem(); - return new QAccessibleDeclarativeItem(declarativeRoot, m_view); - } - return 0; -} - -QAccessibleInterface *QAccessibleDeclarativeView::childAt(int x, int y) const -{ - Q_UNUSED(x); - Q_UNUSED(y); - return child(0); // return the top-level QML item -} - -int QAccessibleDeclarativeView::indexOfChild(const QAccessibleInterface *iface) const -{ - if (iface) { - QDeclarativeItem *declarativeRoot = m_view->accessibleRootItem(); - if (declarativeRoot == iface->object()) - return 0; - } - return -1; -} - -QT_END_NAMESPACE - -#endif // QT_NO_ACCESSIBILITY diff --git a/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.h b/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.h deleted file mode 100644 index d6fc0e2384..0000000000 --- a/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 QACCESSIBLEDECLARATIVEVIEW_H -#define QACCESSIBLEDECLARATIVEVIEW_H - -#include -#include - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_ACCESSIBILITY - -class QAccessibleDeclarativeView: public QAccessibleWidget -{ -public: - explicit QAccessibleDeclarativeView(QWidget *widget); - - QAccessibleInterface *child(int index) const; - int childCount() const; - QAccessibleInterface *childAt(int x, int y) const; - int indexOfChild(const QAccessibleInterface *iface) const; - -private: - QDeclarativeView *m_view; -}; - -#endif // QT_NO_ACCESSIBILITY - -QT_END_NAMESPACE - -#endif // QACCESSIBLEDECLARATIVEVIEW_H diff --git a/src/plugins/accessible/qtquick1/qtquick1.pro b/src/plugins/accessible/qtquick1/qtquick1.pro deleted file mode 100644 index f4602e4420..0000000000 --- a/src/plugins/accessible/qtquick1/qtquick1.pro +++ /dev/null @@ -1,22 +0,0 @@ -contains(QT_CONFIG, accessibility) { - -TARGET = qtaccessibleqtquick1 -load(qt_plugin) -include ($$PWD/../shared/qaccessiblebase.pri) - -QT += core-private gui-private widgets-private v8-private declarative-private qtquick1-private -DESTDIR = $$QT.gui.plugins/accessible - -QTDIR_build:REQUIRES += "contains(QT_CONFIG, accessibility)" - -DEFINES+=Q_ACCESSIBLE_QUICK_ITEM_ENABLE_DEBUG_DESCRIPTION - -SOURCES += \ - main.cpp \ - qaccessibledeclarativeview.cpp \ - qaccessibledeclarativeitem.cpp - -HEADERS += \ - qaccessibledeclarativeview.h \ - qaccessibledeclarativeitem.h -} diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/abstractliveedittool.cpp b/src/plugins/qmltooling/qmldbg_qtquick1/abstractliveedittool.cpp deleted file mode 100644 index 38ac8a376e..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/abstractliveedittool.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 - -#include -#include -#include - -namespace QmlJSDebugger { -namespace QtQuick1 { - -AbstractLiveEditTool::AbstractLiveEditTool(QDeclarativeViewInspector *editorView) - : AbstractTool(editorView) -{ -} - - -AbstractLiveEditTool::~AbstractLiveEditTool() -{ -} - -QDeclarativeViewInspector *AbstractLiveEditTool::inspector() const -{ - return static_cast(AbstractTool::inspector()); -} - -QDeclarativeView *AbstractLiveEditTool::view() const -{ - return inspector()->declarativeView(); -} - -QGraphicsScene* AbstractLiveEditTool::scene() const -{ - return view()->scene(); -} - -void AbstractLiveEditTool::updateSelectedItems() -{ - selectedItemsChanged(items()); -} - -QList AbstractLiveEditTool::items() const -{ - return inspector()->selectedItems(); -} - -bool AbstractLiveEditTool::topItemIsMovable(const QList & itemList) -{ - QGraphicsItem *firstSelectableItem = topMovableGraphicsItem(itemList); - if (firstSelectableItem == 0) - return false; - if (toQDeclarativeItem(firstSelectableItem) != 0) - return true; - - return false; - -} - -bool AbstractLiveEditTool::topSelectedItemIsMovable(const QList &itemList) -{ - QList 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 &/*itemList*/) -{ - return false; -} - -QDeclarativeItem *AbstractLiveEditTool::toQDeclarativeItem(QGraphicsItem *item) -{ - return qobject_cast(item->toGraphicsObject()); -} - -QGraphicsItem *AbstractLiveEditTool::topMovableGraphicsItem(const QList &itemList) -{ - foreach (QGraphicsItem *item, itemList) { - if (item->flags().testFlag(QGraphicsItem::ItemIsMovable)) - return item; - } - return 0; -} - -QDeclarativeItem *AbstractLiveEditTool::topMovableDeclarativeItem(const QList - &itemList) -{ - foreach (QGraphicsItem *item, itemList) { - QDeclarativeItem *declarativeItem = toQDeclarativeItem(item); - if (declarativeItem /*&& (declarativeItem->qmlItemNode().hasShowContent())*/) - return declarativeItem; - } - - return 0; -} - -QList AbstractLiveEditTool::toGraphicsObjectList(const QList - &itemList) -{ - QList 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(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 QtQuick1 -} // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/abstractliveedittool.h b/src/plugins/qmltooling/qmldbg_qtquick1/abstractliveedittool.h deleted file mode 100644 index 8b82ccd7ed..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/abstractliveedittool.h +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 -#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 { -namespace QtQuick1 { - -class QDeclarativeViewInspector; - -class AbstractLiveEditTool : public AbstractTool -{ - Q_OBJECT -public: - AbstractLiveEditTool(QDeclarativeViewInspector *inspector); - - virtual ~AbstractLiveEditTool(); - - void leaveEvent(QEvent *) {} - - virtual void itemsAboutToRemoved(const QList &itemList) = 0; - - virtual void clear() = 0; - - void updateSelectedItems(); - QList items() const; - - bool topItemIsMovable(const QList &itemList); - bool topItemIsResizeHandle(const QList &itemList); - bool topSelectedItemIsMovable(const QList &itemList); - - QString titleForItem(QGraphicsItem *item); - - static QList toGraphicsObjectList(const QList &itemList); - static QGraphicsItem* topMovableGraphicsItem(const QList &itemList); - static QDeclarativeItem* topMovableDeclarativeItem(const QList &itemList); - static QDeclarativeItem *toQDeclarativeItem(QGraphicsItem *item); - -protected: - virtual void selectedItemsChanged(const QList &objectList) = 0; - - QDeclarativeViewInspector *inspector() const; - QDeclarativeView *view() const; - QGraphicsScene *scene() const; - -private: - QList m_itemList; -}; - -} // namespace QtQuick1 -} // namesacpe QmlJSDebugger - -#endif // ABSTRACTLIVEEDITTOOL_H diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/boundingrecthighlighter.cpp b/src/plugins/qmltooling/qmldbg_qtquick1/boundingrecthighlighter.cpp deleted file mode 100644 index 4be624c2dc..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/boundingrecthighlighter.cpp +++ /dev/null @@ -1,241 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 - -#include -#include -#include - -namespace QmlJSDebugger { -namespace QtQuick1 { - -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 items) -{ - if (items.isEmpty()) - return; - - QList 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 QtQuick1 -} // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/boundingrecthighlighter.h b/src/plugins/qmltooling/qmldbg_qtquick1/boundingrecthighlighter.h deleted file mode 100644 index 38e724edc5..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/boundingrecthighlighter.h +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 -#include - -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 { -namespace QtQuick1 { - -class QDeclarativeViewInspector; -class BoundingBox; - -class BoundingRectHighlighter : public LiveLayerItem -{ - Q_OBJECT -public: - explicit BoundingRectHighlighter(QDeclarativeViewInspector *view); - ~BoundingRectHighlighter(); - void clear(); - void highlight(QList 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 m_boxes; - QList m_freeBoxes; -}; - -class BoundingBox : public QObject -{ - Q_OBJECT -public: - explicit BoundingBox(QGraphicsObject *itemToHighlight, QGraphicsItem *parentItem, - QObject *parent = 0); - ~BoundingBox(); - QWeakPointer highlightedObject; - QGraphicsPolygonItem *highlightPolygon; - QGraphicsPolygonItem *highlightPolygonEdge; - -private: - Q_DISABLE_COPY(BoundingBox) - -}; - -class BoundingBoxPolygonItem : public QGraphicsPolygonItem -{ -public: - explicit BoundingBoxPolygonItem(QGraphicsItem *item); - int type() const; -}; - -} // namespace QtQuick1 -} // namespace QmlJSDebugger - -#endif // BOUNDINGRECTHIGHLIGHTER_H diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/colorpickertool.cpp b/src/plugins/qmltooling/qmldbg_qtquick1/colorpickertool.cpp deleted file mode 100644 index 3e975e7f8e..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/colorpickertool.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 -#include -#include -#include -#include -#include -#include - -namespace QmlJSDebugger { -namespace QtQuick1 { - -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 QtQuick1 -} // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/colorpickertool.h b/src/plugins/qmltooling/qmldbg_qtquick1/colorpickertool.h deleted file mode 100644 index 25605b8c63..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/colorpickertool.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 - -QT_FORWARD_DECLARE_CLASS(QPoint) - -namespace QmlJSDebugger { -namespace QtQuick1 { - -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 &) {} - - void clear(); - -signals: - void selectedColorChanged(const QColor &color); - -protected: - void selectedItemsChanged(const QList &) {} - -private: - void pickColor(const QPoint &pos); - -private: - QColor m_selectedColor; -}; - -} // namespace QtQuick1 -} // namespace QmlJSDebugger - -#endif // COLORPICKERTOOL_H diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/livelayeritem.cpp b/src/plugins/qmltooling/qmldbg_qtquick1/livelayeritem.cpp deleted file mode 100644 index 08e36af603..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/livelayeritem.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 - -namespace QmlJSDebugger { -namespace QtQuick1 { - -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 LiveLayerItem::findAllChildItems() const -{ - return findAllChildItems(this); -} - -QList LiveLayerItem::findAllChildItems(const QGraphicsItem *item) const -{ - QList itemList(item->childItems()); - - foreach (QGraphicsItem *childItem, item->childItems()) - itemList += findAllChildItems(childItem); - - return itemList; -} - -} // namespace QtQuick1 -} // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/livelayeritem.h b/src/plugins/qmltooling/qmldbg_qtquick1/livelayeritem.h deleted file mode 100644 index a2af69c1b2..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/livelayeritem.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 - -namespace QmlJSDebugger { -namespace QtQuick1 { - -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 findAllChildItems() const; - -protected: - QList findAllChildItems(const QGraphicsItem *item) const; -}; - -} // namespace QtQuick1 -} // namespace QmlJSDebugger - -#endif // LIVELAYERITEM_H diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/liverubberbandselectionmanipulator.cpp b/src/plugins/qmltooling/qmldbg_qtquick1/liverubberbandselectionmanipulator.cpp deleted file mode 100644 index 27f63a6137..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/liverubberbandselectionmanipulator.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 - -#include - -namespace QmlJSDebugger { -namespace QtQuick1 { - -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 - &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 itemList - = inspectorPrivate->selectableItems(m_selectionRectangleElement.rect(), - Qt::IntersectsItemShape); - QList 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 resultList; - - switch (selectionType) { - case AddToSelection: { - resultList.append(m_oldSelectionList); - resultList.append(newSelectionList); - } - break; - case ReplaceSelection: { - resultList.append(newSelectionList); - } - break; - case RemoveFromSelection: { - QSet oldSelectionSet(m_oldSelectionList.toSet()); - QSet newSelectionSet(newSelectionList.toSet()); - resultList.append(oldSelectionSet.subtract(newSelectionSet).toList()); - } - } - - m_editorView->setSelectedItems(resultList); -} - - -void LiveRubberBandSelectionManipulator::setItems(const QList &itemList) -{ - m_itemList = itemList; -} - -QPointF LiveRubberBandSelectionManipulator::beginPoint() const -{ - return m_beginPoint; -} - -bool LiveRubberBandSelectionManipulator::isActive() const -{ - return m_isActive; -} - -} // namespace QtQuick1 -} // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/liverubberbandselectionmanipulator.h b/src/plugins/qmltooling/qmldbg_qtquick1/liverubberbandselectionmanipulator.h deleted file mode 100644 index 1e8c54ef8e..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/liverubberbandselectionmanipulator.h +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 - -QT_FORWARD_DECLARE_CLASS(QGraphicsItem) - -namespace QmlJSDebugger { -namespace QtQuick1 { - -class QDeclarativeViewInspector; - -class LiveRubberBandSelectionManipulator -{ -public: - enum SelectionType { - ReplaceSelection, - AddToSelection, - RemoveFromSelection - }; - - LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem, - QDeclarativeViewInspector *editorView); - - void setItems(const QList &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 &itemList); - -private: - QList m_itemList; - QList m_oldSelectionList; - LiveSelectionRectangle m_selectionRectangleElement; - QPointF m_beginPoint; - QDeclarativeViewInspector *m_editorView; - QGraphicsItem *m_beginFormEditorItem; - bool m_isActive; -}; - -} // namespace QtQuick1 -} // namespace QmlJSDebugger - -#endif // RUBBERBANDSELECTIONMANIPULATOR_H diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/liveselectionindicator.cpp b/src/plugins/qmltooling/qmldbg_qtquick1/liveselectionindicator.cpp deleted file mode 100644 index d1aee7b36b..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/liveselectionindicator.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 -#include -#include -#include - -namespace QmlJSDebugger { -namespace QtQuick1 { - -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 > &itemList) -{ - clear(); - - foreach (const QWeakPointer &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 QtQuick1 -} // namespace QmlJSDebugger - diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/liveselectionindicator.h b/src/plugins/qmltooling/qmldbg_qtquick1/liveselectionindicator.h deleted file mode 100644 index 3d5e10d7e5..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/liveselectionindicator.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 -#include - -QT_BEGIN_NAMESPACE -class QGraphicsObject; -class QGraphicsRectItem; -class QGraphicsItem; -class QPolygonF; -QT_END_NAMESPACE - -namespace QmlJSDebugger { -namespace QtQuick1 { - -class QDeclarativeViewInspector; - -class LiveSelectionIndicator -{ -public: - LiveSelectionIndicator(QDeclarativeViewInspector *viewInspector, QGraphicsObject *layerItem); - ~LiveSelectionIndicator(); - - void show(); - void hide(); - - void clear(); - - void setItems(const QList > &itemList); - -private: - QHash m_indicatorShapeHash; - QWeakPointer m_layerItem; - QDeclarativeViewInspector *m_view; -}; - -} // namespace QtQuick1 -} // namespace QmlJSDebugger - -#endif // LIVESELECTIONINDICATOR_H diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/liveselectionrectangle.cpp b/src/plugins/qmltooling/qmldbg_qtquick1/liveselectionrectangle.cpp deleted file mode 100644 index 559d86b815..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/liveselectionrectangle.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 -#include -#include -#include - -#include - -#include - -namespace QmlJSDebugger { -namespace QtQuick1 { - -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); -} - -} // namespace QtQuick1 -} // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/liveselectionrectangle.h b/src/plugins/qmltooling/qmldbg_qtquick1/liveselectionrectangle.h deleted file mode 100644 index de1dadb01d..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/liveselectionrectangle.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 - -QT_FORWARD_DECLARE_CLASS(QGraphicsObject) -QT_FORWARD_DECLARE_CLASS(QGraphicsRectItem) -QT_FORWARD_DECLARE_CLASS(QPointF) -QT_FORWARD_DECLARE_CLASS(QRectF) - -namespace QmlJSDebugger { -namespace QtQuick1 { - -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 m_layerItem; -}; - -} // namespace QtQuick1 -} // namespace QmlJSDebugger - -#endif // LIVESELECTIONRECTANGLE_H diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/liveselectiontool.cpp b/src/plugins/qmltooling/qmldbg_qtquick1/liveselectiontool.cpp deleted file mode 100644 index 5a22cdd4f4..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/liveselectiontool.cpp +++ /dev/null @@ -1,425 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -namespace QmlJSDebugger { -namespace QtQuick1 { - -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 &itemList) const -{ - QDeclarativeViewInspectorPrivate *inspectorPrivate - = QDeclarativeViewInspectorPrivate::get(inspector()); - const QList 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 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 &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(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() << 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 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 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 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() << 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 &itemList) -{ - foreach (const QWeakPointer &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 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 QtQuick1 -} // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/liveselectiontool.h b/src/plugins/qmltooling/qmldbg_qtquick1/liveselectiontool.h deleted file mode 100644 index f6046d4c59..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/liveselectiontool.h +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 -#include - -QT_FORWARD_DECLARE_CLASS(QGraphicsItem) -QT_FORWARD_DECLARE_CLASS(QMouseEvent) -QT_FORWARD_DECLARE_CLASS(QKeyEvent) -QT_FORWARD_DECLARE_CLASS(QAction) - -namespace QmlJSDebugger { -namespace QtQuick1 { - -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 &) {} -// QVariant itemChange(const QList &itemList, -// QGraphicsItem::GraphicsItemChange change, -// const QVariant &value ); - -// void update(); - - void clear(); - - void selectedItemsChanged(const QList &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 &itemList, QPoint globalPos); - LiveSingleSelectionManipulator::SelectionType getSelectionType(Qt::KeyboardModifiers modifiers); - bool alreadySelected(const QList &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 > m_selectedItemList; - - QList m_contextMenuItemList; -}; - -} // namespace QtQuick1 -} // namespace QmlJSDebugger - -#endif // LIVESELECTIONTOOL_H diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/livesingleselectionmanipulator.cpp b/src/plugins/qmltooling/qmldbg_qtquick1/livesingleselectionmanipulator.cpp deleted file mode 100644 index d58ab4e0dc..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/livesingleselectionmanipulator.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 - -namespace QmlJSDebugger { -namespace QtQuick1 { - -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 &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 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 itemList = inspectorPrivate->selectableItems(m_beginPoint); - select(selectionType, itemList, selectOnlyContentItems); -} - - -bool LiveSingleSelectionManipulator::isActive() const -{ - return m_isActive; -} - -QPointF LiveSingleSelectionManipulator::beginPoint() const -{ - return m_beginPoint; -} - -} // namespace QtQuick1 -} // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/livesingleselectionmanipulator.h b/src/plugins/qmltooling/qmldbg_qtquick1/livesingleselectionmanipulator.h deleted file mode 100644 index a9aa65593d..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/livesingleselectionmanipulator.h +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 -#include - -QT_FORWARD_DECLARE_CLASS(QGraphicsItem) - -namespace QmlJSDebugger { -namespace QtQuick1 { - -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 &items, - bool selectOnlyContentItems); - void select(SelectionType selectionType, bool selectOnlyContentItems); - - void clear(); - - QPointF beginPoint() const; - - bool isActive() const; - -private: - QList m_oldSelectionList; - QPointF m_beginPoint; - QDeclarativeViewInspector *m_editorView; - bool m_isActive; -}; - -} // namespace QtQuick1 -} // namespace QmlJSDebugger - -#endif // LIVESINGLESELECTIONMANIPULATOR_H diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/qdeclarativeviewinspector.cpp b/src/plugins/qmltooling/qmldbg_qtquick1/qdeclarativeviewinspector.cpp deleted file mode 100644 index 3f2506cf03..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/qdeclarativeviewinspector.cpp +++ /dev/null @@ -1,447 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 -#include - -namespace QmlJSDebugger { -namespace QtQuick1 { - -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 &objects) -{ - QList items; - QList gfxObjects; - foreach (QObject *obj, objects) { - if (QDeclarativeItem *declarativeItem = qobject_cast(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(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()); -} - -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 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(newParent); - QDeclarativeItem *item = qobject_cast(object); - if (newParentItem && item) - item->setParentItem(newParentItem); -} - -void QDeclarativeViewInspectorPrivate::_q_removeFromSelection(QObject *obj) -{ - QList items = selectedItems(); - if (QGraphicsItem *item = qobject_cast(obj)) - items.removeOne(item); - setSelectedItems(items); -} - -void QDeclarativeViewInspectorPrivate::setSelectedItemsForTools(const QList &items) -{ - foreach (const QWeakPointer &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 &items) -{ - QList > oldList = currentSelection; - setSelectedItemsForTools(items); - if (oldList != currentSelection) { - QList objectList; - foreach (const QWeakPointer &graphicsObject, currentSelection) { - if (graphicsObject) - objectList << graphicsObject.data(); - } - - q->sendCurrentObjects(objectList); - } -} - -QList QDeclarativeViewInspectorPrivate::selectedItems() const -{ - QList selection; - foreach (const QWeakPointer &selectedObject, currentSelection) { - if (selectedObject.data()) - selection << selectedObject.data(); - } - - return selection; -} - -void QDeclarativeViewInspector::setSelectedItems(QList items) -{ - data->setSelectedItems(items); -} - -QList QDeclarativeViewInspector::selectedItems() const -{ - return data->selectedItems(); -} - -QDeclarativeView *QDeclarativeViewInspector::declarativeView() const -{ - return data->view; -} - -void QDeclarativeViewInspectorPrivate::clearHighlight() -{ - boundingRectHighlighter->clear(); -} - -void QDeclarativeViewInspectorPrivate::highlight(const QList &items) -{ - if (items.isEmpty()) - return; - - QList objectList; - foreach (QGraphicsItem *item, items) { - QGraphicsItem *child = item; - - if (child) { - QGraphicsObject *childObject = child->toGraphicsObject(); - if (childObject) - objectList << childObject; - } - } - - boundingRectHighlighter->highlight(objectList); -} - -QList QDeclarativeViewInspectorPrivate::selectableItems( - const QPointF &scenePos) const -{ - QList itemlist = view->scene()->items(scenePos); - return filterForSelection(itemlist); -} - -QList QDeclarativeViewInspectorPrivate::selectableItems(const QPoint &pos) const -{ - QList itemlist = view->items(pos); - return filterForSelection(itemlist); -} - -QList QDeclarativeViewInspectorPrivate::selectableItems( - const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const -{ - QList 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 QDeclarativeViewInspectorPrivate::filterForSelection( - QList &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 QtQuick1 -} // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/qdeclarativeviewinspector.h b/src/plugins/qmltooling/qmldbg_qtquick1/qdeclarativeviewinspector.h deleted file mode 100644 index ebaf840b91..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/qdeclarativeviewinspector.h +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 - -#include "abstractviewinspector.h" - -#include -#include - -namespace QmlJSDebugger { -namespace QtQuick1 { - -class AbstractLiveEditTool; -class QDeclarativeViewInspectorPrivate; - -class QDeclarativeViewInspector : public AbstractViewInspector -{ - Q_OBJECT - -public: - explicit QDeclarativeViewInspector(QDeclarativeView *view, QObject *parent = 0); - ~QDeclarativeViewInspector(); - - // AbstractViewInspector - void changeCurrentObjects(const QList &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 items); - QList 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 data; - friend class QDeclarativeViewInspectorPrivate; - friend class AbstractLiveEditTool; -}; - -} // namespace QtQuick1 -} // namespace QmlJSDebugger - -#endif // QDECLARATIVEVIEWINSPECTOR_H diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/qdeclarativeviewinspector_p.h b/src/plugins/qmltooling/qmldbg_qtquick1/qdeclarativeviewinspector_p.h deleted file mode 100644 index 4f5c850354..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/qdeclarativeviewinspector_p.h +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 -#include -#include -#include - -#include "QtDeclarative/private/qdeclarativeinspectorservice_p.h" - -namespace QmlJSDebugger { -namespace QtQuick1 { - -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 viewport; - - QList > currentSelection; - - LiveSelectionTool *selectionTool; - ZoomTool *zoomTool; - ColorPickerTool *colorPickerTool; - LiveLayerItem *manipulatorLayer; - - BoundingRectHighlighter *boundingRectHighlighter; - - void setViewport(QWidget *widget); - - void clearEditorItems(); - void changeToSelectTool(); - QList filterForSelection(QList &itemlist) const; - - QList selectableItems(const QPoint &pos) const; - QList selectableItems(const QPointF &scenePos) const; - QList selectableItems(const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const; - - void setSelectedItemsForTools(const QList &items); - void setSelectedItems(const QList &items); - QList selectedItems() const; - - void clearHighlight(); - void highlight(const QList &item); - inline void highlight(QGraphicsObject *item) - { highlight(QList() << 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 QtQuick1 -} // namespace QmlJSDebugger - -#endif // QDECLARATIVEVIEWINSPECTOR_P_H diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/qmldbg_qtquick1.pro b/src/plugins/qmltooling/qmldbg_qtquick1/qmldbg_qtquick1.pro deleted file mode 100644 index b98f463b5d..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/qmldbg_qtquick1.pro +++ /dev/null @@ -1,50 +0,0 @@ -load(qt_module) - -TARGET = qmldbg_qtquick1 -QT += declarative-private core-private gui-private widgets-private qtquick1 opengl-private - -load(qt_plugin) - -DESTDIR = $$QT.declarative.plugins/qmltooling - -INCLUDEPATH *= $$PWD $$PWD/../shared - -SOURCES += \ - abstractliveedittool.cpp \ - boundingrecthighlighter.cpp \ - colorpickertool.cpp \ - livelayeritem.cpp \ - liverubberbandselectionmanipulator.cpp \ - liveselectionindicator.cpp \ - liveselectionrectangle.cpp \ - liveselectiontool.cpp \ - livesingleselectionmanipulator.cpp \ - qdeclarativeviewinspector.cpp \ - qtquick1plugin.cpp \ - ../shared/abstracttool.cpp \ - ../shared/abstractviewinspector.cpp \ - subcomponentmasklayeritem.cpp \ - zoomtool.cpp - -HEADERS += \ - abstractliveedittool.h \ - boundingrecthighlighter.h \ - colorpickertool.h \ - livelayeritem.h \ - liverubberbandselectionmanipulator.h \ - liveselectionindicator.h \ - liveselectionrectangle.h \ - liveselectiontool.h \ - livesingleselectionmanipulator.h \ - qdeclarativeviewinspector.h \ - qdeclarativeviewinspector_p.h \ - qtquick1plugin.h \ - ../shared/abstracttool.h \ - ../shared/abstractviewinspector.h \ - ../shared/qdeclarativeinspectorprotocol.h \ - ../shared/qmlinspectorconstants.h \ - subcomponentmasklayeritem.h \ - zoomtool.h - -target.path += $$[QT_INSTALL_PLUGINS]/qmltooling -INSTALLS += target diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/qtquick1plugin.cpp b/src/plugins/qmltooling/qmldbg_qtquick1/qtquick1plugin.cpp deleted file mode 100644 index d336d1deae..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/qtquick1plugin.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtquick1plugin.h" -#include "qdeclarativeviewinspector.h" - -#include -#include -#include - -namespace QmlJSDebugger { -namespace QtQuick1 { - -QtQuick1Plugin::QtQuick1Plugin() : - m_inspector(0) -{ -} - -QtQuick1Plugin::~QtQuick1Plugin() -{ - delete m_inspector; -} - -bool QtQuick1Plugin::canHandleView(QObject *view) -{ - return qobject_cast(view); -} - -void QtQuick1Plugin::activate(QObject *view) -{ - QDeclarativeView *qDeclarativeView = qobject_cast(view); - Q_ASSERT(qDeclarativeView); - m_inspector = new QDeclarativeViewInspector(qDeclarativeView, qDeclarativeView); -} - -void QtQuick1Plugin::deactivate() -{ - delete m_inspector; -} - -void QtQuick1Plugin::clientMessage(const QByteArray &message) -{ - if (m_inspector) - m_inspector->handleMessage(message); -} - -} // namespace QtQuick1 -} // namespace QmlJSDebugger - -Q_EXPORT_PLUGIN2(qmldbg_qtquick1, QmlJSDebugger::QtQuick1::QtQuick1Plugin) diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/qtquick1plugin.h b/src/plugins/qmltooling/qmldbg_qtquick1/qtquick1plugin.h deleted file mode 100644 index b974f14b20..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/qtquick1plugin.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEINSPECTORPLUGIN_H -#define QDECLARATIVEINSPECTORPLUGIN_H - -#include -#include - -namespace QmlJSDebugger { - -class AbstractViewInspector; - -namespace QtQuick1 { - -class QtQuick1Plugin : public QObject, public QDeclarativeInspectorInterface -{ - Q_OBJECT - Q_DISABLE_COPY(QtQuick1Plugin) - Q_INTERFACES(QDeclarativeInspectorInterface) - -public: - QtQuick1Plugin(); - ~QtQuick1Plugin(); - - // QDeclarativeInspectorInterface - bool canHandleView(QObject *view); - void activate(QObject *view); - void deactivate(); - void clientMessage(const QByteArray &message); - -private: - QPointer m_inspector; -}; - -} // namespace QtQuick1 -} // namespace QmlJSDebugger - -#endif // QDECLARATIVEINSPECTORPLUGIN_H diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/subcomponentmasklayeritem.cpp b/src/plugins/qmltooling/qmldbg_qtquick1/subcomponentmasklayeritem.cpp deleted file mode 100644 index d77fd5b13c..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/subcomponentmasklayeritem.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 - -namespace QmlJSDebugger { -namespace QtQuick1 { - -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 ®ion) -{ - 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 QtQuick1 -} // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/subcomponentmasklayeritem.h b/src/plugins/qmltooling/qmldbg_qtquick1/subcomponentmasklayeritem.h deleted file mode 100644 index a76e4ffed7..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/subcomponentmasklayeritem.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 - -namespace QmlJSDebugger { -namespace QtQuick1 { - -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 QtQuick1 -} // namespace QmlJSDebugger - -#endif // SUBCOMPONENTMASKLAYERITEM_H diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/zoomtool.cpp b/src/plugins/qmltooling/qmldbg_qtquick1/zoomtool.cpp deleted file mode 100644 index 77521a3dbd..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/zoomtool.cpp +++ /dev/null @@ -1,330 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 -#include -#include -#include -#include - -#include -#include - -namespace QmlJSDebugger { -namespace QtQuick1 { - -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(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 ¢erPos) -{ - - 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 zoomScales = - QList() - << 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 QtQuick1 -} // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_qtquick1/zoomtool.h b/src/plugins/qmltooling/qmldbg_qtquick1/zoomtool.h deleted file mode 100644 index f6855c43f4..0000000000 --- a/src/plugins/qmltooling/qmldbg_qtquick1/zoomtool.h +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** 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 { -namespace QtQuick1 { - -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 &) {} - - void clear(); - -protected: - void selectedItemsChanged(const QList &) {} - -private slots: - void zoomTo100(); - void zoomIn(); - void zoomOut(); - -private: - qreal nextZoomScale(ZoomDirection direction) const; - void scaleView(const QPointF ¢erPos); - -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 QtQuick1 -} // namespace QmlJSDebugger - -#endif // ZOOMTOOL_H diff --git a/src/plugins/qmltooling/qmltooling.pro b/src/plugins/qmltooling/qmltooling.pro index d03ee07fc9..41e1c65a6b 100644 --- a/src/plugins/qmltooling/qmltooling.pro +++ b/src/plugins/qmltooling/qmltooling.pro @@ -2,4 +2,3 @@ TEMPLATE = subdirs SUBDIRS = qmldbg_tcp SUBDIRS += qmldbg_qtquick2 -SUBDIRS += qmldbg_qtquick1 -- cgit v1.2.3