diff --git a/doc/src/debugger/creator-debugger.qdoc b/doc/src/debugger/creator-debugger.qdoc index 1670720ea056b82867c667321bea978a995708c7..c1db72f4c74e1e3cdfed0856dfcb0e2bb287b51b 100644 --- a/doc/src/debugger/creator-debugger.qdoc +++ b/doc/src/debugger/creator-debugger.qdoc @@ -1183,18 +1183,6 @@ d.putSubItem("value", value) \endcode - - \section1 Debugging Helpers for QML - - The debugging helpers for QML provide you with code completion for custom modules - (\c qmldump) and debugging Qt Quick UI projects (\c qmlobserver). - - You have to build the QML Inspector once for each Qt version that you want - to debug - with. Select \gui{Tools > Options > Build & Run > Qt Versions}. - - \note QML Inspector requires Qt 4.7.1 or later. - \section1 Enabling Debugging Helpers for Qt's Bootstrapped Applications Qt's bootstrapped applications (such as moc and qmake) are built in a way diff --git a/doc/src/debugger/qtquick-debugging.qdoc b/doc/src/debugger/qtquick-debugging.qdoc index d1fcba00288e8dd3acad53a23c156f4412e3e9d3..cc60d4974f0c5a7e21ea8b32763189f4699dbca6 100644 --- a/doc/src/debugger/qtquick-debugging.qdoc +++ b/doc/src/debugger/qtquick-debugging.qdoc @@ -30,12 +30,7 @@ \title Debugging Qt Quick Projects - \note You need Qt 4.7.1 or later to debug Qt Quick projects. Debugging - projects not created with the Qt Quick wizards is only supported with - Qt 4.8, or later. - - To debug Qt Quick applications running on devices, you must install - Qt 4.7.4, or later, libraries on devices. + \note You need Qt 4.8 or later to debug Qt Quick projects. For an example of how to debug Qt Quick Projects, see \l{Debugging a Qt Quick Example Application}. diff --git a/doc/src/howto/qtcreator-faq.qdoc b/doc/src/howto/qtcreator-faq.qdoc index 965650ad66e63f3a869b5599947c2850eba9d2ac..522ada136b757126c13fae329a555190f1292000 100644 --- a/doc/src/howto/qtcreator-faq.qdoc +++ b/doc/src/howto/qtcreator-faq.qdoc @@ -50,12 +50,8 @@ \li qtc-debugging-helper - \li qtc-qmldbg - \li qtc-qmldump - \li qtc-qmlobserver - \endlist The location depends on the platform. On Linux and other Unix platforms, the files diff --git a/share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.cpp deleted file mode 100644 index 20fbddd1c0734461a6393900189b0de28ef976a5..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "abstractliveedittool.h" -#include "qdeclarativeviewinspector.h" -#include "../qdeclarativeviewinspector_p.h" - -#include <QDeclarativeEngine> - -#include <QDebug> -#include <QGraphicsItem> -#include <QDeclarativeItem> - -namespace QmlJSDebugger { - -AbstractLiveEditTool::AbstractLiveEditTool(QDeclarativeViewInspector *editorView) - : QObject(editorView), m_inspector(editorView) -{ -} - - -AbstractLiveEditTool::~AbstractLiveEditTool() -{ -} - -QDeclarativeViewInspector *AbstractLiveEditTool::inspector() const -{ - return m_inspector; -} - -QDeclarativeView *AbstractLiveEditTool::view() const -{ - return m_inspector->declarativeView(); -} - -QGraphicsScene* AbstractLiveEditTool::scene() const -{ - return view()->scene(); -} - -void AbstractLiveEditTool::updateSelectedItems() -{ - selectedItemsChanged(items()); -} - -QList<QGraphicsItem*> AbstractLiveEditTool::items() const -{ - return inspector()->selectedItems(); -} - -bool AbstractLiveEditTool::topItemIsMovable(const QList<QGraphicsItem*> & itemList) -{ - QGraphicsItem *firstSelectableItem = topMovableGraphicsItem(itemList); - if (firstSelectableItem == 0) - return false; - if (toQDeclarativeItem(firstSelectableItem) != 0) - return true; - - return false; - -} - -bool AbstractLiveEditTool::topSelectedItemIsMovable(const QList<QGraphicsItem*> &itemList) -{ - QList<QGraphicsItem*> selectedItems = inspector()->selectedItems(); - - foreach (QGraphicsItem *item, itemList) { - QDeclarativeItem *declarativeItem = toQDeclarativeItem(item); - if (declarativeItem - && selectedItems.contains(declarativeItem) - /*&& (declarativeItem->qmlItemNode().hasShowContent() || selectNonContentItems)*/) - return true; - } - - return false; - -} - -bool AbstractLiveEditTool::topItemIsResizeHandle(const QList<QGraphicsItem*> &/*itemList*/) -{ - return false; -} - -QDeclarativeItem *AbstractLiveEditTool::toQDeclarativeItem(QGraphicsItem *item) -{ - return qobject_cast<QDeclarativeItem*>(item->toGraphicsObject()); -} - -QGraphicsItem *AbstractLiveEditTool::topMovableGraphicsItem(const QList<QGraphicsItem*> &itemList) -{ - foreach (QGraphicsItem *item, itemList) { - if (item->flags().testFlag(QGraphicsItem::ItemIsMovable)) - return item; - } - return 0; -} - -QDeclarativeItem *AbstractLiveEditTool::topMovableDeclarativeItem(const QList<QGraphicsItem*> - &itemList) -{ - foreach (QGraphicsItem *item, itemList) { - QDeclarativeItem *declarativeItem = toQDeclarativeItem(item); - if (declarativeItem /*&& (declarativeItem->qmlItemNode().hasShowContent())*/) - return declarativeItem; - } - - return 0; -} - -QList<QGraphicsObject*> AbstractLiveEditTool::toGraphicsObjectList(const QList<QGraphicsItem*> - &itemList) -{ - QList<QGraphicsObject*> gfxObjects; - foreach (QGraphicsItem *item, itemList) { - QGraphicsObject *obj = item->toGraphicsObject(); - if (obj) - gfxObjects << obj; - } - - return gfxObjects; -} - -QString AbstractLiveEditTool::titleForItem(QGraphicsItem *item) -{ - QString className("QGraphicsItem"); - QString objectStringId; - - QString constructedName; - - QGraphicsObject *gfxObject = item->toGraphicsObject(); - if (gfxObject) { - className = gfxObject->metaObject()->className(); - - className.remove(QRegExp("_QMLTYPE_\\d+")); - className.remove(QRegExp("_QML_\\d+")); - if (className.startsWith(QLatin1String("QDeclarative"))) - className = className.remove(QLatin1String("QDeclarative")); - - QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem*>(gfxObject); - if (declarativeItem) { - objectStringId = QDeclarativeViewInspector::idStringForObject(declarativeItem); - } - - if (!objectStringId.isEmpty()) { - constructedName = objectStringId + " (" + className + QLatin1Char(')'); - } else { - if (!gfxObject->objectName().isEmpty()) { - constructedName = gfxObject->objectName() + " (" + className + QLatin1Char(')'); - } else { - constructedName = className; - } - } - } - - return constructedName; -} - - -} // namespace QmlJSDebugger diff --git a/share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.h b/share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.h deleted file mode 100644 index 29a3f8d5b2fd046b3f530bdeb00fdee85fe65c9d..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.h +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef ABSTRACTLIVEEDITTOOL_H -#define ABSTRACTLIVEEDITTOOL_H - -#include <QList> -#include <QObject> - -QT_BEGIN_NAMESPACE -class QMouseEvent; -class QGraphicsItem; -class QDeclarativeItem; -class QKeyEvent; -class QGraphicsScene; -class QGraphicsObject; -class QWheelEvent; -class QDeclarativeView; -QT_END_NAMESPACE - -namespace QmlJSDebugger { - -class QDeclarativeViewInspector; - -class FormEditorView; - -class AbstractLiveEditTool : public QObject -{ - Q_OBJECT -public: - AbstractLiveEditTool(QDeclarativeViewInspector *inspector); - - virtual ~AbstractLiveEditTool(); - - virtual void mousePressEvent(QMouseEvent *event) = 0; - virtual void mouseMoveEvent(QMouseEvent *event) = 0; - virtual void mouseReleaseEvent(QMouseEvent *event) = 0; - virtual void mouseDoubleClickEvent(QMouseEvent *event) = 0; - - virtual void hoverMoveEvent(QMouseEvent *event) = 0; - virtual void wheelEvent(QWheelEvent *event) = 0; - - virtual void keyPressEvent(QKeyEvent *event) = 0; - virtual void keyReleaseEvent(QKeyEvent *keyEvent) = 0; - virtual void itemsAboutToRemoved(const QList<QGraphicsItem*> &itemList) = 0; - - virtual void clear() = 0; - - void updateSelectedItems(); - QList<QGraphicsItem*> items() const; - - void enterContext(QGraphicsItem *itemToEnter); - - bool topItemIsMovable(const QList<QGraphicsItem*> &itemList); - bool topItemIsResizeHandle(const QList<QGraphicsItem*> &itemList); - bool topSelectedItemIsMovable(const QList<QGraphicsItem*> &itemList); - - static QString titleForItem(QGraphicsItem *item); - static QList<QGraphicsObject*> toGraphicsObjectList(const QList<QGraphicsItem*> &itemList); - static QGraphicsItem* topMovableGraphicsItem(const QList<QGraphicsItem*> &itemList); - static QDeclarativeItem* topMovableDeclarativeItem(const QList<QGraphicsItem*> &itemList); - static QDeclarativeItem *toQDeclarativeItem(QGraphicsItem *item); - -protected: - virtual void selectedItemsChanged(const QList<QGraphicsItem*> &objectList) = 0; - - QDeclarativeViewInspector *inspector() const; - QDeclarativeView *view() const; - QGraphicsScene *scene() const; - -private: - QDeclarativeViewInspector *m_inspector; - QList<QGraphicsItem*> m_itemList; -}; - -} - -#endif // ABSTRACTLIVEEDITTOOL_H diff --git a/share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.cpp b/share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.cpp deleted file mode 100644 index 5ce6c141c07137e01ca3d850ab6019ca87fe0bfa..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "boundingrecthighlighter.h" -#include "qdeclarativeviewinspector.h" -#include "qmlinspectorconstants.h" - -#include <QGraphicsPolygonItem> - -#include <QTimer> -#include <QObject> -#include <QDebug> - -namespace QmlJSDebugger { - -BoundingBox::BoundingBox(QGraphicsObject *itemToHighlight, QGraphicsItem *parentItem, - QObject *parent) - : QObject(parent), - highlightedObject(itemToHighlight), - highlightPolygon(0), - highlightPolygonEdge(0) -{ - highlightPolygon = new BoundingBoxPolygonItem(parentItem); - highlightPolygonEdge = new BoundingBoxPolygonItem(parentItem); - - highlightPolygon->setPen(QPen(QColor(0, 22, 159))); - highlightPolygonEdge->setPen(QPen(QColor(158, 199, 255))); - - highlightPolygon->setFlag(QGraphicsItem::ItemIsSelectable, false); - highlightPolygonEdge->setFlag(QGraphicsItem::ItemIsSelectable, false); -} - -BoundingBox::~BoundingBox() -{ - highlightedObject.clear(); -} - -BoundingBoxPolygonItem::BoundingBoxPolygonItem(QGraphicsItem *item) : QGraphicsPolygonItem(item) -{ - QPen pen; - pen.setColor(QColor(108, 141, 221)); - pen.setWidth(1); - setPen(pen); -} - -int BoundingBoxPolygonItem::type() const -{ - return Constants::EditorItemType; -} - -BoundingRectHighlighter::BoundingRectHighlighter(QDeclarativeViewInspector *view) : - LiveLayerItem(view->declarativeView()->scene()), - m_view(view) -{ -} - -BoundingRectHighlighter::~BoundingRectHighlighter() -{ - -} - -void BoundingRectHighlighter::clear() -{ - foreach (BoundingBox *box, m_boxes) - freeBoundingBox(box); -} - -BoundingBox *BoundingRectHighlighter::boxFor(QGraphicsObject *item) const -{ - foreach (BoundingBox *box, m_boxes) { - if (box->highlightedObject.data() == item) - return box; - } - return 0; -} - -void BoundingRectHighlighter::highlight(QList<QGraphicsObject*> items) -{ - if (items.isEmpty()) - return; - - QList<BoundingBox *> newBoxes; - foreach (QGraphicsObject *itemToHighlight, items) { - BoundingBox *box = boxFor(itemToHighlight); - if (!box) - box = createBoundingBox(itemToHighlight); - - newBoxes << box; - } - qSort(newBoxes); - - if (newBoxes != m_boxes) { - clear(); - m_boxes << newBoxes; - } - - highlightAll(); -} - -void BoundingRectHighlighter::highlight(QGraphicsObject* itemToHighlight) -{ - if (!itemToHighlight) - return; - - BoundingBox *box = boxFor(itemToHighlight); - if (!box) { - box = createBoundingBox(itemToHighlight); - m_boxes << box; - qSort(m_boxes); - } - - highlightAll(); -} - -BoundingBox *BoundingRectHighlighter::createBoundingBox(QGraphicsObject *itemToHighlight) -{ - if (!m_freeBoxes.isEmpty()) { - BoundingBox *box = m_freeBoxes.last(); - if (box->highlightedObject.isNull()) { - box->highlightedObject = itemToHighlight; - box->highlightPolygon->show(); - box->highlightPolygonEdge->show(); - m_freeBoxes.removeLast(); - return box; - } - } - - BoundingBox *box = new BoundingBox(itemToHighlight, this, this); - - connect(itemToHighlight, SIGNAL(xChanged()), this, SLOT(refresh())); - connect(itemToHighlight, SIGNAL(yChanged()), this, SLOT(refresh())); - connect(itemToHighlight, SIGNAL(widthChanged()), this, SLOT(refresh())); - connect(itemToHighlight, SIGNAL(heightChanged()), this, SLOT(refresh())); - connect(itemToHighlight, SIGNAL(rotationChanged()), this, SLOT(refresh())); - connect(itemToHighlight, SIGNAL(destroyed(QObject*)), this, SLOT(itemDestroyed(QObject*))); - - return box; -} - -void BoundingRectHighlighter::removeBoundingBox(BoundingBox *box) -{ - delete box; - box = 0; -} - -void BoundingRectHighlighter::freeBoundingBox(BoundingBox *box) -{ - if (!box->highlightedObject.isNull()) { - disconnect(box->highlightedObject.data(), SIGNAL(xChanged()), this, SLOT(refresh())); - disconnect(box->highlightedObject.data(), SIGNAL(yChanged()), this, SLOT(refresh())); - disconnect(box->highlightedObject.data(), SIGNAL(widthChanged()), this, SLOT(refresh())); - disconnect(box->highlightedObject.data(), SIGNAL(heightChanged()), this, SLOT(refresh())); - disconnect(box->highlightedObject.data(), SIGNAL(rotationChanged()), this, SLOT(refresh())); - } - - box->highlightedObject.clear(); - box->highlightPolygon->hide(); - box->highlightPolygonEdge->hide(); - m_boxes.removeOne(box); - m_freeBoxes << box; -} - -void BoundingRectHighlighter::itemDestroyed(QObject *obj) -{ - foreach (BoundingBox *box, m_boxes) { - if (box->highlightedObject.data() == obj) { - freeBoundingBox(box); - break; - } - } -} - -void BoundingRectHighlighter::highlightAll() -{ - foreach (BoundingBox *box, m_boxes) { - Q_ASSERT(box); - if (box->highlightedObject.isNull()) { - // clear all highlights - clear(); - return; - } - QGraphicsObject *item = box->highlightedObject.data(); - - QRectF boundingRectInSceneSpace(item->mapToScene(item->boundingRect()).boundingRect()); - QRectF boundingRectInLayerItemSpace = mapRectFromScene(boundingRectInSceneSpace); - QRectF bboxRect = m_view->adjustToScreenBoundaries(boundingRectInLayerItemSpace); - QRectF edgeRect = bboxRect; - edgeRect.adjust(-1, -1, 1, 1); - - box->highlightPolygon->setPolygon(QPolygonF(bboxRect)); - box->highlightPolygonEdge->setPolygon(QPolygonF(edgeRect)); - } -} - -void BoundingRectHighlighter::refresh() -{ - if (!m_boxes.isEmpty()) - highlightAll(); -} - - -} // namespace QmlJSDebugger diff --git a/share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.h b/share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.h deleted file mode 100644 index d5919a3d3112bbf7cf48037fec6857c55e13034f..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.h +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef BOUNDINGRECTHIGHLIGHTER_H -#define BOUNDINGRECTHIGHLIGHTER_H - -#include "livelayeritem.h" - -#include <QObject> -#include <QWeakPointer> - -QT_FORWARD_DECLARE_CLASS(QGraphicsItem) -QT_FORWARD_DECLARE_CLASS(QPainter) -QT_FORWARD_DECLARE_CLASS(QWidget) -QT_FORWARD_DECLARE_CLASS(QStyleOptionGraphicsItem) -QT_FORWARD_DECLARE_CLASS(QTimer) - -namespace QmlJSDebugger { - -class QDeclarativeViewInspector; -class BoundingBox; - -class BoundingRectHighlighter : public LiveLayerItem -{ - Q_OBJECT -public: - explicit BoundingRectHighlighter(QDeclarativeViewInspector *view); - ~BoundingRectHighlighter(); - void clear(); - void highlight(QList<QGraphicsObject*> items); - void highlight(QGraphicsObject* item); - -private slots: - void refresh(); - void itemDestroyed(QObject *); - -private: - BoundingBox *boxFor(QGraphicsObject *item) const; - void highlightAll(); - BoundingBox *createBoundingBox(QGraphicsObject *itemToHighlight); - void removeBoundingBox(BoundingBox *box); - void freeBoundingBox(BoundingBox *box); - -private: - Q_DISABLE_COPY(BoundingRectHighlighter) - - QDeclarativeViewInspector *m_view; - QList<BoundingBox* > m_boxes; - QList<BoundingBox* > m_freeBoxes; -}; - -class BoundingBox : public QObject -{ - Q_OBJECT -public: - explicit BoundingBox(QGraphicsObject *itemToHighlight, QGraphicsItem *parentItem, - QObject *parent = 0); - ~BoundingBox(); - QWeakPointer<QGraphicsObject> highlightedObject; - QGraphicsPolygonItem *highlightPolygon; - QGraphicsPolygonItem *highlightPolygonEdge; - -private: - Q_DISABLE_COPY(BoundingBox) - -}; - -class BoundingBoxPolygonItem : public QGraphicsPolygonItem -{ -public: - explicit BoundingBoxPolygonItem(QGraphicsItem *item); - int type() const; -}; - -} // namespace QmlJSDebugger - -#endif // BOUNDINGRECTHIGHLIGHTER_H diff --git a/share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.cpp deleted file mode 100644 index 6ef379c510c232dc70227b3e8fd64326f993f4f2..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "colorpickertool.h" -#include "qdeclarativeviewinspector.h" - -#include <QMouseEvent> -#include <QKeyEvent> -#include <QRectF> -#include <QRgb> -#include <QImage> -#include <QApplication> -#include <QPalette> - -namespace QmlJSDebugger { - -ColorPickerTool::ColorPickerTool(QDeclarativeViewInspector *view) : - AbstractLiveEditTool(view) -{ - m_selectedColor.setRgb(0,0,0); -} - -ColorPickerTool::~ColorPickerTool() -{ - -} - -void ColorPickerTool::mousePressEvent(QMouseEvent * /*event*/) -{ -} - -void ColorPickerTool::mouseMoveEvent(QMouseEvent *event) -{ - pickColor(event->pos()); -} - -void ColorPickerTool::mouseReleaseEvent(QMouseEvent *event) -{ - pickColor(event->pos()); -} - -void ColorPickerTool::mouseDoubleClickEvent(QMouseEvent * /*event*/) -{ -} - - -void ColorPickerTool::hoverMoveEvent(QMouseEvent * /*event*/) -{ -} - -void ColorPickerTool::keyPressEvent(QKeyEvent * /*event*/) -{ -} - -void ColorPickerTool::keyReleaseEvent(QKeyEvent * /*keyEvent*/) -{ -} -void ColorPickerTool::wheelEvent(QWheelEvent * /*event*/) -{ -} - -void ColorPickerTool::itemsAboutToRemoved(const QList<QGraphicsItem*> &/*itemList*/) -{ -} - -void ColorPickerTool::clear() -{ - view()->setCursor(Qt::CrossCursor); -} - -void ColorPickerTool::selectedItemsChanged(const QList<QGraphicsItem*> &/*itemList*/) -{ -} - -void ColorPickerTool::pickColor(const QPoint &pos) -{ - QRgb fillColor = view()->backgroundBrush().color().rgb(); - if (view()->backgroundBrush().style() == Qt::NoBrush) - fillColor = view()->palette().color(QPalette::Base).rgb(); - - QRectF target(0,0, 1, 1); - QRect source(pos.x(), pos.y(), 1, 1); - QImage img(1, 1, QImage::Format_ARGB32); - img.fill(fillColor); - QPainter painter(&img); - view()->render(&painter, target, source); - m_selectedColor = QColor::fromRgb(img.pixel(0, 0)); - - emit selectedColorChanged(m_selectedColor); -} - -} // namespace QmlJSDebugger diff --git a/share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.h b/share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.h deleted file mode 100644 index bfedc70e660f35225bbd17586358d3e6478e4a15..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef COLORPICKERTOOL_H -#define COLORPICKERTOOL_H - -#include "abstractliveedittool.h" - -#include <QColor> - -QT_FORWARD_DECLARE_CLASS(QPoint) - -namespace QmlJSDebugger { - -class ColorPickerTool : public AbstractLiveEditTool -{ - Q_OBJECT -public: - explicit ColorPickerTool(QDeclarativeViewInspector *view); - - virtual ~ColorPickerTool(); - - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseDoubleClickEvent(QMouseEvent *event); - - void hoverMoveEvent(QMouseEvent *event); - - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *keyEvent); - - void wheelEvent(QWheelEvent *event); - - void itemsAboutToRemoved(const QList<QGraphicsItem*> &itemList); - - void clear(); - -signals: - void selectedColorChanged(const QColor &color); - -protected: - - void selectedItemsChanged(const QList<QGraphicsItem*> &itemList); - -private: - void pickColor(const QPoint &pos); - -private: - QColor m_selectedColor; -}; - -} // namespace QmlJSDebugger - -#endif // COLORPICKERTOOL_H diff --git a/share/qtcreator/qml/qmljsdebugger/editor/livelayeritem.cpp b/share/qtcreator/qml/qmljsdebugger/editor/livelayeritem.cpp deleted file mode 100644 index 60505afb87393bf488a1841055f899e48c28a11a..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/livelayeritem.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "livelayeritem.h" -#include "qmlinspectorconstants.h" - -#include <QGraphicsScene> - -namespace QmlJSDebugger { - -LiveLayerItem::LiveLayerItem(QGraphicsScene* scene) - : QGraphicsObject() -{ - scene->addItem(this); - setZValue(1); - setFlag(QGraphicsItem::ItemIsMovable, false); -} - -LiveLayerItem::~LiveLayerItem() -{ -} - -void LiveLayerItem::paint(QPainter * /*painter*/, const QStyleOptionGraphicsItem * /*option*/, - QWidget * /*widget*/) -{ -} - -int LiveLayerItem::type() const -{ - return Constants::EditorItemType; -} - -QRectF LiveLayerItem::boundingRect() const -{ - return childrenBoundingRect(); -} - -QList<QGraphicsItem*> LiveLayerItem::findAllChildItems() const -{ - return findAllChildItems(this); -} - -QList<QGraphicsItem*> LiveLayerItem::findAllChildItems(const QGraphicsItem *item) const -{ - QList<QGraphicsItem*> itemList(item->childItems()); - - foreach (QGraphicsItem *childItem, item->childItems()) - itemList += findAllChildItems(childItem); - - return itemList; -} - -} // namespace QmlJSDebugger diff --git a/share/qtcreator/qml/qmljsdebugger/editor/livelayeritem.h b/share/qtcreator/qml/qmljsdebugger/editor/livelayeritem.h deleted file mode 100644 index 6fe82b3dbc3b32730c0fa4ce7e12a5a95d3bf6f8..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/livelayeritem.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef LIVELAYERITEM_H -#define LIVELAYERITEM_H - -#include <QGraphicsObject> - -namespace QmlJSDebugger { - -class LiveLayerItem : public QGraphicsObject -{ -public: - LiveLayerItem(QGraphicsScene *scene); - ~LiveLayerItem(); - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget = 0); - QRectF boundingRect() const; - int type() const; - - QList<QGraphicsItem*> findAllChildItems() const; - -protected: - QList<QGraphicsItem*> findAllChildItems(const QGraphicsItem *item) const; -}; - -} - -#endif // LIVELAYERITEM_H diff --git a/share/qtcreator/qml/qmljsdebugger/editor/liverubberbandselectionmanipulator.cpp b/share/qtcreator/qml/qmljsdebugger/editor/liverubberbandselectionmanipulator.cpp deleted file mode 100644 index 9d96f0472c27af0ea9dc8c21336208068af25401..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/liverubberbandselectionmanipulator.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "liverubberbandselectionmanipulator.h" -#include "../qdeclarativeviewinspector_p.h" - -#include <QGraphicsItem> - -#include <QDebug> - -namespace QmlJSDebugger { - -LiveRubberBandSelectionManipulator::LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem, - QDeclarativeViewInspector *editorView) - : m_selectionRectangleElement(layerItem), - m_editorView(editorView), - m_beginFormEditorItem(0), - m_isActive(false) -{ - m_selectionRectangleElement.hide(); -} - -void LiveRubberBandSelectionManipulator::clear() -{ - m_selectionRectangleElement.clear(); - m_isActive = false; - m_beginPoint = QPointF(); - m_itemList.clear(); - m_oldSelectionList.clear(); -} - -QGraphicsItem *LiveRubberBandSelectionManipulator::topFormEditorItem(const QList<QGraphicsItem*> - &itemList) -{ - if (itemList.isEmpty()) - return 0; - - return itemList.first(); -} - -void LiveRubberBandSelectionManipulator::begin(const QPointF &beginPoint) -{ - m_beginPoint = beginPoint; - m_selectionRectangleElement.setRect(m_beginPoint, m_beginPoint); - m_selectionRectangleElement.show(); - m_isActive = true; - QDeclarativeViewInspectorPrivate *inspectorPrivate - = QDeclarativeViewInspectorPrivate::get(m_editorView); - m_beginFormEditorItem = topFormEditorItem(inspectorPrivate->selectableItems(beginPoint)); - m_oldSelectionList = m_editorView->selectedItems(); -} - -void LiveRubberBandSelectionManipulator::update(const QPointF &updatePoint) -{ - m_selectionRectangleElement.setRect(m_beginPoint, updatePoint); -} - -void LiveRubberBandSelectionManipulator::end() -{ - m_oldSelectionList.clear(); - m_selectionRectangleElement.hide(); - m_isActive = false; -} - -void LiveRubberBandSelectionManipulator::select(SelectionType selectionType) -{ - QDeclarativeViewInspectorPrivate *inspectorPrivate - = QDeclarativeViewInspectorPrivate::get(m_editorView); - QList<QGraphicsItem*> itemList - = inspectorPrivate->selectableItems(m_selectionRectangleElement.rect(), - Qt::IntersectsItemShape); - QList<QGraphicsItem*> newSelectionList; - - foreach (QGraphicsItem* item, itemList) { - if (item - && item->parentItem() - && !newSelectionList.contains(item) - //&& m_beginFormEditorItem->childItems().contains(item) // TODO activate this test - ) - { - newSelectionList.append(item); - } - } - - if (newSelectionList.isEmpty() && m_beginFormEditorItem) - newSelectionList.append(m_beginFormEditorItem); - - QList<QGraphicsItem*> resultList; - - switch(selectionType) { - case AddToSelection: { - resultList.append(m_oldSelectionList); - resultList.append(newSelectionList); - } - break; - case ReplaceSelection: { - resultList.append(newSelectionList); - } - break; - case RemoveFromSelection: { - QSet<QGraphicsItem*> oldSelectionSet(m_oldSelectionList.toSet()); - QSet<QGraphicsItem*> newSelectionSet(newSelectionList.toSet()); - resultList.append(oldSelectionSet.subtract(newSelectionSet).toList()); - } - } - - m_editorView->setSelectedItems(resultList); -} - - -void LiveRubberBandSelectionManipulator::setItems(const QList<QGraphicsItem*> &itemList) -{ - m_itemList = itemList; -} - -QPointF LiveRubberBandSelectionManipulator::beginPoint() const -{ - return m_beginPoint; -} - -bool LiveRubberBandSelectionManipulator::isActive() const -{ - return m_isActive; -} - -} // namespace QmlJSDebugger diff --git a/share/qtcreator/qml/qmljsdebugger/editor/liverubberbandselectionmanipulator.h b/share/qtcreator/qml/qmljsdebugger/editor/liverubberbandselectionmanipulator.h deleted file mode 100644 index 8b2cee12895aedf6076bdce75dbd41b5a44bb274..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/liverubberbandselectionmanipulator.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef RUBBERBANDSELECTIONMANIPULATOR_H -#define RUBBERBANDSELECTIONMANIPULATOR_H - - -#include "liveselectionrectangle.h" - -#include <QPointF> - -QT_FORWARD_DECLARE_CLASS(QGraphicsItem) - -namespace QmlJSDebugger { - -class QDeclarativeViewInspector; - -class LiveRubberBandSelectionManipulator -{ -public: - enum SelectionType { - ReplaceSelection, - AddToSelection, - RemoveFromSelection - }; - - LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem, - QDeclarativeViewInspector *editorView); - - void setItems(const QList<QGraphicsItem*> &itemList); - - void begin(const QPointF& beginPoint); - void update(const QPointF& updatePoint); - void end(); - - void clear(); - - void select(SelectionType selectionType); - - QPointF beginPoint() const; - - bool isActive() const; - -protected: - QGraphicsItem *topFormEditorItem(const QList<QGraphicsItem*> &itemList); - -private: - QList<QGraphicsItem*> m_itemList; - QList<QGraphicsItem*> m_oldSelectionList; - LiveSelectionRectangle m_selectionRectangleElement; - QPointF m_beginPoint; - QDeclarativeViewInspector *m_editorView; - QGraphicsItem *m_beginFormEditorItem; - bool m_isActive; -}; - -} - -#endif // RUBBERBANDSELECTIONMANIPULATOR_H diff --git a/share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.cpp b/share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.cpp deleted file mode 100644 index 67d35b11ec9af5fcc259bafa36c0f2f4f7b2d405..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "liveselectionindicator.h" -#include "../qdeclarativeviewinspector_p.h" -#include "qmlinspectorconstants.h" - -#include <QGraphicsRectItem> -#include <QGraphicsObject> -#include <QGraphicsScene> -#include <QPen> - -namespace QmlJSDebugger { - -LiveSelectionIndicator::LiveSelectionIndicator(QDeclarativeViewInspector *viewInspector, - QGraphicsObject *layerItem) - : m_layerItem(layerItem) - , m_view(viewInspector) -{ -} - -LiveSelectionIndicator::~LiveSelectionIndicator() -{ - clear(); -} - -void LiveSelectionIndicator::show() -{ - foreach (QGraphicsRectItem *item, m_indicatorShapeHash) - item->show(); -} - -void LiveSelectionIndicator::hide() -{ - foreach (QGraphicsRectItem *item, m_indicatorShapeHash) - item->hide(); -} - -void LiveSelectionIndicator::clear() -{ - if (!m_layerItem.isNull()) { - QGraphicsScene *scene = m_layerItem.data()->scene(); - foreach (QGraphicsRectItem *item, m_indicatorShapeHash) { - scene->removeItem(item); - delete item; - } - } - - m_indicatorShapeHash.clear(); - -} - -void LiveSelectionIndicator::setItems(const QList<QWeakPointer<QGraphicsObject> > &itemList) -{ - clear(); - - foreach (const QWeakPointer<QGraphicsObject> &object, itemList) { - if (object.isNull()) - continue; - - QGraphicsItem *item = object.data(); - - if (!m_indicatorShapeHash.contains(item)) { - QGraphicsRectItem *selectionIndicator = new QGraphicsRectItem(m_layerItem.data()); - m_indicatorShapeHash.insert(item, selectionIndicator); - - const QRectF boundingRect = m_view->adjustToScreenBoundaries(item->mapRectToScene(item->boundingRect())); - const QRectF boundingRectInLayerItemSpace = m_layerItem.data()->mapRectFromScene(boundingRect); - - selectionIndicator->setData(Constants::EditorItemDataKey, true); - selectionIndicator->setFlag(QGraphicsItem::ItemIsSelectable, false); - selectionIndicator->setRect(boundingRectInLayerItemSpace); - selectionIndicator->setPen(QColor(108, 141, 221)); - } - } -} - -} //namespace QmlJSDebugger - diff --git a/share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.h b/share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.h deleted file mode 100644 index c3fc2b1d713e531e6f941224c8ece4fe866f4c53..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef LIVESELECTIONINDICATOR_H -#define LIVESELECTIONINDICATOR_H - -#include <QWeakPointer> -#include <QHash> - -QT_BEGIN_NAMESPACE -class QGraphicsObject; -class QGraphicsRectItem; -class QGraphicsItem; -class QPolygonF; -QT_END_NAMESPACE - -namespace QmlJSDebugger { - -class QDeclarativeViewInspector; - -class LiveSelectionIndicator -{ -public: - LiveSelectionIndicator(QDeclarativeViewInspector *viewInspector, QGraphicsObject *layerItem); - ~LiveSelectionIndicator(); - - void show(); - void hide(); - - void clear(); - - void setItems(const QList<QWeakPointer<QGraphicsObject> > &itemList); - -private: - QHash<QGraphicsItem*, QGraphicsRectItem *> m_indicatorShapeHash; - QWeakPointer<QGraphicsObject> m_layerItem; - QDeclarativeViewInspector *m_view; -}; - -} - -#endif // LIVESELECTIONINDICATOR_H diff --git a/share/qtcreator/qml/qmljsdebugger/editor/liveselectionrectangle.cpp b/share/qtcreator/qml/qmljsdebugger/editor/liveselectionrectangle.cpp deleted file mode 100644 index 301f43a42de7b837d28c1ea094a596a9cb9fb376..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/liveselectionrectangle.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "liveselectionrectangle.h" -#include "qmlinspectorconstants.h" - -#include <QPen> -#include <QGraphicsRectItem> -#include <QGraphicsObject> -#include <QGraphicsScene> - -#include <QDebug> - -#include <cmath> - -namespace QmlJSDebugger { - -class SelectionRectShape : public QGraphicsRectItem -{ -public: - SelectionRectShape(QGraphicsItem *parent = 0) : QGraphicsRectItem(parent) {} - int type() const { return Constants::EditorItemType; } -}; - -LiveSelectionRectangle::LiveSelectionRectangle(QGraphicsObject *layerItem) - : m_controlShape(new SelectionRectShape(layerItem)), - m_layerItem(layerItem) -{ - m_controlShape->setPen(QPen(Qt::black)); - m_controlShape->setBrush(QColor(128, 128, 128, 50)); -} - -LiveSelectionRectangle::~LiveSelectionRectangle() -{ - if (m_layerItem) - m_layerItem.data()->scene()->removeItem(m_controlShape); -} - -void LiveSelectionRectangle::clear() -{ - hide(); -} -void LiveSelectionRectangle::show() -{ - m_controlShape->show(); -} - -void LiveSelectionRectangle::hide() -{ - m_controlShape->hide(); -} - -QRectF LiveSelectionRectangle::rect() const -{ - return m_controlShape->mapFromScene(m_controlShape->rect()).boundingRect(); -} - -void LiveSelectionRectangle::setRect(const QPointF &firstPoint, - const QPointF &secondPoint) -{ - double firstX = std::floor(firstPoint.x()) + 0.5; - double firstY = std::floor(firstPoint.y()) + 0.5; - double secondX = std::floor(secondPoint.x()) + 0.5; - double secondY = std::floor(secondPoint.y()) + 0.5; - QPointF topLeftPoint(firstX < secondX ? firstX : secondX, - firstY < secondY ? firstY : secondY); - QPointF bottomRightPoint(firstX > secondX ? firstX : secondX, - firstY > secondY ? firstY : secondY); - - QRectF rect(topLeftPoint, bottomRightPoint); - m_controlShape->setRect(rect); -} - -} diff --git a/share/qtcreator/qml/qmljsdebugger/editor/liveselectionrectangle.h b/share/qtcreator/qml/qmljsdebugger/editor/liveselectionrectangle.h deleted file mode 100644 index 76fdbb81b32b4471758ffdd98152caac844d8610..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/liveselectionrectangle.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef LIVESELECTIONRECTANGLE_H -#define LIVESELECTIONRECTANGLE_H - -#include <QWeakPointer> - -QT_FORWARD_DECLARE_CLASS(QGraphicsObject) -QT_FORWARD_DECLARE_CLASS(QGraphicsRectItem) -QT_FORWARD_DECLARE_CLASS(QPointF) -QT_FORWARD_DECLARE_CLASS(QRectF) - -namespace QmlJSDebugger { - -class LiveSelectionRectangle -{ -public: - LiveSelectionRectangle(QGraphicsObject *layerItem); - ~LiveSelectionRectangle(); - - void show(); - void hide(); - - void clear(); - - void setRect(const QPointF &firstPoint, - const QPointF &secondPoint); - - QRectF rect() const; - -private: - QGraphicsRectItem *m_controlShape; - QWeakPointer<QGraphicsObject> m_layerItem; -}; - -} // namespace QmlJSDebugger - -#endif // LIVESELECTIONRECTANGLE_H diff --git a/share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.cpp deleted file mode 100644 index 8ed9c60f6a62adfafbc0c2f8fce87ac8fd03e823..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.cpp +++ /dev/null @@ -1,424 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "liveselectiontool.h" -#include "livelayeritem.h" - -#include "../qdeclarativeviewinspector_p.h" - -#include <QApplication> -#include <QWheelEvent> -#include <QMouseEvent> -#include <QClipboard> -#include <QMenu> -#include <QAction> -#include <QGraphicsObject> - -#include <QDeclarativeItem> -#include <QDeclarativeEngine> - -#include <QDebug> - -namespace QmlJSDebugger { - -LiveSelectionTool::LiveSelectionTool(QDeclarativeViewInspector *editorView) : - AbstractLiveEditTool(editorView), - m_rubberbandSelectionMode(false), - m_rubberbandSelectionManipulator( - QDeclarativeViewInspectorPrivate::get(editorView)->manipulatorLayer, editorView), - m_singleSelectionManipulator(editorView), - m_selectionIndicator(editorView, - QDeclarativeViewInspectorPrivate::get(editorView)->manipulatorLayer), - //m_resizeIndicator(editorView->manipulatorLayer()), - m_selectOnlyContentItems(true) -{ - -} - -LiveSelectionTool::~LiveSelectionTool() -{ -} - -void LiveSelectionTool::setRubberbandSelectionMode(bool value) -{ - m_rubberbandSelectionMode = value; -} - -LiveSingleSelectionManipulator::SelectionType LiveSelectionTool::getSelectionType(Qt::KeyboardModifiers - modifiers) -{ - LiveSingleSelectionManipulator::SelectionType selectionType - = LiveSingleSelectionManipulator::ReplaceSelection; - if (modifiers.testFlag(Qt::ControlModifier)) { - selectionType = LiveSingleSelectionManipulator::RemoveFromSelection; - } else if (modifiers.testFlag(Qt::ShiftModifier)) { - selectionType = LiveSingleSelectionManipulator::AddToSelection; - } - return selectionType; -} - -bool LiveSelectionTool::alreadySelected(const QList<QGraphicsItem*> &itemList) const -{ - QDeclarativeViewInspectorPrivate *inspectorPrivate - = QDeclarativeViewInspectorPrivate::get(inspector()); - const QList<QGraphicsItem*> selectedItems = inspectorPrivate->selectedItems(); - - if (selectedItems.isEmpty()) - return false; - - foreach (QGraphicsItem *item, itemList) - if (selectedItems.contains(item)) - return true; - - return false; -} - -void LiveSelectionTool::mousePressEvent(QMouseEvent *event) -{ - QDeclarativeViewInspectorPrivate *inspectorPrivate - = QDeclarativeViewInspectorPrivate::get(inspector()); - QList<QGraphicsItem*> itemList = inspectorPrivate->selectableItems(event->pos()); - LiveSingleSelectionManipulator::SelectionType selectionType = getSelectionType(event->modifiers()); - - if (event->buttons() & Qt::LeftButton) { - m_mousePressTimer.start(); - - if (m_rubberbandSelectionMode) { - m_rubberbandSelectionManipulator.begin(event->pos()); - } else { - m_singleSelectionManipulator.begin(event->pos()); - m_singleSelectionManipulator.select(selectionType, m_selectOnlyContentItems); - } - } else if (event->buttons() & Qt::RightButton) { - createContextMenu(itemList, event->globalPos()); - } -} - -void LiveSelectionTool::createContextMenu(QList<QGraphicsItem*> itemList, QPoint globalPos) -{ - QMenu contextMenu; - connect(&contextMenu, SIGNAL(hovered(QAction*)), - this, SLOT(contextMenuElementHovered(QAction*))); - - m_contextMenuItemList = itemList; - - contextMenu.addAction("Items"); - contextMenu.addSeparator(); - int shortcutKey = Qt::Key_1; - bool addKeySequence = true; - 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 (addKeySequence) - elementAction->setShortcut(QKeySequence(shortcutKey)); - - shortcutKey++; - if (shortcutKey > Qt::Key_9) - addKeySequence = false; - - ++i; - } - // add root item separately - // QString itemTitle = QString(tr("%1")).arg(titleForItem(view()->currentRootItem())); - // contextMenu.addAction(itemTitle, this, SLOT(contextMenuElementSelected())); - // m_contextMenuItemList.append(view()->currentRootItem()); - - contextMenu.exec(globalPos); - m_contextMenuItemList.clear(); -} - -void LiveSelectionTool::contextMenuElementSelected() -{ - QAction *senderAction = static_cast<QAction*>(sender()); - int itemListIndex = senderAction->data().toInt(); - if (itemListIndex >= 0 && itemListIndex < m_contextMenuItemList.length()) { - - QPointF updatePt(0, 0); - QGraphicsItem *item = m_contextMenuItemList.at(itemListIndex); - m_singleSelectionManipulator.begin(updatePt); - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::InvertSelection, - QList<QGraphicsItem*>() << item, - false); - m_singleSelectionManipulator.end(updatePt); - } -} - -void LiveSelectionTool::contextMenuElementHovered(QAction *action) -{ - int itemListIndex = action->data().toInt(); - if (itemListIndex >= 0 && itemListIndex < m_contextMenuItemList.length()) { - QGraphicsObject *item = m_contextMenuItemList.at(itemListIndex)->toGraphicsObject(); - QDeclarativeViewInspectorPrivate::get(inspector())->highlight(item); - } -} - -void LiveSelectionTool::mouseMoveEvent(QMouseEvent *event) -{ - if (m_singleSelectionManipulator.isActive()) { - QPointF mouseMovementVector = m_singleSelectionManipulator.beginPoint() - event->pos(); - - if ((mouseMovementVector.toPoint().manhattanLength() > Constants::DragStartDistance) - && (m_mousePressTimer.elapsed() > Constants::DragStartTime)) - { - m_singleSelectionManipulator.end(event->pos()); - //view()->changeToMoveTool(m_singleSelectionManipulator.beginPoint()); - return; - } - } else if (m_rubberbandSelectionManipulator.isActive()) { - QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->pos(); - - if ((mouseMovementVector.toPoint().manhattanLength() > Constants::DragStartDistance) - && (m_mousePressTimer.elapsed() > Constants::DragStartTime)) { - m_rubberbandSelectionManipulator.update(event->pos()); - - if (event->modifiers().testFlag(Qt::ControlModifier)) - m_rubberbandSelectionManipulator.select( - LiveRubberBandSelectionManipulator::RemoveFromSelection); - else if (event->modifiers().testFlag(Qt::ShiftModifier)) - m_rubberbandSelectionManipulator.select( - LiveRubberBandSelectionManipulator::AddToSelection); - else - m_rubberbandSelectionManipulator.select( - LiveRubberBandSelectionManipulator::ReplaceSelection); - } - } -} - -void LiveSelectionTool::hoverMoveEvent(QMouseEvent * event) -{ -// ### commented out until move tool is re-enabled -// QList<QGraphicsItem*> itemList = view()->items(event->pos()); -// if (!itemList.isEmpty() && !m_rubberbandSelectionMode) { -// -// foreach (QGraphicsItem *item, itemList) { -// if (item->type() == Constants::ResizeHandleItemType) { -// ResizeHandleItem* resizeHandle = ResizeHandleItem::fromGraphicsItem(item); -// if (resizeHandle) -// view()->changeTool(Constants::ResizeToolMode); -// return; -// } -// } -// if (topSelectedItemIsMovable(itemList)) -// view()->changeTool(Constants::MoveToolMode); -// } - QDeclarativeViewInspectorPrivate *inspectorPrivate - = QDeclarativeViewInspectorPrivate::get(inspector()); - - QList<QGraphicsItem*> selectableItemList = inspectorPrivate->selectableItems(event->pos()); - if (!selectableItemList.isEmpty()) { - QGraphicsObject *item = selectableItemList.first()->toGraphicsObject(); - if (item) - QDeclarativeViewInspectorPrivate::get(inspector())->highlight(item); - - return; - } - - QDeclarativeViewInspectorPrivate::get(inspector())->clearHighlight(); -} - -void LiveSelectionTool::mouseReleaseEvent(QMouseEvent *event) -{ - if (m_singleSelectionManipulator.isActive()) { - m_singleSelectionManipulator.end(event->pos()); - } else if (m_rubberbandSelectionManipulator.isActive()) { - QPointF mouseMovementVector = m_rubberbandSelectionManipulator.beginPoint() - event->pos(); - if (mouseMovementVector.toPoint().manhattanLength() < Constants::DragStartDistance) { - m_singleSelectionManipulator.begin(event->pos()); - - if (event->modifiers().testFlag(Qt::ControlModifier)) - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::RemoveFromSelection, - m_selectOnlyContentItems); - else if (event->modifiers().testFlag(Qt::ShiftModifier)) - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::AddToSelection, - m_selectOnlyContentItems); - else - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::InvertSelection, - m_selectOnlyContentItems); - - m_singleSelectionManipulator.end(event->pos()); - } else { - m_rubberbandSelectionManipulator.update(event->pos()); - - if (event->modifiers().testFlag(Qt::ControlModifier)) - m_rubberbandSelectionManipulator.select( - LiveRubberBandSelectionManipulator::RemoveFromSelection); - else if (event->modifiers().testFlag(Qt::ShiftModifier)) - m_rubberbandSelectionManipulator.select( - LiveRubberBandSelectionManipulator::AddToSelection); - else - m_rubberbandSelectionManipulator.select( - LiveRubberBandSelectionManipulator::ReplaceSelection); - - m_rubberbandSelectionManipulator.end(); - } - } -} - -void LiveSelectionTool::mouseDoubleClickEvent(QMouseEvent * /*event*/) -{ -} - -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::keyReleaseEvent(QKeyEvent * /*keyEvent*/) -{ - -} - -void LiveSelectionTool::wheelEvent(QWheelEvent *event) -{ - if (event->orientation() == Qt::Horizontal || m_rubberbandSelectionMode) - return; - - QDeclarativeViewInspectorPrivate *inspectorPrivate - = QDeclarativeViewInspectorPrivate::get(inspector()); - QList<QGraphicsItem*> itemList = inspectorPrivate->selectableItems(event->pos()); - - if (itemList.isEmpty()) - return; - - int selectedIdx = 0; - if (!inspector()->selectedItems().isEmpty()) { - selectedIdx = itemList.indexOf(inspector()->selectedItems().first()); - if (selectedIdx >= 0) { - if (event->delta() > 0) { - selectedIdx++; - if (selectedIdx == itemList.length()) - selectedIdx = 0; - } else if (event->delta() < 0) { - selectedIdx--; - if (selectedIdx == -1) - selectedIdx = itemList.length() - 1; - } - } else { - selectedIdx = 0; - } - } - - QPointF updatePt(0, 0); - m_singleSelectionManipulator.begin(updatePt); - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::ReplaceSelection, - QList<QGraphicsItem*>() << itemList.at(selectedIdx), - false); - m_singleSelectionManipulator.end(updatePt); - -} - -void LiveSelectionTool::setSelectOnlyContentItems(bool selectOnlyContentItems) -{ - m_selectOnlyContentItems = selectOnlyContentItems; -} - -void LiveSelectionTool::itemsAboutToRemoved(const QList<QGraphicsItem*> &/*itemList*/) -{ -} - -void LiveSelectionTool::clear() -{ - view()->setCursor(Qt::ArrowCursor); - m_rubberbandSelectionManipulator.clear(), - m_singleSelectionManipulator.clear(); - m_selectionIndicator.clear(); - //m_resizeIndicator.clear(); -} - -void LiveSelectionTool::selectedItemsChanged(const QList<QGraphicsItem*> &itemList) -{ - foreach (const QWeakPointer<QGraphicsObject> &obj, m_selectedItemList) { - if (!obj.isNull()) { - disconnect(obj.data(), SIGNAL(xChanged()), this, SLOT(repaintBoundingRects())); - disconnect(obj.data(), SIGNAL(yChanged()), this, SLOT(repaintBoundingRects())); - disconnect(obj.data(), SIGNAL(widthChanged()), this, SLOT(repaintBoundingRects())); - disconnect(obj.data(), SIGNAL(heightChanged()), this, SLOT(repaintBoundingRects())); - disconnect(obj.data(), SIGNAL(rotationChanged()), this, SLOT(repaintBoundingRects())); - } - } - - QList<QGraphicsObject*> objects = toGraphicsObjectList(itemList); - m_selectedItemList.clear(); - - foreach (QGraphicsObject *obj, objects) { - m_selectedItemList.append(obj); - connect(obj, SIGNAL(xChanged()), this, SLOT(repaintBoundingRects())); - connect(obj, SIGNAL(yChanged()), this, SLOT(repaintBoundingRects())); - connect(obj, SIGNAL(widthChanged()), this, SLOT(repaintBoundingRects())); - connect(obj, SIGNAL(heightChanged()), this, SLOT(repaintBoundingRects())); - connect(obj, SIGNAL(rotationChanged()), this, SLOT(repaintBoundingRects())); - } - - m_selectionIndicator.setItems(m_selectedItemList); - //m_resizeIndicator.setItems(toGraphicsObjectList(itemList)); -} - -void LiveSelectionTool::repaintBoundingRects() -{ - m_selectionIndicator.setItems(m_selectedItemList); -} - -void LiveSelectionTool::selectUnderPoint(QMouseEvent *event) -{ - m_singleSelectionManipulator.begin(event->pos()); - - if (event->modifiers().testFlag(Qt::ControlModifier)) - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::RemoveFromSelection, - m_selectOnlyContentItems); - else if (event->modifiers().testFlag(Qt::ShiftModifier)) - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::AddToSelection, - m_selectOnlyContentItems); - else - m_singleSelectionManipulator.select(LiveSingleSelectionManipulator::InvertSelection, - m_selectOnlyContentItems); - - m_singleSelectionManipulator.end(event->pos()); -} - -} // namespace QmlJSDebugger diff --git a/share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.h b/share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.h deleted file mode 100644 index d2b900f518e02fdb1867e343bcd9b67a90598168..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.h +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef LIVESELECTIONTOOL_H -#define LIVESELECTIONTOOL_H - - -#include "abstractliveedittool.h" -#include "liverubberbandselectionmanipulator.h" -#include "livesingleselectionmanipulator.h" -#include "liveselectionindicator.h" - -#include <QList> -#include <QTime> - -QT_FORWARD_DECLARE_CLASS(QGraphicsItem) -QT_FORWARD_DECLARE_CLASS(QMouseEvent) -QT_FORWARD_DECLARE_CLASS(QKeyEvent) -QT_FORWARD_DECLARE_CLASS(QAction) - -namespace QmlJSDebugger { - -class LiveSelectionTool : public AbstractLiveEditTool -{ - Q_OBJECT - -public: - LiveSelectionTool(QDeclarativeViewInspector* editorView); - ~LiveSelectionTool(); - - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseDoubleClickEvent(QMouseEvent *event); - void hoverMoveEvent(QMouseEvent *event); - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *keyEvent); - void wheelEvent(QWheelEvent *event); - - void itemsAboutToRemoved(const QList<QGraphicsItem*> &itemList); -// QVariant itemChange(const QList<QGraphicsItem*> &itemList, -// QGraphicsItem::GraphicsItemChange change, -// const QVariant &value ); - -// void update(); - - void clear(); - - void selectedItemsChanged(const QList<QGraphicsItem*> &itemList); - - void selectUnderPoint(QMouseEvent *event); - - void setSelectOnlyContentItems(bool selectOnlyContentItems); - - void setRubberbandSelectionMode(bool value); - -private slots: - void contextMenuElementSelected(); - void contextMenuElementHovered(QAction *action); - void repaintBoundingRects(); - -private: - void createContextMenu(QList<QGraphicsItem*> itemList, QPoint globalPos); - LiveSingleSelectionManipulator::SelectionType getSelectionType(Qt::KeyboardModifiers modifiers); - bool alreadySelected(const QList<QGraphicsItem*> &itemList) const; - -private: - bool m_rubberbandSelectionMode; - LiveRubberBandSelectionManipulator m_rubberbandSelectionManipulator; - LiveSingleSelectionManipulator m_singleSelectionManipulator; - LiveSelectionIndicator m_selectionIndicator; - //ResizeIndicator m_resizeIndicator; - QTime m_mousePressTimer; - bool m_selectOnlyContentItems; - - QList<QWeakPointer<QGraphicsObject> > m_selectedItemList; - - QList<QGraphicsItem*> m_contextMenuItemList; -}; - -} // namespace QmlJSDebugger - -#endif // LIVESELECTIONTOOL_H diff --git a/share/qtcreator/qml/qmljsdebugger/editor/livesingleselectionmanipulator.cpp b/share/qtcreator/qml/qmljsdebugger/editor/livesingleselectionmanipulator.cpp deleted file mode 100644 index 11c69edd5712912a8884948a5db1fe17f14bdd27..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/livesingleselectionmanipulator.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "livesingleselectionmanipulator.h" -#include "qdeclarativeviewinspector.h" -#include "../qdeclarativeviewinspector_p.h" -#include <QDebug> - -namespace QmlJSDebugger { - -LiveSingleSelectionManipulator::LiveSingleSelectionManipulator(QDeclarativeViewInspector *editorView) - : m_editorView(editorView), - m_isActive(false) -{ -} - - -void LiveSingleSelectionManipulator::begin(const QPointF &beginPoint) -{ - m_beginPoint = beginPoint; - m_isActive = true; - m_oldSelectionList = QDeclarativeViewInspectorPrivate::get(m_editorView)->selectedItems(); -} - -void LiveSingleSelectionManipulator::update(const QPointF &/*updatePoint*/) -{ - m_oldSelectionList.clear(); -} - -void LiveSingleSelectionManipulator::clear() -{ - m_beginPoint = QPointF(); - m_oldSelectionList.clear(); -} - - -void LiveSingleSelectionManipulator::end(const QPointF &/*updatePoint*/) -{ - m_oldSelectionList.clear(); - m_isActive = false; -} - -void LiveSingleSelectionManipulator::select(SelectionType selectionType, - const QList<QGraphicsItem*> &items, - bool /*selectOnlyContentItems*/) -{ - QGraphicsItem *selectedItem = 0; - - foreach (QGraphicsItem* item, items) - { - //FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item); - if (item - /*&& !formEditorItem->qmlItemNode().isRootNode() - && (formEditorItem->qmlItemNode().hasShowContent() || !selectOnlyContentItems)*/) - { - selectedItem = item; - break; - } - } - - QList<QGraphicsItem*> resultList; - - switch(selectionType) { - case AddToSelection: { - resultList.append(m_oldSelectionList); - if (selectedItem && !m_oldSelectionList.contains(selectedItem)) - resultList.append(selectedItem); - } - break; - case ReplaceSelection: { - if (selectedItem) - resultList.append(selectedItem); - } - break; - case RemoveFromSelection: { - resultList.append(m_oldSelectionList); - if (selectedItem) - resultList.removeAll(selectedItem); - } - break; - case InvertSelection: { - if (selectedItem - && !m_oldSelectionList.contains(selectedItem)) - { - resultList.append(selectedItem); - } - } - } - - m_editorView->setSelectedItems(resultList); -} - -void LiveSingleSelectionManipulator::select(SelectionType selectionType, bool selectOnlyContentItems) -{ - QDeclarativeViewInspectorPrivate *inspectorPrivate = - QDeclarativeViewInspectorPrivate::get(m_editorView); - QList<QGraphicsItem*> itemList = inspectorPrivate->selectableItems(m_beginPoint); - select(selectionType, itemList, selectOnlyContentItems); -} - - -bool LiveSingleSelectionManipulator::isActive() const -{ - return m_isActive; -} - -QPointF LiveSingleSelectionManipulator::beginPoint() const -{ - return m_beginPoint; -} - -} // namespace QmlJSDebugger diff --git a/share/qtcreator/qml/qmljsdebugger/editor/livesingleselectionmanipulator.h b/share/qtcreator/qml/qmljsdebugger/editor/livesingleselectionmanipulator.h deleted file mode 100644 index b5018d1fe3b2ce021fe3f79efa143dbf2d46129e..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/livesingleselectionmanipulator.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef LIVESINGLESELECTIONMANIPULATOR_H -#define LIVESINGLESELECTIONMANIPULATOR_H - -#include <QPointF> -#include <QList> - -QT_FORWARD_DECLARE_CLASS(QGraphicsItem); - -namespace QmlJSDebugger { - -class QDeclarativeViewInspector; - -class LiveSingleSelectionManipulator -{ -public: - LiveSingleSelectionManipulator(QDeclarativeViewInspector *editorView); - - enum SelectionType { - ReplaceSelection, - AddToSelection, - RemoveFromSelection, - InvertSelection - }; - - void begin(const QPointF& beginPoint); - void update(const QPointF& updatePoint); - void end(const QPointF& updatePoint); - - void select(SelectionType selectionType, const QList<QGraphicsItem*> &items, - bool selectOnlyContentItems); - void select(SelectionType selectionType, bool selectOnlyContentItems); - - void clear(); - - QPointF beginPoint() const; - - bool isActive() const; - -private: - QList<QGraphicsItem*> m_oldSelectionList; - QPointF m_beginPoint; - QDeclarativeViewInspector *m_editorView; - bool m_isActive; -}; - -} // namespace QmlJSDebugger - -#endif // LIVESINGLESELECTIONMANIPULATOR_H diff --git a/share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.cpp b/share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.cpp deleted file mode 100644 index 46dd1edf01e2548df3bed5ee851ce9433351e185..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "subcomponentmasklayeritem.h" -#include "qmlinspectorconstants.h" -#include "qdeclarativeviewinspector.h" -#include <QPolygonF> - -namespace QmlJSDebugger { - -SubcomponentMaskLayerItem::SubcomponentMaskLayerItem(QDeclarativeViewInspector *inspector, - QGraphicsItem *parentItem) : - QGraphicsPolygonItem(parentItem), - m_inspector(inspector), - m_currentItem(0), - m_borderRect(new QGraphicsRectItem(this)) -{ - m_borderRect->setRect(0,0,0,0); - m_borderRect->setPen(QPen(QColor(60, 60, 60), 1)); - m_borderRect->setData(Constants::EditorItemDataKey, QVariant(true)); - - setBrush(QBrush(QColor(160,160,160))); - setPen(Qt::NoPen); -} - -int SubcomponentMaskLayerItem::type() const -{ - return Constants::EditorItemType; -} - -static QRectF resizeRect(const QRectF &newRect, const QRectF &oldRect) -{ - QRectF result = newRect; - if (oldRect.left() < newRect.left()) - result.setLeft(oldRect.left()); - - if (oldRect.top() < newRect.top()) - result.setTop(oldRect.top()); - - if (oldRect.right() > newRect.right()) - result.setRight(oldRect.right()); - - if (oldRect.bottom() > newRect.bottom()) - result.setBottom(oldRect.bottom()); - - return result; -} - -static QPolygonF regionToPolygon(const QRegion ®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 QmlJSDebugger diff --git a/share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.h b/share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.h deleted file mode 100644 index 4faa9ba17568c5748ce4caa815fe6426a7b09f97..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef SUBCOMPONENTMASKLAYERITEM_H -#define SUBCOMPONENTMASKLAYERITEM_H - -#include <QGraphicsPolygonItem> - -namespace QmlJSDebugger { - -class QDeclarativeViewInspector; - -class SubcomponentMaskLayerItem : public QGraphicsPolygonItem -{ -public: - explicit SubcomponentMaskLayerItem(QDeclarativeViewInspector *inspector, - QGraphicsItem *parentItem = 0); - int type() const; - void setCurrentItem(QGraphicsItem *item); - void setBoundingBox(const QRectF &boundingBox); - QGraphicsItem *currentItem() const; - QRectF itemRect() const; - -private: - QDeclarativeViewInspector *m_inspector; - QGraphicsItem *m_currentItem; - QGraphicsRectItem *m_borderRect; - QRectF m_itemPolyRect; -}; - -} // namespace QmlJSDebugger - -#endif // SUBCOMPONENTMASKLAYERITEM_H diff --git a/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.cpp deleted file mode 100644 index ab8ebf5b3c365ed7f94bcafe644101bf9dac0784..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.cpp +++ /dev/null @@ -1,323 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "zoomtool.h" -#include "../qdeclarativeviewinspector_p.h" - -#include <QMouseEvent> -#include <QWheelEvent> -#include <QKeyEvent> -#include <QMenu> -#include <QAction> - -#include <QRectF> -#include <QDebug> - -namespace QmlJSDebugger { - -ZoomTool::ZoomTool(QDeclarativeViewInspector *view) : - AbstractLiveEditTool(view), - m_rubberbandManipulator(), - m_smoothZoomMultiplier(0.05f), - m_currentScale(1.0f) -{ - m_zoomTo100Action = new QAction(tr("Zoom to &100%"), this); - m_zoomInAction = new QAction(tr("Zoom In"), this); - m_zoomOutAction = new QAction(tr("Zoom Out"), this); - m_zoomInAction->setShortcut(QKeySequence(Qt::Key_Plus)); - m_zoomOutAction->setShortcut(QKeySequence(Qt::Key_Minus)); - - - LiveLayerItem *layerItem = QDeclarativeViewInspectorPrivate::get(view)->manipulatorLayer; - QGraphicsObject *layerObject = reinterpret_cast<QGraphicsObject *>(layerItem); - m_rubberbandManipulator = new LiveRubberBandSelectionManipulator(layerObject, view); - - - connect(m_zoomTo100Action, SIGNAL(triggered()), SLOT(zoomTo100())); - connect(m_zoomInAction, SIGNAL(triggered()), SLOT(zoomIn())); - connect(m_zoomOutAction, SIGNAL(triggered()), SLOT(zoomOut())); -} - -ZoomTool::~ZoomTool() -{ - delete m_rubberbandManipulator; -} - -void ZoomTool::mousePressEvent(QMouseEvent *event) -{ - m_mousePos = event->pos(); - - QPointF scenePos = view()->mapToScene(event->pos()); - - if (event->buttons() & Qt::RightButton) { - QMenu contextMenu; - contextMenu.addAction(m_zoomTo100Action); - contextMenu.addSeparator(); - contextMenu.addAction(m_zoomInAction); - contextMenu.addAction(m_zoomOutAction); - contextMenu.exec(event->globalPos()); - } else if (event->buttons() & Qt::LeftButton) { - m_dragBeginPos = scenePos; - m_dragStarted = false; - } -} - -void ZoomTool::mouseMoveEvent(QMouseEvent *event) -{ - m_mousePos = event->pos(); - - QPointF scenePos = view()->mapToScene(event->pos()); - - if (event->buttons() & Qt::LeftButton - && (QPointF(scenePos - m_dragBeginPos).manhattanLength() - > Constants::DragStartDistance / 3) - && !m_dragStarted) - { - m_dragStarted = true; - m_rubberbandManipulator->begin(m_dragBeginPos); - return; - } - - if (m_dragStarted) - m_rubberbandManipulator->update(scenePos); - -} - -void ZoomTool::mouseReleaseEvent(QMouseEvent *event) -{ - m_mousePos = event->pos(); - QPointF scenePos = view()->mapToScene(event->pos()); - - if (m_dragStarted) { - m_rubberbandManipulator->end(); - - int x1 = qMin(scenePos.x(), m_rubberbandManipulator->beginPoint().x()); - int x2 = qMax(scenePos.x(), m_rubberbandManipulator->beginPoint().x()); - int y1 = qMin(scenePos.y(), m_rubberbandManipulator->beginPoint().y()); - int y2 = qMax(scenePos.y(), m_rubberbandManipulator->beginPoint().y()); - - QPointF scenePosTopLeft = QPoint(x1, y1); - QPointF scenePosBottomRight = QPoint(x2, y2); - - QRectF sceneArea(scenePosTopLeft, scenePosBottomRight); - - m_currentScale = qMin(view()->rect().width() / sceneArea.width(), - view()->rect().height() / sceneArea.height()); - - - QTransform transform; - transform.scale(m_currentScale, m_currentScale); - - view()->setTransform(transform); - view()->setSceneRect(sceneArea); - } else { - Qt::KeyboardModifier modifierKey = Qt::ControlModifier; -#ifdef Q_OS_MAC - modifierKey = Qt::AltModifier; -#endif - if (event->modifiers() & modifierKey) { - zoomOut(); - } else { - zoomIn(); - } - } -} - -void ZoomTool::zoomIn() -{ - m_currentScale = nextZoomScale(ZoomIn); - scaleView(view()->mapToScene(m_mousePos)); -} - -void ZoomTool::zoomOut() -{ - m_currentScale = nextZoomScale(ZoomOut); - scaleView(view()->mapToScene(m_mousePos)); -} - -void ZoomTool::mouseDoubleClickEvent(QMouseEvent *event) -{ - m_mousePos = event->pos(); -} - - -void ZoomTool::hoverMoveEvent(QMouseEvent *event) -{ - m_mousePos = event->pos(); -} - - -void ZoomTool::keyPressEvent(QKeyEvent * /*event*/) -{ -} - -void ZoomTool::wheelEvent(QWheelEvent *event) -{ - if (event->orientation() != Qt::Vertical) - return; - - Qt::KeyboardModifier smoothZoomModifier = Qt::ControlModifier; - if (event->modifiers() & smoothZoomModifier) { - int numDegrees = event->delta() / 8; - m_currentScale += m_smoothZoomMultiplier * (numDegrees / 15.0f); - - scaleView(view()->mapToScene(m_mousePos)); - - } else if (!event->modifiers()) { - if (event->delta() > 0) { - m_currentScale = nextZoomScale(ZoomIn); - } else if (event->delta() < 0) { - m_currentScale = nextZoomScale(ZoomOut); - } - scaleView(view()->mapToScene(m_mousePos)); - } -} - -void ZoomTool::keyReleaseEvent(QKeyEvent *event) -{ - switch(event->key()) { - case Qt::Key_Plus: - zoomIn(); - break; - case Qt::Key_Minus: - zoomOut(); - break; - case Qt::Key_1: - case Qt::Key_2: - case Qt::Key_3: - case Qt::Key_4: - case Qt::Key_5: - case Qt::Key_6: - case Qt::Key_7: - case Qt::Key_8: - case Qt::Key_9: - { - m_currentScale = ((event->key() - Qt::Key_0) * 1.0f); - scaleView(view()->mapToScene(m_mousePos)); // view()->mapToScene(view()->rect().center()) - break; - } - - default: - break; - } - -} - -void ZoomTool::itemsAboutToRemoved(const QList<QGraphicsItem*> &/*itemList*/) -{ -} - -void ZoomTool::clear() -{ - view()->setCursor(Qt::ArrowCursor); -} - -void ZoomTool::selectedItemsChanged(const QList<QGraphicsItem*> &/*itemList*/) -{ -} - -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<qreal> zoomScales = - QList<qreal>() - << 0.125f - << 1.0f / 6.0f - << 0.25f - << 1.0f / 3.0f - << 0.5f - << 2.0f / 3.0f - << 1.0f - << 2.0f - << 3.0f - << 4.0f - << 5.0f - << 6.0f - << 7.0f - << 8.0f - << 12.0f - << 16.0f - << 32.0f - << 48.0f; - - if (direction == ZoomIn) { - for (int i = 0; i < zoomScales.length(); ++i) { - if (zoomScales[i] > m_currentScale || i == zoomScales.length() - 1) - return zoomScales[i]; - } - } else { - for (int i = zoomScales.length() - 1; i >= 0; --i) { - if (zoomScales[i] < m_currentScale || i == 0) - return zoomScales[i]; - } - } - - return 1.0f; -} - -} // namespace QmlJSDebugger diff --git a/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.h b/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.h deleted file mode 100644 index 999045f15b261749fee25dc2b58c2c2459016a8f..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef ZOOMTOOL_H -#define ZOOMTOOL_H - -#include "abstractliveedittool.h" -#include "liverubberbandselectionmanipulator.h" - -QT_FORWARD_DECLARE_CLASS(QAction) - -namespace QmlJSDebugger { - -class ZoomTool : public AbstractLiveEditTool -{ - Q_OBJECT -public: - enum ZoomDirection { - ZoomIn, - ZoomOut - }; - - explicit ZoomTool(QDeclarativeViewInspector *view); - - virtual ~ZoomTool(); - - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseDoubleClickEvent(QMouseEvent *event); - - void hoverMoveEvent(QMouseEvent *event); - void wheelEvent(QWheelEvent *event); - - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *keyEvent); - void itemsAboutToRemoved(const QList<QGraphicsItem*> &itemList); - - void clear(); -protected: - void selectedItemsChanged(const QList<QGraphicsItem*> &itemList); - -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 QmlJSDebugger - -#endif // ZOOMTOOL_H diff --git a/share/qtcreator/qml/qmljsdebugger/include/jsdebuggeragent.h b/share/qtcreator/qml/qmljsdebugger/include/jsdebuggeragent.h deleted file mode 100644 index 3602bd0a3ab283a2090297963e6a936a97125ded..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/include/jsdebuggeragent.h +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef JSDEBUGGERAGENT_H -#define JSDEBUGGERAGENT_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qscriptengineagent.h> - -#include "qt_private/qdeclarativedebugservice_p.h" - -#include "qmljsdebugger_global.h" - -QT_BEGIN_NAMESPACE -class QScriptValue; -class QDeclarativeEngine; -QT_END_NAMESPACE - -namespace QmlJSDebugger { - -class JSDebuggerAgentPrivate; - -class QMLJSDEBUGGER_EXPORT JSDebuggerAgent - : public QDeclarativeDebugService - , public QScriptEngineAgent -{ - Q_OBJECT - -public: - JSDebuggerAgent(QScriptEngine *engine); - JSDebuggerAgent(QDeclarativeEngine *engine); - ~JSDebuggerAgent(); - - // reimplemented - void scriptLoad(qint64 id, const QString &program, - const QString &fileName, int baseLineNumber); - void scriptUnload(qint64 id); - - void contextPush(); - void contextPop(); - - void functionEntry(qint64 scriptId); - void functionExit(qint64 scriptId, - const QScriptValue &returnValue); - - void positionChange(qint64 scriptId, - int lineNumber, int columnNumber); - - void exceptionThrow(qint64 scriptId, - const QScriptValue &exception, - bool hasHandler); - void exceptionCatch(qint64 scriptId, - const QScriptValue &exception); - - bool supportsExtension(Extension extension) const; - QVariant extension(Extension extension, - const QVariant &argument = QVariant()); - - void messageReceived(const QByteArray &); - void statusChanged(Status status); - void baseMessageReceived(const QByteArray &message); - -public slots: - -private: - JSDebuggerAgentPrivate *d; -}; - -} // namespace QmlJSDebugger - -#endif // JSDEBUGGERAGENT_H diff --git a/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeinspectorservice.h b/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeinspectorservice.h deleted file mode 100644 index f6c02b1978be2604ed79964a5a98904e155652d6..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeinspectorservice.h +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QDECLARATIVEDINSPECTORSERVICE_H -#define QDECLARATIVEDINSPECTORSERVICE_H - -#include "qt_private/qdeclarativedebugservice_p.h" -#include "qmlinspectorconstants.h" -#include "qmljsdebugger_global.h" - -#include <QHash> - -QT_FORWARD_DECLARE_CLASS(QColor) -QT_FORWARD_DECLARE_CLASS(QDeclarativeEngine) -QT_FORWARD_DECLARE_CLASS(QDeclarativeContext) -QT_FORWARD_DECLARE_CLASS(QDeclarativeWatcher) -QT_FORWARD_DECLARE_CLASS(QDataStream) - -namespace QmlJSDebugger { - -class QMLJSDEBUGGER_EXPORT QDeclarativeInspectorService : public QDeclarativeDebugService -{ - Q_OBJECT -public: - QDeclarativeInspectorService(); - static QDeclarativeInspectorService *instance(); - - void setDesignModeBehavior(bool inDesignMode); - void setCurrentObjects(QList<QObject*> items); - void setAnimationSpeed(qreal slowDownFactor); - void setAnimationPaused(bool paused); - void setCurrentTool(QmlJSDebugger::Constants::DesignTool toolId); - void reloaded(); - void setShowAppOnTop(bool showAppOnTop); - - QString idStringForObject(QObject *obj) const; - - void sendMessage(const QByteArray &message); - -public Q_SLOTS: - void selectedColorChanged(const QColor &color); - -Q_SIGNALS: - void debuggingClientChanged(bool hasDebuggingClient); - - void currentObjectsChanged(const QList<QObject*> &objects); - void designModeBehaviorChanged(bool inDesignMode); - void showAppOnTopChanged(bool showAppOnTop); - void reloadRequested(); - void selectToolRequested(); - void selectMarqueeToolRequested(); - void zoomToolRequested(); - void colorPickerToolRequested(); - - void objectCreationRequested(const QString &qml, QObject *parent, - const QStringList &imports, const QString &filename = QString(), int order = -1); - void objectReparentRequested(QObject *object, QObject *newParent); - void objectDeletionRequested(QObject *object); - - // 1 = normal speed, - // 1 < x < 16 = slowdown by some factor - void animationSpeedChangeRequested(qreal speedFactor); - void executionPauseChangeRequested(bool paused); - - void clearComponentCacheRequested(); - -protected: - virtual void statusChanged(Status status); - virtual void messageReceived(const QByteArray &); - -private: - QHash<int, QString> m_stringIdForObjectId; -}; - -} // namespace QmlJSDebugger - -#endif // QDECLARATIVEDINSPECTORSERVICE_H diff --git a/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewinspector.h b/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewinspector.h deleted file mode 100644 index 16adc285ba9086dd4d551f40514e6a925c9b41b7..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewinspector.h +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QDECLARATIVEVIEWINSPECTOR_H -#define QDECLARATIVEVIEWINSPECTOR_H - -#include "qmljsdebugger_global.h" -#include "qmlinspectorconstants.h" - -#include <QScopedPointer> -#include <QDeclarativeView> - -QT_FORWARD_DECLARE_CLASS(QDeclarativeItem) -QT_FORWARD_DECLARE_CLASS(QMouseEvent) - -namespace QmlJSDebugger { - -class CrumblePath; -class QDeclarativeViewInspectorPrivate; - -class QMLJSDEBUGGER_EXPORT QDeclarativeViewInspector : public QObject -{ - Q_OBJECT -public: - - explicit QDeclarativeViewInspector(QDeclarativeView *view, QObject *parent = 0); - ~QDeclarativeViewInspector(); - - void setSelectedItems(QList<QGraphicsItem *> items); - QList<QGraphicsItem *> selectedItems(); - - QDeclarativeView *declarativeView(); - - static QString idStringForObject(QObject *obj); - QRectF adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace); - - bool showAppOnTop() const; - -public Q_SLOTS: - void setDesignModeBehavior(bool value); - bool designModeBehavior(); - - void setShowAppOnTop(bool appOnTop); - - void setAnimationSpeed(qreal factor); - void setAnimationPaused(bool paused); - -Q_SIGNALS: - void designModeBehaviorChanged(bool inDesignMode); - void showAppOnTopChanged(bool showAppOnTop); - void reloadRequested(); - void marqueeSelectToolActivated(); - void selectToolActivated(); - void zoomToolActivated(); - void colorPickerActivated(); - void selectedColorChanged(const QColor &color); - - void animationSpeedChanged(qreal factor); - void animationPausedChanged(bool paused); - -protected: - bool eventFilter(QObject *obj, QEvent *event); - - bool leaveEvent(QEvent *); - bool mousePressEvent(QMouseEvent *event); - bool mouseMoveEvent(QMouseEvent *event); - bool mouseReleaseEvent(QMouseEvent *event); - bool keyPressEvent(QKeyEvent *event); - bool keyReleaseEvent(QKeyEvent *keyEvent); - bool mouseDoubleClickEvent(QMouseEvent *event); - bool wheelEvent(QWheelEvent *event); - - void setSelectedItemsForTools(QList<QGraphicsItem *> items); - -private slots: - void animationSpeedChangeRequested(qreal factor); - void animationPausedChangeRequested(bool paused); - -private: - Q_DISABLE_COPY(QDeclarativeViewInspector) - - inline QDeclarativeViewInspectorPrivate *d_func() { return data.data(); } - QScopedPointer<QDeclarativeViewInspectorPrivate> data; - friend class QDeclarativeViewInspectorPrivate; - friend class AbstractLiveEditTool; -}; - -} // namespace QmlJSDebugger - -#endif // QDECLARATIVEVIEWINSPECTOR_H diff --git a/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewobserver.h b/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewobserver.h deleted file mode 100644 index 938f96463ca556083e8177cfd5d48a0c30ea8872..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewobserver.h +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QDECLARATIVEVIEWOBSERVER_H -#define QDECLARATIVEVIEWOBSERVER_H - -#include "qdeclarativeviewinspector.h" - -namespace QmlJSDebugger { - -// Provided for compatibility with QmlApplicationViewer -class QMLJSDEBUGGER_EXPORT QDeclarativeViewObserver : public QDeclarativeViewInspector -{ - Q_OBJECT - -public: - explicit QDeclarativeViewObserver(QDeclarativeView *view, QObject *parent = 0) - : QDeclarativeViewInspector(view, parent) - {} -}; - -} // namespace QmlJSDebugger - -#endif // QDECLARATIVEVIEWOBSERVER_H diff --git a/share/qtcreator/qml/qmljsdebugger/include/qmlinspectorconstants.h b/share/qtcreator/qml/qmljsdebugger/include/qmlinspectorconstants.h deleted file mode 100644 index 080892fa83b46bdb212f0ee5b392dd93a54ac78e..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/include/qmlinspectorconstants.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QMLINSPECTORCONSTANTS_H -#define QMLINSPECTORCONSTANTS_H - -namespace QmlJSDebugger { -namespace Constants { - -enum DesignTool { - NoTool = 0, - SelectionToolMode = 1, - MarqueeSelectionToolMode = 2, - MoveToolMode = 3, - ResizeToolMode = 4, - ColorPickerMode = 5, - ZoomMode = 6 -}; - -enum ToolFlags { - NoToolFlags = 0, - UseCursorPos = 1 -}; - -static const int DragStartTime = 50; - -static const int DragStartDistance = 20; - -static const double ZoomSnapDelta = 0.04; - -static const int EditorItemDataKey = 1000; - -enum GraphicsItemTypes { - EditorItemType = 0xEAAA, - ResizeHandleItemType = 0xEAEA -}; - - -} // namespace Constants -} // namespace QmlJSDebugger - -#endif // QMLINSPECTORCONSTANTS_H diff --git a/share/qtcreator/qml/qmljsdebugger/include/qmljsdebugger_global.h b/share/qtcreator/qml/qmljsdebugger/include/qmljsdebugger_global.h deleted file mode 100644 index 224927e54f85abad36a98901b078a3e0789530ec..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/include/qmljsdebugger_global.h +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QMLJSDEBUGGER_GLOBAL_H -#define QMLJSDEBUGGER_GLOBAL_H - -#include <qglobal.h> - -# if defined(BUILD_QMLJSDEBUGGER_LIB) -# define QMLJSDEBUGGER_EXPORT Q_DECL_EXPORT -# define QMLJSDEBUGGER_EXTERN Q_DECL_IMPORT -# elif defined(BUILD_QMLJSDEBUGGER_STATIC_LIB) -# define QMLJSDEBUGGER_EXPORT -# define QMLJSDEBUGGER_EXTERN Q_DECL_IMPORT -# else -# define QMLJSDEBUGGER_EXPORT -# define QMLJSDEBUGGER_EXTERN Q_DECL_IMPORT -#endif - -#endif // QMLJSDEBUGGER_GLOBAL_H diff --git a/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebughelper_p.h b/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebughelper_p.h deleted file mode 100644 index a1872a1ef192a43a70c23717bda5b64f5524c25e..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebughelper_p.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QDECLARATIVEDEBUGHELPER_P_H -#define QDECLARATIVEDEBUGHELPER_P_H - -#include "../qmljsdebugger_global.h" -#include <qglobal.h> - -QT_BEGIN_NAMESPACE - -class QScriptEngine; -class QDeclarativeEngine; - -// Helper functions to access private API through a stable interface -// This is used in the qmljsdebugger library of QtCreator. -class QMLJSDEBUGGER_EXTERN QDeclarativeDebugHelper -{ -public: - static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine); - static void setAnimationSlowDownFactor(qreal factor); - - // Enables remote debugging functionality - // Only use this for debugging in a safe environment! - static void enableDebugging(); -}; - -QT_END_NAMESPACE - -#endif // QDECLARATIVEDEBUGHELPER_P_H diff --git a/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebugservice_p.h b/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebugservice_p.h deleted file mode 100644 index bd220ff059f027a309627c37ccc9ef3a9b114372..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativedebugservice_p.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QDECLARATIVEDEBUGSERVICE_H -#define QDECLARATIVEDEBUGSERVICE_H - -#include "../qmljsdebugger_global.h" -#include <qobject.h> - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeDebugServicePrivate; -class QMLJSDEBUGGER_EXTERN QDeclarativeDebugService : public QObject -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QDeclarativeDebugService) - Q_DISABLE_COPY(QDeclarativeDebugService) - -public: - explicit QDeclarativeDebugService(const QString &, QObject *parent = 0); - ~QDeclarativeDebugService(); - - QString name() const; - - enum Status { NotConnected, Unavailable, Enabled }; - Status status() const; - - void sendMessage(const QByteArray &); - - static int idForObject(QObject *); - static QObject *objectForId(int); - - static QString objectToString(QObject *obj); - - static bool isDebuggingEnabled(); - static bool hasDebuggingClient(); - -protected: - virtual void statusChanged(Status); - virtual void messageReceived(const QByteArray &); - -private: - friend class QDeclarativeDebugServer; -}; - -QT_END_NAMESPACE - -#endif // QDECLARATIVEDEBUGSERVICE_H - diff --git a/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativestate_p.h b/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativestate_p.h deleted file mode 100644 index cc1a81ab6b1475b16c08a99b2f1b542b18bc9992..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/include/qt_private/qdeclarativestate_p.h +++ /dev/null @@ -1,194 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QDECLARATIVESTATE_H -#define QDECLARATIVESTATE_H - -#include "../qmljsdebugger_global.h" - -#include <qdeclarative.h> -#include <qdeclarativeproperty.h> -#include <qobject.h> -#include <qsharedpointer.h> - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QDeclarativeActionEvent; -class QDeclarativeAbstractBinding; -class QDeclarativeBinding; -class QDeclarativeExpression; -class QMLJSDEBUGGER_EXTERN QDeclarativeAction -{ -public: - QDeclarativeAction(); - QDeclarativeAction(QObject *, const QString &, const QVariant &); - QDeclarativeAction(QObject *, const QString &, - QDeclarativeContext *, const QVariant &); - - bool restore:1; - bool actionDone:1; - bool reverseEvent:1; - bool deletableToBinding:1; - - QDeclarativeProperty property; - QVariant fromValue; - QVariant toValue; - - QDeclarativeAbstractBinding *fromBinding; - QWeakPointer<QDeclarativeAbstractBinding> toBinding; - QDeclarativeActionEvent *event; - - //strictly for matching - QObject *specifiedObject; - QString specifiedProperty; - - void deleteFromBinding(); -}; - -class QMLJSDEBUGGER_EXTERN QDeclarativeActionEvent -{ -public: - virtual ~QDeclarativeActionEvent(); - virtual QString typeName() const; - - enum Reason { ActualChange, FastForward }; - - virtual void execute(Reason reason = ActualChange); - virtual bool isReversable(); - virtual void reverse(Reason reason = ActualChange); - virtual void saveOriginals() {} - virtual bool needsCopy() { return false; } - virtual void copyOriginals(QDeclarativeActionEvent *) {} - virtual bool isRewindable() { return isReversable(); } - virtual void rewind() {} - virtual void saveCurrentValues() {} - virtual void saveTargetValues() {} - - virtual bool changesBindings(); - virtual void clearBindings(); - virtual bool override(QDeclarativeActionEvent*other); -}; - -//### rename to QDeclarativeStateChange? -class QDeclarativeStateGroup; -class QDeclarativeState; -class QDeclarativeStateOperationPrivate; -class QMLJSDEBUGGER_EXTERN QDeclarativeStateOperation : public QObject -{ - Q_OBJECT -public: - QDeclarativeStateOperation(QObject *parent = 0) - : QObject(parent) {} - typedef QList<QDeclarativeAction> ActionList; - - virtual ActionList actions(); - - QDeclarativeState *state() const; - void setState(QDeclarativeState *state); - -protected: - QDeclarativeStateOperation(QObjectPrivate &dd, QObject *parent = 0); - -private: - Q_DECLARE_PRIVATE(QDeclarativeStateOperation) - Q_DISABLE_COPY(QDeclarativeStateOperation) -}; - -typedef QDeclarativeStateOperation::ActionList QDeclarativeStateActions; - -class QDeclarativeTransition; -class QDeclarativeStatePrivate; -class QMLJSDEBUGGER_EXTERN QDeclarativeState : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QString name READ name WRITE setName) - Q_PROPERTY(QDeclarativeBinding *when READ when WRITE setWhen) - Q_PROPERTY(QString extend READ extends WRITE setExtends) - Q_PROPERTY(QDeclarativeListProperty<QDeclarativeStateOperation> changes READ changes) - Q_CLASSINFO("DefaultProperty", "changes") - Q_CLASSINFO("DeferredPropertyNames", "changes") - -public: - QDeclarativeState(QObject *parent=0); - virtual ~QDeclarativeState(); - - QString name() const; - void setName(const QString &); - bool isNamed() const; - - /*'when' is a QDeclarativeBinding to limit state changes oscillation - due to the unpredictable order of evaluation of bound expressions*/ - bool isWhenKnown() const; - QDeclarativeBinding *when() const; - void setWhen(QDeclarativeBinding *); - - QString extends() const; - void setExtends(const QString &); - - QDeclarativeListProperty<QDeclarativeStateOperation> changes(); - int operationCount() const; - QDeclarativeStateOperation *operationAt(int) const; - - QDeclarativeState &operator<<(QDeclarativeStateOperation *); - - void apply(QDeclarativeStateGroup *, QDeclarativeTransition *, QDeclarativeState *revert); - void cancel(); - - QDeclarativeStateGroup *stateGroup() const; - void setStateGroup(QDeclarativeStateGroup *); - - bool containsPropertyInRevertList(QObject *target, const QString &name) const; - bool changeValueInRevertList(QObject *target, const QString &name, const QVariant &revertValue); - bool changeBindingInRevertList(QObject *target, const QString &name, QDeclarativeAbstractBinding *binding); - bool removeEntryFromRevertList(QObject *target, const QString &name); - void addEntryToRevertList(const QDeclarativeAction &action); - void removeAllEntriesFromRevertList(QObject *target); - void addEntriesToRevertList(const QList<QDeclarativeAction> &actions); - QVariant valueInRevertList(QObject *target, const QString &name) const; - QDeclarativeAbstractBinding *bindingInRevertList(QObject *target, const QString &name) const; - - bool isStateActive() const; - -Q_SIGNALS: - void completed(); - -private: - Q_DECLARE_PRIVATE(QDeclarativeState) - Q_DISABLE_COPY(QDeclarativeState) -}; - -QT_END_NAMESPACE - -//QML_DECLARE_TYPE(QDeclarativeStateOperation) -//QML_DECLARE_TYPE(QDeclarativeState) - -#endif // QDECLARATIVESTATE_H diff --git a/share/qtcreator/qml/qmljsdebugger/jsdebuggeragent.cpp b/share/qtcreator/qml/qmljsdebugger/jsdebuggeragent.cpp deleted file mode 100644 index 8f3ed659feedc15749de8c464677b3ca55563cb9..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/jsdebuggeragent.cpp +++ /dev/null @@ -1,672 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "jsdebuggeragent.h" -#include "qt_private/qdeclarativedebughelper_p.h" - -#include <qdatetime.h> -#include <qdebug.h> -#include <qcoreapplication.h> -#include <qset.h> -#include <qurl.h> -#include <qscriptcontextinfo.h> -#include <qscriptengine.h> -#include <qscriptvalueiterator.h> - -namespace QmlJSDebugger { - -enum JSDebuggerState -{ - NoState, - SteppingIntoState, - SteppingOverState, - SteppingOutState, - StoppedState -}; - -struct JSAgentWatchData -{ - QByteArray exp; - QByteArray name; - QByteArray value; - QByteArray type; - bool hasChildren; - quint64 objectId; -}; - -QDataStream &operator<<(QDataStream &s, const JSAgentWatchData &data) -{ - return s << data.exp << data.name << data.value - << data.type << data.hasChildren << data.objectId; -} - -struct JSAgentStackData -{ - QByteArray functionName; - QByteArray fileUrl; - qint32 lineNumber; -}; - -QDataStream &operator<<(QDataStream &s, const JSAgentStackData &data) -{ - return s << data.functionName << data.fileUrl << data.lineNumber; -} - -struct JSAgentBreakpointData -{ - QByteArray functionName; - QByteArray fileUrl; - qint32 lineNumber; -}; - -typedef QSet<JSAgentBreakpointData> JSAgentBreakpoints; - -QDataStream &operator<<(QDataStream &s, const JSAgentBreakpointData &data) -{ - return s << data.functionName << data.fileUrl << data.lineNumber; -} - -QDataStream &operator>>(QDataStream &s, JSAgentBreakpointData &data) -{ - return s >> data.functionName >> data.fileUrl >> data.lineNumber; -} - -bool operator==(const JSAgentBreakpointData &b1, const JSAgentBreakpointData &b2) -{ - return b1.lineNumber == b2.lineNumber && b1.fileUrl == b2.fileUrl; -} - -uint qHash(const JSAgentBreakpointData &b) -{ - return b.lineNumber ^ qHash(b.fileUrl); -} - -class JSDebuggerAgentPrivate -{ -public: - JSDebuggerAgentPrivate(JSDebuggerAgent *q) - : q(q), state(NoState) - {} - - void continueExec(); - void recordKnownObjects(const QList<JSAgentWatchData> &); - QList<JSAgentWatchData> getLocals(QScriptContext *); - void positionChange(qint64 scriptId, int lineNumber, int columnNumber); - QScriptEngine *engine() { return q->engine(); } - void stopped(); - void messageReceived(const QByteArray &message); - void sendMessage(const QByteArray &message) { q->sendMessage(message); } - -public: - JSDebuggerAgent *q; - JSDebuggerState state; - int stepDepth; - int stepCount; - - QEventLoop loop; - QHash<qint64, QString> filenames; - JSAgentBreakpoints breakpoints; - // breakpoints by filename (without path) - QHash<QString, JSAgentBreakpointData> fileNameToBreakpoints; - QStringList watchExpressions; - QSet<qint64> knownObjectIds; -}; - -class SetupExecEnv -{ -public: - SetupExecEnv(JSDebuggerAgentPrivate *a) - : agent(a), - previousState(a->state), - hadException(a->engine()->hasUncaughtException()) - { - agent->state = StoppedState; - } - - ~SetupExecEnv() - { - if (!hadException && agent->engine()->hasUncaughtException()) - agent->engine()->clearExceptions(); - agent->state = previousState; - } - -private: - JSDebuggerAgentPrivate *agent; - JSDebuggerState previousState; - bool hadException; -}; - -static JSAgentWatchData fromScriptValue(const QString &expression, - const QScriptValue &value) -{ - static const QString arrayStr = QCoreApplication::translate - ("Debugger::JSAgentWatchData", "[Array of length %1]"); - static const QString undefinedStr = QCoreApplication::translate - ("Debugger::JSAgentWatchData", "<undefined>"); - - JSAgentWatchData data; - data.exp = expression.toUtf8(); - data.name = data.exp; - data.hasChildren = false; - data.value = value.toString().toUtf8(); - data.objectId = value.objectId(); - if (value.isArray()) { - data.type = "Array"; - data.value = arrayStr.arg(value.property("length").toString()).toUtf8(); - data.hasChildren = true; - } else if (value.isBool()) { - data.type = "Bool"; - // data.value = value.toBool() ? "true" : "false"; - } else if (value.isDate()) { - data.type = "Date"; - data.value = value.toDateTime().toString().toUtf8(); - } else if (value.isError()) { - data.type = "Error"; - } else if (value.isFunction()) { - data.type = "Function"; - } else if (value.isUndefined()) { - data.type = undefinedStr.toUtf8(); - } else if (value.isNumber()) { - data.type = "Number"; - } else if (value.isRegExp()) { - data.type = "RegExp"; - } else if (value.isString()) { - data.type = "String"; - } else if (value.isVariant()) { - data.type = "Variant"; - } else if (value.isQObject()) { - const QObject *obj = value.toQObject(); - data.type = "Object"; - data.value += '['; - data.value += obj->metaObject()->className(); - data.value += ']'; - data.hasChildren = true; - } else if (value.isObject()) { - data.type = "Object"; - data.hasChildren = true; - data.value = "[Object]"; - } else if (value.isNull()) { - data.type = "<null>"; - } else { - data.type = "<unknown>"; - } - return data; -} - -static QList<JSAgentWatchData> expandObject(const QScriptValue &object) -{ - QList<JSAgentWatchData> result; - QScriptValueIterator it(object); - while (it.hasNext()) { - it.next(); - if (it.flags() & QScriptValue::SkipInEnumeration) - continue; - if (/*object.isQObject() &&*/ it.value().isFunction()) { - // Cosmetics: skip all functions and slot, there are too many of them, - // and it is not useful information in the debugger. - continue; - } - JSAgentWatchData data = fromScriptValue(it.name(), it.value()); - result.append(data); - } - if (result.isEmpty()) { - JSAgentWatchData data; - data.name = "<no initialized data>"; - data.hasChildren = false; - data.value = " "; - data.objectId = 0; - result.append(data); - } - return result; -} - -void JSDebuggerAgentPrivate::recordKnownObjects(const QList<JSAgentWatchData>& list) -{ - foreach (const JSAgentWatchData &data, list) - knownObjectIds << data.objectId; -} - -QList<JSAgentWatchData> JSDebuggerAgentPrivate::getLocals(QScriptContext *ctx) -{ - QList<JSAgentWatchData> locals; - if (ctx) { - QScriptValue activationObject = ctx->activationObject(); - QScriptValue thisObject = ctx->thisObject(); - locals = expandObject(activationObject); - if (thisObject.isObject() - && thisObject.objectId() != engine()->globalObject().objectId() - && QScriptValueIterator(thisObject).hasNext()) - locals.prepend(fromScriptValue("this", thisObject)); - recordKnownObjects(locals); - knownObjectIds << activationObject.objectId(); - } - return locals; -} - -/*! - Constructs a new agent for the given \a engine. The agent will - report debugging-related events (e.g. step completion) to the given - \a backend. -*/ -JSDebuggerAgent::JSDebuggerAgent(QScriptEngine *engine) - : QDeclarativeDebugService("JSDebugger") - , QScriptEngineAgent(engine) - , d(new JSDebuggerAgentPrivate(this)) -{ - if (status() == Enabled) - engine->setAgent(this); -} - -JSDebuggerAgent::JSDebuggerAgent(QDeclarativeEngine *engine) - : QDeclarativeDebugService("JSDebugger") - , QScriptEngineAgent(QDeclarativeDebugHelper::getScriptEngine(engine)) - , d(new JSDebuggerAgentPrivate(this)) -{ - if (status() == Enabled) - QDeclarativeDebugHelper::getScriptEngine(engine)->setAgent(this); -} - -/*! - Destroys this QScriptDebuggerAgent. -*/ -JSDebuggerAgent::~JSDebuggerAgent() -{ - delete d; -} - -/*! - \reimp -*/ -void JSDebuggerAgent::scriptLoad(qint64 id, const QString &program, - const QString &fileName, int) -{ - Q_UNUSED(program); - d->filenames.insert(id, fileName); -} - -/*! - \reimp -*/ -void JSDebuggerAgent::scriptUnload(qint64 id) -{ - d->filenames.remove(id); -} - -/*! - \reimp -*/ -void JSDebuggerAgent::contextPush() -{ -} - -/*! - \reimp -*/ -void JSDebuggerAgent::contextPop() -{ -} - -/*! - \reimp -*/ -void JSDebuggerAgent::functionEntry(qint64 scriptId) -{ - Q_UNUSED(scriptId); - d->stepDepth++; -} - -/*! - \reimp -*/ -void JSDebuggerAgent::functionExit(qint64 scriptId, const QScriptValue &returnValue) -{ - Q_UNUSED(scriptId); - Q_UNUSED(returnValue); - d->stepDepth--; -} - -/*! - \reimp -*/ -void JSDebuggerAgent::positionChange(qint64 scriptId, int lineNumber, int columnNumber) -{ - d->positionChange(scriptId, lineNumber, columnNumber); -} - -QString fileName(const QString &fileUrl) -{ - int lastDelimiterPos = fileUrl.lastIndexOf(QLatin1Char('/')); - return fileUrl.mid(lastDelimiterPos, fileUrl.size() - lastDelimiterPos); -} - -void JSDebuggerAgentPrivate::positionChange(qint64 scriptId, int lineNumber, int columnNumber) -{ - Q_UNUSED(columnNumber); - - if (state == StoppedState) - return; //no re-entrency - - // check breakpoints - if (!breakpoints.isEmpty()) { - QScriptContext *ctx = engine()->currentContext(); - QScriptContextInfo info(ctx); - - if (info.functionType() == QScriptContextInfo::ScriptFunction) { - QHash<qint64, QString>::const_iterator it = filenames.constFind(scriptId); - if (it == filenames.constEnd()) { - // It is possible that the scripts are loaded before the agent is attached - QString filename = info.fileName(); - - JSAgentStackData frame; - frame.functionName = info.functionName().toUtf8(); - it = filenames.insert(scriptId, filename); - } - - const QString filePath = it->toUtf8(); - JSAgentBreakpoints bps = fileNameToBreakpoints.values(fileName(filePath)).toSet(); - - foreach (const JSAgentBreakpointData &bp, bps) { - if (bp.lineNumber == lineNumber) { - stopped(); - return; - } - } - } - } - - switch (state) { - case NoState: - case StoppedState: - // Do nothing - break; - case SteppingOutState: - if (stepDepth >= 0) - break; - //fallthough - case SteppingOverState: - if (stepDepth > 0) - break; - //fallthough - case SteppingIntoState: - stopped(); - break; - } - -} - -/*! - \reimp -*/ -void JSDebuggerAgent::exceptionThrow(qint64 scriptId, - const QScriptValue &exception, - bool hasHandler) -{ - Q_UNUSED(scriptId); - Q_UNUSED(exception); - Q_UNUSED(hasHandler); -// qDebug() << Q_FUNC_INFO << exception.toString() << hasHandler; -#if 0 //sometimes, we get exceptions that we should just ignore. - if (!hasHandler && state != StoppedState) - stopped(true, exception); -#endif -} - -/*! - \reimp -*/ -void JSDebuggerAgent::exceptionCatch(qint64 scriptId, const QScriptValue &exception) -{ - Q_UNUSED(scriptId); - Q_UNUSED(exception); -} - -bool JSDebuggerAgent::supportsExtension(Extension extension) const -{ - return extension == QScriptEngineAgent::DebuggerInvocationRequest; -} - -QVariant JSDebuggerAgent::extension(Extension extension, const QVariant &argument) -{ - if (extension == QScriptEngineAgent::DebuggerInvocationRequest) { - d->stopped(); - return QVariant(); - } - return QScriptEngineAgent::extension(extension, argument); -} - -void JSDebuggerAgent::messageReceived(const QByteArray &message) -{ - d->messageReceived(message); -} - -void JSDebuggerAgentPrivate::messageReceived(const QByteArray &message) -{ - QDataStream ds(message); - QByteArray command; - ds >> command; - if (command == "BREAKPOINTS") { - ds >> breakpoints; - - fileNameToBreakpoints.clear(); - foreach (const JSAgentBreakpointData &bp, breakpoints) { - fileNameToBreakpoints.insertMulti(fileName(bp.fileUrl), bp); - } - - //qDebug() << "BREAKPOINTS"; - //foreach (const JSAgentBreakpointData &bp, breakpoints) - // qDebug() << "BREAKPOINT: " << bp.fileName << bp.lineNumber; - } else if (command == "WATCH_EXPRESSIONS") { - ds >> watchExpressions; - } else if (command == "STEPOVER") { - stepDepth = 0; - state = SteppingOverState; - continueExec(); - } else if (command == "STEPINTO" || command == "INTERRUPT") { - stepDepth = 0; - state = SteppingIntoState; - continueExec(); - } else if (command == "STEPOUT") { - stepDepth = 0; - state = SteppingOutState; - continueExec(); - } else if (command == "CONTINUE") { - state = NoState; - continueExec(); - } else if (command == "EXEC") { - SetupExecEnv execEnv(this); - - QByteArray id; - QString expr; - ds >> id >> expr; - - JSAgentWatchData data = fromScriptValue(expr, engine()->evaluate(expr)); - knownObjectIds << data.objectId; - - QByteArray reply; - QDataStream rs(&reply, QIODevice::WriteOnly); - rs << QByteArray("RESULT") << id << data; - sendMessage(reply); - } else if (command == "EXPAND") { - SetupExecEnv execEnv(this); - - QByteArray requestId; - quint64 objectId; - ds >> requestId >> objectId; - QScriptValue v; - if (knownObjectIds.contains(objectId)) - v = engine()->objectById(objectId); - - QList<JSAgentWatchData> result = expandObject(v); - recordKnownObjects(result); - - QByteArray reply; - QDataStream rs(&reply, QIODevice::WriteOnly); - rs << QByteArray("EXPANDED") << requestId << result; - sendMessage(reply); - - } else if (command == "ACTIVATE_FRAME") { - SetupExecEnv execEnv(this); - - int frameId; - ds >> frameId; - - int deep = 0; - QScriptContext *ctx = engine()->currentContext(); - while (ctx && deep < frameId) { - ctx = ctx->parentContext(); - deep++; - } - - QList<JSAgentWatchData> watches; - QList<JSAgentWatchData> locals = getLocals(ctx); - - // re-evaluate watches given the frame's context - QScriptContext *currentCtx = engine()->pushContext(); - currentCtx->setActivationObject(ctx->activationObject()); - currentCtx->setThisObject(ctx->thisObject()); - foreach (const QString &expr, watchExpressions) - watches << fromScriptValue(expr, engine()->evaluate(expr)); - recordKnownObjects(watches); - engine()->popContext(); - - QByteArray reply; - QDataStream rs(&reply, QIODevice::WriteOnly); - rs << QByteArray("LOCALS") << frameId << locals << watches; - sendMessage(reply); - } else if (command == "SET_PROPERTY") { - SetupExecEnv execEnv(this); - - QByteArray id; - qint64 objectId; - QString property; - QString value; - ds >> id >> objectId >> property >> value; - - if (knownObjectIds.contains(objectId)) { - QScriptValue object; - object = engine()->objectById(objectId); - - if (object.isObject()) { - QScriptValue result = engine()->evaluate(value); - object.setProperty(property, result); - } - } - - //TODO: feedback - } else if (command == "PING") { - int ping; - ds >> ping; - QByteArray reply; - QDataStream rs(&reply, QIODevice::WriteOnly); - rs << QByteArray("PONG") << ping; - sendMessage(reply); - } else { - qDebug() << Q_FUNC_INFO << "Unknown command" << command; - } - - q->baseMessageReceived(message); -} - -void JSDebuggerAgentPrivate::stopped() -{ - bool becauseOfException = false; - const QScriptValue &exception = QScriptValue(); - - knownObjectIds.clear(); - state = StoppedState; - QList<JSAgentStackData> backtrace; - - for (QScriptContext* ctx = engine()->currentContext(); ctx; ctx = ctx->parentContext()) { - QScriptContextInfo info(ctx); - - JSAgentStackData frame; - frame.functionName = info.functionName().toUtf8(); - if (frame.functionName.isEmpty()) { - if (ctx->parentContext()) { - switch (info.functionType()) { - case QScriptContextInfo::ScriptFunction: - frame.functionName = "<anonymous>"; - break; - case QScriptContextInfo::NativeFunction: - frame.functionName = "<native>"; - break; - case QScriptContextInfo::QtFunction: - case QScriptContextInfo::QtPropertyFunction: - frame.functionName = "<native slot>"; - break; - } - } else { - frame.functionName = "<global>"; - } - } - frame.lineNumber = info.lineNumber(); - // if the line number is unknown, fallback to the function line number - if (frame.lineNumber == -1) - frame.lineNumber = info.functionStartLineNumber(); - - frame.fileUrl = info.fileName().toUtf8(); - backtrace.append(frame); - } - QList<JSAgentWatchData> watches; - foreach (const QString &expr, watchExpressions) - watches << fromScriptValue(expr, engine()->evaluate(expr)); - recordKnownObjects(watches); - - QList<JSAgentWatchData> locals = getLocals(engine()->currentContext()); - - if (!becauseOfException) { - // Clear any exceptions occurred during locals evaluation. - engine()->clearExceptions(); - } - - QByteArray reply; - QDataStream rs(&reply, QIODevice::WriteOnly); - rs << QByteArray("STOPPED") << backtrace << watches << locals - << becauseOfException << exception.toString(); - sendMessage(reply); - - loop.exec(QEventLoop::ExcludeUserInputEvents); -} - -void JSDebuggerAgentPrivate::continueExec() -{ - loop.quit(); -} - -void JSDebuggerAgent::statusChanged(Status status) -{ - engine()->setAgent((status == QDeclarativeDebugService::Enabled) ? this : 0); -} - -void JSDebuggerAgent::baseMessageReceived(const QByteArray &message) -{ - QDeclarativeDebugService::messageReceived(message); -} - -} // namespace QmlJSDebugger diff --git a/share/qtcreator/qml/qmljsdebugger/protocol/inspectorprotocol.h b/share/qtcreator/qml/qmljsdebugger/protocol/inspectorprotocol.h deleted file mode 100644 index 341091617234759e1cdf9e432a83247cefdc83e5..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/protocol/inspectorprotocol.h +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef INSPECTORPROTOCOL_H -#define INSPECTORPROTOCOL_H - -#include <QDebug> -#include <QMetaType> -#include <QMetaEnum> -#include <QObject> - -namespace QmlJSDebugger { - -class InspectorProtocol : public QObject -{ - Q_OBJECT - Q_ENUMS(Message Tool) - -public: - enum Message { - AnimationSpeedChanged = 0, - AnimationPausedChanged = 19, // highest value - ChangeTool = 1, - ClearComponentCache = 2, - ColorChanged = 3, - CreateObject = 5, - CurrentObjectsChanged = 6, - DestroyObject = 7, - MoveObject = 8, - ObjectIdList = 9, - Reload = 10, - Reloaded = 11, - SetAnimationSpeed = 12, - SetAnimationPaused = 18, - SetCurrentObjects = 14, - SetDesignMode = 15, - ShowAppOnTop = 16, - ToolChanged = 17 - }; - - enum Tool { - ColorPickerTool, - SelectMarqueeTool, - SelectTool, - ZoomTool - }; - - static inline QString toString(Message message) - { - return staticMetaObject.enumerator(0).valueToKey(message); - } - - static inline QString toString(Tool tool) - { - return staticMetaObject.enumerator(1).valueToKey(tool); - } -}; - -inline QDataStream & operator<< (QDataStream &stream, InspectorProtocol::Message message) -{ - return stream << static_cast<quint32>(message); -} - -inline QDataStream & operator>> (QDataStream &stream, InspectorProtocol::Message &message) -{ - quint32 i; - stream >> i; - message = static_cast<InspectorProtocol::Message>(i); - return stream; -} - -inline QDebug operator<< (QDebug dbg, InspectorProtocol::Message message) -{ - dbg << InspectorProtocol::toString(message); - return dbg; -} - -inline QDataStream & operator<< (QDataStream &stream, InspectorProtocol::Tool tool) -{ - return stream << static_cast<quint32>(tool); -} - -inline QDataStream & operator>> (QDataStream &stream, InspectorProtocol::Tool &tool) -{ - quint32 i; - stream >> i; - tool = static_cast<InspectorProtocol::Tool>(i); - return stream; -} - -inline QDebug operator<< (QDebug dbg, InspectorProtocol::Tool tool) -{ - dbg << InspectorProtocol::toString(tool); - return dbg; -} - -} // namespace QmlJSDebugger - -#endif // INSPECTORPROTOCOL_H diff --git a/share/qtcreator/qml/qmljsdebugger/protocol/protocol.pri b/share/qtcreator/qml/qmljsdebugger/protocol/protocol.pri deleted file mode 100644 index dfb18fb864f48e57bb71ec7c8f0a83c747b0690c..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/protocol/protocol.pri +++ /dev/null @@ -1,3 +0,0 @@ -INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD -HEADERS += $$PWD/inspectorprotocol.h diff --git a/share/qtcreator/qml/qmljsdebugger/qdeclarativeinspectorservice.cpp b/share/qtcreator/qml/qmljsdebugger/qdeclarativeinspectorservice.cpp deleted file mode 100644 index 947c80fdb4e729206e3efda868afd2a4f60e13f3..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/qdeclarativeinspectorservice.cpp +++ /dev/null @@ -1,284 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "qdeclarativeinspectorservice.h" - -#include <inspectorprotocol.h> - -#include <QStringList> -#include <QColor> - -namespace QmlJSDebugger { - -Q_GLOBAL_STATIC(QDeclarativeInspectorService, serviceInstance) - -QDeclarativeInspectorService::QDeclarativeInspectorService() - : QDeclarativeDebugService(QLatin1String("QDeclarativeObserverMode")) -{ -} - -QDeclarativeInspectorService *QDeclarativeInspectorService::instance() -{ - return serviceInstance(); -} - -void QDeclarativeInspectorService::statusChanged(Status status) -{ - emit debuggingClientChanged((status == Enabled)); -} - -void QDeclarativeInspectorService::messageReceived(const QByteArray &message) -{ - QDataStream ds(message); - - InspectorProtocol::Message type; - ds >> type; - - switch (type) { - case InspectorProtocol::SetCurrentObjects: { - int itemCount = 0; - ds >> itemCount; - - QList<QObject*> selectedObjects; - for (int i = 0; i < itemCount; ++i) { - int debugId = -1; - ds >> debugId; - if (QObject *obj = objectForId(debugId)) - selectedObjects << obj; - } - - emit currentObjectsChanged(selectedObjects); - break; - } - case InspectorProtocol::Reload: { - emit reloadRequested(); - break; - } - case InspectorProtocol::SetAnimationSpeed: { - qreal speed; - ds >> speed; - emit animationSpeedChangeRequested(speed); - break; - } - case InspectorProtocol::SetAnimationPaused: { - bool paused; - ds >> paused; - emit executionPauseChangeRequested(paused); - break; - } - case InspectorProtocol::ChangeTool: { - InspectorProtocol::Tool tool; - ds >> tool; - switch (tool) { - case InspectorProtocol::ColorPickerTool: - emit colorPickerToolRequested(); - break; - case InspectorProtocol::SelectTool: - emit selectToolRequested(); - break; - case InspectorProtocol::SelectMarqueeTool: - emit selectMarqueeToolRequested(); - break; - case InspectorProtocol::ZoomTool: - emit zoomToolRequested(); - break; - default: - qWarning() << "Warning: Unhandled tool:" << tool; - } - break; - } - case InspectorProtocol::SetDesignMode: { - bool inDesignMode; - ds >> inDesignMode; - emit designModeBehaviorChanged(inDesignMode); - break; - } - case InspectorProtocol::ShowAppOnTop: { - bool showOnTop; - ds >> showOnTop; - emit showAppOnTopChanged(showOnTop); - break; - } - case InspectorProtocol::CreateObject: { - QString qml; - int parentId; - QString filename; - QStringList imports; - ds >> qml >> parentId >> imports >> filename; - int order = -1; - if (!ds.atEnd()) { - ds >> order; - } - emit objectCreationRequested(qml, objectForId(parentId), imports, filename, order); - break; - } - case InspectorProtocol::DestroyObject: { - int debugId; - ds >> debugId; - if (QObject* obj = objectForId(debugId)) { - emit objectDeletionRequested(obj); - } - break; - } - case InspectorProtocol::MoveObject: { - int debugId, newParent; - ds >> debugId >> newParent; - emit objectReparentRequested(objectForId(debugId), objectForId(newParent)); - break; - } - case InspectorProtocol::ObjectIdList: { - int itemCount; - ds >> itemCount; - m_stringIdForObjectId.clear(); - for (int i = 0; i < itemCount; ++i) { - int itemDebugId; - QString itemIdString; - ds >> itemDebugId - >> itemIdString; - - m_stringIdForObjectId.insert(itemDebugId, itemIdString); - } - break; - } - case InspectorProtocol::ClearComponentCache: { - emit clearComponentCacheRequested(); - break; - } - default: - qWarning() << "Warning: Not handling message:" << type; - } -} - -void QDeclarativeInspectorService::setDesignModeBehavior(bool inDesignMode) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::SetDesignMode - << inDesignMode; - - sendMessage(message); -} - -void QDeclarativeInspectorService::setCurrentObjects(QList<QObject*> objects) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::CurrentObjectsChanged - << objects.length(); - - foreach (QObject *object, objects) { - int id = idForObject(object); - ds << id; - } - - sendMessage(message); -} - -void QDeclarativeInspectorService::setCurrentTool(QmlJSDebugger::Constants::DesignTool toolId) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::ToolChanged - << toolId; - - sendMessage(message); -} - -void QDeclarativeInspectorService::setAnimationSpeed(qreal slowDownFactor) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::AnimationSpeedChanged - << slowDownFactor; - - sendMessage(message); -} - -void QDeclarativeInspectorService::setAnimationPaused(bool paused) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::AnimationPausedChanged - << paused; - - sendMessage(message); -} - -void QDeclarativeInspectorService::reloaded() -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::Reloaded; - - sendMessage(message); -} - -void QDeclarativeInspectorService::setShowAppOnTop(bool showAppOnTop) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::ShowAppOnTop << showAppOnTop; - - sendMessage(message); -} - -void QDeclarativeInspectorService::selectedColorChanged(const QColor &color) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::ColorChanged - << color; - - sendMessage(message); -} - -QString QDeclarativeInspectorService::idStringForObject(QObject *obj) const -{ - int id = idForObject(obj); - QString idString = m_stringIdForObjectId.value(id, QString()); - return idString; -} - -void QDeclarativeInspectorService::sendMessage(const QByteArray &message) -{ - if (status() != Enabled) - return; - - QDeclarativeDebugService::sendMessage(message); -} - -} // namespace QmlJSDebugger diff --git a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewinspector.cpp b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewinspector.cpp deleted file mode 100644 index 6b944bfd6fdd76db7683db66fc112a18a08730f0..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewinspector.cpp +++ /dev/null @@ -1,835 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "qdeclarativeviewinspector.h" -#include "qdeclarativeviewinspector_p.h" -#include "qdeclarativeinspectorservice.h" -#include "editor/liveselectiontool.h" -#include "editor/zoomtool.h" -#include "editor/colorpickertool.h" -#include "editor/livelayeritem.h" -#include "editor/boundingrecthighlighter.h" - -#include "qt_private/qdeclarativedebughelper_p.h" - -#include <QDeclarativeItem> -#include <QDeclarativeEngine> -#include <QDeclarativeContext> -#include <QDeclarativeExpression> -#include <QWidget> -#include <QVBoxLayout> -#include <QMouseEvent> -#include <QGraphicsObject> -#include <QApplication> - -#include "qt_private/qdeclarativestate_p.h" - -namespace QmlJSDebugger { - -QDeclarativeViewInspectorPrivate::QDeclarativeViewInspectorPrivate(QDeclarativeViewInspector *q) : - q(q), - designModeBehavior(false), - showAppOnTop(false), - animationPaused(false), - slowDownFactor(1.0f) -{ -} - -QDeclarativeViewInspectorPrivate::~QDeclarativeViewInspectorPrivate() -{ -} - -QDeclarativeViewInspector::QDeclarativeViewInspector(QDeclarativeView *view, QObject *parent) : - QObject(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); - data->currentTool = data->selectionTool; - - // to capture ChildRemoved event when viewport changes - data->view->installEventFilter(this); - - data->setViewport(data->view->viewport()); - - data->debugService = QDeclarativeInspectorService::instance(); - - connect(data->debugService, SIGNAL(designModeBehaviorChanged(bool)), - SLOT(setDesignModeBehavior(bool))); - connect(data->debugService, SIGNAL(showAppOnTopChanged(bool)), - SLOT(setShowAppOnTop(bool))); - connect(data->debugService, SIGNAL(reloadRequested()), data.data(), SLOT(_q_reloadView())); - connect(data->debugService, SIGNAL(currentObjectsChanged(QList<QObject*>)), - data.data(), SLOT(_q_onCurrentObjectsChanged(QList<QObject*>))); - connect(data->debugService, SIGNAL(animationSpeedChangeRequested(qreal)), - SLOT(animationSpeedChangeRequested(qreal))); - connect(data->debugService, SIGNAL(executionPauseChangeRequested(bool)), - SLOT(animationPausedChangeRequested(bool))); - connect(data->debugService, SIGNAL(colorPickerToolRequested()), - data.data(), SLOT(_q_changeToColorPickerTool())); - connect(data->debugService, SIGNAL(selectMarqueeToolRequested()), - data.data(), SLOT(_q_changeToMarqueeSelectTool())); - connect(data->debugService, SIGNAL(selectToolRequested()), data.data(), SLOT(_q_changeToSingleSelectTool())); - connect(data->debugService, SIGNAL(zoomToolRequested()), data.data(), SLOT(_q_changeToZoomTool())); - connect(data->debugService, - SIGNAL(objectCreationRequested(QString,QObject*,QStringList,QString,int)), - data.data(), SLOT(_q_createQmlObject(QString,QObject*,QStringList,QString,int))); - connect(data->debugService, - SIGNAL(objectDeletionRequested(QObject*)), data.data(), SLOT(_q_deleteQmlObject(QObject*))); - connect(data->debugService, - SIGNAL(objectReparentRequested(QObject*,QObject*)), - data.data(), SLOT(_q_reparentQmlObject(QObject*,QObject*))); - connect(data->debugService, SIGNAL(clearComponentCacheRequested()), - data.data(), SLOT(_q_clearComponentCache())); - 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)), - data->debugService, SLOT(selectedColorChanged(QColor))); - - data->_q_changeToSingleSelectTool(); -} - -QDeclarativeViewInspector::~QDeclarativeViewInspector() -{ -} - -void QDeclarativeViewInspectorPrivate::_q_reloadView() -{ - clearHighlight(); - emit q->reloadRequested(); -} - -void QDeclarativeViewInspectorPrivate::setViewport(QWidget *widget) -{ - if (viewport.data() == widget) - return; - - if (viewport) - viewport.data()->removeEventFilter(q); - - viewport = widget; - if (viewport) { - // make sure we get mouse move events - viewport.data()->setMouseTracking(true); - viewport.data()->installEventFilter(q); - } -} - -void QDeclarativeViewInspectorPrivate::clearEditorItems() -{ - clearHighlight(); - setSelectedItems(QList<QGraphicsItem*>()); -} - -bool QDeclarativeViewInspector::eventFilter(QObject *obj, QEvent *event) -{ - if (obj == data->view) { - // Event from view - if (event->type() == QEvent::ChildRemoved) { - // Might mean that viewport has changed - if (data->view->viewport() != data->viewport.data()) - data->setViewport(data->view->viewport()); - } - return QObject::eventFilter(obj, event); - } - - // Event from viewport - switch (event->type()) { - case QEvent::Leave: { - if (leaveEvent(event)) - return true; - break; - } - case QEvent::MouseButtonPress: { - if (mousePressEvent(static_cast<QMouseEvent*>(event))) - return true; - break; - } - case QEvent::MouseMove: { - if (mouseMoveEvent(static_cast<QMouseEvent*>(event))) - return true; - break; - } - case QEvent::MouseButtonRelease: { - if (mouseReleaseEvent(static_cast<QMouseEvent*>(event))) - return true; - break; - } - case QEvent::KeyPress: { - if (keyPressEvent(static_cast<QKeyEvent*>(event))) - return true; - break; - } - case QEvent::KeyRelease: { - if (keyReleaseEvent(static_cast<QKeyEvent*>(event))) - return true; - break; - } - case QEvent::MouseButtonDblClick: { - if (mouseDoubleClickEvent(static_cast<QMouseEvent*>(event))) - return true; - break; - } - case QEvent::Wheel: { - if (wheelEvent(static_cast<QWheelEvent*>(event))) - return true; - break; - } - default: { - break; - } - } //switch - - // standard event processing - return QObject::eventFilter(obj, event); -} - -bool QDeclarativeViewInspector::leaveEvent(QEvent * /*event*/) -{ - if (!data->designModeBehavior) - return false; - data->clearHighlight(); - return true; -} - -bool QDeclarativeViewInspector::mousePressEvent(QMouseEvent *event) -{ - if (!data->designModeBehavior) - return false; - data->cursorPos = event->pos(); - data->currentTool->mousePressEvent(event); - return true; -} - -bool QDeclarativeViewInspector::mouseMoveEvent(QMouseEvent *event) -{ - if (!data->designModeBehavior) { - data->clearEditorItems(); - return false; - } - data->cursorPos = event->pos(); - - QList<QGraphicsItem*> selItems = data->selectableItems(event->pos()); - if (!selItems.isEmpty()) { - declarativeView()->setToolTip(AbstractLiveEditTool::titleForItem(selItems.first())); - } else { - declarativeView()->setToolTip(QString()); - } - if (event->buttons()) { - data->currentTool->mouseMoveEvent(event); - } else { - data->currentTool->hoverMoveEvent(event); - } - return true; -} - -bool QDeclarativeViewInspector::mouseReleaseEvent(QMouseEvent *event) -{ - if (!data->designModeBehavior) - return false; - - data->cursorPos = event->pos(); - data->currentTool->mouseReleaseEvent(event); - return true; -} - -bool QDeclarativeViewInspector::keyPressEvent(QKeyEvent *event) -{ - if (!data->designModeBehavior) - return false; - - data->currentTool->keyPressEvent(event); - return true; -} - -bool QDeclarativeViewInspector::keyReleaseEvent(QKeyEvent *event) -{ - if (!data->designModeBehavior) - return false; - - switch(event->key()) { - case Qt::Key_V: - data->_q_changeToSingleSelectTool(); - break; -// disabled because multiselection does not do anything useful without design mode -// case Qt::Key_M: -// data->_q_changeToMarqueeSelectTool(); -// break; - case Qt::Key_I: - data->_q_changeToColorPickerTool(); - break; - case Qt::Key_Z: - data->_q_changeToZoomTool(); - break; - case Qt::Key_Space: - setAnimationPaused(!data->animationPaused); - break; - default: - break; - } - - data->currentTool->keyReleaseEvent(event); - return true; -} - -bool insertObjectInListProperty(QDeclarativeListReference &fromList, int position, QObject *object) -{ - QList<QObject *> tmpList; - int i; - - if (!(fromList.canCount() && fromList.canAt() && fromList.canAppend() && fromList.canClear())) - return false; - - if (position == fromList.count()) { - fromList.append(object); - return true; - } - - for (i=0; i<fromList.count(); ++i) - tmpList << fromList.at(i); - - fromList.clear(); - for (i=0; i<position; ++i) - fromList.append(tmpList.at(i)); - - fromList.append(object); - for (; i<tmpList.count(); ++i) - fromList.append(tmpList.at(i)); - - return true; -} - -bool removeObjectFromListProperty(QDeclarativeListReference &fromList, QObject *object) -{ - QList<QObject *> tmpList; - int i; - - if (!(fromList.canCount() && fromList.canAt() && fromList.canAppend() && fromList.canClear())) - return false; - - for (i=0; i<fromList.count(); ++i) - if (object != fromList.at(i)) - tmpList << fromList.at(i); - - fromList.clear(); - - foreach (QObject *item, tmpList) - fromList.append(item); - - return true; -} - -void QDeclarativeViewInspectorPrivate::_q_createQmlObject(const QString &qml, QObject *parent, - const QStringList &importList, - const QString &filename, int order) -{ - if (!parent) - return; - - QString imports; - foreach (const QString &s, importList) { - imports += s; - imports += QLatin1Char('\n'); - } - - QDeclarativeContext *parentContext = view->engine()->contextForObject(parent); - QDeclarativeComponent component(view->engine(), q); - QByteArray constructedQml = QString(imports + qml).toLatin1(); - - component.setData(constructedQml, filename); - QObject *newObject = component.create(parentContext); - if (newObject) { - newObject->setParent(parent); - do { - // add child item - QDeclarativeItem *parentItem = qobject_cast<QDeclarativeItem*>(parent); - QDeclarativeItem *newItem = qobject_cast<QDeclarativeItem*>(newObject); - if (parentItem && newItem) { - newItem->setParentItem(parentItem); - break; - } - - // add property change - QDeclarativeState *parentState = qobject_cast<QDeclarativeState*>(parent); - QDeclarativeStateOperation *newPropertyChanges = qobject_cast<QDeclarativeStateOperation *>(newObject); - if (parentState && newPropertyChanges) { - (*parentState) << newPropertyChanges; - break; - } - - // add states - QDeclarativeState *newState = qobject_cast<QDeclarativeState*>(newObject); - if (parentItem && newState) { - QDeclarativeListReference statesList(parentItem, "states"); - statesList.append(newObject); - break; - } - - // add animation to transition - if (parent->inherits("QDeclarativeTransition") && - newObject->inherits("QDeclarativeAbstractAnimation")) { - QDeclarativeListReference animationsList(parent, "animations"); - animationsList.append(newObject); - break; - } - - // add animation to animation - if (parent->inherits("QDeclarativeAnimationGroup") && - newObject->inherits("QDeclarativeAbstractAnimation")) { - QDeclarativeListReference animationsList(parent, "animations"); - if (order==-1) { - animationsList.append(newObject); - } else { - if (!insertObjectInListProperty(animationsList, order, newObject)) { - animationsList.append(newObject); - } - } - break; - } - - // add transition - if (parentItem && newObject->inherits("QDeclarativeTransition")) { - QDeclarativeListReference transitionsList(parentItem,"transitions"); - if (transitionsList.count() == 1 && transitionsList.at(0) == 0) { - transitionsList.clear(); - } - transitionsList.append(newObject); - break; - } - - } while (false); - } -} - -void QDeclarativeViewInspectorPrivate::_q_reparentQmlObject(QObject *object, QObject *newParent) -{ - if (!newParent) - return; - - object->setParent(newParent); - QDeclarativeItem *newParentItem = qobject_cast<QDeclarativeItem*>(newParent); - QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(object); - if (newParentItem && item) - item->setParentItem(newParentItem); -} - -void QDeclarativeViewInspectorPrivate::_q_deleteQmlObject(QObject *object) -{ - // special cases for transitions/animations - if (object->inherits("QDeclarativeAbstractAnimation")) { - if (object->parent()) { - QDeclarativeListReference animationsList(object->parent(), "animations"); - if (removeObjectFromListProperty(animationsList, object)) - object->deleteLater(); - return; - } - } - - if (object->inherits("QDeclarativeTransition")) { - QDeclarativeListReference transitionsList(object->parent(), "transitions"); - if (removeObjectFromListProperty(transitionsList, object)) - object->deleteLater(); - return; - } -} - -void QDeclarativeViewInspectorPrivate::_q_clearComponentCache() -{ - view->engine()->clearComponentCache(); -} - -void QDeclarativeViewInspectorPrivate::_q_removeFromSelection(QObject *obj) -{ - QList<QGraphicsItem*> items = selectedItems(); - if (QGraphicsItem *item = qobject_cast<QGraphicsObject*>(obj)) - items.removeOne(item); - setSelectedItems(items); -} - -bool QDeclarativeViewInspector::mouseDoubleClickEvent(QMouseEvent * /*event*/) -{ - if (!data->designModeBehavior) - return false; - - return true; -} - -bool QDeclarativeViewInspector::wheelEvent(QWheelEvent *event) -{ - if (!data->designModeBehavior) - return false; - data->currentTool->wheelEvent(event); - return true; -} - -void QDeclarativeViewInspector::setDesignModeBehavior(bool value) -{ - emit designModeBehaviorChanged(value); - - data->debugService->setDesignModeBehavior(value); - - data->designModeBehavior = value; - - if (!data->designModeBehavior) - data->clearEditorItems(); -} - -bool QDeclarativeViewInspector::designModeBehavior() -{ - return data->designModeBehavior; -} - -bool QDeclarativeViewInspector::showAppOnTop() const -{ - return data->showAppOnTop; -} - -void QDeclarativeViewInspector::setShowAppOnTop(bool appOnTop) -{ - if (data->view) { - QWidget *window = data->view->window(); - Qt::WindowFlags flags = window->windowFlags(); - if (appOnTop) - flags |= Qt::WindowStaysOnTopHint; - else - flags &= ~Qt::WindowStaysOnTopHint; - - window->setWindowFlags(flags); - window->show(); - } - - data->showAppOnTop = appOnTop; - data->debugService->setShowAppOnTop(appOnTop); - - emit showAppOnTopChanged(appOnTop); -} - -void QDeclarativeViewInspectorPrivate::changeTool(Constants::DesignTool tool, - Constants::ToolFlags /*flags*/) -{ - switch(tool) { - case Constants::SelectionToolMode: - _q_changeToSingleSelectTool(); - break; - case Constants::NoTool: - default: - currentTool = 0; - break; - } -} - -void QDeclarativeViewInspectorPrivate::setSelectedItemsForTools(QList<QGraphicsItem *> items) -{ - foreach (const QWeakPointer<QGraphicsObject> &obj, currentSelection) { - if (QGraphicsItem *item = obj.data()) { - if (!items.contains(item)) { - QObject::disconnect(obj.data(), SIGNAL(destroyed(QObject*)), - this, SLOT(_q_removeFromSelection(QObject*))); - currentSelection.removeOne(obj); - } - } - } - - foreach (QGraphicsItem *item, items) { - if (QGraphicsObject *obj = item->toGraphicsObject()) { - if (!currentSelection.contains(obj)) { - QObject::connect(obj, SIGNAL(destroyed(QObject*)), - this, SLOT(_q_removeFromSelection(QObject*))); - currentSelection.append(obj); - } - } - } - - currentTool->updateSelectedItems(); -} - -void QDeclarativeViewInspectorPrivate::setSelectedItems(QList<QGraphicsItem *> items) -{ - QList<QWeakPointer<QGraphicsObject> > oldList = currentSelection; - setSelectedItemsForTools(items); - if (oldList != currentSelection) { - QList<QObject*> objectList; - foreach (const QWeakPointer<QGraphicsObject> &graphicsObject, currentSelection) { - if (graphicsObject) - objectList << graphicsObject.data(); - } - - debugService->setCurrentObjects(objectList); - } -} - -QList<QGraphicsItem *> QDeclarativeViewInspectorPrivate::selectedItems() -{ - QList<QGraphicsItem *> selection; - foreach (const QWeakPointer<QGraphicsObject> &selectedObject, currentSelection) { - if (selectedObject.data()) - selection << selectedObject.data(); - } - - return selection; -} - -void QDeclarativeViewInspector::setSelectedItems(QList<QGraphicsItem *> items) -{ - data->setSelectedItems(items); -} - -QList<QGraphicsItem *> QDeclarativeViewInspector::selectedItems() -{ - return data->selectedItems(); -} - -QDeclarativeView *QDeclarativeViewInspector::declarativeView() -{ - return data->view; -} - -void QDeclarativeViewInspectorPrivate::clearHighlight() -{ - boundingRectHighlighter->clear(); -} - -void QDeclarativeViewInspectorPrivate::highlight(const QList<QGraphicsObject *> &items) -{ - if (items.isEmpty()) - return; - - QList<QGraphicsObject*> objectList; - foreach (QGraphicsItem *item, items) { - QGraphicsItem *child = item; - - if (child) { - QGraphicsObject *childObject = child->toGraphicsObject(); - if (childObject) - objectList << childObject; - } - } - - boundingRectHighlighter->highlight(objectList); -} - -QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::selectableItems( - const QPointF &scenePos) const -{ - QList<QGraphicsItem*> itemlist = view->scene()->items(scenePos); - return filterForSelection(itemlist); -} - -QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::selectableItems(const QPoint &pos) const -{ - QList<QGraphicsItem*> itemlist = view->items(pos); - return filterForSelection(itemlist); -} - -QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::selectableItems( - const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const -{ - QList<QGraphicsItem*> itemlist = view->scene()->items(sceneRect, selectionMode); - return filterForSelection(itemlist); -} - -void QDeclarativeViewInspectorPrivate::_q_changeToSingleSelectTool() -{ - currentToolMode = Constants::SelectionToolMode; - selectionTool->setRubberbandSelectionMode(false); - - changeToSelectTool(); - - emit q->selectToolActivated(); - debugService->setCurrentTool(Constants::SelectionToolMode); -} - -void QDeclarativeViewInspectorPrivate::changeToSelectTool() -{ - if (currentTool == selectionTool) - return; - - currentTool->clear(); - currentTool = selectionTool; - currentTool->clear(); - currentTool->updateSelectedItems(); -} - -void QDeclarativeViewInspectorPrivate::_q_changeToMarqueeSelectTool() -{ - changeToSelectTool(); - currentToolMode = Constants::MarqueeSelectionToolMode; - selectionTool->setRubberbandSelectionMode(true); - - emit q->marqueeSelectToolActivated(); - debugService->setCurrentTool(Constants::MarqueeSelectionToolMode); -} - -void QDeclarativeViewInspectorPrivate::_q_changeToZoomTool() -{ - currentToolMode = Constants::ZoomMode; - currentTool->clear(); - currentTool = zoomTool; - currentTool->clear(); - - emit q->zoomToolActivated(); - debugService->setCurrentTool(Constants::ZoomMode); -} - -void QDeclarativeViewInspectorPrivate::_q_changeToColorPickerTool() -{ - if (currentTool == colorPickerTool) - return; - - currentToolMode = Constants::ColorPickerMode; - currentTool->clear(); - currentTool = colorPickerTool; - currentTool->clear(); - - emit q->colorPickerActivated(); - debugService->setCurrentTool(Constants::ColorPickerMode); -} - -void QDeclarativeViewInspector::setAnimationSpeed(qreal slowDownFactor) -{ - Q_ASSERT(slowDownFactor > 0); - if (data->slowDownFactor == slowDownFactor) - return; - - animationSpeedChangeRequested(slowDownFactor); - data->debugService->setAnimationSpeed(slowDownFactor); -} - -void QDeclarativeViewInspector::setAnimationPaused(bool paused) -{ - if (data->animationPaused == paused) - return; - - animationPausedChangeRequested(paused); - data->debugService->setAnimationPaused(paused); -} - -void QDeclarativeViewInspector::animationSpeedChangeRequested(qreal factor) -{ - if (data->slowDownFactor != factor) { - data->slowDownFactor = factor; - emit animationSpeedChanged(factor); - } - - const float effectiveFactor = data->animationPaused ? 0 : factor; - QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor); -} - -void QDeclarativeViewInspector::animationPausedChangeRequested(bool paused) -{ - if (data->animationPaused != paused) { - data->animationPaused = paused; - emit animationPausedChanged(paused); - } - - const float effectiveFactor = paused ? 0 : data->slowDownFactor; - QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor); -} - - -void QDeclarativeViewInspectorPrivate::_q_applyChangesFromClient() -{ -} - - -QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::filterForSelection( - QList<QGraphicsItem*> &itemlist) const -{ - foreach (QGraphicsItem *item, itemlist) { - if (isEditorItem(item)) - itemlist.removeOne(item); - } - - return itemlist; -} - -bool QDeclarativeViewInspectorPrivate::isEditorItem(QGraphicsItem *item) const -{ - return (item->type() == Constants::EditorItemType - || item->type() == Constants::ResizeHandleItemType - || item->data(Constants::EditorItemDataKey).toBool()); -} - -void QDeclarativeViewInspectorPrivate::_q_onStatusChanged(QDeclarativeView::Status status) -{ - if (status == QDeclarativeView::Ready) - debugService->reloaded(); -} - -void QDeclarativeViewInspectorPrivate::_q_onCurrentObjectsChanged(QList<QObject*> objects) -{ - QList<QGraphicsItem*> items; - QList<QGraphicsObject*> gfxObjects; - foreach (QObject *obj, objects) { - if (QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem*>(obj)) { - items << declarativeItem; - gfxObjects << declarativeItem; - } - } - if (designModeBehavior) { - setSelectedItemsForTools(items); - clearHighlight(); - highlight(gfxObjects); - } -} - -QString QDeclarativeViewInspector::idStringForObject(QObject *obj) -{ - return QDeclarativeInspectorService::instance()->idStringForObject(obj); -} - -// adjusts bounding boxes on edges of screen to be visible -QRectF QDeclarativeViewInspector::adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace) -{ - int marginFromEdge = 1; - QRectF boundingRect(boundingRectInSceneSpace); - if (qAbs(boundingRect.left()) - 1 < 2) - boundingRect.setLeft(marginFromEdge); - - QRect rect = data->view->rect(); - - if (boundingRect.right() >= rect.right()) - boundingRect.setRight(rect.right() - marginFromEdge); - - if (qAbs(boundingRect.top()) - 1 < 2) - boundingRect.setTop(marginFromEdge); - - if (boundingRect.bottom() >= rect.bottom()) - boundingRect.setBottom(rect.bottom() - marginFromEdge); - - return boundingRect; -} - -} // namespace QmlJSDebugger diff --git a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewinspector_p.h b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewinspector_p.h deleted file mode 100644 index e2a208cbd789dc864575feffc9c8d9906f4bfb5e..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewinspector_p.h +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QDECLARATIVEVIEWINSPECTOR_P_H -#define QDECLARATIVEVIEWINSPECTOR_P_H - -#include <QWeakPointer> -#include <QPointF> - -#include "qdeclarativeviewinspector.h" -#include "qdeclarativeinspectorservice.h" - -namespace QmlJSDebugger { - -class JSDebuggerAgent; -class QDeclarativeViewInspector; -class LiveSelectionTool; -class ZoomTool; -class ColorPickerTool; -class LiveLayerItem; -class BoundingRectHighlighter; -class CrumblePath; -class AbstractLiveEditTool; - -class QDeclarativeViewInspectorPrivate : public QObject -{ - Q_OBJECT -public: - QDeclarativeViewInspectorPrivate(QDeclarativeViewInspector *); - ~QDeclarativeViewInspectorPrivate(); - - QDeclarativeView *view; - QDeclarativeViewInspector *q; - QDeclarativeInspectorService *debugService; - QWeakPointer<QWidget> viewport; - - QPointF cursorPos; - QList<QWeakPointer<QGraphicsObject> > currentSelection; - - Constants::DesignTool currentToolMode; - AbstractLiveEditTool *currentTool; - - LiveSelectionTool *selectionTool; - ZoomTool *zoomTool; - ColorPickerTool *colorPickerTool; - LiveLayerItem *manipulatorLayer; - - BoundingRectHighlighter *boundingRectHighlighter; - - bool designModeBehavior; - bool showAppOnTop; - - bool animationPaused; - qreal slowDownFactor; - - void setViewport(QWidget *widget); - - void clearEditorItems(); - void changeToSelectTool(); - QList<QGraphicsItem*> filterForSelection(QList<QGraphicsItem*> &itemlist) const; - - QList<QGraphicsItem*> selectableItems(const QPoint &pos) const; - QList<QGraphicsItem*> selectableItems(const QPointF &scenePos) const; - QList<QGraphicsItem*> selectableItems(const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const; - - void setSelectedItemsForTools(QList<QGraphicsItem *> items); - void setSelectedItems(QList<QGraphicsItem *> items); - QList<QGraphicsItem *> selectedItems(); - - void changeTool(Constants::DesignTool tool, - Constants::ToolFlags flags = Constants::NoToolFlags); - - void clearHighlight(); - void highlight(const QList<QGraphicsObject *> &item); - inline void highlight(QGraphicsObject *item) - { highlight(QList<QGraphicsObject*>() << item); } - - bool isEditorItem(QGraphicsItem *item) const; - -public slots: - void _q_reloadView(); - void _q_onStatusChanged(QDeclarativeView::Status status); - void _q_onCurrentObjectsChanged(QList<QObject*> objects); - void _q_applyChangesFromClient(); - void _q_createQmlObject(const QString &qml, QObject *parent, - const QStringList &imports, const QString &filename = QString(), int order = 0); - void _q_reparentQmlObject(QObject *, QObject *); - void _q_deleteQmlObject(QObject *); - - void _q_changeToSingleSelectTool(); - void _q_changeToMarqueeSelectTool(); - void _q_changeToZoomTool(); - void _q_changeToColorPickerTool(); - void _q_clearComponentCache(); - void _q_removeFromSelection(QObject *); - -public: - static QDeclarativeViewInspectorPrivate *get(QDeclarativeViewInspector *v) { return v->d_func(); } -}; - -} // namespace QmlJSDebugger - -#endif // QDECLARATIVEVIEWINSPECTOR_P_H diff --git a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri deleted file mode 100644 index 820267165fce6aa3bb7fef3e6555202ea20bacb7..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri +++ /dev/null @@ -1,14 +0,0 @@ -# This file is part of Qt Creator -# It enables debugging of Qt Quick applications - -QT += declarative script -INCLUDEPATH += $$PWD/include - -windows:CONFIG(debug, debug|release) { - LIBNAME = QmlJSDebuggerd -} else { - LIBNAME = QmlJSDebugger -} -LIBS += -L$$PWD -l$$LIBNAME - -DEFINES += QMLJSDEBUGGER diff --git a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-src.pri b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-src.pri deleted file mode 100644 index cb41d7169f88f4dedea23982b4709a2cce8cd24b..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-src.pri +++ /dev/null @@ -1,45 +0,0 @@ -INCLUDEPATH += $$PWD/include - -include($$PWD/protocol/protocol.pri) - -HEADERS += \ - $$PWD/include/jsdebuggeragent.h \ - $$PWD/include/qmljsdebugger_global.h - -SOURCES += \ - $$PWD/jsdebuggeragent.cpp - -HEADERS += \ - $$PWD/include/qdeclarativeviewinspector.h \ - $$PWD/include/qdeclarativeviewobserver.h \ - $$PWD/include/qdeclarativeinspectorservice.h \ - $$PWD/include/qmlinspectorconstants.h \ - $$PWD/editor/abstractliveedittool.h \ - $$PWD/editor/liveselectiontool.h \ - $$PWD/editor/livelayeritem.h \ - $$PWD/editor/livesingleselectionmanipulator.h \ - $$PWD/editor/liverubberbandselectionmanipulator.h \ - $$PWD/editor/liveselectionrectangle.h \ - $$PWD/editor/liveselectionindicator.h \ - $$PWD/editor/boundingrecthighlighter.h \ - $$PWD/editor/subcomponentmasklayeritem.h \ - $$PWD/editor/zoomtool.h \ - $$PWD/editor/colorpickertool.h \ - $$PWD/qdeclarativeviewinspector_p.h - -SOURCES += \ - $$PWD/qdeclarativeviewinspector.cpp \ - $$PWD/qdeclarativeinspectorservice.cpp \ - $$PWD/editor/abstractliveedittool.cpp \ - $$PWD/editor/liveselectiontool.cpp \ - $$PWD/editor/livelayeritem.cpp \ - $$PWD/editor/livesingleselectionmanipulator.cpp \ - $$PWD/editor/liverubberbandselectionmanipulator.cpp \ - $$PWD/editor/liveselectionrectangle.cpp \ - $$PWD/editor/liveselectionindicator.cpp \ - $$PWD/editor/boundingrecthighlighter.cpp \ - $$PWD/editor/subcomponentmasklayeritem.cpp \ - $$PWD/editor/zoomtool.cpp \ - $$PWD/editor/colorpickertool.cpp - -DEFINES += QMLJSDEBUGGER diff --git a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro deleted file mode 100644 index f7585e1478bc23f300aa0e5e518e11784ec2719d..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro +++ /dev/null @@ -1,18 +0,0 @@ -# This file is part of Qt Creator -# It enables debugging of Qt Quick applications - -TEMPLATE = lib -CONFIG += staticlib create_prl -QT += declarative script - -DEFINES += BUILD_QMLJSDEBUGGER_STATIC_LIB - -unix:QMAKE_CXXFLAGS_DEBUG += -O3 - -DESTDIR = $$PWD -TARGET=QmlJSDebugger -CONFIG(debug, debug|release) { - windows:TARGET=QmlJSDebuggerd -} - -include(qmljsdebugger-src.pri) diff --git a/share/qtcreator/qml/qmlobserver/Info.plist.in b/share/qtcreator/qml/qmlobserver/Info.plist.in deleted file mode 100644 index 924d1fc411f9956247825a27c61ea469a8ac3d06..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/Info.plist.in +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version=\"1.0\" encoding=\"UTF-8\"?> -<!DOCTYPE plist SYSTEM \"file://localhost/System/Library/DTDs/PropertyList.dtd\"> -<plist version=\"0.1\"> -<dict> - <key>NSHumanReadableCopyright</key> - <string>This file is part of Qt Creator - -Copyright (c) 2013 Digia Plc and/or its subsidiary(-ies). - -Contact: http://www.qt-project.org/ - -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, Digia gives you certain additional -rights. These rights are described in the Digia Qt LGPL Exception -version 1.1, included in the file LGPL_EXCEPTION.txt in this package. - -Other Usage - -Alternatively, this file may be used in accordance with the terms and -conditions contained in a signed written agreement between you and Digia.</string> - <key>CFBundleIconFile</key> - <string>@ICON@</string> - <key>CFBundleIdentifier</key> - <string>com.nokia.qt.qml</string> - <key>CFBundlePackageType</key> - <string>APPL</string> - <key>CFBundleGetInfoString</key> - <string>Created by Qt/QMake</string> - <key>CFBundleSignature</key> - <string>@TYPEINFO@</string> - <key>CFBundleExecutable</key> - <string>@EXECUTABLE@</string> - <key>CFBundleVersion</key> - <string>$$QTCREATOR_VERSION</string> - <key>CFBundleShortVersionString</key> - <string>$$QTCREATOR_VERSION</string> - <key>UTExportedTypeDeclarations</key> - <array> - <dict> - <key>UTTypeIdentifier</key> - <string>com.nokia.qt.qml</string> - <key>UTTypeDescription</key> - <string>Qt Markup Language</string> - <key>UTTypeConformsTo</key> - <array> - <string>public.plain-text</string> - </array> - <key>UTTypeTagSpecification</key> - <dict> - <key>public.filename-extension</key> - <array> - <string>qml</string> - </array> - </dict> - </dict> - </array> - <key>CFBundleDocumentTypes</key> - <array> - <dict> - <key>LSItemContentTypes</key> - <array> - <string>com.nokia.qt.qml</string> - </array> - <key>CFBundleTypeRole</key> - <string>Viewer</string> - </dict> - </array> -</dict> -</plist> diff --git a/share/qtcreator/qml/qmlobserver/LGPL_EXCEPTION.TXT b/share/qtcreator/qml/qmlobserver/LGPL_EXCEPTION.TXT deleted file mode 100644 index add80b93182aa3fa2ffd0ae076cccf72ad11e910..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/LGPL_EXCEPTION.TXT +++ /dev/null @@ -1,22 +0,0 @@ -Digia Qt LGPL Exception version 1.1 - -As an additional permission to the GNU Lesser General Public License version -2.1, the object code form of a "work that uses the Library" may incorporate -material from a header file that is part of the Library. You may distribute -such object code under terms of your choice, provided that: - (i) the header files of the Library have not been modified; and - (ii) the incorporated material is limited to numerical parameters, data - structure layouts, accessors, macros, inline functions and - templates; and - (iii) you comply with the terms of Section 6 of the GNU Lesser General - Public License version 2.1. - -Moreover, you may apply this exception to a modified version of the Library, -provided that such modification does not involve copying material from the -Library into the modified Library's header files unless such material is -limited to (i) numerical parameters; (ii) data structure layouts; -(iii) accessors; and (iv) small macros, templates and inline functions of -five lines or less in length. - -Furthermore, you are not required to apply this additional permission to a -modified version of the Library. diff --git a/share/qtcreator/qml/qmlobserver/LICENSE.LGPL b/share/qtcreator/qml/qmlobserver/LICENSE.LGPL deleted file mode 100644 index 602bfc94635ddf8f1bf2b00419a85ead645a5b67..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/LICENSE.LGPL +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - <one line to give the library's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - <signature of Ty Coon>, 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/share/qtcreator/qml/qmlobserver/browser/Browser.qml b/share/qtcreator/qml/qmlobserver/browser/Browser.qml deleted file mode 100644 index 83d5c1aeb5b6adb97b597f76ba9b03caf9800ed9..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/browser/Browser.qml +++ /dev/null @@ -1,306 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -import QtQuick 1.0 -import Qt.labs.folderlistmodel 1.0 - -Rectangle { - id: root - property bool showFocusHighlight: false - property variant folders: folders1 - property variant view: view1 - width: 320 - height: 480 - color: palette.window - - FolderListModel { - id: folders1 - nameFilters: [ "*.qml" ] - folder: qmlViewerFolder - } - FolderListModel { - id: folders2 - nameFilters: [ "*.qml" ] - folder: qmlViewerFolder - } - - SystemPalette { id: palette } - - function down(path) { - if (folders == folders1) { - view = view2 - folders = folders2; - view1.state = "exitLeft"; - } else { - view = view1 - folders = folders1; - view2.state = "exitLeft"; - } - view.x = root.width; - view.state = "current"; - view.focus = true; - folders.folder = path; - } - function up() { - var path = folders.parentFolder; - if (folders == folders1) { - view = view2 - folders = folders2; - view1.state = "exitRight"; - } else { - view = view1 - folders = folders1; - view2.state = "exitRight"; - } - view.x = -root.width; - view.state = "current"; - view.focus = true; - folders.folder = path; - } - function keyPressed(key) { - switch (key) { - case Qt.Key_Up: - case Qt.Key_Down: - case Qt.Key_Left: - case Qt.Key_Right: - root.showFocusHighlight = true; - break; - default: - // do nothing - break; - } - } - - Component { - id: folderDelegate - Rectangle { - id: wrapper - function launch() { - if (folders.isFolder(index)) { - down(filePath); - } else { - qmlViewer.launch(filePath); - } - } - width: root.width - height: 52 - color: "transparent" - Rectangle { - id: highlight; visible: false - anchors.fill: parent - color: palette.highlight - gradient: Gradient { - GradientStop { id: t1; position: 0.0; color: palette.highlight } - GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) } - } - } - Item { - width: 48; height: 48 - Image { source: "images/folder.png"; anchors.centerIn: parent; visible: folders.isFolder(index)} - } - Text { - id: nameText - anchors.fill: parent; verticalAlignment: Text.AlignVCenter - text: fileName - anchors.leftMargin: 54 - font.pixelSize: 32 - color: (wrapper.ListView.isCurrentItem && root.showFocusHighlight) ? palette.highlightedText : palette.windowText - elide: Text.ElideRight - } - MouseArea { - id: mouseRegion - anchors.fill: parent - onPressed: { - root.showFocusHighlight = false; - wrapper.ListView.view.currentIndex = index; - } - onClicked: { if (folders == wrapper.ListView.view.model) launch() } - } - states: [ - State { - name: "pressed" - when: mouseRegion.pressed - PropertyChanges { target: highlight; visible: true } - PropertyChanges { target: nameText; color: palette.highlightedText } - } - ] - } - } - - ListView { - id: view1 - anchors.top: titleBar.bottom - anchors.bottom: parent.bottom - x: 0 - width: parent.width - model: folders1 - delegate: folderDelegate - highlight: Rectangle { - color: palette.highlight - visible: root.showFocusHighlight && view1.count != 0 - gradient: Gradient { - GradientStop { id: t1; position: 0.0; color: palette.highlight } - GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) } - } - width: view1.currentItem == null ? 0 : view1.currentItem.width - } - highlightMoveSpeed: 1000 - pressDelay: 100 - focus: true - state: "current" - states: [ - State { - name: "current" - PropertyChanges { target: view1; x: 0 } - }, - State { - name: "exitLeft" - PropertyChanges { target: view1; x: -root.width } - }, - State { - name: "exitRight" - PropertyChanges { target: view1; x: root.width } - } - ] - transitions: [ - Transition { - to: "current" - SequentialAnimation { - NumberAnimation { properties: "x"; duration: 250 } - } - }, - Transition { - NumberAnimation { properties: "x"; duration: 250 } - NumberAnimation { properties: "x"; duration: 250 } - } - ] - Keys.onPressed: root.keyPressed(event.key) - } - - ListView { - id: view2 - anchors.top: titleBar.bottom - anchors.bottom: parent.bottom - x: parent.width - width: parent.width - model: folders2 - delegate: folderDelegate - highlight: Rectangle { - color: palette.highlight - visible: root.showFocusHighlight && view2.count != 0 - gradient: Gradient { - GradientStop { id: t1; position: 0.0; color: palette.highlight } - GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) } - } - width: view1.currentItem == null ? 0 : view1.currentItem.width - } - highlightMoveSpeed: 1000 - pressDelay: 100 - states: [ - State { - name: "current" - PropertyChanges { target: view2; x: 0 } - }, - State { - name: "exitLeft" - PropertyChanges { target: view2; x: -root.width } - }, - State { - name: "exitRight" - PropertyChanges { target: view2; x: root.width } - } - ] - transitions: [ - Transition { - to: "current" - SequentialAnimation { - NumberAnimation { properties: "x"; duration: 250 } - } - }, - Transition { - NumberAnimation { properties: "x"; duration: 250 } - } - ] - Keys.onPressed: root.keyPressed(event.key) - } - - Keys.onPressed: { - root.keyPressed(event.key); - if (event.key == Qt.Key_Return || event.key == Qt.Key_Select || event.key == Qt.Key_Right) { - view.currentItem.launch(); - event.accepted = true; - } else if (event.key == Qt.Key_Left) { - up(); - } - } - - BorderImage { - source: "images/titlebar.sci"; - width: parent.width; - height: 52 - y: -7 - id: titleBar - - Rectangle { - id: upButton - width: 48 - height: titleBar.height - 7 - color: "transparent" - - Image { anchors.centerIn: parent; source: "images/up.png" } - MouseArea { id: upRegion; anchors.centerIn: parent - width: 56 - height: 56 - onClicked: if (folders.parentFolder != "") up() - } - states: [ - State { - name: "pressed" - when: upRegion.pressed - PropertyChanges { target: upButton; color: palette.highlight } - } - ] - } - Rectangle { - color: "gray" - x: 48 - width: 1 - height: 44 - } - - Text { - anchors.left: upButton.right; anchors.right: parent.right; height: parent.height - anchors.leftMargin: 4; anchors.rightMargin: 4 - text: folders.folder - color: "white" - elide: Text.ElideLeft; horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignVCenter - font.pixelSize: 32 - } - } -} diff --git a/share/qtcreator/qml/qmlobserver/browser/browser.qrc b/share/qtcreator/qml/qmlobserver/browser/browser.qrc deleted file mode 100644 index 9c688e752153817cc82be0f614d8da380cc0dcac..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/browser/browser.qrc +++ /dev/null @@ -1,9 +0,0 @@ -<RCC> - <qresource prefix="/browser"> - <file>Browser.qml</file> - <file>images/up.png</file> - <file>images/folder.png</file> - <file>images/titlebar.sci</file> - <file>images/titlebar.png</file> - </qresource> -</RCC> diff --git a/share/qtcreator/qml/qmlobserver/browser/images/folder.png b/share/qtcreator/qml/qmlobserver/browser/images/folder.png deleted file mode 100644 index e53e2ad464eb993256a6c3567fc940498e26fc8b..0000000000000000000000000000000000000000 Binary files a/share/qtcreator/qml/qmlobserver/browser/images/folder.png and /dev/null differ diff --git a/share/qtcreator/qml/qmlobserver/browser/images/titlebar.png b/share/qtcreator/qml/qmlobserver/browser/images/titlebar.png deleted file mode 100644 index 51c90082d052a94af34488ca9a13842122f7d7a4..0000000000000000000000000000000000000000 Binary files a/share/qtcreator/qml/qmlobserver/browser/images/titlebar.png and /dev/null differ diff --git a/share/qtcreator/qml/qmlobserver/browser/images/titlebar.sci b/share/qtcreator/qml/qmlobserver/browser/images/titlebar.sci deleted file mode 100644 index 0418d94cd60c70a1cc88fc8d35cd27d63706e24b..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/browser/images/titlebar.sci +++ /dev/null @@ -1,5 +0,0 @@ -border.left: 10 -border.top: 12 -border.bottom: 12 -border.right: 10 -source: titlebar.png diff --git a/share/qtcreator/qml/qmlobserver/browser/images/up.png b/share/qtcreator/qml/qmlobserver/browser/images/up.png deleted file mode 100644 index b05f8025d0157a5e7b2792b058cdb4553b1d6bff..0000000000000000000000000000000000000000 Binary files a/share/qtcreator/qml/qmlobserver/browser/images/up.png and /dev/null differ diff --git a/share/qtcreator/qml/qmlobserver/deviceorientation.cpp b/share/qtcreator/qml/qmlobserver/deviceorientation.cpp deleted file mode 100644 index ca26a935bf1c36a54e9ddf44a42441a4877f0412..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/deviceorientation.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "deviceorientation.h" - -QT_USE_NAMESPACE - -class DefaultDeviceOrientation : public DeviceOrientation -{ - Q_OBJECT -public: - DefaultDeviceOrientation() : DeviceOrientation(), m_orientation(DeviceOrientation::Portrait) {} - - Orientation orientation() const { - return m_orientation; - } - - void pauseListening() { - } - void resumeListening() { - } - - void setOrientation(Orientation o) { - if (o != m_orientation) { - m_orientation = o; - emit orientationChanged(); - } - } - - Orientation m_orientation; -}; - -DeviceOrientation* DeviceOrientation::instance() -{ - static DefaultDeviceOrientation *o = 0; - if (!o) - o = new DefaultDeviceOrientation; - return o; -} - -#include "deviceorientation.moc" - diff --git a/share/qtcreator/qml/qmlobserver/deviceorientation.h b/share/qtcreator/qml/qmlobserver/deviceorientation.h deleted file mode 100644 index feda6e946e64c99903bc4d28554438d4cfac15ad..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/deviceorientation.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef ORIENTATION_H -#define ORIENTATION_H - -#include <QObject> - -QT_BEGIN_NAMESPACE - -class DeviceOrientationPrivate; -class DeviceOrientation : public QObject -{ - Q_OBJECT - Q_ENUMS(Orientation) -public: - enum Orientation { - UnknownOrientation, - Portrait, - Landscape, - PortraitInverted, - LandscapeInverted - }; - - virtual Orientation orientation() const = 0; - virtual void setOrientation(Orientation) = 0; - - virtual void pauseListening() = 0; - virtual void resumeListening() = 0; - - static DeviceOrientation *instance(); - -signals: - void orientationChanged(); - -protected: - DeviceOrientation() {} - -private: - DeviceOrientationPrivate *d_ptr; - friend class DeviceOrientationPrivate; -}; - -QT_END_NAMESPACE - -#endif diff --git a/share/qtcreator/qml/qmlobserver/deviceorientation_symbian.cpp b/share/qtcreator/qml/qmlobserver/deviceorientation_symbian.cpp deleted file mode 100644 index 7b5e25265338c1bb9d0388164a287131cf1f56a2..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/deviceorientation_symbian.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "deviceorientation.h" - -#include <e32base.h> -#include <sensrvchannelfinder.h> -#include <sensrvdatalistener.h> -#include <sensrvchannel.h> -#include <sensrvorientationsensor.h> - -class SymbianOrientation : public DeviceOrientation, public MSensrvDataListener -{ - Q_OBJECT -public: - SymbianOrientation() - : DeviceOrientation(), m_current(UnknownOrientation), m_sensorChannel(0), m_channelOpen(false) - { - TRAP_IGNORE(initL()); - if (!m_sensorChannel) - qWarning("No valid sensors found."); - } - - ~SymbianOrientation() - { - if (m_sensorChannel) { - m_sensorChannel->StopDataListening(); - m_sensorChannel->CloseChannel(); - delete m_sensorChannel; - } - } - - void initL() - { - CSensrvChannelFinder *channelFinder = CSensrvChannelFinder::NewLC(); - RSensrvChannelInfoList channelInfoList; - CleanupClosePushL(channelInfoList); - - TSensrvChannelInfo searchConditions; - searchConditions.iChannelType = KSensrvChannelTypeIdOrientationData; - channelFinder->FindChannelsL(channelInfoList, searchConditions); - - for (int i = 0; i < channelInfoList.Count(); ++i) { - TRAPD(error, m_sensorChannel = CSensrvChannel::NewL(channelInfoList[i])); - if (!error) - TRAP(error, m_sensorChannel->OpenChannelL()); - if (!error) { - TRAP(error, m_sensorChannel->StartDataListeningL(this, 1, 1, 0)); - m_channelOpen = true; - break; - } - if (error) { - delete m_sensorChannel; - m_sensorChannel = 0; - } - } - - channelInfoList.Close(); - CleanupStack::Pop(&channelInfoList); - CleanupStack::PopAndDestroy(channelFinder); - } - - Orientation orientation() const - { - return m_current; - } - - void setOrientation(Orientation) { } - -private: - DeviceOrientation::Orientation m_current; - CSensrvChannel *m_sensorChannel; - bool m_channelOpen; - void pauseListening() { - if (m_sensorChannel && m_channelOpen) { - m_sensorChannel->StopDataListening(); - m_sensorChannel->CloseChannel(); - m_channelOpen = false; - } - } - - void resumeListening() { - if (m_sensorChannel && !m_channelOpen) { - TRAPD(error, m_sensorChannel->OpenChannelL()); - if (!error) { - TRAP(error, m_sensorChannel->StartDataListeningL(this, 1, 1, 0)); - if (!error) { - m_channelOpen = true; - } - } - if (error) { - delete m_sensorChannel; - m_sensorChannel = 0; - } - } - } - - void DataReceived(CSensrvChannel &channel, TInt count, TInt dataLost) - { - Q_UNUSED(dataLost) - if (channel.GetChannelInfo().iChannelType == KSensrvChannelTypeIdOrientationData) { - TSensrvOrientationData data; - for (int i = 0; i < count; ++i) { - TPckgBuf<TSensrvOrientationData> dataBuf; - channel.GetData(dataBuf); - data = dataBuf(); - Orientation orientation = UnknownOrientation; - switch (data.iDeviceOrientation) { - case TSensrvOrientationData::EOrientationDisplayUp: - orientation = Portrait; - break; - case TSensrvOrientationData::EOrientationDisplayRightUp: - orientation = Landscape; - break; - case TSensrvOrientationData::EOrientationDisplayLeftUp: - orientation = LandscapeInverted; - break; - case TSensrvOrientationData::EOrientationDisplayDown: - orientation = PortraitInverted; - break; - case TSensrvOrientationData::EOrientationUndefined: - case TSensrvOrientationData::EOrientationDisplayUpwards: - case TSensrvOrientationData::EOrientationDisplayDownwards: - default: - break; - } - - if (m_current != orientation && orientation != UnknownOrientation) { - m_current = orientation; - emit orientationChanged(); - } - } - } - } - - void DataError(CSensrvChannel& /* channel */, TSensrvErrorSeverity /* error */) - { - } - - void GetDataListenerInterfaceL(TUid /* interfaceUid */, TAny*& /* interface */) - { - } -}; - - -DeviceOrientation* DeviceOrientation::instance() -{ - static SymbianOrientation *o = 0; - if (!o) - o = new SymbianOrientation; - return o; -} - -#include "deviceorientation_symbian.moc" diff --git a/share/qtcreator/qml/qmlobserver/loggerwidget.cpp b/share/qtcreator/qml/qmlobserver/loggerwidget.cpp deleted file mode 100644 index 9700b45e879b828ac865633e356e44ffc958ee6e..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/loggerwidget.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include <qglobal.h> -#include <QDebug> -#include <QSettings> -#include <QActionGroup> -#include <QMenu> -#include <QPlainTextEdit> -#ifdef Q_WS_MAEMO_5 -# include <QScrollArea> -# include <QVBoxLayout> -# include "texteditautoresizer_maemo5.h" -#endif - -#include "loggerwidget.h" - -QT_BEGIN_NAMESPACE - -LoggerWidget::LoggerWidget(QWidget *parent) : - QMainWindow(parent), - m_visibilityOrigin(SettingsOrigin) -{ - setAttribute(Qt::WA_QuitOnClose, false); - setWindowTitle(tr("Warnings")); - - m_plainTextEdit = new QPlainTextEdit(); - -#ifdef Q_WS_MAEMO_5 - new TextEditAutoResizer(m_plainTextEdit); - setAttribute(Qt::WA_Maemo5StackedWindow); - QScrollArea *area = new QScrollArea(); - area->setWidget(m_plainTextEdit); - area->setWidgetResizable(true); - setCentralWidget(area); -#else - setCentralWidget(m_plainTextEdit); -#endif - readSettings(); - setupPreferencesMenu(); -} - -void LoggerWidget::append(const QString &msg) -{ - m_plainTextEdit->appendPlainText(msg); - - if (!isVisible() && (defaultVisibility() == AutoShowWarnings)) - setVisible(true); -} - -LoggerWidget::Visibility LoggerWidget::defaultVisibility() const -{ - return m_visibility; -} - -void LoggerWidget::setDefaultVisibility(LoggerWidget::Visibility visibility) -{ - if (m_visibility == visibility) - return; - - m_visibility = visibility; - m_visibilityOrigin = CommandLineOrigin; - - m_preferencesMenu->setEnabled(m_visibilityOrigin == SettingsOrigin); -} - -QMenu *LoggerWidget::preferencesMenu() -{ - return m_preferencesMenu; -} - -QAction *LoggerWidget::showAction() -{ - return m_showWidgetAction; -} - -void LoggerWidget::readSettings() -{ - QSettings settings; - QString warningsPreferences = settings.value("warnings", "hide").toString(); - if (warningsPreferences == "show") { - m_visibility = ShowWarnings; - } else if (warningsPreferences == "hide") { - m_visibility = HideWarnings; - } else { - m_visibility = AutoShowWarnings; - } -} - -void LoggerWidget::saveSettings() -{ - if (m_visibilityOrigin != SettingsOrigin) - return; - - QString value = "autoShow"; - if (defaultVisibility() == ShowWarnings) { - value = "show"; - } else if (defaultVisibility() == HideWarnings) { - value = "hide"; - } - - QSettings settings; - settings.setValue("warnings", value); -} - -void LoggerWidget::warningsPreferenceChanged(QAction *action) -{ - Visibility newSetting = static_cast<Visibility>(action->data().toInt()); - m_visibility = newSetting; - saveSettings(); -} - -void LoggerWidget::showEvent(QShowEvent *event) -{ - QWidget::showEvent(event); - emit opened(); -} - -void LoggerWidget::closeEvent(QCloseEvent *event) -{ - QWidget::closeEvent(event); - emit closed(); -} - -void LoggerWidget::setupPreferencesMenu() -{ - m_preferencesMenu = new QMenu(tr("Warnings")); - QActionGroup *warnings = new QActionGroup(m_preferencesMenu); - warnings->setExclusive(true); - - connect(warnings, SIGNAL(triggered(QAction*)), this, SLOT(warningsPreferenceChanged(QAction*))); - - QAction *showWarningsPreference = new QAction(tr("Show by default"), m_preferencesMenu); - showWarningsPreference->setCheckable(true); - showWarningsPreference->setData(LoggerWidget::ShowWarnings); - warnings->addAction(showWarningsPreference); - m_preferencesMenu->addAction(showWarningsPreference); - - QAction *hideWarningsPreference = new QAction(tr("Hide by default"), m_preferencesMenu); - hideWarningsPreference->setCheckable(true); - hideWarningsPreference->setData(LoggerWidget::HideWarnings); - warnings->addAction(hideWarningsPreference); - m_preferencesMenu->addAction(hideWarningsPreference); - - QAction *autoWarningsPreference = new QAction(tr("Show for first warning"), m_preferencesMenu); - autoWarningsPreference->setCheckable(true); - autoWarningsPreference->setData(LoggerWidget::AutoShowWarnings); - warnings->addAction(autoWarningsPreference); - m_preferencesMenu->addAction(autoWarningsPreference); - - switch (defaultVisibility()) { - case LoggerWidget::ShowWarnings: - showWarningsPreference->setChecked(true); - break; - case LoggerWidget::HideWarnings: - hideWarningsPreference->setChecked(true); - break; - default: - autoWarningsPreference->setChecked(true); - } -} - -QT_END_NAMESPACE diff --git a/share/qtcreator/qml/qmlobserver/loggerwidget.h b/share/qtcreator/qml/qmlobserver/loggerwidget.h deleted file mode 100644 index 5461e20a085993645e14bd30066db34668a30678..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/loggerwidget.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef LOGGERWIDGET_H -#define LOGGERWIDGET_H - -#include <QMainWindow> -#include <QMetaType> - -QT_BEGIN_NAMESPACE - -class QPlainTextEdit; -class QMenu; -class QAction; - -class LoggerWidget : public QMainWindow { - Q_OBJECT -public: - LoggerWidget(QWidget *parent=0); - - enum Visibility { ShowWarnings, HideWarnings, AutoShowWarnings }; - - Visibility defaultVisibility() const; - void setDefaultVisibility(Visibility visibility); - - QMenu *preferencesMenu(); - QAction *showAction(); - -public slots: - void append(const QString &msg); - -private slots: - void warningsPreferenceChanged(QAction *action); - void readSettings(); - void saveSettings(); - -protected: - void showEvent(QShowEvent *event); - void closeEvent(QCloseEvent *event); - -signals: - void opened(); - void closed(); - -private: - void setupPreferencesMenu(); - - QMenu *m_preferencesMenu; - QAction *m_showWidgetAction; - QPlainTextEdit *m_plainTextEdit; - - enum ConfigOrigin { CommandLineOrigin, SettingsOrigin }; - ConfigOrigin m_visibilityOrigin; - Visibility m_visibility; -}; - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(LoggerWidget::Visibility) - -#endif // LOGGERWIDGET_H diff --git a/share/qtcreator/qml/qmlobserver/main.cpp b/share/qtcreator/qml/qmlobserver/main.cpp deleted file mode 100644 index 7f61c99ee3ee72ff73dd87704c46d2d0f76c7309..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/main.cpp +++ /dev/null @@ -1,562 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "qdeclarative.h" -#include "qmlruntime.h" -#include "qdeclarativeengine.h" -#include "loggerwidget.h" -#include <QWidget> -#include <QDir> -#include <QApplication> -#include <QTranslator> -#include <QDebug> -#include <QMessageBox> -#include <QAtomicInt> -#include "qdeclarativetester.h" -#include "qt_private/qdeclarativedebughelper_p.h" - -QT_USE_NAMESPACE - -QtMsgHandler systemMsgOutput = 0; - -static QDeclarativeViewer *openFile(const QString &fileName); -static void showViewer(QDeclarativeViewer *viewer); - -QWeakPointer<LoggerWidget> logger; - -QString warnings; -void exitApp(int i) -{ -#ifdef Q_OS_WIN - // Debugging output is not visible by default on Windows - - // therefore show modal dialog with errors instead. - if (!warnings.isEmpty()) { - QMessageBox::warning(0, QApplication::tr("Qt QML Viewer"), warnings); - } -#endif - exit(i); -} - -static QAtomicInt recursiveLock(0); - -void myMessageOutput(QtMsgType type, const char *msg) -{ - QString strMsg = QString::fromLatin1(msg); - - if (!QCoreApplication::closingDown()) { - if (!logger.isNull()) { - if (recursiveLock.testAndSetOrdered(0, 1)) { - QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg)); - recursiveLock = 0; - } - } else { - warnings += strMsg; - warnings += QLatin1Char('\n'); - } - } - if (systemMsgOutput) { // Windows - systemMsgOutput(type, msg); - } else { // Unix - fprintf(stderr, "%s\n", msg); - fflush(stderr); - } -} - -static QDeclarativeViewer* globalViewer = 0; - -// The qml file that is shown if the user didn't specify a QML file -QString initialFile = "qrc:/startup/startup.qml"; - -void usage() -{ - qWarning("Usage: qmlobserver [options] <filename>"); - qWarning(" "); - qWarning(" options:"); - qWarning(" -v, -version ............................. display version"); - qWarning(" -frameless ............................... run with no window frame"); - qWarning(" -maximized................................ run maximized"); - qWarning(" -fullscreen............................... run fullscreen"); - qWarning(" -stayontop................................ keep viewer window on top"); - qWarning(" -sizeviewtorootobject .................... the view resizes to the changes in the content"); - qWarning(" -sizerootobjecttoview .................... the content resizes to the changes in the view (default)"); - qWarning(" -qmlbrowser .............................. use a QML-based file browser"); - qWarning(" -warnings [show|hide]..................... show warnings in a separate log window"); -#ifndef NO_PRIVATE_HEADERS - qWarning(" -recordfile <output> ..................... set video recording file"); - qWarning(" - ImageMagick 'convert' for GIF)"); - qWarning(" - png file for raw frames"); - qWarning(" - 'ffmpeg' for other formats"); - qWarning(" -recorddither ordered|threshold|floyd .... set GIF dither recording mode"); - qWarning(" -recordrate <fps> ........................ set recording frame rate"); - qWarning(" -record arg .............................. add a recording process argument"); - qWarning(" -autorecord [from-]<tomilliseconds> ...... set recording to start and stop"); -#endif - qWarning(" -devicekeys .............................. use numeric keys (see F1)"); - qWarning(" -dragthreshold <size> .................... set mouse drag threshold size"); - qWarning(" -netcache <size> ......................... set disk cache to size bytes"); - qWarning(" -translation <translationfile> ........... set the language to run in"); - qWarning(" -I <directory> ........................... prepend to the module import search path,"); - qWarning(" display path if <directory> is empty"); - qWarning(" -P <directory> ........................... prepend to the plugin search path"); -#if defined(Q_OS_MAC) - qWarning(" -no-opengl ............................... don't use a QGLWidget for the viewport"); -#else - qWarning(" -opengl .................................. use a QGLWidget for the viewport"); -#endif -#ifndef NO_PRIVATE_HEADERS - qWarning(" -script <path> ........................... set the script to use"); - qWarning(" -scriptopts <options>|help ............... set the script options to use"); -#endif - - qWarning(" "); - qWarning(" Press F1 for interactive help"); - - exitApp(1); -} - -void scriptOptsUsage() -{ - qWarning("Usage: qmlobserver -scriptopts <option>[,<option>...] ..."); - qWarning(" options:"); - qWarning(" record ................................... record a new script"); - qWarning(" play ..................................... playback an existing script"); - qWarning(" testimages ............................... record images or compare images on playback"); - qWarning(" testerror ................................ test 'error' property of root item on playback"); - qWarning(" testskip ................................ test 'skip' property of root item on playback"); - qWarning(" snapshot ................................. file being recorded is static,"); - qWarning(" only one frame will be recorded or tested"); - qWarning(" exitoncomplete ........................... cleanly exit the viewer on script completion"); - qWarning(" exitonfailure ............................ immediately exit the viewer on script failure"); - qWarning(" saveonexit ............................... save recording on viewer exit"); - qWarning(" "); - qWarning(" One of record, play or both must be specified."); - - exitApp(1); -} - -enum WarningsConfig { ShowWarnings, HideWarnings, DefaultWarnings }; - -struct ViewerOptions -{ - ViewerOptions() - : frameless(false), - fps(0.0), - autorecord_from(0), - autorecord_to(0), - dither("none"), - runScript(false), - devkeys(false), - cache(0), - useGL(false), - fullScreen(false), - stayOnTop(false), - maximized(false), - useNativeFileBrowser(true), - experimentalGestures(false), - warningsConfig(DefaultWarnings), - sizeToView(true) - { -#if defined(Q_OS_MAC) - useGL = true; -#endif - } - - bool frameless; - double fps; - int autorecord_from; - int autorecord_to; - QString dither; - QString recordfile; - QStringList recordargs; - QStringList imports; - QStringList plugins; - QString script; - QString scriptopts; - bool runScript; - bool devkeys; - int cache; - QString translationFile; - bool useGL; - bool fullScreen; - bool stayOnTop; - bool maximized; - bool useNativeFileBrowser; - bool experimentalGestures; - - WarningsConfig warningsConfig; - bool sizeToView; - - QDeclarativeViewer::ScriptOptions scriptOptions; -}; - -static ViewerOptions opts; -static QStringList fileNames; - -class Application : public QApplication -{ - Q_OBJECT -public: - Application(int &argc, char **&argv) - : QApplication(argc, argv) - {} - -protected: - bool event(QEvent *ev) - { - if (ev->type() != QEvent::FileOpen) - return QApplication::event(ev); - - QFileOpenEvent *fev = static_cast<QFileOpenEvent *>(ev); - - globalViewer->open(fev->file()); - if (!globalViewer->isVisible()) - showViewer(globalViewer); - - return true; - } - -private Q_SLOTS: - void showInitialViewer() - { - QApplication::processEvents(); - - QDeclarativeViewer *viewer = globalViewer; - if (!viewer) - return; - if (viewer->currentFile().isEmpty()) { - if(opts.useNativeFileBrowser) - viewer->open(initialFile); - else - viewer->openFile(); - } - if (!viewer->isVisible()) - showViewer(viewer); - } -}; - -static void parseScriptOptions() -{ - QStringList options = - opts.scriptopts.split(QLatin1Char(','), QString::SkipEmptyParts); - - QDeclarativeViewer::ScriptOptions scriptOptions = 0; - for (int i = 0; i < options.count(); ++i) { - const QString &option = options.at(i); - if (option == QLatin1String("help")) { - scriptOptsUsage(); - } else if (option == QLatin1String("play")) { - scriptOptions |= QDeclarativeViewer::Play; - } else if (option == QLatin1String("record")) { - scriptOptions |= QDeclarativeViewer::Record; - } else if (option == QLatin1String("testimages")) { - scriptOptions |= QDeclarativeViewer::TestImages; - } else if (option == QLatin1String("testerror")) { - scriptOptions |= QDeclarativeViewer::TestErrorProperty; - } else if (option == QLatin1String("testskip")) { - scriptOptions |= QDeclarativeViewer::TestSkipProperty; - } else if (option == QLatin1String("exitoncomplete")) { - scriptOptions |= QDeclarativeViewer::ExitOnComplete; - } else if (option == QLatin1String("exitonfailure")) { - scriptOptions |= QDeclarativeViewer::ExitOnFailure; - } else if (option == QLatin1String("saveonexit")) { - scriptOptions |= QDeclarativeViewer::SaveOnExit; - } else if (option == QLatin1String("snapshot")) { - scriptOptions |= QDeclarativeViewer::Snapshot; - } else { - scriptOptsUsage(); - } - } - - opts.scriptOptions = scriptOptions; -} - -static void parseCommandLineOptions(const QStringList &arguments) -{ - for (int i = 1; i < arguments.count(); ++i) { - bool lastArg = (i == arguments.count() - 1); - QString arg = arguments.at(i); - if (arg == "-frameless") { - opts.frameless = true; - } else if (arg == "-maximized") { - opts.maximized = true; - } else if (arg == "-fullscreen") { - opts.fullScreen = true; - } else if (arg == "-stayontop") { - opts.stayOnTop = true; - } else if (arg == "-netcache") { - if (lastArg) usage(); - opts.cache = arguments.at(++i).toInt(); - } else if (arg == "-recordrate") { - if (lastArg) usage(); - opts.fps = arguments.at(++i).toDouble(); - } else if (arg == "-recordfile") { - if (lastArg) usage(); - opts.recordfile = arguments.at(++i); - } else if (arg == "-record") { - if (lastArg) usage(); - opts.recordargs << arguments.at(++i); - } else if (arg == "-recorddither") { - if (lastArg) usage(); - opts.dither = arguments.at(++i); - } else if (arg == "-autorecord") { - if (lastArg) usage(); - QString range = arguments.at(++i); - int dash = range.indexOf('-'); - if (dash > 0) - opts.autorecord_from = range.left(dash).toInt(); - opts.autorecord_to = range.mid(dash+1).toInt(); - } else if (arg == "-devicekeys") { - opts.devkeys = true; - } else if (arg == "-dragthreshold") { - if (lastArg) usage(); - qApp->setStartDragDistance(arguments.at(++i).toInt()); - } else if (arg == QLatin1String("-v") || arg == QLatin1String("-version")) { - qWarning("Qt QML Viewer version %s", qVersion()); - exitApp(0); - } else if (arg == "-translation") { - if (lastArg) usage(); - opts.translationFile = arguments.at(++i); -#if defined(Q_OS_MAC) - } else if (arg == "-no-opengl") { - opts.useGL = false; -#else - } else if (arg == "-opengl") { - opts.useGL = true; -#endif - } else if (arg == "-qmlbrowser") { - opts.useNativeFileBrowser = false; - } else if (arg == "-warnings") { - if (lastArg) usage(); - QString warningsStr = arguments.at(++i); - if (warningsStr == QLatin1String("show")) { - opts.warningsConfig = ShowWarnings; - } else if (warningsStr == QLatin1String("hide")) { - opts.warningsConfig = HideWarnings; - } else { - usage(); - } - } else if (arg == "-I" || arg == "-L") { - if (arg == "-L") - qWarning("-L option provided for compatibility only, use -I instead"); - if (lastArg) { - QDeclarativeEngine tmpEngine; - QString paths = tmpEngine.importPathList().join(QLatin1String(":")); - qWarning("Current search path: %s", paths.toLocal8Bit().constData()); - exitApp(0); - } - opts.imports << arguments.at(++i); - } else if (arg == "-P") { - if (lastArg) usage(); - opts.plugins << arguments.at(++i); - } else if (arg == "-script") { - if (lastArg) usage(); - opts.script = arguments.at(++i); - } else if (arg == "-scriptopts") { - if (lastArg) usage(); - opts.scriptopts = arguments.at(++i); - } else if (arg == "-savescript") { - if (lastArg) usage(); - opts.script = arguments.at(++i); - opts.runScript = false; - } else if (arg == "-playscript") { - if (lastArg) usage(); - opts.script = arguments.at(++i); - opts.runScript = true; - } else if (arg == "-sizeviewtorootobject") { - opts.sizeToView = false; - } else if (arg == "-sizerootobjecttoview") { - opts.sizeToView = true; - } else if (arg == "-experimentalgestures") { - opts.experimentalGestures = true; - } else if (!arg.startsWith('-')) { - fileNames.append(arg); - } else if (true || arg == "-help") { - usage(); - } - } - - if (!opts.scriptopts.isEmpty()) { - - parseScriptOptions(); - - if (opts.script.isEmpty()) - usage(); - - if (!(opts.scriptOptions & QDeclarativeViewer::Record) && !(opts.scriptOptions & QDeclarativeViewer::Play)) - scriptOptsUsage(); - } else if (!opts.script.isEmpty()) { - usage(); - } - -} - -static QDeclarativeViewer *createViewer() -{ - Qt::WFlags wflags = (opts.frameless ? Qt::FramelessWindowHint : Qt::Widget); - if (opts.stayOnTop) - wflags |= Qt::WindowStaysOnTopHint; - - QDeclarativeViewer *viewer = new QDeclarativeViewer(0, wflags); - viewer->setAttribute(Qt::WA_DeleteOnClose, true); - viewer->setUseGL(opts.useGL); - - if (!opts.scriptopts.isEmpty()) { - viewer->setScriptOptions(opts.scriptOptions); - viewer->setScript(opts.script); - } - - logger = viewer->warningsWidget(); - if (opts.warningsConfig == ShowWarnings) { - logger.data()->setDefaultVisibility(LoggerWidget::ShowWarnings); - logger.data()->show(); - } else if (opts.warningsConfig == HideWarnings){ - logger.data()->setDefaultVisibility(LoggerWidget::HideWarnings); - } - - if (opts.experimentalGestures) - viewer->enableExperimentalGestures(); - - foreach (const QString &lib, opts.imports) - viewer->addLibraryPath(lib); - - foreach (const QString &plugin, opts.plugins) - viewer->addPluginPath(plugin); - - viewer->setNetworkCacheSize(opts.cache); - viewer->setRecordFile(opts.recordfile); - viewer->setSizeToView(opts.sizeToView); - if (opts.fps > 0) - viewer->setRecordRate(opts.fps); - if (opts.autorecord_to) - viewer->setAutoRecord(opts.autorecord_from, opts.autorecord_to); - if (opts.devkeys) - viewer->setDeviceKeys(true); - viewer->setRecordDither(opts.dither); - if (opts.recordargs.count()) - viewer->setRecordArgs(opts.recordargs); - - viewer->setUseNativeFileBrowser(opts.useNativeFileBrowser); - - return viewer; -} - -void showViewer(QDeclarativeViewer *viewer) -{ - if (opts.fullScreen) - viewer->showFullScreen(); - else if (opts.maximized) - viewer->showMaximized(); - else - viewer->show(); - viewer->raise(); -} - -QDeclarativeViewer *openFile(const QString &fileName) -{ - QDeclarativeViewer *viewer = globalViewer; - - viewer->open(fileName); - showViewer(viewer); - - return viewer; -} - -int main(int argc, char ** argv) -{ - systemMsgOutput = qInstallMsgHandler(myMessageOutput); - -#if defined (Q_WS_X11) || defined (Q_OS_MAC) - //### default to using raster graphics backend for now - bool gsSpecified = false; - for (int i = 0; i < argc; ++i) { - QString arg = argv[i]; - if (arg == "-graphicssystem") { - gsSpecified = true; - break; - } - } - - if (!gsSpecified) - QApplication::setGraphicsSystem("raster"); -#endif - - Application app(argc, argv); - app.setApplicationName("QtQmlViewer"); - app.setOrganizationName("QtProject"); - app.setOrganizationDomain("qt-project.org"); - - QDeclarativeViewer::registerTypes(); - QDeclarativeTester::registerTypes(); - - parseCommandLineOptions(app.arguments()); - - QTranslator qmlTranslator; - if (!opts.translationFile.isEmpty()) { - qmlTranslator.load(opts.translationFile); - app.installTranslator(&qmlTranslator); - } - - if (opts.fullScreen && opts.maximized) - qWarning() << "Both -fullscreen and -maximized specified. Using -fullscreen."; - - if (fileNames.isEmpty()) { - QFile qmlapp(QLatin1String("qmlapp")); - if (qmlapp.exists() && qmlapp.open(QFile::ReadOnly)) { - QString content = QString::fromUtf8(qmlapp.readAll()); - qmlapp.close(); - - int newline = content.indexOf(QLatin1Char('\n')); - if (newline >= 0) - fileNames += content.left(newline); - else - fileNames += content; - } - } - - //enable remote debugging - QDeclarativeDebugHelper::enableDebugging(); - - globalViewer = createViewer(); - - if (fileNames.isEmpty()) { - // show the initial viewer delayed. - // This prevents an initial viewer popping up while there - // are FileOpen events coming through the event queue - QTimer::singleShot(1, &app, SLOT(showInitialViewer())); - } else { - foreach (const QString &fileName, fileNames) - openFile(fileName); - } - - QObject::connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); - - return app.exec(); -} - -#include "main.moc" diff --git a/share/qtcreator/qml/qmlobserver/proxysettings.cpp b/share/qtcreator/qml/qmlobserver/proxysettings.cpp deleted file mode 100644 index 473ec01c2b34c7026e3cc1aec8034e70d8c1c6dc..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/proxysettings.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include <QIntValidator> -#include <QSettings> - -#include "proxysettings.h" - -QT_BEGIN_NAMESPACE - -ProxySettings::ProxySettings (QWidget * parent) - : QDialog (parent), Ui::ProxySettings() -{ - setupUi (this); - -#if !defined Q_WS_MAEMO_5 - // the onscreen keyboard can't cope with masks - proxyServerEdit->setInputMask ("000.000.000.000;_"); -#endif - QIntValidator *validator = new QIntValidator (0, 9999, this); - proxyPortEdit->setValidator (validator); - - QSettings settings; - proxyCheckBox->setChecked (settings.value ("http_proxy/use", 0).toBool ()); - proxyServerEdit->insert (settings.value ("http_proxy/hostname", "").toString ()); - proxyPortEdit->insert (settings.value ("http_proxy/port", "80").toString ()); - usernameEdit->insert (settings.value ("http_proxy/username", "").toString ()); - passwordEdit->insert (settings.value ("http_proxy/password", "").toString ()); -} - -ProxySettings::~ProxySettings() -{ -} - -void ProxySettings::accept () -{ - QSettings settings; - - settings.setValue ("http_proxy/use", proxyCheckBox->isChecked ()); - settings.setValue ("http_proxy/hostname", proxyServerEdit->text ()); - settings.setValue ("http_proxy/port", proxyPortEdit->text ()); - settings.setValue ("http_proxy/username", usernameEdit->text ()); - settings.setValue ("http_proxy/password", passwordEdit->text ()); - - QDialog::accept (); -} - -QNetworkProxy ProxySettings::httpProxy () -{ - QSettings settings; - QNetworkProxy proxy; - - bool proxyInUse = settings.value ("http_proxy/use", 0).toBool (); - if (proxyInUse) { - proxy.setType (QNetworkProxy::HttpProxy); - proxy.setHostName (settings.value ("http_proxy/hostname", "").toString ());// "192.168.220.5" - proxy.setPort (settings.value ("http_proxy/port", 80).toInt ()); // 8080 - proxy.setUser (settings.value ("http_proxy/username", "").toString ()); - proxy.setPassword (settings.value ("http_proxy/password", "").toString ()); - //QNetworkProxy::setApplicationProxy (proxy); - } else { - proxy.setType (QNetworkProxy::NoProxy); - } - return proxy; -} - -bool ProxySettings::httpProxyInUse() -{ - QSettings settings; - return settings.value ("http_proxy/use", 0).toBool (); -} - -QT_END_NAMESPACE diff --git a/share/qtcreator/qml/qmlobserver/proxysettings.h b/share/qtcreator/qml/qmlobserver/proxysettings.h deleted file mode 100644 index 95f224df41a13250c1ad886bd17576c03b2baec7..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/proxysettings.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef PROXYSETTINGS_H -#define PROXYSETTINGS_H - -#include <QDialog> -#include <QNetworkProxy> -#ifdef Q_WS_MAEMO_5 -#include "ui_proxysettings_maemo5.h" -#else -#include "ui_proxysettings.h" -#endif - -QT_BEGIN_NAMESPACE -/** -*/ -class ProxySettings : public QDialog, public Ui::ProxySettings -{ - -Q_OBJECT - -public: - ProxySettings(QWidget * parent = 0); - - ~ProxySettings(); - - static QNetworkProxy httpProxy (); - static bool httpProxyInUse (); - -public slots: - virtual void accept (); -}; - -QT_END_NAMESPACE - -#endif // PROXYSETTINGS_H diff --git a/share/qtcreator/qml/qmlobserver/proxysettings.ui b/share/qtcreator/qml/qmlobserver/proxysettings.ui deleted file mode 100644 index 84e39fe03dbd30f4d0e4c7f0fa3eb3b7d76bea33..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/proxysettings.ui +++ /dev/null @@ -1,115 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>ProxySettings</class> - <widget class="QDialog" name="ProxySettings"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>318</width> - <height>199</height> - </rect> - </property> - <property name="windowTitle"> - <string>Dialog</string> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0" colspan="2"> - <widget class="QCheckBox" name="proxyCheckBox"> - <property name="text"> - <string>Use http proxy</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="serverAddressLabel"> - <property name="text"> - <string>Server Address:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="proxyServerEdit"/> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Port:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="proxyPortEdit"/> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="usernameLabel"> - <property name="text"> - <string>Username:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLineEdit" name="usernameEdit"/> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="passwordLabel"> - <property name="text"> - <string>Password:</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QLineEdit" name="passwordEdit"> - <property name="echoMode"> - <enum>QLineEdit::Password</enum> - </property> - </widget> - </item> - <item row="5" column="0" colspan="2"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections> - <connection> - <sender>buttonBox</sender> - <signal>accepted()</signal> - <receiver>ProxySettings</receiver> - <slot>accept()</slot> - <hints> - <hint type="sourcelabel"> - <x>248</x> - <y>254</y> - </hint> - <hint type="destinationlabel"> - <x>157</x> - <y>274</y> - </hint> - </hints> - </connection> - <connection> - <sender>buttonBox</sender> - <signal>rejected()</signal> - <receiver>ProxySettings</receiver> - <slot>reject()</slot> - <hints> - <hint type="sourcelabel"> - <x>316</x> - <y>260</y> - </hint> - <hint type="destinationlabel"> - <x>286</x> - <y>274</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/share/qtcreator/qml/qmlobserver/proxysettings_maemo5.ui b/share/qtcreator/qml/qmlobserver/proxysettings_maemo5.ui deleted file mode 100644 index 83f0c2a9de21d03b130d99bb9b0e73ce8c958ddf..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/proxysettings_maemo5.ui +++ /dev/null @@ -1,177 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>ProxySettings</class> - <widget class="QDialog" name="ProxySettings"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>449</width> - <height>164</height> - </rect> - </property> - <property name="windowTitle"> - <string>HTTP Proxy</string> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <property name="leftMargin"> - <number>16</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>16</number> - </property> - <property name="bottomMargin"> - <number>8</number> - </property> - <property name="horizontalSpacing"> - <number>16</number> - </property> - <property name="verticalSpacing"> - <number>0</number> - </property> - <item row="0" column="0"> - <widget class="QCheckBox" name="proxyCheckBox"> - <property name="text"> - <string>Use HTTP Proxy</string> - </property> - </widget> - </item> - <item row="0" column="1" rowspan="2"> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="0" rowspan="2"> - <widget class="QWidget" name="widget" native="true"> - <layout class="QGridLayout" name="gridLayout"> - <property name="horizontalSpacing"> - <number>16</number> - </property> - <property name="verticalSpacing"> - <number>0</number> - </property> - <property name="margin"> - <number>0</number> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="serverAddressLabel"> - <property name="text"> - <string>Server</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="proxyServerEdit"> - <property name="placeholderText"> - <string>Name or IP</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Port</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="proxyPortEdit"> - <property name="text"> - <string>8080</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="usernameLabel"> - <property name="text"> - <string>Username</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="usernameEdit"/> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="passwordLabel"> - <property name="text"> - <string>Password</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLineEdit" name="passwordEdit"> - <property name="echoMode"> - <enum>QLineEdit::Password</enum> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="2" column="1"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </widget> - <tabstops> - <tabstop>proxyCheckBox</tabstop> - <tabstop>proxyServerEdit</tabstop> - <tabstop>proxyPortEdit</tabstop> - <tabstop>usernameEdit</tabstop> - <tabstop>passwordEdit</tabstop> - <tabstop>buttonBox</tabstop> - </tabstops> - <resources/> - <connections> - <connection> - <sender>buttonBox</sender> - <signal>accepted()</signal> - <receiver>ProxySettings</receiver> - <slot>accept()</slot> - <hints> - <hint type="sourcelabel"> - <x>318</x> - <y>100</y> - </hint> - <hint type="destinationlabel"> - <x>157</x> - <y>116</y> - </hint> - </hints> - </connection> - <connection> - <sender>buttonBox</sender> - <signal>rejected()</signal> - <receiver>ProxySettings</receiver> - <slot>reject()</slot> - <hints> - <hint type="sourcelabel"> - <x>318</x> - <y>100</y> - </hint> - <hint type="destinationlabel"> - <x>286</x> - <y>116</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/share/qtcreator/qml/qmlobserver/qdeclarativetester.cpp b/share/qtcreator/qml/qmlobserver/qdeclarativetester.cpp deleted file mode 100644 index adcbaf761542b2e4dfe768edf88ace1bc61af8d5..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/qdeclarativetester.cpp +++ /dev/null @@ -1,445 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include <qdeclarativetester.h> -#include <qdeclarativeview.h> -#include <QDeclarativeComponent> -#include <QGraphicsObject> -#include <QApplication> -#include <QDebug> -#include <QFile> -#include <QDir> -#include <QCryptographicHash> - -#ifndef NO_PRIVATE_HEADERS -#include <private/qabstractanimation_p.h> -#include <private/qdeclarativeitem_p.h> -#endif - -QT_BEGIN_NAMESPACE - -extern Q_GUI_EXPORT bool qt_applefontsmoothing_enabled; - -QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions opts, - QDeclarativeView *parent) -: QAbstractAnimation(parent), m_script(script), m_view(parent), filterEvents(true), options(opts), - testscript(0), hasCompleted(false), hasFailed(false) -{ - parent->viewport()->installEventFilter(this); - parent->installEventFilter(this); -#ifndef NO_PRIVATE_HEADERS - QUnifiedTimer::instance()->setConsistentTiming(true); -#endif - - //Font antialiasing makes tests system-specific, so disable it - QFont noAA = QApplication::font(); - noAA.setStyleStrategy(QFont::NoAntialias); - QApplication::setFont(noAA); - - if (options & QDeclarativeViewer::Play) - this->run(); - start(); -} - -QDeclarativeTester::~QDeclarativeTester() -{ - if (!hasFailed && - options & QDeclarativeViewer::Record && - options & QDeclarativeViewer::SaveOnExit) - save(); -} - -int QDeclarativeTester::duration() const -{ - return -1; -} - -void QDeclarativeTester::addMouseEvent(Destination dest, QMouseEvent *me) -{ - MouseEvent e(me); - e.destination = dest; - m_mouseEvents << e; -} - -void QDeclarativeTester::addKeyEvent(Destination dest, QKeyEvent *ke) -{ - KeyEvent e(ke); - e.destination = dest; - m_keyEvents << e; -} - -bool QDeclarativeTester::eventFilter(QObject *o, QEvent *e) -{ - if (!filterEvents) - return false; - - Destination destination; - if (o == m_view) { - destination = View; - } else if (o == m_view->viewport()) { - destination = ViewPort; - } else { - return false; - } - - switch (e->type()) { - case QEvent::KeyPress: - case QEvent::KeyRelease: - addKeyEvent(destination, (QKeyEvent *)e); - return true; - case QEvent::MouseButtonPress: - case QEvent::MouseButtonRelease: - case QEvent::MouseMove: - case QEvent::MouseButtonDblClick: - addMouseEvent(destination, (QMouseEvent *)e); - return true; - default: - break; - } - return false; -} - -void QDeclarativeTester::executefailure() -{ - hasFailed = true; - - if (options & QDeclarativeViewer::ExitOnFailure) - exit(-1); -} - -void QDeclarativeTester::imagefailure() -{ - hasFailed = true; - - if (options & QDeclarativeViewer::ExitOnFailure){ - testSkip(); - exit(hasFailed?-1:0); - } -} - -void QDeclarativeTester::testSkip() -{ - if (options & QDeclarativeViewer::TestSkipProperty){ - QString e = m_view->rootObject()->property("skip").toString(); - if (!e.isEmpty()) { - if(hasFailed){ - qWarning() << "Test failed, but skipping it: " << e; - }else{ - qWarning() << "Test skipped: " << e; - } - hasFailed = 0; - } - } -} - -void QDeclarativeTester::complete() -{ - if ((options & QDeclarativeViewer::TestErrorProperty) && !hasFailed) { - QString e = m_view->rootObject()->property("error").toString(); - if (!e.isEmpty()) { - qWarning() << "Test failed:" << e; - hasFailed = true; - } - } - - - testSkip(); - if (options & QDeclarativeViewer::ExitOnComplete) - QApplication::exit(hasFailed?-1:0); - - if (hasCompleted) - return; - hasCompleted = true; - - if (options & QDeclarativeViewer::Play) - qWarning("Script playback complete"); -} - -void QDeclarativeTester::run() -{ - QDeclarativeComponent c(m_view->engine(), m_script + QLatin1String(".qml")); - - testscript = qobject_cast<QDeclarativeVisualTest *>(c.create()); - if (testscript) testscript->setParent(this); - else { executefailure(); exit(-1); } - testscriptidx = 0; -} - -void QDeclarativeTester::save() -{ - QString filename = m_script + QLatin1String(".qml"); - QFileInfo filenameInfo(filename); - QDir saveDir = filenameInfo.absoluteDir(); - saveDir.mkpath("."); - - QFile file(filename); - file.open(QIODevice::WriteOnly); - QTextStream ts(&file); - - ts << "import Qt.VisualTest 4.7\n\n"; - ts << "VisualTest {\n"; - - int imgCount = 0; - QList<KeyEvent> keyevents = m_savedKeyEvents; - QList<MouseEvent> mouseevents = m_savedMouseEvents; - for (int ii = 0; ii < m_savedFrameEvents.count(); ++ii) { - const FrameEvent &fe = m_savedFrameEvents.at(ii); - ts << " Frame {\n"; - ts << " msec: " << fe.msec << "\n"; - if (!fe.hash.isEmpty()) { - ts << " hash: \"" << fe.hash.toHex() << "\"\n"; - } else if (!fe.image.isNull()) { - QString filename = filenameInfo.baseName() + QLatin1Char('.') - + QString::number(imgCount) + ".png"; - fe.image.save(m_script + QLatin1Char('.') + QString::number(imgCount) + ".png"); - imgCount++; - ts << " image: \"" << filename << "\"\n"; - } - ts << " }\n"; - - while (!mouseevents.isEmpty() && - mouseevents.first().msec == fe.msec) { - MouseEvent me = mouseevents.takeFirst(); - - ts << " Mouse {\n"; - ts << " type: " << me.type << "\n"; - ts << " button: " << me.button << "\n"; - ts << " buttons: " << me.buttons << "\n"; - ts << " x: " << me.pos.x() << "; y: " << me.pos.y() << "\n"; - ts << " modifiers: " << me.modifiers << "\n"; - if (me.destination == ViewPort) - ts << " sendToViewport: true\n"; - ts << " }\n"; - } - - while (!keyevents.isEmpty() && - keyevents.first().msec == fe.msec) { - KeyEvent ke = keyevents.takeFirst(); - - ts << " Key {\n"; - ts << " type: " << ke.type << "\n"; - ts << " key: " << ke.key << "\n"; - ts << " modifiers: " << ke.modifiers << "\n"; - ts << " text: \"" << ke.text.toUtf8().toHex() << "\"\n"; - ts << " autorep: " << (ke.autorep?"true":"false") << "\n"; - ts << " count: " << ke.count << "\n"; - if (ke.destination == ViewPort) - ts << " sendToViewport: true\n"; - ts << " }\n"; - } - } - - ts << "}\n"; - file.close(); -} - -void QDeclarativeTester::updateCurrentTime(int msec) -{ -#ifndef NO_PRIVATE_HEADERS - QDeclarativeItemPrivate::setConsistentTime(msec); -#endif - if (!testscript && msec > 16 && options & QDeclarativeViewer::Snapshot) - return; - - QImage img(m_view->width(), m_view->height(), QImage::Format_RGB32); - - if (options & QDeclarativeViewer::TestImages) { - img.fill(qRgb(255,255,255)); - -#ifdef Q_OS_MAC - bool oldSmooth = qt_applefontsmoothing_enabled; - qt_applefontsmoothing_enabled = false; -#endif - QPainter p(&img); -#ifdef Q_OS_MAC - qt_applefontsmoothing_enabled = oldSmooth; -#endif - - m_view->render(&p); - } - - bool snapshot = msec == 16 && (options & QDeclarativeViewer::Snapshot - || (testscript && testscript->count() == 2)); - - FrameEvent fe; - fe.msec = msec; - if (msec == 0 || !(options & QDeclarativeViewer::TestImages)) { - // Skip first frame, skip if not doing images - } else if (0 == ((m_savedFrameEvents.count()-1) % 60) || snapshot) { - fe.image = img; - } else { - QCryptographicHash hash(QCryptographicHash::Md5); - hash.addData((const char *)img.bits(), img.bytesPerLine() * img.height()); - fe.hash = hash.result(); - } - m_savedFrameEvents.append(fe); - - // Deliver mouse events - filterEvents = false; - - if (!testscript) { - for (int ii = 0; ii < m_mouseEvents.count(); ++ii) { - MouseEvent &me = m_mouseEvents[ii]; - me.msec = msec; - QMouseEvent event(me.type, me.pos, me.button, me.buttons, me.modifiers); - - if (me.destination == View) { - QCoreApplication::sendEvent(m_view, &event); - } else { - QCoreApplication::sendEvent(m_view->viewport(), &event); - } - } - - for (int ii = 0; ii < m_keyEvents.count(); ++ii) { - KeyEvent &ke = m_keyEvents[ii]; - ke.msec = msec; - QKeyEvent event(ke.type, ke.key, ke.modifiers, ke.text, ke.autorep, ke.count); - - if (ke.destination == View) { - QCoreApplication::sendEvent(m_view, &event); - } else { - QCoreApplication::sendEvent(m_view->viewport(), &event); - } - } - m_savedMouseEvents.append(m_mouseEvents); - m_savedKeyEvents.append(m_keyEvents); - } - - m_mouseEvents.clear(); - m_keyEvents.clear(); - - // Advance test script - while (testscript && testscript->count() > testscriptidx) { - - QObject *event = testscript->event(testscriptidx); - - if (QDeclarativeVisualTestFrame *frame = qobject_cast<QDeclarativeVisualTestFrame *>(event)) { - if (frame->msec() < msec) { - if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) { - qWarning() << "QDeclarativeTester(" << m_script << "): Extra frame. Seen:" - << msec << "Expected:" << frame->msec(); - imagefailure(); - } - } else if (frame->msec() == msec) { - if (!frame->hash().isEmpty() && frame->hash().toUtf8() != fe.hash.toHex()) { - if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) { - qWarning() << "QDeclarativeTester(" << m_script << "): Mismatched frame hash at" << msec - << ". Seen:" << fe.hash.toHex() - << "Expected:" << frame->hash().toUtf8(); - imagefailure(); - } - } - } else if (frame->msec() > msec) { - break; - } - - if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record) && !frame->image().isEmpty()) { - QImage goodImage(frame->image().toLocalFile()); - if (frame->msec() == 16 && goodImage.size() != img.size()){ - //Also an image mismatch, but this warning is more informative. Only checked at start though. - qWarning() << "QDeclarativeTester(" << m_script << "): Size mismatch. This test must be run at " << goodImage.size(); - imagefailure(); - } - if (goodImage != img) { - QString reject(frame->image().toLocalFile() + ".reject.png"); - qWarning() << "QDeclarativeTester(" << m_script << "): Image mismatch. Reject saved to:" - << reject; - img.save(reject); - bool doDiff = (goodImage.size() == img.size()); - if (doDiff) { - QImage diffimg(m_view->width(), m_view->height(), QImage::Format_RGB32); - diffimg.fill(qRgb(255,255,255)); - QPainter p(&diffimg); - int diffCount = 0; - for (int x = 0; x < img.width(); ++x) { - for (int y = 0; y < img.height(); ++y) { - if (goodImage.pixel(x,y) != img.pixel(x,y)) { - ++diffCount; - p.drawPoint(x,y); - } - } - } - QString diff(frame->image().toLocalFile() + ".diff.png"); - diffimg.save(diff); - qWarning().nospace() << " Diff (" << diffCount << " pixels differed) saved to: " << diff; - } - imagefailure(); - } - } - } else if (QDeclarativeVisualTestMouse *mouse = qobject_cast<QDeclarativeVisualTestMouse *>(event)) { - QPoint pos(mouse->x(), mouse->y()); - QPoint globalPos = m_view->mapToGlobal(QPoint(0, 0)) + pos; - QMouseEvent event((QEvent::Type)mouse->type(), pos, globalPos, (Qt::MouseButton)mouse->button(), (Qt::MouseButtons)mouse->buttons(), (Qt::KeyboardModifiers)mouse->modifiers()); - - MouseEvent me(&event); - me.msec = msec; - if (!mouse->sendToViewport()) { - QCoreApplication::sendEvent(m_view, &event); - me.destination = View; - } else { - QCoreApplication::sendEvent(m_view->viewport(), &event); - me.destination = ViewPort; - } - m_savedMouseEvents.append(me); - } else if (QDeclarativeVisualTestKey *key = qobject_cast<QDeclarativeVisualTestKey *>(event)) { - - QKeyEvent event((QEvent::Type)key->type(), key->key(), (Qt::KeyboardModifiers)key->modifiers(), QString::fromUtf8(QByteArray::fromHex(key->text().toUtf8())), key->autorep(), key->count()); - - KeyEvent ke(&event); - ke.msec = msec; - if (!key->sendToViewport()) { - QCoreApplication::sendEvent(m_view, &event); - ke.destination = View; - } else { - QCoreApplication::sendEvent(m_view->viewport(), &event); - ke.destination = ViewPort; - } - m_savedKeyEvents.append(ke); - } - testscriptidx++; - } - - filterEvents = true; - - if (testscript && testscript->count() <= testscriptidx) { - //if (msec == 16) //for a snapshot, leave it up long enough to see - // (void)::sleep(1); - complete(); - } -} - -void QDeclarativeTester::registerTypes() -{ - qmlRegisterType<QDeclarativeVisualTest>("Qt.VisualTest", 4,7, "VisualTest"); - qmlRegisterType<QDeclarativeVisualTestFrame>("Qt.VisualTest", 4,7, "Frame"); - qmlRegisterType<QDeclarativeVisualTestMouse>("Qt.VisualTest", 4,7, "Mouse"); - qmlRegisterType<QDeclarativeVisualTestKey>("Qt.VisualTest", 4,7, "Key"); -} - -QT_END_NAMESPACE diff --git a/share/qtcreator/qml/qmlobserver/qdeclarativetester.h b/share/qtcreator/qml/qmlobserver/qdeclarativetester.h deleted file mode 100644 index d370a10209000c41c6a614a1d6b5831ddc4141c4..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/qdeclarativetester.h +++ /dev/null @@ -1,280 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QDECLARATIVETESTER_H -#define QDECLARATIVETESTER_H - -#include <qmlruntime.h> - -#include <qdeclarativelist.h> -#include <qdeclarative.h> - -#include <QMouseEvent> -#include <QKeyEvent> -#include <QImage> -#include <QUrl> -#include <QEvent> -#include <QAbstractAnimation> - -QT_BEGIN_NAMESPACE - -class QDeclarativeVisualTest : public QObject -{ - Q_OBJECT - Q_PROPERTY(QDeclarativeListProperty<QObject> events READ events CONSTANT) - Q_CLASSINFO("DefaultProperty", "events") -public: - QDeclarativeVisualTest() {} - - QDeclarativeListProperty<QObject> events() { return QDeclarativeListProperty<QObject>(this, m_events); } - - int count() const { return m_events.count(); } - QObject *event(int idx) { return m_events.at(idx); } - -private: - QList<QObject *> m_events; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeVisualTest) - -QT_BEGIN_NAMESPACE - -class QDeclarativeVisualTestFrame : public QObject -{ - Q_OBJECT - Q_PROPERTY(int msec READ msec WRITE setMsec) - Q_PROPERTY(QString hash READ hash WRITE setHash) - Q_PROPERTY(QUrl image READ image WRITE setImage) -public: - QDeclarativeVisualTestFrame() : m_msec(-1) {} - - int msec() const { return m_msec; } - void setMsec(int m) { m_msec = m; } - - QString hash() const { return m_hash; } - void setHash(const QString &hash) { m_hash = hash; } - - QUrl image() const { return m_image; } - void setImage(const QUrl &image) { m_image = image; } - -private: - int m_msec; - QString m_hash; - QUrl m_image; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeVisualTestFrame) - -QT_BEGIN_NAMESPACE - -class QDeclarativeVisualTestMouse : public QObject -{ - Q_OBJECT - Q_PROPERTY(int type READ type WRITE setType) - Q_PROPERTY(int button READ button WRITE setButton) - Q_PROPERTY(int buttons READ buttons WRITE setButtons) - Q_PROPERTY(int x READ x WRITE setX) - Q_PROPERTY(int y READ y WRITE setY) - Q_PROPERTY(int modifiers READ modifiers WRITE setModifiers) - Q_PROPERTY(bool sendToViewport READ sendToViewport WRITE setSendToViewport) -public: - QDeclarativeVisualTestMouse() : m_type(0), m_button(0), m_buttons(0), m_x(0), m_y(0), m_modifiers(0), m_viewport(false) {} - - int type() const { return m_type; } - void setType(int t) { m_type = t; } - - int button() const { return m_button; } - void setButton(int b) { m_button = b; } - - int buttons() const { return m_buttons; } - void setButtons(int b) { m_buttons = b; } - - int x() const { return m_x; } - void setX(int x) { m_x = x; } - - int y() const { return m_y; } - void setY(int y) { m_y = y; } - - int modifiers() const { return m_modifiers; } - void setModifiers(int modifiers) { m_modifiers = modifiers; } - - bool sendToViewport() const { return m_viewport; } - void setSendToViewport(bool v) { m_viewport = v; } -private: - int m_type; - int m_button; - int m_buttons; - int m_x; - int m_y; - int m_modifiers; - bool m_viewport; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeVisualTestMouse) - -QT_BEGIN_NAMESPACE - -class QDeclarativeVisualTestKey : public QObject -{ - Q_OBJECT - Q_PROPERTY(int type READ type WRITE setType) - Q_PROPERTY(int key READ key WRITE setKey) - Q_PROPERTY(int modifiers READ modifiers WRITE setModifiers) - Q_PROPERTY(QString text READ text WRITE setText) - Q_PROPERTY(bool autorep READ autorep WRITE setAutorep) - Q_PROPERTY(int count READ count WRITE setCount) - Q_PROPERTY(bool sendToViewport READ sendToViewport WRITE setSendToViewport) -public: - QDeclarativeVisualTestKey() : m_type(0), m_key(0), m_modifiers(0), m_autorep(false), m_count(0), m_viewport(false) {} - - int type() const { return m_type; } - void setType(int t) { m_type = t; } - - int key() const { return m_key; } - void setKey(int k) { m_key = k; } - - int modifiers() const { return m_modifiers; } - void setModifiers(int m) { m_modifiers = m; } - - QString text() const { return m_text; } - void setText(const QString &t) { m_text = t; } - - bool autorep() const { return m_autorep; } - void setAutorep(bool a) { m_autorep = a; } - - int count() const { return m_count; } - void setCount(int c) { m_count = c; } - - bool sendToViewport() const { return m_viewport; } - void setSendToViewport(bool v) { m_viewport = v; } -private: - int m_type; - int m_key; - int m_modifiers; - QString m_text; - bool m_autorep; - int m_count; - bool m_viewport; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeVisualTestKey) - -QT_BEGIN_NAMESPACE - -class QDeclarativeTester : public QAbstractAnimation -{ -public: - QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions options, QDeclarativeView *parent); - ~QDeclarativeTester(); - - static void registerTypes(); - - virtual int duration() const; - - void run(); - void save(); - - void executefailure(); -protected: - virtual void updateCurrentTime(int msecs); - virtual bool eventFilter(QObject *, QEvent *); - -private: - QString m_script; - - void imagefailure(); - void complete(); - void testSkip(); - - enum Destination { View, ViewPort }; - void addKeyEvent(Destination, QKeyEvent *); - void addMouseEvent(Destination, QMouseEvent *); - QDeclarativeView *m_view; - - struct MouseEvent { - MouseEvent(QMouseEvent *e) - : type(e->type()), button(e->button()), buttons(e->buttons()), - pos(e->pos()), modifiers(e->modifiers()), destination(View) {} - - QEvent::Type type; - Qt::MouseButton button; - Qt::MouseButtons buttons; - QPoint pos; - Qt::KeyboardModifiers modifiers; - Destination destination; - - int msec; - }; - struct KeyEvent { - KeyEvent(QKeyEvent *e) - : type(e->type()), key(e->key()), modifiers(e->modifiers()), text(e->text()), - autorep(e->isAutoRepeat()), count(e->count()), destination(View) {} - QEvent::Type type; - int key; - Qt::KeyboardModifiers modifiers; - QString text; - bool autorep; - ushort count; - Destination destination; - - int msec; - }; - struct FrameEvent { - QImage image; - QByteArray hash; - int msec; - }; - QList<MouseEvent> m_mouseEvents; - QList<KeyEvent> m_keyEvents; - - QList<MouseEvent> m_savedMouseEvents; - QList<KeyEvent> m_savedKeyEvents; - QList<FrameEvent> m_savedFrameEvents; - bool filterEvents; - - QDeclarativeViewer::ScriptOptions options; - int testscriptidx; - QDeclarativeVisualTest *testscript; - - bool hasCompleted; - bool hasFailed; -}; - - -QT_END_NAMESPACE - -#endif // QDECLARATIVETESTER_H diff --git a/share/qtcreator/qml/qmlobserver/qml.icns b/share/qtcreator/qml/qmlobserver/qml.icns deleted file mode 100644 index c76051626a1cc12076136ba4dd816f5e82c563cf..0000000000000000000000000000000000000000 Binary files a/share/qtcreator/qml/qmlobserver/qml.icns and /dev/null differ diff --git a/share/qtcreator/qml/qmlobserver/qml.pri b/share/qtcreator/qml/qmlobserver/qml.pri deleted file mode 100644 index 827a273249fe0f7869245c94c326b74c0b1a9d8d..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/qml.pri +++ /dev/null @@ -1,37 +0,0 @@ -QT += declarative script network sql -contains(QT_CONFIG, opengl) { - QT += opengl - DEFINES += GL_SUPPORTED -} - -INCLUDEPATH += $$PWD - -HEADERS += $$PWD/qmlruntime.h \ - $$PWD/proxysettings.h \ - $$PWD/qdeclarativetester.h \ - $$PWD/deviceorientation.h \ - $$PWD/loggerwidget.h -SOURCES += $$PWD/qmlruntime.cpp \ - $$PWD/proxysettings.cpp \ - $$PWD/qdeclarativetester.cpp \ - $$PWD/loggerwidget.cpp - -RESOURCES = $$PWD/browser/browser.qrc \ - $$PWD/startup/startup.qrc - -maemo5 { - QT += dbus - HEADERS += $$PWD/texteditautoresizer_maemo5.h - SOURCES += $$PWD/deviceorientation_maemo5.cpp - FORMS = $$PWD/recopts_maemo5.ui \ - $$PWD/proxysettings_maemo5.ui -} else:linux-g++-maemo { - QT += dbus - SOURCES += $$PWD/deviceorientation_harmattan.cpp - FORMS = $$PWD/recopts.ui \ - $$PWD/proxysettings.ui -} else { - SOURCES += $$PWD/deviceorientation.cpp - FORMS = $$PWD/recopts.ui \ - $$PWD/proxysettings.ui -} diff --git a/share/qtcreator/qml/qmlobserver/qmlobserver.pro b/share/qtcreator/qml/qmlobserver/qmlobserver.pro deleted file mode 100644 index 503a375dc5d313cd4bc5067df519e021465bfd57..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/qmlobserver.pro +++ /dev/null @@ -1,73 +0,0 @@ -TEMPLATE = app - -CONFIG += qt uic - -include(qml.pri) - -SOURCES += main.cpp - -exists($$PWD/../qmljsdebugger/qmljsdebugger-src.pri) { - # directly compile in debugger files - include($$PWD/../qmljsdebugger/qmljsdebugger-src.pri) -} else { - # INCLUDEPATH and library path has to be extended by qmake call - DEBUGLIB=QmlJSDebugger - CONFIG(debug, debug|release) { - windows:DEBUGLIB = QmlJSDebuggerd - } - LIBS+=-l$$DEBUGLIB -} - -#INCLUDEPATH += ../../include/QtDeclarative -#INCLUDEPATH += ../../src/declarative/util -#INCLUDEPATH += ../../src/declarative/graphicsitems - -!exists($$[QT_INSTALL_HEADERS]/QtCore/private/qabstractanimation_p.h) { - DEFINES += NO_PRIVATE_HEADERS -} - -target.path = $$[QT_INSTALL_BINS] -INSTALLS += target - -wince* { - QT += xml - - contains(QT_CONFIG, scripttools) { - QT += scripttools - } - contains(QT_CONFIG, phonon) { - QT += phonon - } - contains(QT_CONFIG, xmlpatterns) { - QT += xmlpatterns - } - contains(QT_CONFIG, webkit) { - QT += webkit - } -} -maemo5 { - QT += maemo5 -} -symbian { - TARGET.UID3 = 0x20021317 - include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - TARGET.EPOCHEAPSIZE = 0x20000 0x4000000 - TARGET.CAPABILITY = NetworkServices ReadUserData - !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { - LIBS += -lsensrvclient -lsensrvutil - } - contains(QT_CONFIG, s60): { - LIBS += -lavkon -lcone - } -} - -# generation of Info.plist from Info.plist.in is handled by static.pro -# compiling this project directly from the Qt Creator source tree does not work -OTHER_FILES+=Info.plist -mac { - QMAKE_INFO_PLIST=Info.plist - TARGET=QMLObserver - ICON=qml.icns -} else { - TARGET=qmlobserver -} diff --git a/share/qtcreator/qml/qmlobserver/qmlruntime.cpp b/share/qtcreator/qml/qmlobserver/qmlruntime.cpp deleted file mode 100644 index 39c39046b6d3b66af51548b9e286c9abaffa45c5..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/qmlruntime.cpp +++ /dev/null @@ -1,1633 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include <qdeclarativeview.h> - -#ifdef hz -#undef hz -#endif -#ifdef Q_WS_MAEMO_5 -# include <QMaemo5ValueButton> -# include <QMaemo5ListPickSelector> -# include <QWidgetAction> -# include <QStringListModel> -# include "ui_recopts_maemo5.h" -#else -# include "ui_recopts.h" -#endif - -#include "qmlruntime.h" -#include <qdeclarativecontext.h> -#include <qdeclarativeengine.h> -#include <qdeclarativenetworkaccessmanagerfactory.h> -#include "qdeclarative.h" -#include <QAbstractAnimation> -#ifndef NO_PRIVATE_HEADERS -#include <private/qabstractanimation_p.h> -#endif - -#include <qdeclarativeviewinspector.h> -#include <qdeclarativeinspectorservice.h> - -#include <QNetworkReply> -#include <QNetworkCookieJar> -#include <QNetworkDiskCache> -#include <QNetworkAccessManager> -#include <QNetworkProxyFactory> - -#include <QDeclarativeComponent> - -#include <QWidget> -#include <QApplication> -#include <QTextBrowser> -#include <QVBoxLayout> -#include <QProgressDialog> -#include <QMenuBar> -#include <QMenu> -#include <QAction> -#include <QFileDialog> -#include <QInputDialog> -#include <QGraphicsObject> -#include <QKeyEvent> - -#include <QSignalMapper> -#include <QSettings> -#include <QXmlStreamReader> -#include <QBuffer> -#include <QTranslator> -#include <QDir> -#include <QFile> -#include <QFileInfo> -#include <QProcess> -#include <QTimer> -#include <QMutex> -#include <QMutexLocker> - -#include "proxysettings.h" -#include "deviceorientation.h" - -#ifdef GL_SUPPORTED -#include <QGLWidget> -#endif - -#if defined(Q_WS_S60) -#include <aknappui.h> // For locking app orientation -#endif - -#include <qdeclarativetester.h> - -#include "jsdebuggeragent.h" - -QT_BEGIN_NAMESPACE - -class DragAndDropView : public QDeclarativeView -{ - Q_OBJECT -public: - DragAndDropView(QDeclarativeViewer *parent = 0) - : QDeclarativeView(parent) - { - setAcceptDrops(true); - } - - void dragEnterEvent(QDragEnterEvent *event) - { - const QMimeData *mimeData = event->mimeData(); - if (mimeData->hasUrls()) - event->acceptProposedAction(); - } - - void dragMoveEvent(QDragMoveEvent *event) - { - event->acceptProposedAction(); - } - - void dragLeaveEvent(QDragLeaveEvent *event) - { - event->accept(); - } - - void dropEvent(QDropEvent *event) - { - const QMimeData *mimeData = event->mimeData(); - if (!mimeData->hasUrls()) - return; - const QList<QUrl> urlList = mimeData->urls(); - foreach (const QUrl &url, urlList) { - if (url.scheme() == QLatin1String("file")) { - static_cast<QDeclarativeViewer *>(parent())->open(url.toLocalFile()); - event->accept(); - return; - } - } - } -}; - -class Runtime : public QObject -{ - Q_OBJECT - - Q_PROPERTY(bool isActiveWindow READ isActiveWindow NOTIFY isActiveWindowChanged) - Q_PROPERTY(DeviceOrientation::Orientation orientation READ orientation NOTIFY orientationChanged) - -public: - static Runtime* instance() - { - static Runtime *instance = 0; - if (!instance) - instance = new Runtime; - return instance; - } - - bool isActiveWindow() const { return activeWindow; } - void setActiveWindow(bool active) - { - if (active == activeWindow) - return; - activeWindow = active; - emit isActiveWindowChanged(); - } - - DeviceOrientation::Orientation orientation() const { return DeviceOrientation::instance()->orientation(); } - -Q_SIGNALS: - void isActiveWindowChanged(); - void orientationChanged(); - -private: - Runtime(QObject *parent=0) : QObject(parent), activeWindow(false) - { - connect(DeviceOrientation::instance(), SIGNAL(orientationChanged()), - this, SIGNAL(orientationChanged())); - } - - bool activeWindow; -}; - - - -#if defined(Q_WS_MAEMO_5) - -class Maemo5PickerAction : public QWidgetAction { - Q_OBJECT -public: - Maemo5PickerAction(const QString &text, QActionGroup *actions, QObject *parent) - : QWidgetAction(parent), m_text(text), m_actions(actions) - { } - - QWidget *createWidget(QWidget *parent) - { - QMaemo5ValueButton *button = new QMaemo5ValueButton(m_text, parent); - button->setValueLayout(QMaemo5ValueButton::ValueUnderTextCentered); - QMaemo5ListPickSelector *pick = new QMaemo5ListPickSelector(button); - button->setPickSelector(pick); - if (m_actions) { - QStringList sl; - int curIdx = -1, idx = 0; - foreach (QAction *a, m_actions->actions()) { - sl << a->text(); - if (a->isChecked()) - curIdx = idx; - idx++; - } - pick->setModel(new QStringListModel(sl)); - pick->setCurrentIndex(curIdx); - } else { - button->setEnabled(false); - } - connect(pick, SIGNAL(selected(QString)), this, SLOT(emitTriggered())); - return button; - } - -private slots: - void emitTriggered() - { - QMaemo5ListPickSelector *pick = qobject_cast<QMaemo5ListPickSelector *>(sender()); - if (!pick) - return; - int idx = pick->currentIndex(); - - if (m_actions && idx >= 0 && idx < m_actions->actions().count()) - m_actions->actions().at(idx)->trigger(); - } - -private: - QString m_text; - QPointer<QActionGroup> m_actions; -}; - -#endif // Q_WS_MAEMO_5 - -static struct { const char *name, *args; } ffmpegprofiles[] = { - {"Maximum Quality", "-sameq"}, - {"High Quality", "-qmax 2"}, - {"Medium Quality", "-qmax 6"}, - {"Low Quality", "-qmax 16"}, - {"Custom ffmpeg arguments", ""}, - {0,0} -}; - -class RecordingDialog : public QDialog, public Ui::RecordingOptions { - Q_OBJECT - -public: - RecordingDialog(QWidget *parent) : QDialog(parent) - { - setupUi(this); -#ifndef Q_WS_MAEMO_5 - hz->setValidator(new QDoubleValidator(hz)); -#endif - for (int i=0; ffmpegprofiles[i].name; ++i) { - profile->addItem(ffmpegprofiles[i].name); - } - } - - void setArguments(QString a) - { - int i; - for (i=0; ffmpegprofiles[i].args[0]; ++i) { - if (ffmpegprofiles[i].args == a) { - profile->setCurrentIndex(i); - args->setText(QLatin1String(ffmpegprofiles[i].args)); - return; - } - } - customargs = a; - args->setText(a); - profile->setCurrentIndex(i); - } - - QString arguments() const - { - int i = profile->currentIndex(); - return ffmpegprofiles[i].args[0] ? QLatin1String(ffmpegprofiles[i].args) : customargs; - } - - void setOriginalSize(const QSize &s) - { - QString str = tr("Original (%1x%2)").arg(s.width()).arg(s.height()); - -#ifdef Q_WS_MAEMO_5 - sizeCombo->setItemText(0, str); -#else - sizeOriginal->setText(str); - if (sizeWidth->value()<=1) { - sizeWidth->setValue(s.width()); - sizeHeight->setValue(s.height()); - } -#endif - } - - void showffmpegOptions(bool b) - { -#ifdef Q_WS_MAEMO_5 - profileLabel->setVisible(b); - profile->setVisible(b); - ffmpegHelp->setVisible(b); - args->setVisible(b); -#else - ffmpegOptions->setVisible(b); -#endif - } - - void showRateOptions(bool b) - { -#ifdef Q_WS_MAEMO_5 - rateLabel->setVisible(b); - rateCombo->setVisible(b); -#else - rateOptions->setVisible(b); -#endif - } - - void setVideoRate(int rate) - { -#ifdef Q_WS_MAEMO_5 - int idx; - if (rate >= 60) - idx = 0; - else if (rate >= 50) - idx = 2; - else if (rate >= 25) - idx = 3; - else if (rate >= 24) - idx = 4; - else if (rate >= 20) - idx = 5; - else if (rate >= 15) - idx = 6; - else - idx = 7; - rateCombo->setCurrentIndex(idx); -#else - if (rate == 24) - hz24->setChecked(true); - else if (rate == 25) - hz25->setChecked(true); - else if (rate == 50) - hz50->setChecked(true); - else if (rate == 60) - hz60->setChecked(true); - else { - hzCustom->setChecked(true); - hz->setText(QString::number(rate)); - } -#endif - } - - int videoRate() const - { -#ifdef Q_WS_MAEMO_5 - switch (rateCombo->currentIndex()) { - case 0: return 60; - case 1: return 50; - case 2: return 25; - case 3: return 24; - case 4: return 20; - case 5: return 15; - case 7: return 10; - default: return 60; - } -#else - if (hz24->isChecked()) - return 24; - else if (hz25->isChecked()) - return 25; - else if (hz50->isChecked()) - return 50; - else if (hz60->isChecked()) - return 60; - else { - return hz->text().toInt(); - } -#endif - } - - QSize videoSize() const - { -#ifdef Q_WS_MAEMO_5 - switch (sizeCombo->currentIndex()) { - case 0: return QSize(); - case 1: return QSize(640,480); - case 2: return QSize(320,240); - case 3: return QSize(1280,720); - default: return QSize(); - } -#else - if (sizeOriginal->isChecked()) - return QSize(); - else if (size720p->isChecked()) - return QSize(1280,720); - else if (sizeVGA->isChecked()) - return QSize(640,480); - else if (sizeQVGA->isChecked()) - return QSize(320,240); - else - return QSize(sizeWidth->value(), sizeHeight->value()); -#endif - } - - - -private slots: - void pickProfile(int i) - { - if (ffmpegprofiles[i].args[0]) { - args->setText(QLatin1String(ffmpegprofiles[i].args)); - } else { - args->setText(customargs); - } - } - - void storeCustomArgs(QString s) - { - setArguments(s); - } - -private: - QString customargs; -}; - -class PersistentCookieJar : public QNetworkCookieJar { -public: - PersistentCookieJar(QObject *parent) : QNetworkCookieJar(parent) { load(); } - ~PersistentCookieJar() { save(); } - - virtual QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const - { - QMutexLocker lock(&mutex); - return QNetworkCookieJar::cookiesForUrl(url); - } - - virtual bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url) - { - QMutexLocker lock(&mutex); - return QNetworkCookieJar::setCookiesFromUrl(cookieList, url); - } - -private: - void save() - { - QMutexLocker lock(&mutex); - QList<QNetworkCookie> list = allCookies(); - QByteArray data; - foreach (const QNetworkCookie &cookie, list) { - if (!cookie.isSessionCookie()) { - data.append(cookie.toRawForm()); - data.append('\n'); - } - } - QSettings settings; - settings.setValue("Cookies",data); - } - - void load() - { - QMutexLocker lock(&mutex); - QSettings settings; - QByteArray data = settings.value("Cookies").toByteArray(); - setAllCookies(QNetworkCookie::parseCookies(data)); - } - - mutable QMutex mutex; -}; - -class SystemProxyFactory : public QNetworkProxyFactory -{ -public: - SystemProxyFactory() : proxyDirty(true), httpProxyInUse(false) { - } - - virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query) - { - if (proxyDirty) - setupProxy(); - QString protocolTag = query.protocolTag(); - if (httpProxyInUse && (protocolTag == "http" || protocolTag == "https")) { - QList<QNetworkProxy> ret; - ret << httpProxy; - return ret; - } -#ifdef Q_OS_WIN - // systemProxyForQuery can take insanely long on Windows (QTBUG-10106) - return QNetworkProxyFactory::proxyForQuery(query); -#else - return QNetworkProxyFactory::systemProxyForQuery(query); -#endif - } - - void setupProxy() { - // Don't bother locking because we know that the proxy only - // changes in response to the settings dialog and that - // the view will be reloaded. - proxyDirty = false; - httpProxyInUse = ProxySettings::httpProxyInUse(); - if (httpProxyInUse) - httpProxy = ProxySettings::httpProxy(); - } - - void proxyChanged() { - proxyDirty = true; - } - -private: - volatile bool proxyDirty; - bool httpProxyInUse; - QNetworkProxy httpProxy; -}; - -class NetworkAccessManagerFactory : public QObject, public QDeclarativeNetworkAccessManagerFactory -{ - Q_OBJECT -public: - NetworkAccessManagerFactory() : cacheSize(0) {} - ~NetworkAccessManagerFactory() {} - - QNetworkAccessManager *create(QObject *parent); - - void setCacheSize(int size) { - if (size != cacheSize) { - cacheSize = size; - } - } - - void proxyChanged() { - foreach (QNetworkAccessManager *nam, namList) { - static_cast<SystemProxyFactory*>(nam->proxyFactory())->proxyChanged(); - } - } - - static PersistentCookieJar *cookieJar; - -private slots: - void managerDestroyed(QObject *obj) { - namList.removeOne(static_cast<QNetworkAccessManager*>(obj)); - } - -private: - QMutex mutex; - int cacheSize; - QList<QNetworkAccessManager*> namList; -}; - -PersistentCookieJar *NetworkAccessManagerFactory::cookieJar = 0; - -static void cleanup_cookieJar() -{ - delete NetworkAccessManagerFactory::cookieJar; - NetworkAccessManagerFactory::cookieJar = 0; -} - -QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) -{ - QMutexLocker lock(&mutex); - QNetworkAccessManager *manager = new QNetworkAccessManager(parent); - if (!cookieJar) { - qAddPostRoutine(cleanup_cookieJar); - cookieJar = new PersistentCookieJar(0); - } - manager->setCookieJar(cookieJar); - cookieJar->setParent(0); - manager->setProxyFactory(new SystemProxyFactory); - if (cacheSize > 0) { - QNetworkDiskCache *cache = new QNetworkDiskCache; - cache->setCacheDirectory(QDir::tempPath()+QLatin1String("/qml-viewer-network-cache")); - cache->setMaximumCacheSize(cacheSize); - manager->setCache(cache); - } else { - manager->setCache(0); - } - connect(manager, SIGNAL(destroyed(QObject*)), this, SLOT(managerDestroyed(QObject*))); - namList.append(manager); - qDebug() << "created new network access manager for" << parent; - return manager; -} - -QString QDeclarativeViewer::getVideoFileName() -{ - QString title = convertAvailable || ffmpegAvailable ? tr("Save Video File") : tr("Save PNG Frames"); - QStringList types; - if (ffmpegAvailable) types += tr("Common Video files")+QLatin1String(" (*.avi *.mpeg *.mov)"); - if (convertAvailable) types += tr("GIF Animation")+QLatin1String(" (*.gif)"); - types += tr("Individual PNG frames")+QLatin1String(" (*.png)"); - if (ffmpegAvailable) types += tr("All ffmpeg formats (*.*)"); - return QFileDialog::getSaveFileName(this, title, "", types.join(";; ")); -} - -QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) - : QMainWindow(parent, flags) - , loggerWindow(new LoggerWidget(this)) - , frame_stream(0) - , rotateAction(0) - , orientation(0) - , showWarningsWindow(0) - , designModeBehaviorAction(0) - , m_scriptOptions(0) - , tester(0) - , useQmlFileBrowser(true) - , translator(0) -{ - QDeclarativeViewer::registerTypes(); - setWindowTitle(tr("Qt QML Viewer")); -#ifdef Q_WS_MAEMO_5 - setAttribute(Qt::WA_Maemo5StackedWindow); -// setPalette(QApplication::palette("QLabel")); -#endif - - devicemode = false; - canvas = 0; - record_autotime = 0; - record_rate = 50; - record_args += QLatin1String("-sameq"); - - recdlg = new RecordingDialog(this); - connect(recdlg->pickfile, SIGNAL(clicked()), this, SLOT(pickRecordingFile())); - senseFfmpeg(); - senseImageMagick(); - if (!ffmpegAvailable) - recdlg->showffmpegOptions(false); - if (!ffmpegAvailable && !convertAvailable) - recdlg->showRateOptions(false); - QString warn; - if (!ffmpegAvailable) { - if (!convertAvailable) - warn = tr("ffmpeg and ImageMagick not available - no video output"); - else - warn = tr("ffmpeg not available - GIF and PNG outputs only"); - recdlg->warning->setText(warn); - } else { - recdlg->warning->hide(); - } - - canvas = new DragAndDropView(this); - inspector = new QmlJSDebugger::QDeclarativeViewInspector(canvas, this); - new QmlJSDebugger::JSDebuggerAgent(canvas->engine()); - - canvas->setAttribute(Qt::WA_OpaquePaintEvent); - canvas->setAttribute(Qt::WA_NoSystemBackground); - - canvas->setFocus(); - - QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize))); - QObject::connect(canvas, SIGNAL(statusChanged(QDeclarativeView::Status)), this, SLOT(statusChanged())); - QObject::connect(canvas->engine(), SIGNAL(quit()), this, SLOT(close())); - - QObject::connect(warningsWidget(), SIGNAL(opened()), this, SLOT(warningsWidgetOpened())); - QObject::connect(warningsWidget(), SIGNAL(closed()), this, SLOT(warningsWidgetClosed())); - - if (!(flags & Qt::FramelessWindowHint)) { - createMenu(); - changeOrientation(orientation->actions().value(0)); - } else { - setMenuBar(0); - } - - setCentralWidget(canvas); - - namFactory = new NetworkAccessManagerFactory; - canvas->engine()->setNetworkAccessManagerFactory(namFactory); - - connect(&autoStartTimer, SIGNAL(timeout()), this, SLOT(autoStartRecording())); - connect(&autoStopTimer, SIGNAL(timeout()), this, SLOT(autoStopRecording())); - connect(&recordTimer, SIGNAL(timeout()), this, SLOT(recordFrame())); - connect(DeviceOrientation::instance(), SIGNAL(orientationChanged()), - this, SLOT(orientationChanged()), Qt::QueuedConnection); - autoStartTimer.setSingleShot(true); - autoStopTimer.setSingleShot(true); - recordTimer.setSingleShot(false); - - QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(appAboutToQuit())); -} - -QDeclarativeViewer::~QDeclarativeViewer() -{ - delete loggerWindow; - canvas->engine()->setNetworkAccessManagerFactory(0); - delete namFactory; -} - -void QDeclarativeViewer::setDesignModeBehavior(bool value) -{ - if (designModeBehaviorAction) - designModeBehaviorAction->setChecked(value); - inspector->setDesignModeBehavior(value); -} - -void QDeclarativeViewer::enableExperimentalGestures() -{ -#ifndef QT_NO_GESTURES - canvas->viewport()->grabGesture(Qt::TapGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); - canvas->viewport()->grabGesture(Qt::TapAndHoldGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); - canvas->viewport()->grabGesture(Qt::PanGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); - canvas->viewport()->grabGesture(Qt::PinchGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); - canvas->viewport()->grabGesture(Qt::SwipeGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); - canvas->viewport()->setAttribute(Qt::WA_AcceptTouchEvents); -#endif -} - -QDeclarativeView *QDeclarativeViewer::view() const -{ - return canvas; -} - -LoggerWidget *QDeclarativeViewer::warningsWidget() const -{ - return loggerWindow; -} - -void QDeclarativeViewer::createMenu() -{ - QAction *openAction = new QAction(tr("&Open..."), this); - openAction->setShortcuts(QKeySequence::Open); - connect(openAction, SIGNAL(triggered()), this, SLOT(openFile())); - - QAction *openUrlAction = new QAction(tr("Open &URL..."), this); - connect(openUrlAction, SIGNAL(triggered()), this, SLOT(openUrl())); - - QAction *reloadAction = new QAction(tr("&Reload"), this); - reloadAction->setShortcuts(QKeySequence::Refresh); - connect(reloadAction, SIGNAL(triggered()), this, SLOT(reload())); - - QAction *snapshotAction = new QAction(tr("&Take Snapshot"), this); - snapshotAction->setShortcut(QKeySequence("F3")); - connect(snapshotAction, SIGNAL(triggered()), this, SLOT(takeSnapShot())); - - recordAction = new QAction(tr("Start Recording &Video"), this); - recordAction->setShortcut(QKeySequence("F9")); - connect(recordAction, SIGNAL(triggered()), this, SLOT(toggleRecordingWithSelection())); - - QAction *recordOptions = new QAction(tr("Video &Options..."), this); - connect(recordOptions, SIGNAL(triggered()), this, SLOT(chooseRecordingOptions())); - - QMenu *playSpeedMenu = new QMenu(tr("Animation Speed"), this); - playSpeedMenuActions = new QActionGroup(this); - playSpeedMenuActions->setExclusive(true); - - QAction *speedAction = playSpeedMenu->addAction(tr("1x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setChecked(true); - speedAction->setData(1.0f); - playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.5x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(2.0f); - playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.25x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(4.0f); - playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.125x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(8.0f); - playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.1x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(10.0f); - playSpeedMenuActions->addAction(speedAction); - - pauseAnimationsAction = playSpeedMenu->addAction(tr("Pause"), inspector, SLOT(setAnimationPaused(bool))); - pauseAnimationsAction->setCheckable(true); - pauseAnimationsAction->setShortcut(QKeySequence("Ctrl+.")); - - animationStepAction = playSpeedMenu->addAction(tr("Pause and step"), this, SLOT(stepAnimations())); - animationStepAction->setShortcut(QKeySequence("Ctrl+,")); - - animationSetStepAction = playSpeedMenu->addAction(tr("Set step"), this, SLOT(setAnimationStep())); - m_stepSize = 40; - - QAction *playSpeedAction = new QAction(tr("Animations"), this); - playSpeedAction->setMenu(playSpeedMenu); - - connect(inspector, SIGNAL(animationSpeedChanged(qreal)), SLOT(animationSpeedChanged(qreal))); - connect(inspector, SIGNAL(animationPausedChanged(bool)), pauseAnimationsAction, SLOT(setChecked(bool))); - - showWarningsWindow = new QAction(tr("Show Warnings"), this); - showWarningsWindow->setCheckable((true)); - showWarningsWindow->setChecked(loggerWindow->isVisible()); - connect(showWarningsWindow, SIGNAL(triggered(bool)), this, SLOT(showWarnings(bool))); - - designModeBehaviorAction = new QAction(tr("&Inspector Mode"), this); - designModeBehaviorAction->setShortcut(QKeySequence("Ctrl+D")); - designModeBehaviorAction->setCheckable(true); - designModeBehaviorAction->setChecked(inspector->designModeBehavior()); - designModeBehaviorAction->setEnabled(QmlJSDebugger::QDeclarativeInspectorService::hasDebuggingClient()); - connect(designModeBehaviorAction, SIGNAL(triggered(bool)), this, SLOT(setDesignModeBehavior(bool))); - connect(inspector, SIGNAL(designModeBehaviorChanged(bool)), designModeBehaviorAction, SLOT(setChecked(bool))); - connect(QmlJSDebugger::QDeclarativeInspectorService::instance(), SIGNAL(debuggingClientChanged(bool)), - designModeBehaviorAction, SLOT(setEnabled(bool))); - - appOnTopAction = new QAction(tr("Keep Window on Top"), this); - appOnTopAction->setCheckable(true); - appOnTopAction->setChecked(inspector->showAppOnTop()); - - connect(appOnTopAction, SIGNAL(triggered(bool)), inspector, SLOT(setShowAppOnTop(bool))); - connect(inspector, SIGNAL(showAppOnTopChanged(bool)), appOnTopAction, SLOT(setChecked(bool))); - - QAction *proxyAction = new QAction(tr("HTTP &Proxy..."), this); - connect(proxyAction, SIGNAL(triggered()), this, SLOT(showProxySettings())); - - QAction *fullscreenAction = new QAction(tr("Full Screen"), this); - fullscreenAction->setCheckable(true); - connect(fullscreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen())); - - rotateAction = new QAction(tr("Rotate orientation"), this); - rotateAction->setShortcut(QKeySequence("Ctrl+T")); - connect(rotateAction, SIGNAL(triggered()), this, SLOT(rotateOrientation())); - - orientation = new QActionGroup(this); - orientation->setExclusive(true); - connect(orientation, SIGNAL(triggered(QAction*)), this, SLOT(changeOrientation(QAction*))); - - QAction *portraitAction = new QAction(tr("Portrait"), this); - portraitAction->setCheckable(true); - QAction *landscapeAction = new QAction(tr("Landscape"), this); - landscapeAction->setCheckable(true); - QAction *portraitInvAction = new QAction(tr("Portrait (inverted)"), this); - portraitInvAction->setCheckable(true); - QAction *landscapeInvAction = new QAction(tr("Landscape (inverted)"), this); - landscapeInvAction->setCheckable(true); - - QAction *aboutAction = new QAction(tr("&About Qt..."), this); - aboutAction->setMenuRole(QAction::AboutQtRole); - connect(aboutAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); - - QAction *closeAction = new QAction(tr("&Close"), this); - closeAction->setShortcuts(QKeySequence::Close); - connect(closeAction, SIGNAL(triggered()), this, SLOT(close())); - - QAction *quitAction = new QAction(tr("&Quit"), this); - quitAction->setMenuRole(QAction::QuitRole); - quitAction->setShortcuts(QKeySequence::Quit); - connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); - - QMenuBar *menu = menuBar(); - if (!menu) - return; - -#if defined(Q_WS_MAEMO_5) - menu->addAction(openAction); - menu->addAction(openUrlAction); - menu->addAction(reloadAction); - - menu->addAction(snapshotAction); - menu->addAction(recordAction); - - menu->addAction(recordOptions); - menu->addAction(proxyAction); - - menu->addAction(playSpeedMenu); - menu->addAction(showWarningsWindow); - - orientation->addAction(landscapeAction); - orientation->addAction(portraitAction); - menu->addAction(new Maemo5PickerAction(tr("Set orientation"), orientation, this)); - menu->addAction(fullscreenAction); - return; -#endif // Q_WS_MAEMO_5 - - QMenu *fileMenu = menu->addMenu(tr("&File")); - fileMenu->addAction(openAction); - fileMenu->addAction(openUrlAction); - fileMenu->addAction(reloadAction); - fileMenu->addSeparator(); - fileMenu->addAction(closeAction); - fileMenu->addAction(quitAction); - - QMenu *recordMenu = menu->addMenu(tr("&Recording")); - recordMenu->addAction(snapshotAction); - recordMenu->addAction(recordAction); - - QMenu *debugMenu = menu->addMenu(tr("&Debugging")); - debugMenu->addMenu(playSpeedMenu); - debugMenu->addAction(showWarningsWindow); - debugMenu->addAction(designModeBehaviorAction); - debugMenu->addAction(appOnTopAction); - - QMenu *settingsMenu = menu->addMenu(tr("&Settings")); - settingsMenu->addAction(proxyAction); - settingsMenu->addAction(recordOptions); - settingsMenu->addMenu(loggerWindow->preferencesMenu()); - settingsMenu->addAction(rotateAction); - - QMenu *propertiesMenu = settingsMenu->addMenu(tr("Properties")); - - orientation->addAction(portraitAction); - orientation->addAction(landscapeAction); - orientation->addAction(portraitInvAction); - orientation->addAction(landscapeInvAction); - propertiesMenu->addActions(orientation->actions()); - - QMenu *helpMenu = menu->addMenu(tr("&Help")); - helpMenu->addAction(aboutAction); -} - -void QDeclarativeViewer::showProxySettings() -{ - ProxySettings settingsDlg (this); - - connect(&settingsDlg, SIGNAL(accepted()), this, SLOT(proxySettingsChanged())); - - settingsDlg.exec(); -} - -void QDeclarativeViewer::proxySettingsChanged() -{ - namFactory->proxyChanged(); - reload (); -} - -void QDeclarativeViewer::rotateOrientation() -{ -#if defined(Q_WS_S60) - CAknAppUi *appUi = static_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi()); - if (appUi) { - CAknAppUi::TAppUiOrientation oldOrientation = appUi->Orientation(); - QString newOrientation; - if (oldOrientation == CAknAppUi::EAppUiOrientationPortrait) { - newOrientation = QLatin1String("Landscape"); - } else { - newOrientation = QLatin1String("Portrait"); - } - foreach (QAction *action, orientation->actions()) { - if (action->text() == newOrientation) { - changeOrientation(action); - } - } - } -#else - QAction *current = orientation->checkedAction(); - QList<QAction *> actions = orientation->actions(); - int index = actions.indexOf(current); - if (index < 0) - return; - - QAction *newOrientation = actions[(index + 1) % actions.count()]; - changeOrientation(newOrientation); -#endif -} - -void QDeclarativeViewer::toggleFullScreen() -{ - if (isFullScreen()) - showMaximized(); - else - showFullScreen(); -} - -void QDeclarativeViewer::showWarnings(bool show) -{ - loggerWindow->setVisible(show); -} - -void QDeclarativeViewer::warningsWidgetOpened() -{ - showWarningsWindow->setChecked(true); -} - -void QDeclarativeViewer::warningsWidgetClosed() -{ - showWarningsWindow->setChecked(false); -} - -void QDeclarativeViewer::takeSnapShot() -{ - static int snapshotcount = 1; - QString snapFileName = QString(QLatin1String("snapshot%1.png")).arg(snapshotcount); - QPixmap::grabWidget(canvas).save(snapFileName); - qDebug() << "Wrote" << snapFileName; - ++snapshotcount; -} - -void QDeclarativeViewer::pickRecordingFile() -{ - QString fileName = getVideoFileName(); - if (!fileName.isEmpty()) - recdlg->file->setText(fileName); -} - -void QDeclarativeViewer::chooseRecordingOptions() -{ - // File - recdlg->file->setText(record_file); - - // Size - recdlg->setOriginalSize(canvas->size()); - - // Rate - recdlg->setVideoRate(record_rate); - - - // Profile - recdlg->setArguments(record_args.join(" ")); - if (recdlg->exec()) { - // File - record_file = recdlg->file->text(); - // Size - record_outsize = recdlg->videoSize(); - // Rate - record_rate = recdlg->videoRate(); - // Profile - record_args = recdlg->arguments().split(QLatin1Char(' '),QString::SkipEmptyParts); - } -} - -void QDeclarativeViewer::toggleRecordingWithSelection() -{ - if (!recordTimer.isActive()) { - if (record_file.isEmpty()) { - QString fileName = getVideoFileName(); - if (fileName.isEmpty()) - return; - if (!fileName.contains(QRegExp(".[^\\/]*$"))) - fileName += ".avi"; - setRecordFile(fileName); - } - } - toggleRecording(); -} - -void QDeclarativeViewer::toggleRecording() -{ -#ifndef NO_PRIVATE_HEADERS - if (record_file.isEmpty()) { - toggleRecordingWithSelection(); - return; - } - bool recording = !recordTimer.isActive(); - recordAction->setText(recording ? tr("&Stop Recording Video\tF9") : tr("&Start Recording Video\tF9")); - setRecording(recording); -#endif -} - -void QDeclarativeViewer::pauseAnimations() -{ - inspector->setAnimationPaused(true); -} - -void QDeclarativeViewer::stepAnimations() -{ - inspector->setAnimationPaused(false); - QTimer::singleShot(m_stepSize, this, SLOT(pauseAnimations())); - } - -void QDeclarativeViewer::setAnimationStep() -{ - bool ok; - int stepSize = QInputDialog::getInt(this, tr("Set animation step duration"), - tr("Step duration (ms):"), m_stepSize, 20, 10000, 1, &ok); - if (ok) m_stepSize = stepSize; -} - -void QDeclarativeViewer::changeAnimationSpeed() -{ - if (QAction *action = qobject_cast<QAction*>(sender())) - inspector->setAnimationSpeed(action->data().toFloat()); -} - -void QDeclarativeViewer::addLibraryPath(const QString& lib) -{ - canvas->engine()->addImportPath(lib); -} - -void QDeclarativeViewer::addPluginPath(const QString& plugin) -{ - canvas->engine()->addPluginPath(plugin); -} - -void QDeclarativeViewer::reload() -{ - launch(currentFileOrUrl); -} - -void QDeclarativeViewer::openFile() -{ - QString cur = canvas->source().toLocalFile(); - if (useQmlFileBrowser) { - open("qrc:/browser/Browser.qml"); - } else { - QString fileName = QFileDialog::getOpenFileName(this, tr("Open QML file"), cur, tr("QML Files (*.qml)")); - if (!fileName.isEmpty()) { - QFileInfo fi(fileName); - open(fi.absoluteFilePath()); - } - } -} - -void QDeclarativeViewer::openUrl() -{ - QString cur = canvas->source().toLocalFile(); - QString url= QInputDialog::getText(this, tr("Open QML file"), tr("URL of main QML file:"), QLineEdit::Normal, cur); - if (!url.isEmpty()) - open(url); -} - -void QDeclarativeViewer::statusChanged() -{ - if (canvas->status() == QDeclarativeView::Error && tester) - tester->executefailure(); - - if (canvas->status() == QDeclarativeView::Ready) { - initialSize = canvas->initialSize(); - updateSizeHints(true); - } -} - -void QDeclarativeViewer::launch(const QString& file_or_url) -{ - QMetaObject::invokeMethod(this, "open", Qt::QueuedConnection, Q_ARG(QString, file_or_url)); -} - -void QDeclarativeViewer::loadTranslationFile(const QString& directory) -{ - if (!translator) { - translator = new QTranslator(this); - QApplication::installTranslator(translator); - } - - translator->load(QLatin1String("qml_" )+QLocale::system().name(), directory + QLatin1String("/i18n")); -} - -void QDeclarativeViewer::loadDummyDataFiles(const QString& directory) -{ - QDir dir(directory+"/dummydata", "*.qml"); - QStringList list = dir.entryList(); - for (int i = 0; i < list.size(); ++i) { - QString qml = list.at(i); - QDeclarativeComponent comp(canvas->engine(), dir.filePath(qml)); - QObject *dummyData = comp.create(); - - if(comp.isError()) { - QList<QDeclarativeError> errors = comp.errors(); - foreach (const QDeclarativeError &error, errors) { - qWarning() << error; - } - if (tester) tester->executefailure(); - } - - if (dummyData) { - qWarning() << "Loaded dummy data:" << dir.filePath(qml); - qml.truncate(qml.length()-4); - canvas->rootContext()->setContextProperty(qml, dummyData); - dummyData->setParent(this); - } - } -} - -bool QDeclarativeViewer::open(const QString& file_or_url) -{ - currentFileOrUrl = file_or_url; - - QUrl url; - QFileInfo fi(file_or_url); - if (fi.exists()) - url = QUrl::fromLocalFile(fi.absoluteFilePath()); - else - url = QUrl(file_or_url); - setWindowTitle(tr("%1 - Qt QML Viewer").arg(file_or_url)); - -#ifndef NO_PRIVATE_HEADERS - if (!m_script.isEmpty()) - tester = new QDeclarativeTester(m_script, m_scriptOptions, canvas); -#endif - - delete canvas->rootObject(); - canvas->engine()->clearComponentCache(); - QDeclarativeContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("qmlViewer", this); - ctxt->setContextProperty("qmlViewerFolder", QDir::currentPath()); - ctxt->setContextProperty("runtime", Runtime::instance()); - - QString fileName = url.toLocalFile(); - if (!fileName.isEmpty()) { - fi.setFile(fileName); - if (fi.exists()) { - if (fi.suffix().toLower() != QLatin1String("qml")) { - qWarning() << "qml cannot open non-QML file" << fileName; - return false; - } - - QFileInfo fi(fileName); - loadTranslationFile(fi.path()); - loadDummyDataFiles(fi.path()); - } else { - qWarning() << "qml cannot find file:" << fileName; - return false; - } - } - - QTime t; - t.start(); - - canvas->setSource(url); - - return true; -} - -void QDeclarativeViewer::setAutoRecord(int from, int to) -{ - if (from==0) from=1; // ensure resized - record_autotime = to-from; - autoStartTimer.setInterval(from); - autoStartTimer.start(); -} - -void QDeclarativeViewer::setRecordArgs(const QStringList& a) -{ - record_args = a; -} - -void QDeclarativeViewer::setRecordFile(const QString& f) -{ - record_file = f; -} - -void QDeclarativeViewer::setRecordRate(int fps) -{ - record_rate = fps; -} - -void QDeclarativeViewer::sceneResized(QSize) -{ - updateSizeHints(); -} - -void QDeclarativeViewer::keyPressEvent(QKeyEvent *event) -{ - if (event->key() == Qt::Key_0 && devicemode) - exit(0); - else if (event->key() == Qt::Key_F1 || (event->key() == Qt::Key_1 && devicemode)) { - qDebug() << "F1 - help\n" - << "F2 - save test script\n" - << "F3 - take PNG snapshot\n" - << "F4 - show items and state\n" - << "F5 - reload QML\n" - << "F6 - show object tree\n" - << "F7 - show timing\n" - << "F9 - toggle video recording\n" - << "F10 - toggle orientation\n" - << "device keys: 0=quit, 1..8=F1..F8" - ; - } else if (event->key() == Qt::Key_F2 || (event->key() == Qt::Key_2 && devicemode)) { - if (tester && m_scriptOptions & Record) - tester->save(); - } else if (event->key() == Qt::Key_F3 || (event->key() == Qt::Key_3 && devicemode)) { - takeSnapShot(); - } else if (event->key() == Qt::Key_F5 || (event->key() == Qt::Key_5 && devicemode)) { - reload(); - } else if (event->key() == Qt::Key_F9 || (event->key() == Qt::Key_9 && devicemode)) { - toggleRecording(); - } else if (event->key() == Qt::Key_F10) { - rotateOrientation(); - } - - QWidget::keyPressEvent(event); -} - -bool QDeclarativeViewer::event(QEvent *event) -{ - if (event->type() == QEvent::WindowActivate) { - Runtime::instance()->setActiveWindow(true); - DeviceOrientation::instance()->resumeListening(); - } else if (event->type() == QEvent::WindowDeactivate) { - Runtime::instance()->setActiveWindow(false); - DeviceOrientation::instance()->pauseListening(); - } - return QWidget::event(event); -} - -void QDeclarativeViewer::senseImageMagick() -{ - QProcess proc; - proc.start("convert", QStringList() << "-h"); - proc.waitForFinished(2000); - QString help = proc.readAllStandardOutput(); - convertAvailable = help.contains("ImageMagick"); -} - -void QDeclarativeViewer::senseFfmpeg() -{ - QProcess proc; - proc.start("ffmpeg", QStringList() << "-h"); - proc.waitForFinished(2000); - QString ffmpegHelp = proc.readAllStandardOutput(); - ffmpegAvailable = ffmpegHelp.contains("-s "); - ffmpegHelp = tr("Video recording uses ffmpeg:")+"\n\n"+ffmpegHelp; - - QDialog *d = new QDialog(recdlg); - QVBoxLayout *l = new QVBoxLayout(d); - QTextBrowser *b = new QTextBrowser(d); - QFont f = b->font(); - f.setFamily("courier"); - b->setFont(f); - b->setText(ffmpegHelp); - l->addWidget(b); - d->setLayout(l); - ffmpegHelpWindow = d; - connect(recdlg->ffmpegHelp,SIGNAL(clicked()), ffmpegHelpWindow, SLOT(show())); -} - -void QDeclarativeViewer::setRecording(bool on) -{ - if (on == recordTimer.isActive()) - return; - - int period = int(1000/record_rate+0.5); -#ifndef NO_PRIVATE_HEADERS - QUnifiedTimer::instance()->setTimingInterval(on ? period:16); - QUnifiedTimer::instance()->setConsistentTiming(on); -#endif - if (on) { - canvas->setViewportUpdateMode(QGraphicsView::FullViewportUpdate); - recordTimer.setInterval(period); - recordTimer.start(); - frame_fmt = record_file.right(4).toLower(); - frame = QImage(canvas->width(),canvas->height(),QImage::Format_RGB32); - if (frame_fmt != ".png" && (!convertAvailable || frame_fmt != ".gif")) { - // Stream video to ffmpeg - - QProcess *proc = new QProcess(this); - connect(proc, SIGNAL(finished(int)), this, SLOT(ffmpegFinished(int))); - frame_stream = proc; - - QStringList args; - args << "-y"; - args << "-r" << QString::number(record_rate); - args << "-f" << "rawvideo"; - args << "-pix_fmt" << (frame_fmt == ".gif" ? "rgb24" : "rgb32"); - args << "-s" << QString("%1x%2").arg(canvas->width()).arg(canvas->height()); - args << "-i" << "-"; - if (record_outsize.isValid()) { - args << "-s" << QString("%1x%2").arg(record_outsize.width()).arg(record_outsize.height()); - args << "-aspect" << QString::number(double(canvas->width())/canvas->height()); - } - args += record_args; - args << record_file; - proc->start("ffmpeg",args); - - } else { - // Store frames, save to GIF/PNG - frame_stream = 0; - } - } else { - canvas->setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate); - recordTimer.stop(); - if (frame_stream) { - qDebug() << "Saving video..."; - frame_stream->close(); - qDebug() << "Wrote" << record_file; - } else { - QProgressDialog progress(tr("Saving frames..."), tr("Cancel"), 0, frames.count()+10, this); - progress.setWindowModality(Qt::WindowModal); - - int frame=0; - QStringList inputs; - qDebug() << "Saving frames..."; - - QString framename; - bool png_output = false; - if (record_file.right(4).toLower()==".png") { - if (record_file.contains('%')) - framename = record_file; - else - framename = record_file.left(record_file.length()-4)+"%04d"+record_file.right(4); - png_output = true; - } else { - framename = "tmp-frame%04d.png"; - png_output = false; - } - foreach (QImage* img, frames) { - progress.setValue(progress.value()+1); - if (progress.wasCanceled()) - break; - QString name; - name.sprintf(framename.toLocal8Bit(),frame++); - if (record_outsize.isValid()) - *img = img->scaled(record_outsize,Qt::IgnoreAspectRatio,Qt::SmoothTransformation); - if (record_dither=="ordered") - img->convertToFormat(QImage::Format_Indexed8,Qt::PreferDither|Qt::OrderedDither).save(name); - else if (record_dither=="threshold") - img->convertToFormat(QImage::Format_Indexed8,Qt::PreferDither|Qt::ThresholdDither).save(name); - else if (record_dither=="floyd") - img->convertToFormat(QImage::Format_Indexed8,Qt::PreferDither).save(name); - else - img->save(name); - inputs << name; - delete img; - } - - if (!progress.wasCanceled()) { - if (png_output) { - framename.replace(QRegExp("%\\d*."),"*"); - qDebug() << "Wrote frames" << framename; - inputs.clear(); // don't remove them - } else { - // ImageMagick and gifsicle for GIF encoding - progress.setLabelText(tr("Converting frames to GIF file...")); - QStringList args; - args << "-delay" << QString::number(period/10); - args << inputs; - args << record_file; - qDebug() << "Converting..." << record_file << "(this may take a while)"; - if (0!=QProcess::execute("convert", args)) { - qWarning() << "Cannot run ImageMagick 'convert' - recorded frames not converted"; - inputs.clear(); // don't remove them - qDebug() << "Wrote frames tmp-frame*.png"; - } else { - if (record_file.right(4).toLower() == ".gif") { - qDebug() << "Compressing..." << record_file; - if (0!=QProcess::execute("gifsicle", QStringList() << "-O2" << "-o" << record_file << record_file)) - qWarning() << "Cannot run 'gifsicle' - not compressed"; - } - qDebug() << "Wrote" << record_file; - } - } - } - - progress.setValue(progress.maximum()-1); - foreach (const QString &name, inputs) - QFile::remove(name); - - frames.clear(); - } - } - qDebug() << "Recording: " << (recordTimer.isActive()?"ON":"OFF"); -} - -void QDeclarativeViewer::ffmpegFinished(int code) -{ - qDebug() << "ffmpeg returned" << code << frame_stream->readAllStandardError(); -} - -void QDeclarativeViewer::appAboutToQuit() -{ - // avoid QGLContext errors about invalid contexts on exit - canvas->setViewport(0); - - // avoid crashes if messages are received after app has closed - delete loggerWindow; - loggerWindow = 0; - delete tester; - tester = 0; -} - -void QDeclarativeViewer::autoStartRecording() -{ - setRecording(true); - autoStopTimer.setInterval(record_autotime); - autoStopTimer.start(); -} - -void QDeclarativeViewer::autoStopRecording() -{ - setRecording(false); -} - -void QDeclarativeViewer::recordFrame() -{ - canvas->QWidget::render(&frame); - if (frame_stream) { - if (frame_fmt == ".gif") { - // ffmpeg can't do 32bpp with gif - QImage rgb24 = frame.convertToFormat(QImage::Format_RGB888); - frame_stream->write((char*)rgb24.bits(),rgb24.numBytes()); - } else { - frame_stream->write((char*)frame.bits(),frame.numBytes()); - } - } else { - frames.append(new QImage(frame)); - } -} - -void QDeclarativeViewer::changeOrientation(QAction *action) -{ - if (!action) - return; - QString o = action->text(); - action->setChecked(true); -#if defined(Q_WS_S60) - CAknAppUi *appUi = static_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi()); - if (appUi) { - CAknAppUi::TAppUiOrientation orientation = appUi->Orientation(); - if (o == QLatin1String("Auto-orientation")) { - appUi->SetOrientationL(CAknAppUi::EAppUiOrientationAutomatic); - rotateAction->setVisible(false); - } else if (o == QLatin1String("Portrait")) { - appUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait); - rotateAction->setVisible(true); - } else if (o == QLatin1String("Landscape")) { - appUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape); - rotateAction->setVisible(true); - } - } -#else - if (o == QLatin1String("Portrait")) - DeviceOrientation::instance()->setOrientation(DeviceOrientation::Portrait); - else if (o == QLatin1String("Landscape")) - DeviceOrientation::instance()->setOrientation(DeviceOrientation::Landscape); - else if (o == QLatin1String("Portrait (inverted)")) - DeviceOrientation::instance()->setOrientation(DeviceOrientation::PortraitInverted); - else if (o == QLatin1String("Landscape (inverted)")) - DeviceOrientation::instance()->setOrientation(DeviceOrientation::LandscapeInverted); -#endif -} - -void QDeclarativeViewer::orientationChanged() -{ - updateSizeHints(); -} - -void QDeclarativeViewer::animationSpeedChanged(qreal factor) -{ - foreach (QAction *action, playSpeedMenuActions->actions()) { - if (action->data().toFloat() == factor) { - action->setChecked(true); - break; - } - } -} - -void QDeclarativeViewer::setDeviceKeys(bool on) -{ - devicemode = on; -} - -void QDeclarativeViewer::setNetworkCacheSize(int size) -{ - namFactory->setCacheSize(size); -} - -void QDeclarativeViewer::setUseGL(bool useGL) -{ -#ifdef GL_SUPPORTED - if (useGL) { - QGLFormat format = QGLFormat::defaultFormat(); -#ifdef Q_OS_MAC - format.setSampleBuffers(true); -#else - format.setSampleBuffers(false); -#endif - - QGLWidget *glWidget = new QGLWidget(format); - //### potentially faster, but causes junk to appear if top-level is Item, not Rectangle - //glWidget->setAutoFillBackground(false); - - canvas->setViewport(glWidget); - } -#else - Q_UNUSED(useGL) -#endif -} - -void QDeclarativeViewer::setUseNativeFileBrowser(bool use) -{ - useQmlFileBrowser = !use; -} - -void QDeclarativeViewer::setSizeToView(bool sizeToView) -{ - QDeclarativeView::ResizeMode resizeMode = sizeToView ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject; - if (resizeMode != canvas->resizeMode()) { - canvas->setResizeMode(resizeMode); - updateSizeHints(); - } -} - -void QDeclarativeViewer::setStayOnTop(bool stayOnTop) -{ - appOnTopAction->setChecked(stayOnTop); -} - -void QDeclarativeViewer::updateSizeHints(bool initial) -{ - static bool isRecursive = false; - - if (isRecursive) - return; - isRecursive = true; - - if (initial || (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject)) { - QSize newWindowSize = initial ? initialSize : canvas->sizeHint(); - //qWarning() << "USH:" << (initial ? "INIT:" : "V2R:") << "setting fixed size " << newWindowSize; - if (!isFullScreen() && !isMaximized()) { - canvas->setFixedSize(newWindowSize); - resize(1, 1); - layout()->setSizeConstraint(QLayout::SetFixedSize); - layout()->activate(); - } - } - //qWarning() << "USH: R2V: setting free size "; - layout()->setSizeConstraint(QLayout::SetNoConstraint); - layout()->activate(); - setMinimumSize(minimumSizeHint()); - setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)); - canvas->setMinimumSize(QSize(0,0)); - canvas->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)); - - isRecursive = false; -} - -void QDeclarativeViewer::registerTypes() -{ - static bool registered = false; - - if (!registered) { - // registering only for exposing the DeviceOrientation::Orientation enum - qmlRegisterUncreatableType<DeviceOrientation>("Qt",4,7,"Orientation",""); - qmlRegisterUncreatableType<DeviceOrientation>("QtQuick",1,0,"Orientation",""); - registered = true; - } -} - -QT_END_NAMESPACE - -#include "qmlruntime.moc" diff --git a/share/qtcreator/qml/qmlobserver/qmlruntime.h b/share/qtcreator/qml/qmlobserver/qmlruntime.h deleted file mode 100644 index 7486373ac0563a098d243df2dc2483fa9b195084..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/qmlruntime.h +++ /dev/null @@ -1,214 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QMLRUNTIME_H -#define QMLRUNTIME_H - -#include <QMainWindow> -#include <QTimer> -#include <QTime> -#include <QList> - -#include "loggerwidget.h" - -namespace QmlJSDebugger { - class QDeclarativeViewInspector; -} - -QT_BEGIN_NAMESPACE - -class QDeclarativeView; -class PreviewDeviceSkin; -class QDeclarativeTestEngine; -class QProcess; -class RecordingDialog; -class QDeclarativeTester; -class QNetworkReply; -class QNetworkCookieJar; -class NetworkAccessManagerFactory; -class QTranslator; -class QActionGroup; -class QMenuBar; - -class QDeclarativeViewer - : public QMainWindow -{ - Q_OBJECT - -public: - QDeclarativeViewer(QWidget *parent = 0, Qt::WindowFlags flags = 0); - ~QDeclarativeViewer(); - - static void registerTypes(); - - enum ScriptOption { - Play = 0x00000001, - Record = 0x00000002, - TestImages = 0x00000004, - TestErrorProperty = 0x00000008, - SaveOnExit = 0x00000010, - ExitOnComplete = 0x00000020, - ExitOnFailure = 0x00000040, - Snapshot = 0x00000080, - TestSkipProperty = 0x00000100 - }; - Q_DECLARE_FLAGS(ScriptOptions, ScriptOption) - void setScript(const QString &s) { m_script = s; } - void setScriptOptions(ScriptOptions opt) { m_scriptOptions = opt; } - void setRecordDither(const QString& s) { record_dither = s; } - void setRecordRate(int fps); - void setRecordFile(const QString&); - void setRecordArgs(const QStringList&); - void setRecording(bool on); - bool isRecording() const { return recordTimer.isActive(); } - void setAutoRecord(int from, int to); - void setDeviceKeys(bool); - void setNetworkCacheSize(int size); - void addLibraryPath(const QString& lib); - void addPluginPath(const QString& plugin); - void setUseGL(bool use); - void setUseNativeFileBrowser(bool); - void setSizeToView(bool sizeToView); - void setStayOnTop(bool stayOnTop); - - QDeclarativeView *view() const; - LoggerWidget *warningsWidget() const; - QString currentFile() const { return currentFileOrUrl; } - - void enableExperimentalGestures(); - -public slots: - void setDesignModeBehavior(bool value); - void sceneResized(QSize size); - bool open(const QString&); - void openFile(); - void openUrl(); - void reload(); - void takeSnapShot(); - void toggleRecording(); - void toggleRecordingWithSelection(); - void ffmpegFinished(int code); - void showProxySettings (); - void proxySettingsChanged (); - void rotateOrientation(); - void statusChanged(); - void pauseAnimations(); - void stepAnimations(); - void setAnimationStep(); - void changeAnimationSpeed(); - void launch(const QString &); - -protected: - virtual void keyPressEvent(QKeyEvent *); - virtual bool event(QEvent *); - void createMenu(); - -private slots: - void appAboutToQuit(); - - void autoStartRecording(); - void autoStopRecording(); - void recordFrame(); - void chooseRecordingOptions(); - void pickRecordingFile(); - void toggleFullScreen(); - void changeOrientation(QAction*); - void orientationChanged(); - - void animationSpeedChanged(qreal factor); - - void showWarnings(bool show); - void warningsWidgetOpened(); - void warningsWidgetClosed(); - -private: - void updateSizeHints(bool initial = false); - - QString getVideoFileName(); - - LoggerWidget *loggerWindow; - QDeclarativeView *canvas; - QmlJSDebugger::QDeclarativeViewInspector *inspector; - QSize initialSize; - QString currentFileOrUrl; - QTimer recordTimer; - QString frame_fmt; - QImage frame; - QList<QImage*> frames; - QProcess* frame_stream; - QTimer autoStartTimer; - QTimer autoStopTimer; - QString record_dither; - QString record_file; - QSize record_outsize; - QStringList record_args; - int record_rate; - int record_autotime; - bool devicemode; - QAction *recordAction; - RecordingDialog *recdlg; - - void senseImageMagick(); - void senseFfmpeg(); - QWidget *ffmpegHelpWindow; - bool ffmpegAvailable; - bool convertAvailable; - - int m_stepSize; - QActionGroup *playSpeedMenuActions; - QAction *pauseAnimationsAction; - QAction *animationStepAction; - QAction *animationSetStepAction; - - QAction *rotateAction; - QActionGroup *orientation; - QAction *showWarningsWindow; - QAction *designModeBehaviorAction; - QAction *appOnTopAction; - - QString m_script; - ScriptOptions m_scriptOptions; - QDeclarativeTester *tester; - - QNetworkReply *wgtreply; - QString wgtdir; - NetworkAccessManagerFactory *namFactory; - - bool useQmlFileBrowser; - - QTranslator *translator; - void loadTranslationFile(const QString& directory); - - void loadDummyDataFiles(const QString& directory); -}; -Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeViewer::ScriptOptions) - -QT_END_NAMESPACE - -#endif // QMLRUNTIME_H diff --git a/share/qtcreator/qml/qmlobserver/recopts.ui b/share/qtcreator/qml/qmlobserver/recopts.ui deleted file mode 100644 index ce2da307673f5ff2e15c134afb2e530d841ed02b..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/recopts.ui +++ /dev/null @@ -1,513 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>RecordingOptions</class> - <widget class="QDialog" name="RecordingOptions"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>316</width> - <height>436</height> - </rect> - </property> - <property name="windowTitle"> - <string>Video options</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QLabel" name="label"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>File:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="file"/> - </item> - <item> - <widget class="QToolButton" name="pickfile"> - <property name="text"> - <string>...</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>Size</string> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QRadioButton" name="sizeOriginal"> - <property name="text"> - <string/> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QRadioButton" name="sizeVGA"> - <property name="text"> - <string>VGA</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QRadioButton" name="size720p"> - <property name="text"> - <string>720p</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QRadioButton" name="sizeQVGA"> - <property name="text"> - <string>QVGA</string> - </property> - </widget> - </item> - <item row="2" column="0" colspan="3"> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QRadioButton" name="sizeCustom"> - <property name="text"> - <string>Width:</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="sizeWidth"> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>9999</number> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Height:</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="sizeHeight"> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>9999</number> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::MinimumExpanding</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item row="0" column="2"> - <spacer name="horizontalSpacer_4"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::MinimumExpanding</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="rateOptions"> - <property name="title"> - <string>Rate</string> - </property> - <layout class="QGridLayout" name="gridLayout_4"> - <item row="0" column="0"> - <widget class="QRadioButton" name="hz60"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>60Hz</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QRadioButton" name="hz50"> - <property name="text"> - <string>50Hz</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QRadioButton" name="hz25"> - <property name="text"> - <string>25Hz</string> - </property> - </widget> - </item> - <item row="2" column="0" colspan="4"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="spacing"> - <number>0</number> - </property> - <item> - <widget class="QRadioButton" name="hzCustom"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="hz"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Hz</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::MinimumExpanding</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item row="1" column="2"> - <widget class="QRadioButton" name="hz24"> - <property name="text"> - <string>24Hz</string> - </property> - </widget> - </item> - <item row="0" column="3"> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::MinimumExpanding</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="0" column="1"> - <spacer name="horizontalSpacer_5"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="ffmpegOptions"> - <property name="title"> - <string>Profile</string> - </property> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="0" column="0" colspan="3"> - <widget class="QComboBox" name="profile"/> - </item> - <item row="1" column="0" colspan="2"> - <widget class="QLineEdit" name="args"/> - </item> - <item row="1" column="2"> - <widget class="QToolButton" name="ffmpegHelp"> - <property name="text"> - <string>Help</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QLabel" name="warning"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </widget> - <tabstops> - <tabstop>file</tabstop> - <tabstop>pickfile</tabstop> - <tabstop>sizeOriginal</tabstop> - <tabstop>sizeVGA</tabstop> - <tabstop>size720p</tabstop> - <tabstop>sizeQVGA</tabstop> - <tabstop>sizeCustom</tabstop> - <tabstop>sizeWidth</tabstop> - <tabstop>sizeHeight</tabstop> - <tabstop>hz60</tabstop> - <tabstop>hz25</tabstop> - <tabstop>hz50</tabstop> - <tabstop>hz24</tabstop> - <tabstop>hzCustom</tabstop> - <tabstop>hz</tabstop> - <tabstop>profile</tabstop> - <tabstop>args</tabstop> - <tabstop>ffmpegHelp</tabstop> - <tabstop>buttonBox</tabstop> - </tabstops> - <resources/> - <connections> - <connection> - <sender>hzCustom</sender> - <signal>clicked()</signal> - <receiver>hz</receiver> - <slot>setFocus()</slot> - <hints> - <hint type="sourcelabel"> - <x>43</x> - <y>257</y> - </hint> - <hint type="destinationlabel"> - <x>129</x> - <y>262</y> - </hint> - </hints> - </connection> - <connection> - <sender>hz</sender> - <signal>textChanged(QString)</signal> - <receiver>hzCustom</receiver> - <slot>toggle()</slot> - <hints> - <hint type="sourcelabel"> - <x>143</x> - <y>262</y> - </hint> - <hint type="destinationlabel"> - <x>43</x> - <y>257</y> - </hint> - </hints> - </connection> - <connection> - <sender>hz</sender> - <signal>selectionChanged()</signal> - <receiver>hzCustom</receiver> - <slot>toggle()</slot> - <hints> - <hint type="sourcelabel"> - <x>143</x> - <y>262</y> - </hint> - <hint type="destinationlabel"> - <x>43</x> - <y>257</y> - </hint> - </hints> - </connection> - <connection> - <sender>buttonBox</sender> - <signal>accepted()</signal> - <receiver>RecordingOptions</receiver> - <slot>accept()</slot> - <hints> - <hint type="sourcelabel"> - <x>258</x> - <y>424</y> - </hint> - <hint type="destinationlabel"> - <x>60</x> - <y>219</y> - </hint> - </hints> - </connection> - <connection> - <sender>buttonBox</sender> - <signal>rejected()</signal> - <receiver>RecordingOptions</receiver> - <slot>reject()</slot> - <hints> - <hint type="sourcelabel"> - <x>258</x> - <y>424</y> - </hint> - <hint type="destinationlabel"> - <x>92</x> - <y>219</y> - </hint> - </hints> - </connection> - <connection> - <sender>profile</sender> - <signal>activated(int)</signal> - <receiver>RecordingOptions</receiver> - <slot>pickProfile(int)</slot> - <hints> - <hint type="sourcelabel"> - <x>92</x> - <y>329</y> - </hint> - <hint type="destinationlabel"> - <x>48</x> - <y>194</y> - </hint> - </hints> - </connection> - <connection> - <sender>args</sender> - <signal>textEdited(QString)</signal> - <receiver>RecordingOptions</receiver> - <slot>storeCustomArgs(QString)</slot> - <hints> - <hint type="sourcelabel"> - <x>128</x> - <y>357</y> - </hint> - <hint type="destinationlabel"> - <x>102</x> - <y>189</y> - </hint> - </hints> - </connection> - <connection> - <sender>sizeWidth</sender> - <signal>valueChanged(int)</signal> - <receiver>sizeCustom</receiver> - <slot>toggle()</slot> - <hints> - <hint type="sourcelabel"> - <x>108</x> - <y>133</y> - </hint> - <hint type="destinationlabel"> - <x>48</x> - <y>133</y> - </hint> - </hints> - </connection> - <connection> - <sender>sizeHeight</sender> - <signal>valueChanged(int)</signal> - <receiver>sizeCustom</receiver> - <slot>toggle()</slot> - <hints> - <hint type="sourcelabel"> - <x>212</x> - <y>133</y> - </hint> - <hint type="destinationlabel"> - <x>64</x> - <y>129</y> - </hint> - </hints> - </connection> - </connections> - <slots> - <signal>filePicked(QString)</signal> - <signal>argumentsPicked(QString)</signal> - <slot>pickFile()</slot> - <slot>pickProfile(int)</slot> - <slot>storeCustomArgs(QString)</slot> - </slots> -</ui> diff --git a/share/qtcreator/qml/qmlobserver/recopts_maemo5.ui b/share/qtcreator/qml/qmlobserver/recopts_maemo5.ui deleted file mode 100644 index 3bb5ecabd91ccab04780eaf16e1bf5032224b759..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/recopts_maemo5.ui +++ /dev/null @@ -1,254 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>RecordingOptions</class> - <widget class="QDialog" name="RecordingOptions"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>469</width> - <height>142</height> - </rect> - </property> - <property name="windowTitle"> - <string>Video options</string> - </property> - <layout class="QGridLayout" name="gridLayout" columnstretch="0,2,0"> - <property name="sizeConstraint"> - <enum>QLayout::SetMinAndMaxSize</enum> - </property> - <property name="leftMargin"> - <number>16</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>16</number> - </property> - <property name="bottomMargin"> - <number>8</number> - </property> - <property name="horizontalSpacing"> - <number>16</number> - </property> - <property name="verticalSpacing"> - <number>0</number> - </property> - <item row="0" column="1"> - <widget class="QLineEdit" name="file"/> - </item> - <item row="0" column="2" rowspan="3"> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>72</width> - <height>56</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Size</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="sizeCombo"> - <item> - <property name="text"> - <string/> - </property> - </item> - <item> - <property name="text"> - <string>VGA</string> - </property> - </item> - <item> - <property name="text"> - <string>QVGA</string> - </property> - </item> - <item> - <property name="text"> - <string>720p</string> - </property> - </item> - </widget> - </item> - <item row="2" column="0" rowspan="2"> - <widget class="QLabel" name="rateLabel"> - <property name="text"> - <string>Rate</string> - </property> - </widget> - </item> - <item row="2" column="1" rowspan="2"> - <widget class="QComboBox" name="rateCombo"> - <item> - <property name="text"> - <string>60 Hz</string> - </property> - </item> - <item> - <property name="text"> - <string>50 Hz</string> - </property> - </item> - <item> - <property name="text"> - <string>25 Hz</string> - </property> - </item> - <item> - <property name="text"> - <string>24 Hz</string> - </property> - </item> - <item> - <property name="text"> - <string>20 Hz</string> - </property> - </item> - <item> - <property name="text"> - <string>15 Hz</string> - </property> - </item> - <item> - <property name="text"> - <string>10 Hz</string> - </property> - </item> - </widget> - </item> - <item row="5" column="1"> - <widget class="QLineEdit" name="args"/> - </item> - <item row="4" column="1"> - <widget class="QComboBox" name="profile"/> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="profileLabel"> - <property name="text"> - <string>Profile</string> - </property> - </widget> - </item> - <item row="6" column="0" colspan="2"> - <widget class="QLabel" name="warning"> - <property name="text"> - <string notr="true">warning</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="4" column="2" rowspan="3"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QPushButton" name="pickfile"> - <property name="text"> - <string>File</string> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QPushButton" name="ffmpegHelp"> - <property name="text"> - <string>Options</string> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections> - <connection> - <sender>buttonBox</sender> - <signal>accepted()</signal> - <receiver>RecordingOptions</receiver> - <slot>accept()</slot> - <hints> - <hint type="sourcelabel"> - <x>258</x> - <y>424</y> - </hint> - <hint type="destinationlabel"> - <x>60</x> - <y>219</y> - </hint> - </hints> - </connection> - <connection> - <sender>buttonBox</sender> - <signal>rejected()</signal> - <receiver>RecordingOptions</receiver> - <slot>reject()</slot> - <hints> - <hint type="sourcelabel"> - <x>258</x> - <y>424</y> - </hint> - <hint type="destinationlabel"> - <x>92</x> - <y>219</y> - </hint> - </hints> - </connection> - <connection> - <sender>profile</sender> - <signal>activated(int)</signal> - <receiver>RecordingOptions</receiver> - <slot>pickProfile(int)</slot> - <hints> - <hint type="sourcelabel"> - <x>92</x> - <y>329</y> - </hint> - <hint type="destinationlabel"> - <x>48</x> - <y>194</y> - </hint> - </hints> - </connection> - <connection> - <sender>args</sender> - <signal>textEdited(QString)</signal> - <receiver>RecordingOptions</receiver> - <slot>storeCustomArgs(QString)</slot> - <hints> - <hint type="sourcelabel"> - <x>128</x> - <y>357</y> - </hint> - <hint type="destinationlabel"> - <x>102</x> - <y>189</y> - </hint> - </hints> - </connection> - </connections> - <slots> - <signal>filePicked(QString)</signal> - <signal>argumentsPicked(QString)</signal> - <slot>pickFile()</slot> - <slot>pickProfile(int)</slot> - <slot>storeCustomArgs(QString)</slot> - </slots> -</ui> diff --git a/share/qtcreator/qml/qmlobserver/startup/Logo.qml b/share/qtcreator/qml/qmlobserver/startup/Logo.qml deleted file mode 100644 index 2bd7051e1108f8b190aac7455653c575b8d6401d..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/startup/Logo.qml +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -import QtQuick 2.1 - -Rectangle { - id: myApp - width: 411 - height: 411 - color: "transparent" - property alias logoState : myApp.state - signal animationFinished - - Item { - id: sketchBlueHolder - width: sketchLogo.width - height: sketchLogo.height - Image { - id: image1 - x: -44 - y: -45 - smooth: true - source: "shadow.png" - } - Item { - clip: true - width: sketchLogo.width - height: sketchLogo.height - Image { - id: sketchLogo - smooth: true - source: "qt-sketch.jpg" - } - Image { - id: blueLogo - y: -420 - smooth: true - source: "qt-blue.jpg" - } - } - } - - states: [ - State { - name: "showBlueprint" - PropertyChanges { - target: blueLogo - y: 0 - } - PropertyChanges { - target: sketchLogo - opacity: 0 - } - }, - State { - extend: "showBlueprint" - name: "finale" - PropertyChanges { - target: fullLogo - opacity: 1 - } - PropertyChanges { - target: backLogo - opacity: 1 - scale: 1 - } - PropertyChanges { - target: frontLogo - opacity: 1 - scale: 1 - } - PropertyChanges { - target: qtText - opacity: 1 - scale: 1 - } - PropertyChanges { - target: sketchBlueHolder - opacity: 0 - scale: 1.4 - } - } - ] - - transitions: [ - Transition { - to: "showBlueprint" - SequentialAnimation { - NumberAnimation { property: "y"; duration: 600; easing.type: "OutBounce" } - PropertyAction { target: sketchLogo; property: "opacity" } - } - }, - Transition { - to: "finale" - PropertyAction { target: fullLogo; property: "opacity" } - SequentialAnimation { - NumberAnimation { target: backLogo; properties: "scale, opacity"; duration: 300 } - NumberAnimation { target: frontLogo; properties: "scale, opacity"; duration: 300 } - ParallelAnimation { - NumberAnimation { target: qtText; properties: "opacity, scale"; duration: 400; easing.type: "OutQuad" } - NumberAnimation { target: sketchBlueHolder; property: "opacity"; duration: 300; easing.type: "OutQuad" } - NumberAnimation { target: sketchBlueHolder; property: "scale"; duration: 320; easing.type: "OutQuad" } - } - PauseAnimation { duration: 1000 } - ScriptAction { script: myApp.animationFinished() } - } - } - ] - - Item { - id: fullLogo - opacity: 0 - Image { - id: backLogo - x: -16 - y: -41 - opacity: 0 - scale: 0.7 - smooth: true - source: "qt-back.png" - } - Image { - id: frontLogo - x: -17 - y: -41 - opacity: 0 - scale: 1.2 - smooth: true - source: "qt-front.png" - } - Image { - id: qtText - x: -10 - y: -41 - opacity: 0 - scale: 1.2 - smooth: true - source: "qt-text.png" - } - } -} diff --git a/share/qtcreator/qml/qmlobserver/startup/qt-back.png b/share/qtcreator/qml/qmlobserver/startup/qt-back.png deleted file mode 100644 index 077215f882f67b610bffdda72029ee8c2d7dd485..0000000000000000000000000000000000000000 Binary files a/share/qtcreator/qml/qmlobserver/startup/qt-back.png and /dev/null differ diff --git a/share/qtcreator/qml/qmlobserver/startup/qt-blue.jpg b/share/qtcreator/qml/qmlobserver/startup/qt-blue.jpg deleted file mode 100644 index b2048964836a6ef5056b6caaef326212d9b65ecc..0000000000000000000000000000000000000000 Binary files a/share/qtcreator/qml/qmlobserver/startup/qt-blue.jpg and /dev/null differ diff --git a/share/qtcreator/qml/qmlobserver/startup/qt-front.png b/share/qtcreator/qml/qmlobserver/startup/qt-front.png deleted file mode 100644 index dbfb43e374bb55847bb209fa60db200d197f3bef..0000000000000000000000000000000000000000 Binary files a/share/qtcreator/qml/qmlobserver/startup/qt-front.png and /dev/null differ diff --git a/share/qtcreator/qml/qmlobserver/startup/qt-sketch.jpg b/share/qtcreator/qml/qmlobserver/startup/qt-sketch.jpg deleted file mode 100644 index 1ede6f079b534e6ea55c3fbbb1c4f01721054649..0000000000000000000000000000000000000000 Binary files a/share/qtcreator/qml/qmlobserver/startup/qt-sketch.jpg and /dev/null differ diff --git a/share/qtcreator/qml/qmlobserver/startup/qt-text.png b/share/qtcreator/qml/qmlobserver/startup/qt-text.png deleted file mode 100644 index d44995c9b34ed3a9ff263becd861268e8a1b9441..0000000000000000000000000000000000000000 Binary files a/share/qtcreator/qml/qmlobserver/startup/qt-text.png and /dev/null differ diff --git a/share/qtcreator/qml/qmlobserver/startup/quick-blur.png b/share/qtcreator/qml/qmlobserver/startup/quick-blur.png deleted file mode 100644 index 29ec2433874bc2da07776332cdca881e7a9c73c3..0000000000000000000000000000000000000000 Binary files a/share/qtcreator/qml/qmlobserver/startup/quick-blur.png and /dev/null differ diff --git a/share/qtcreator/qml/qmlobserver/startup/quick-regular.png b/share/qtcreator/qml/qmlobserver/startup/quick-regular.png deleted file mode 100644 index 38321cbf19366635ad6f183a43a5ecda30304117..0000000000000000000000000000000000000000 Binary files a/share/qtcreator/qml/qmlobserver/startup/quick-regular.png and /dev/null differ diff --git a/share/qtcreator/qml/qmlobserver/startup/shadow.png b/share/qtcreator/qml/qmlobserver/startup/shadow.png deleted file mode 100644 index 44f92fee736f67843f88a74da87c109878d231ee..0000000000000000000000000000000000000000 Binary files a/share/qtcreator/qml/qmlobserver/startup/shadow.png and /dev/null differ diff --git a/share/qtcreator/qml/qmlobserver/startup/startup.qml b/share/qtcreator/qml/qmlobserver/startup/startup.qml deleted file mode 100644 index cc33425e40c22dcbd5158ee19473b9a0b89e480e..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/startup/startup.qml +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: treatsApp - width: 800 - height: 480 - color: "darkgrey" - Component.onCompleted: treatsApp.state = "part1" - signal animationFinished - - Item { - width: 800 - height: 480 - anchors.centerIn: parent - clip: true - - Logo { - id: logo - x: 165 - y: 35 - rotation: -15 - scale: 0.6 - opacity: 0 - onAnimationFinished: treatsApp.animationFinished(); - } - - Item { - id: quickblur - x: 800//325 - y: 344 - Image { - id: blurText - source: "quick-blur.png" - } - Image { - id: quickregular - x: -1 - y: 0 - opacity: 0 - source: "quick-regular.png" - } - Image { - id: star - x: -1 - y: 0 - opacity: 0 - source: "white-star.png" - smooth: true - NumberAnimation on rotation { - from: 0 - to: 360 - loops: NumberAnimation.Infinite - running: true - duration: 2000 - } - } - } - } - - states: [ - State { - name: "part1" - PropertyChanges { - target: logo - scale: 0.8 - opacity: 1 - rotation: 0 - } - PropertyChanges { - target: treatsApp - color: "black" - } - PropertyChanges { - target: logo - y: 10 - } - PropertyChanges { - target: quickblur - x: logo.x + 145 - } - PropertyChanges { - target: blurText - opacity: 0 - } - PropertyChanges { - target: quickregular - opacity: 1 - } - PropertyChanges { - target: star - x: -7 - y: -37 - } - } - ] - - transitions: [ - Transition { - ParallelAnimation { - NumberAnimation { target: logo; property: "opacity"; duration: 500 } - NumberAnimation { target: logo; property: "scale"; duration: 4000; } - NumberAnimation { target: logo; property: "rotation"; duration: 2000; easing.type: "OutBack"} - ColorAnimation { duration: 3000} - SequentialAnimation { - PauseAnimation { duration: 1000 } - ScriptAction { script: logo.logoState = "showBlueprint" } - PauseAnimation { duration: 800 } - ScriptAction { script: logo.logoState = "finale" } - PauseAnimation { duration: 800 } - ParallelAnimation { - NumberAnimation { target: quickblur; property: "x"; duration: 200;} - SequentialAnimation { - PauseAnimation { duration: 200} - ParallelAnimation { - NumberAnimation { target: blurText; property: "opacity"; duration: 300;} - NumberAnimation { target: quickregular; property: "opacity"; duration: 300;} - } - NumberAnimation { target: star; property: "opacity"; from: 0; to: 1; duration: 500 } - PauseAnimation { duration: 200 } - NumberAnimation { target: star; property: "opacity"; from: 1; to: 0; duration: 500 } - } - SequentialAnimation { - PauseAnimation { duration: 150} - NumberAnimation { target: logo; property: "y"; duration: 300; easing.type: "OutBounce" } - } - } - } - } - } - ] - -} // treatsApp diff --git a/share/qtcreator/qml/qmlobserver/startup/startup.qrc b/share/qtcreator/qml/qmlobserver/startup/startup.qrc deleted file mode 100644 index 52e67050d942814a73634c0565ba2003767e34b1..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/startup/startup.qrc +++ /dev/null @@ -1,16 +0,0 @@ -<RCC> - <qresource prefix="/startup"> - <file>Logo.qml</file> - <file>qt-back.png</file> - <file>qt-blue.jpg</file> - <file>qt-front.png</file> - <file>qt-sketch.jpg</file> - <file>qt-text.png</file> - <file>quick-blur.png</file> - <file>quick-regular.png</file> - <file>shadow.png</file> - <file>startup.qml</file> - <file>startup.qrc</file> - <file>white-star.png</file> - </qresource> -</RCC> diff --git a/share/qtcreator/qml/qmlobserver/startup/white-star.png b/share/qtcreator/qml/qmlobserver/startup/white-star.png deleted file mode 100644 index f467c9480e4fa553ea46c153ed8deec9b43394b7..0000000000000000000000000000000000000000 Binary files a/share/qtcreator/qml/qmlobserver/startup/white-star.png and /dev/null differ diff --git a/share/qtcreator/qml/qmlobserver/texteditautoresizer_maemo5.h b/share/qtcreator/qml/qmlobserver/texteditautoresizer_maemo5.h deleted file mode 100644 index 579390a695ddf4fe53a0f8fcc70cfa380d617efc..0000000000000000000000000000000000000000 --- a/share/qtcreator/qml/qmlobserver/texteditautoresizer_maemo5.h +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include <qplaintextedit.h> -#include <qtextedit.h> -#include <qabstractkineticscroller.h> -#include <qscrollarea.h> -#include <QDebug> - -#ifndef TEXTEDITAUTORESIZER_H -#define TEXTEDITAUTORESIZER_H - -class TextEditAutoResizer : public QObject -{ - Q_OBJECT -public: - TextEditAutoResizer(QWidget *parent) - : QObject(parent), plainTextEdit(qobject_cast<QPlainTextEdit *>(parent)), - textEdit(qobject_cast<QTextEdit *>(parent)), edit(qobject_cast<QFrame *>(parent)) - { - // parent must either inherit QPlainTextEdit or QTextEdit! - Q_ASSERT(plainTextEdit || textEdit); - - connect(parent, SIGNAL(textChanged()), this, SLOT(textEditChanged())); - connect(parent, SIGNAL(cursorPositionChanged()), this, SLOT(textEditChanged())); - - textEditChanged(); - } - -private Q_SLOTS: - inline void textEditChanged(); - -private: - QPlainTextEdit *plainTextEdit; - QTextEdit *textEdit; - QFrame *edit; -}; - -void TextEditAutoResizer::textEditChanged() -{ - QTextDocument *doc = textEdit ? textEdit->document() : plainTextEdit->document(); - QRect cursor = textEdit ? textEdit->cursorRect() : plainTextEdit->cursorRect(); - - QSize s = doc->size().toSize(); - if (plainTextEdit) - s.setHeight((s.height() + 2) * edit->fontMetrics().lineSpacing()); - - const QRect fr = edit->frameRect(); - const QRect cr = edit->contentsRect(); - - edit->setMinimumHeight(qMax(70, s.height() + (fr.height() - cr.height() - 1))); - - // make sure the cursor is visible in case we have a QAbstractScrollArea parent - QPoint pos = edit->pos(); - QWidget *pw = edit->parentWidget(); - while (pw) { - if (qobject_cast<QScrollArea *>(pw)) - break; - pw = pw->parentWidget(); - } - - if (pw) { - QScrollArea *area = static_cast<QScrollArea *>(pw); - QPoint scrollto = area->widget()->mapFrom(edit, cursor.center()); - QPoint margin(10 + cursor.width(), 2 * cursor.height()); - - if (QAbstractKineticScroller *scroller = area->property("kineticScroller").value<QAbstractKineticScroller *>()) { - scroller->ensureVisible(scrollto, margin.x(), margin.y()); - } else { - area->ensureVisible(scrollto.x(), scrollto.y(), margin.x(), margin.y()); - } - } -} - -#endif diff --git a/share/qtcreator/static.pro b/share/qtcreator/static.pro index 956659f6059906dc895d6aed1c2111e23ea96947..7795d9cec3abbd01d84d1b4e6de187b68faba417 100644 --- a/share/qtcreator/static.pro +++ b/share/qtcreator/static.pro @@ -72,9 +72,6 @@ OTHER_FILES += $$FILES dumpinfo.input = qml/qmldump/Info.plist.in dumpinfo.output = $$IDE_DATA_PATH/qml/qmldump/Info.plist QMAKE_SUBSTITUTES += dumpinfo - observerinfo.input = qml/qmlobserver/Info.plist.in - observerinfo.output = $$IDE_DATA_PATH/qml/qmlobserver/Info.plist - QMAKE_SUBSTITUTES += observerinfo puppetinfo.input = qml/qmlpuppet/qmlpuppet/Info.plist.in puppetinfo.output = $$IDE_DATA_PATH/qml/qmlpuppet/qmlpuppet/Info.plist QMAKE_SUBSTITUES += puppetinfo diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 6321d7a0dabdef590b0a146c504d0a26f6b20475..e7a1d5de2d5cdc6ac7507d2b3dbe2bd18b22b600 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1663,9 +1663,6 @@ void ProjectExplorerPlugin::showRunErrorMessage(const QString &errorMessage) if (errorMessage.isNull()) { // a error occured, but message was not set QMessageBox::critical(ICore::mainWindow(), tr("Unknown error"), errorMessage); - } else if (errorMessage.isEmpty()) { - // a error, but the message was set to empty - // hack for qml observer warning, show nothing at all } else { QMessageBox::critical(ICore::mainWindow(), tr("Could Not Run"), errorMessage); } diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp index 76f5bd808c7191df16b9bf3cacbc4d90af9de3cd..66e7802111ea82f070f3dcb80cea98416abc07d3 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp @@ -366,8 +366,6 @@ QbsBuildStepConfigWidget::QbsBuildStepConfigWidget(QbsBuildStep *step) : connect(m_ui->propertyEdit, SIGNAL(propertiesChanged()), this, SLOT(changeProperties())); connect(m_ui->qmlDebuggingLibraryCheckBox, SIGNAL(toggled(bool)), this, SLOT(linkQmlDebuggingLibraryChecked(bool))); - connect(m_ui->qmlDebuggingWarningText, SIGNAL(linkActivated(QString)), - this, SLOT(buildQmlDebuggingHelper())); connect(QtSupport::QtVersionManager::instance(), SIGNAL(dumpUpdatedFor(Utils::FileName)), this, SLOT(updateQmlDebuggingOption())); updateState(); @@ -531,12 +529,6 @@ void QbsBuildStepConfigWidget::linkQmlDebuggingLibraryChecked(bool checked) m_ignoreChange = false; } -void QbsBuildStepConfigWidget::buildQmlDebuggingHelper() -{ - QtSupport::BaseQtVersion::buildDebuggingHelper(m_step->target()->kit(), - static_cast<int>(QtSupport::DebuggingHelperBuildTask::QmlDebugging)); -} - // -------------------------------------------------------------------- // QbsBuildStepFactory: // -------------------------------------------------------------------- diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.h b/src/plugins/qbsprojectmanager/qbsbuildstep.h index a6e6827da94c8b0bc4c8eb733ea6b6bd66b6f014..f1ec50f67ba1ee3377d478298c368c0c54507240 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.h +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.h @@ -134,7 +134,6 @@ private slots: // QML debugging: void linkQmlDebuggingLibraryChecked(bool checked); - void buildQmlDebuggingHelper(); private: Ui::QbsBuildStepConfigWidget *m_ui; diff --git a/src/plugins/qmakeprojectmanager/qmakestep.cpp b/src/plugins/qmakeprojectmanager/qmakestep.cpp index 81efeff72a3a33031ab1c2ddd356cb57abe328d6..5a128fe711c3a4b731aa01e98f28a1465f117286 100644 --- a/src/plugins/qmakeprojectmanager/qmakestep.cpp +++ b/src/plugins/qmakeprojectmanager/qmakestep.cpp @@ -193,25 +193,9 @@ QStringList QMakeStep::deducedArguments() QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit()); if (linkQmlDebuggingLibrary() && version) { - if (!version->needsQmlDebuggingLibrary()) { - // This Qt version has the QML debugging services built in, however - // they still need to be enabled at compile time - // TODO: For Qt5, we can pass both arguments as there can be Qt Quick 1/2 projects. - // Currently there is no support for debugging multiple engines. - arguments << QLatin1String(Constants::QMAKEVAR_QUICK1_DEBUG); - if (version->qtVersion().majorVersion >= 5) - arguments << QLatin1String(Constants::QMAKEVAR_QUICK2_DEBUG); - } else { - const QString qmlDebuggingHelperLibrary = version->qmlDebuggingHelperLibrary(true); - if (!qmlDebuggingHelperLibrary.isEmpty()) { - // Do not turn debugger path into native path separators: Qmake does not like that! - const QString debuggingHelperPath - = QFileInfo(qmlDebuggingHelperLibrary).dir().path(); - - arguments << QLatin1String(Constants::QMAKEVAR_QMLJSDEBUGGER_PATH) - + QLatin1Char('=') + debuggingHelperPath; - } - } + arguments << QLatin1String(Constants::QMAKEVAR_QUICK1_DEBUG); + if (version->qtVersion().majorVersion >= 5) + arguments << QLatin1String(Constants::QMAKEVAR_QUICK2_DEBUG); } @@ -478,8 +462,6 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step) this, SLOT(buildConfigurationSelected())); connect(m_ui->qmlDebuggingLibraryCheckBox, SIGNAL(toggled(bool)), this, SLOT(linkQmlDebuggingLibraryChecked(bool))); - connect(m_ui->qmlDebuggingWarningText, SIGNAL(linkActivated(QString)), - this, SLOT(buildQmlDebuggingHelper())); connect(step, SIGNAL(userArgumentsChanged()), this, SLOT(userArgumentsChanged())); connect(step, SIGNAL(linkQmlDebuggingLibraryChanged()), @@ -600,12 +582,6 @@ void QMakeStepConfigWidget::linkQmlDebuggingLibraryChecked(bool checked) question->show(); } -void QMakeStepConfigWidget::buildQmlDebuggingHelper() -{ - QtSupport::BaseQtVersion::buildDebuggingHelper(m_step->target()->kit(), - static_cast<int>(QtSupport::DebuggingHelperBuildTask::QmlDebugging)); -} - void QMakeStepConfigWidget::updateSummaryLabel() { QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(m_step->target()->kit()); diff --git a/src/plugins/qmakeprojectmanager/qmakestep.h b/src/plugins/qmakeprojectmanager/qmakestep.h index 1e1ab8fbc4ba97e920e8ada5c56daca1ef8a4a5f..9eb537e146e437a5031cabd4631d5bc970d4118f 100644 --- a/src/plugins/qmakeprojectmanager/qmakestep.h +++ b/src/plugins/qmakeprojectmanager/qmakestep.h @@ -157,9 +157,6 @@ private slots: void buildConfigurationSelected(); void linkQmlDebuggingLibraryChecked(bool checked); - // other - void buildQmlDebuggingHelper(); - private slots: void recompileMessageBoxFinished(int button); diff --git a/src/plugins/qmakeprojectmanager/qmakestep.ui b/src/plugins/qmakeprojectmanager/qmakestep.ui index 43c5828044bb97a2da7f5533f976260d7952971c..0b6315c87887d5ff5026f33adc540daa57d33daf 100644 --- a/src/plugins/qmakeprojectmanager/qmakestep.ui +++ b/src/plugins/qmakeprojectmanager/qmakestep.ui @@ -14,7 +14,16 @@ <property name="fieldGrowthPolicy"> <enum>QFormLayout::ExpandingFieldsGrow</enum> </property> - <property name="margin"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> <number>0</number> </property> <item row="0" column="0"> @@ -27,7 +36,16 @@ <item row="0" column="1"> <widget class="QWidget" name="buildConfigurrationWidget" native="true"> <layout class="QHBoxLayout" name="horizontalLayout_2"> - <property name="margin"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> <number>0</number> </property> <item> @@ -86,7 +104,16 @@ <item row="2" column="1"> <widget class="QWidget" name="widget" native="true"> <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="margin"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> <number>0</number> </property> <item> diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.cpp b/src/plugins/qmlprofiler/qmlprofilerengine.cpp index de05868abfdd43313c97068ddc4da33526b8366f..c66a8f81e73631cf7ddb4cfe4b369ce57ca4d4a1 100644 --- a/src/plugins/qmlprofiler/qmlprofilerengine.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerengine.cpp @@ -113,16 +113,6 @@ bool QmlProfilerRunControl::startEngine() d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppStarting); - if (ProjectExplorer::LocalApplicationRunConfiguration *rc = - qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration())) { - if (rc->executable().isEmpty()) { - showQmlObserverToolWarning(); - d->m_profilerState->setCurrentState(QmlProfilerStateManager::Idle); - AnalyzerManager::stopTool(); - return false; - } - } - if (startParameters().startMode == StartLocal) { d->m_noDebugOutputTimer.start(); } else { @@ -317,28 +307,5 @@ void QmlProfilerRunControl::profilerStateChanged() } } -void QmlProfilerRunControl::showQmlObserverToolWarning() -{ - QMessageBox dialog(QApplication::activeWindow()); - QPushButton *qtPref = dialog.addButton(tr("Open Qt Versions"), - QMessageBox::ActionRole); - dialog.addButton(QMessageBox::Cancel); - dialog.setDefaultButton(qtPref); - dialog.setWindowTitle(tr("QML Observer Missing")); - dialog.setText(tr("QML Observer could not be found for this Qt version.")); - dialog.setInformativeText(tr( - "QML Observer is used to offer debugging features for " - "Qt Quick UI projects in the Qt 4.7 series.\n\n" - "To compile QML Observer, go to the Qt Versions page, " - "select the current Qt version, " - "and click Build in the Helpers section.")); - dialog.exec(); - if (dialog.clickedButton() == qtPref) { - Core::ICore::showOptionsDialog( - ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY, - QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID); - } -} - } // namespace Internal } // namespace QmlProfiler diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.h b/src/plugins/qmlprofiler/qmlprofilerengine.h index cfacd6f8a8b7a2a2e224d37d0adb863d6735270a..cf0b476f9f9e9d01720e4c0e7c83aeb71bd954f1 100644 --- a/src/plugins/qmlprofiler/qmlprofilerengine.h +++ b/src/plugins/qmlprofiler/qmlprofilerengine.h @@ -75,9 +75,6 @@ private slots: private slots: void profilerStateChanged(); -private: - void showQmlObserverToolWarning(); - private: class QmlProfilerEnginePrivate; QmlProfilerEnginePrivate *d; diff --git a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp index 067a9035a507988cc698a7e19e870f959577252c..b871be0795449425d4f099f5ca2232a6e8e84542 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp @@ -77,29 +77,6 @@ void QmlProjectPlugin::extensionsInitialized() { } -void QmlProjectPlugin::showQmlObserverToolWarning() -{ - QMessageBox dialog(QApplication::activeWindow()); - QPushButton *qtPref = dialog.addButton(tr("Open Qt Versions"), - QMessageBox::ActionRole); - dialog.addButton(QMessageBox::Cancel); - dialog.setDefaultButton(qtPref); - dialog.setWindowTitle(tr("QML Observer Missing")); - dialog.setText(tr("QML Observer could not be found for this Qt version.")); - dialog.setInformativeText(tr( - "QML Observer is used to offer debugging features for " - "Qt Quick UI projects in the Qt 4.7 series.\n\n" - "To compile QML Observer, go to the Qt Versions page, " - "select the current Qt version, " - "and click Build in the Helpers section.")); - dialog.exec(); - if (dialog.clickedButton() == qtPref) { - Core::ICore::showOptionsDialog( - ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY, - QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID); - } -} - } // namespace QmlProjectManager Q_EXPORT_PLUGIN(QmlProjectManager::QmlProjectPlugin) diff --git a/src/plugins/qmlprojectmanager/qmlprojectplugin.h b/src/plugins/qmlprojectmanager/qmlprojectplugin.h index 6cd6ae7016c48899a0dbe879eadddfbeaa04abfb..9ea0e83506b8a6e1b0fe3f6c308a5516b49abaf2 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectplugin.h +++ b/src/plugins/qmlprojectmanager/qmlprojectplugin.h @@ -47,8 +47,6 @@ public: virtual bool initialize(const QStringList &arguments, QString *errorString); virtual void extensionsInitialized(); - - static void showQmlObserverToolWarning(); }; } // namespace QmlProject diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp index 8ce33831b7775f9a897229379c18b96c2f90170b..024a4bf5af194e8541e3df9a5b0f57f155fd1e99 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp @@ -110,10 +110,7 @@ QString QmlProjectRunConfiguration::executable() const if (id() == Constants::QML_SCENE_RC_ID) return version->qmlsceneCommand(); - if (!version->needsQmlDebuggingLibrary()) - return version->qmlviewerCommand(); - return version->qmlObserverTool(); - + return version->qmlviewerCommand(); } ProjectExplorer::LocalApplicationRunConfiguration::RunMode QmlProjectRunConfiguration::runMode() const diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index c8c0d942365fc912732a2e83fc3c9b75e0dfeee0..626e94152677be26a11f0fb82dbda9dd9fad6d65 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -29,9 +29,7 @@ #include "baseqtversion.h" #include "qtconfigwidget.h" -#include "qmlobservertool.h" #include "qmldumptool.h" -#include "qmldebugginglibrary.h" #include "qtkitinformation.h" #include "qtversionmanager.h" @@ -141,8 +139,6 @@ BaseQtVersion::BaseQtVersion(const FileName &qmakeCommand, bool isAutodetected, m_isAutodetected(isAutodetected), m_hasDebuggingHelper(false), m_hasQmlDump(false), - m_hasQmlDebuggingLibrary(false), - m_hasQmlObserver(false), m_mkspecUpToDate(false), m_mkspecReadUpToDate(false), m_defaultConfigIsDebug(true), @@ -164,8 +160,6 @@ BaseQtVersion::BaseQtVersion() : m_id(-1), m_isAutodetected(false), m_hasDebuggingHelper(false), m_hasQmlDump(false), - m_hasQmlDebuggingLibrary(false), - m_hasQmlObserver(false), m_mkspecUpToDate(false), m_mkspecReadUpToDate(false), m_defaultConfigIsDebug(true), @@ -918,8 +912,6 @@ void BaseQtVersion::updateVersionInfo() const m_hasDocumentation = false; m_hasDebuggingHelper = false; m_hasQmlDump = false; - m_hasQmlDebuggingLibrary = false; - m_hasQmlObserver = false; if (!queryQMakeVariables(qmakeCommand(), qmakeRunEnvironment(), &m_versionInfo)) { m_qmakeIsExecutable = false; @@ -938,10 +930,6 @@ void BaseQtVersion::updateVersionInfo() const m_hasQmlDump = !QmlDumpTool::toolForQtPaths(qtInstallData, qtInstallBins, qtHeaderData, false).isEmpty() || !QmlDumpTool::toolForQtPaths(qtInstallData, qtInstallBins, qtHeaderData, true).isEmpty(); - m_hasQmlDebuggingLibrary - = !QmlDebuggingLibrary::libraryByInstallData(qtInstallData, false).isEmpty() - || !QmlDebuggingLibrary::libraryByInstallData(qtInstallData, true).isEmpty(); - m_hasQmlObserver = !QmlObserverTool::toolByInstallData(qtInstallData).isEmpty(); } } @@ -1107,23 +1095,6 @@ bool BaseQtVersion::needsQmlDump() const return qtVersion() < QtVersionNumber(4, 8, 0); } -bool BaseQtVersion::hasQmlDebuggingLibrary() const -{ - updateVersionInfo(); - return m_hasQmlDebuggingLibrary; -} - -bool BaseQtVersion::needsQmlDebuggingLibrary() const -{ - return qtVersion() < QtVersionNumber(4, 8, 0); -} - -bool BaseQtVersion::hasQmlObserver() const -{ - updateVersionInfo(); - return m_hasQmlObserver; -} - Environment BaseQtVersion::qmlToolsEnvironment() const { // FIXME: This seems broken! @@ -1160,22 +1131,6 @@ QString BaseQtVersion::qmlDumpTool(bool debugVersion) const return QmlDumpTool::toolForQtPaths(qtInstallData, qtInstallBins, qtHeaderData, debugVersion); } -QString BaseQtVersion::qmlDebuggingHelperLibrary(bool debugVersion) const -{ - QString qtInstallData = qmakeProperty("QT_INSTALL_DATA"); - if (qtInstallData.isEmpty()) - return QString(); - return QmlDebuggingLibrary::libraryByInstallData(qtInstallData, debugVersion); -} - -QString BaseQtVersion::qmlObserverTool() const -{ - QString qtInstallData = qmakeProperty("QT_INSTALL_DATA"); - if (qtInstallData.isEmpty()) - return QString(); - return QmlObserverTool::toolByInstallData(qtInstallData); -} - QStringList BaseQtVersion::debuggingHelperLibraryLocations() const { QString qtInstallData = qmakeProperty("QT_INSTALL_DATA"); @@ -1472,25 +1427,19 @@ bool BaseQtVersion::isQmlDebuggingSupported(Kit *k, QString *reason) bool BaseQtVersion::isQmlDebuggingSupported(QString *reason) const { - if (!needsQmlDebuggingLibrary() || hasQmlDebuggingLibrary()) - return true; - if (!isValid()) { if (reason) *reason = QCoreApplication::translate("BaseQtVersion", "Invalid Qt version."); return false; } - if (qtVersion() < QtVersionNumber(4, 7, 1)) { + if (qtVersion() < QtVersionNumber(4, 8, 0)) { if (reason) - *reason = QCoreApplication::translate("BaseQtVersion", "Requires Qt 4.7.1 or newer."); + *reason = QCoreApplication::translate("BaseQtVersion", "Requires Qt 4.8.0 or newer."); return false; } - if (reason) - *reason = QCoreApplication::translate("BaseQtVersion", "Library not available. <a href='compile'>Compile...</a>"); - - return false; + return true; } void BaseQtVersion::buildDebuggingHelper(Kit *k, int tools) diff --git a/src/plugins/qtsupport/baseqtversion.h b/src/plugins/qtsupport/baseqtversion.h index 40bb5908128acbc8996d9c2f975c2aa7db0d2566..5b382c2d6963ce27c136dbbbd314237711879550 100644 --- a/src/plugins/qtsupport/baseqtversion.h +++ b/src/plugins/qtsupport/baseqtversion.h @@ -193,18 +193,13 @@ public: virtual bool supportsBinaryDebuggingHelper() const; virtual QString gdbDebuggingHelperLibrary() const; - virtual QString qmlDebuggingHelperLibrary(bool debugVersion) const; virtual QString qmlDumpTool(bool debugVersion) const; - virtual QString qmlObserverTool() const; virtual QStringList debuggingHelperLibraryLocations() const; virtual bool hasGdbDebuggingHelper() const; virtual bool hasQmlDump() const; virtual bool hasQmlDumpWithRelocatableFlag() const; virtual bool needsQmlDump() const; - virtual bool hasQmlDebuggingLibrary() const; - virtual bool needsQmlDebuggingLibrary() const; - virtual bool hasQmlObserver() const; Utils::Environment qmlToolsEnvironment() const; virtual QtConfigWidget *createConfigurationWidget() const; @@ -270,8 +265,6 @@ private: bool m_isAutodetected; mutable bool m_hasDebuggingHelper; // controlled by m_versionInfoUpToDate mutable bool m_hasQmlDump; // controlled by m_versionInfoUpToDate - mutable bool m_hasQmlDebuggingLibrary; // controlled by m_versionInfoUpdate - mutable bool m_hasQmlObserver; // controlled by m_versionInfoUpToDate mutable bool m_mkspecUpToDate; mutable bool m_mkspecReadUpToDate; mutable bool m_defaultConfigIsDebug; diff --git a/src/plugins/qtsupport/debugginghelper.ui b/src/plugins/qtsupport/debugginghelper.ui index 56c484de5c529337c63701a8cf295a347ae903ca..cd7dba4e4b416d01cc92a6af08b5c618541ac086 100644 --- a/src/plugins/qtsupport/debugginghelper.ui +++ b/src/plugins/qtsupport/debugginghelper.ui @@ -6,16 +6,32 @@ <rect> <x>0</x> <y>0</y> - <width>404</width> - <height>176</height> + <width>330</width> + <height>85</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout"> - <property name="margin"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> <number>0</number> </property> <item> <layout class="QGridLayout" name="gridLayout"> + <item row="1" column="2"> + <widget class="QPushButton" name="qmlDumpBuildButton"> + <property name="text"> + <string>Build</string> + </property> + </widget> + </item> <item row="1" column="0"> <widget class="QLabel" name="qmlDumpLabel"> <property name="toolTip"> @@ -26,31 +42,15 @@ </property> </widget> </item> - <item row="1" column="1"> - <widget class="QLabel" name="qmlDumpStatus"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>2</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string notr="true">TextLabel</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="qmlObserverLabel"> - <property name="toolTip"> - <string>A modified version of qmlviewer with support for QML/JS debugging.</string> - </property> + <item row="2" column="2"> + <widget class="QPushButton" name="gdbHelperBuildButton"> <property name="text"> - <string>QML Observer:</string> + <string>Build</string> </property> </widget> </item> - <item row="3" column="1"> - <widget class="QLabel" name="qmlObserverStatus"> + <item row="1" column="1"> + <widget class="QLabel" name="qmlDumpStatus"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>2</horstretch> @@ -63,26 +63,6 @@ </widget> </item> <item row="2" column="0"> - <widget class="QLabel" name="qmlDebuggingLibLabel"> - <property name="text"> - <string>QML Debugging Library:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLabel" name="qmlDebuggingLibStatus"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>2</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string notr="true">TextLabel</string> - </property> - </widget> - </item> - <item row="4" column="0"> <widget class="QLabel" name="gdbHelperLabel"> <property name="toolTip"> <string>Helps showing content of Qt types. Only used in older versions of GDB.</string> @@ -92,7 +72,7 @@ </property> </widget> </item> - <item row="4" column="1"> + <item row="2" column="1"> <widget class="QLabel" name="gdbHelperStatus"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> @@ -105,34 +85,6 @@ </property> </widget> </item> - <item row="1" column="2"> - <widget class="QPushButton" name="qmlDumpBuildButton"> - <property name="text"> - <string>Build</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QPushButton" name="qmlDebuggingLibBuildButton"> - <property name="text"> - <string>Build</string> - </property> - </widget> - </item> - <item row="3" column="2"> - <widget class="QPushButton" name="qmlObserverBuildButton"> - <property name="text"> - <string>Build</string> - </property> - </widget> - </item> - <item row="4" column="2"> - <widget class="QPushButton" name="gdbHelperBuildButton"> - <property name="text"> - <string>Build</string> - </property> - </widget> - </item> </layout> </item> <item> diff --git a/src/plugins/qtsupport/debugginghelperbuildtask.cpp b/src/plugins/qtsupport/debugginghelperbuildtask.cpp index 9886945f7ec32cd65c969a6dadf03567640c62a6..090806562c40f6355dfa9eacadfa009026e1240c 100644 --- a/src/plugins/qtsupport/debugginghelperbuildtask.cpp +++ b/src/plugins/qtsupport/debugginghelperbuildtask.cpp @@ -30,8 +30,6 @@ #include "debugginghelperbuildtask.h" #include "debugginghelper.h" #include "qmldumptool.h" -#include "qmlobservertool.h" -#include "qmldebugginglibrary.h" #include "baseqtversion.h" #include "qtversionmanager.h" #include <utils/qtcassert.h> @@ -128,11 +126,6 @@ DebuggingHelperBuildTask::Tools DebuggingHelperBuildTask::availableTools(const B } if (QmlDumpTool::canBuild(version)) tools |= QmlDump; - if (QmlDebuggingLibrary::canBuild(version)) { - tools |= QmlDebugging; - if (QmlObserverTool::canBuild(version)) - tools |= QmlObserver; // requires QML debugging. - } return tools; } @@ -143,7 +136,7 @@ void DebuggingHelperBuildTask::showOutputOnError(bool show) void DebuggingHelperBuildTask::run(QFutureInterface<void> &future) { - future.setProgressRange(0, 5); + future.setProgressRange(0, 3); future.setProgressValue(1); if (m_invalidQt || !buildDebuggingHelper(future)) { @@ -203,47 +196,6 @@ bool DebuggingHelperBuildTask::buildDebuggingHelper(QFutureInterface<void> &futu return false; } future.setProgressValue(3); - - QString qmlDebuggingDirectory; - if (m_tools & QmlDebugging) { - QString output, error; - - qmlDebuggingDirectory = QmlDebuggingLibrary::copy(m_qtInstallData, &error); - - bool success = true; - arguments.directory = qmlDebuggingDirectory; - if (arguments.directory.isEmpty() - || !QmlDebuggingLibrary::build(arguments, &output, &error)) { - success = false; - } - - log(output, error); - if (!success) - return false; - } - future.setProgressValue(4); - - if (m_tools & QmlObserver) { - QString output, error; - bool success = true; - - arguments.directory = QmlObserverTool::copy(m_qtInstallData, &error); - arguments.qmakeArguments << QLatin1String("INCLUDEPATH+=\"\\\"") - + qmlDebuggingDirectory - + QLatin1String("include\\\"\""); - arguments.qmakeArguments << QLatin1String("LIBS+=-L\"\\\"") - + qmlDebuggingDirectory - + QLatin1String("\\\"\""); - - if (arguments.directory.isEmpty() - || !QmlObserverTool::build(arguments, &output, &error)) { - success = false; - } - log(output, error); - if (!success) - return false; - } - future.setProgressValue(5); return true; } diff --git a/src/plugins/qtsupport/debugginghelperbuildtask.h b/src/plugins/qtsupport/debugginghelperbuildtask.h index 6d8cd7efcaf0c3d400b107265608d48917ac23bc..dc767cf0cf96bb26c9589fa3a18b7888fdc64074 100644 --- a/src/plugins/qtsupport/debugginghelperbuildtask.h +++ b/src/plugins/qtsupport/debugginghelperbuildtask.h @@ -51,10 +51,8 @@ class QTSUPPORT_EXPORT DebuggingHelperBuildTask : public QObject public: enum DebuggingHelper { GdbDebugging = 0x01, - QmlDebugging = 0x02, - QmlObserver = 0x04, - QmlDump = 0x08, - AllTools = GdbDebugging | QmlDebugging | QmlObserver | QmlDump + QmlDump = 0x02, + AllTools = GdbDebugging | QmlDump }; Q_DECLARE_FLAGS(Tools, DebuggingHelper) diff --git a/src/plugins/qtsupport/qmldebugginglibrary.cpp b/src/plugins/qtsupport/qmldebugginglibrary.cpp deleted file mode 100644 index f2a90a45ad5c0dd565027aff19d6b78b80680523..0000000000000000000000000000000000000000 --- a/src/plugins/qtsupport/qmldebugginglibrary.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "qmldebugginglibrary.h" - -#include "baseqtversion.h" -#include <coreplugin/icore.h> - -#include <QDesktopServices> -#include <QCoreApplication> -#include <QDir> -#include <QDebug> - -namespace QtSupport { - - -QString QmlDebuggingLibrary::libraryByInstallData(const QString &qtInstallData, bool debugBuild) -{ - if (!Core::ICore::instance()) - return QString(); - - const QStringList directories = installDirectories(qtInstallData); - - QStringList binFilenames; - if (debugBuild) { - binFilenames << QLatin1String("QmlJSDebuggerd.lib"); - binFilenames << QLatin1String("libQmlJSDebuggerd.a"); // mingw - } else { - binFilenames << QLatin1String("QmlJSDebugger.lib"); - } - binFilenames << QLatin1String("libQmlJSDebugger.a"); - binFilenames << QLatin1String("QmlJSDebugger.prl"); // Symbian. Note that the actual lib is in EPOCROOT - - return byInstallDataHelper(sourcePath(), sourceFileNames(), directories, binFilenames, false); -} - -bool QmlDebuggingLibrary::canBuild(const BaseQtVersion *qtVersion, QString *reason) -{ - if (qtVersion->qtVersion() < QtVersionNumber(4, 7, 1)) { - if (reason) - *reason = QCoreApplication::translate("QmakeProjectManager::QmlDebuggingLibrary", "Only available for Qt 4.7.1 or newer."); - return false; - } - if (qtVersion->qtVersion() >= QtVersionNumber(4, 8, 0)) { - if (reason) - *reason = QCoreApplication::translate("QmakeProjectManager::QmlDebuggingLibrary", "Not needed."); - return false; - } - return true; -} - -bool QmlDebuggingLibrary::build(BuildHelperArguments arguments, QString *log, QString *errorMessage) -{ - arguments.helperName = QCoreApplication::translate("QmakeProjectManager::QmlDebuggingLibrary", "QML Debugging"); - arguments.proFilename = QLatin1String("qmljsdebugger.pro"); - return buildHelper(arguments, log, errorMessage); -} - -static inline bool mkpath(const QString &targetDirectory, QString *errorMessage) -{ - if (!QDir().mkpath(targetDirectory)) { - *errorMessage = QCoreApplication::translate("QmakeProjectManager::QmlDebuggingLibrary", "The target directory %1 could not be created.").arg(targetDirectory); - return false; - } - return true; -} - -QString QmlDebuggingLibrary::copy(const QString &qtInstallData, QString *errorMessage) -{ - const QStringList directories = QmlDebuggingLibrary::installDirectories(qtInstallData); - - // Try to find a writeable directory. - foreach (const QString &directory, directories) { - if (!mkpath(directory, errorMessage)) - continue; - else - errorMessage->clear(); - - if (copyFiles(sourcePath(), sourceFileNames(), - directory, errorMessage)) - { - errorMessage->clear(); - return directory; - } - } - *errorMessage = QCoreApplication::translate("QmakeProjectManager::QmlDebuggingLibrary", - "QML Debugging library could not be built in any of the directories:\n- %1\n\nReason: %2") - .arg(directories.join(QLatin1String("\n- ")), *errorMessage); - return QString(); -} - -QStringList QmlDebuggingLibrary::recursiveFileList(const QDir &dir, const QString &prefix) -{ - QStringList files; - - QString _prefix = prefix; - if (!_prefix.isEmpty() && !_prefix.endsWith(QLatin1Char('/'))) - _prefix = _prefix + QLatin1Char('/'); - foreach (const QString &fileName, dir.entryList(QDir::Files)) { - files << _prefix + fileName; - } - - foreach (const QString &subDir, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) { - files += recursiveFileList(QDir(dir.absoluteFilePath(subDir)), _prefix + subDir); - } - return files; -} - -QStringList QmlDebuggingLibrary::installDirectories(const QString &qtInstallData) -{ - const QChar slash = QLatin1Char('/'); - const uint hash = qHash(qtInstallData); - QStringList directories; - directories - << (qtInstallData + QLatin1String("/qtc-qmldbg/")) - << QDir::cleanPath((QCoreApplication::applicationDirPath() + QLatin1String("/../qtc-qmldbg/") + QString::number(hash))) + slash - << (QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QLatin1String("/qtc-qmldbg/") + QString::number(hash)) + slash; - return directories; -} - -QString QmlDebuggingLibrary::sourcePath() -{ - return Core::ICore::resourcePath() + QLatin1String("/qml/qmljsdebugger/"); -} - -QStringList QmlDebuggingLibrary::sourceFileNames() -{ - return recursiveFileList(QDir(sourcePath())); -} - -} // namespace diff --git a/src/plugins/qtsupport/qmldebugginglibrary.h b/src/plugins/qtsupport/qmldebugginglibrary.h deleted file mode 100644 index 64a16a1e874a5f97688137ef46c4d382d89b322b..0000000000000000000000000000000000000000 --- a/src/plugins/qtsupport/qmldebugginglibrary.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QMLDEBUGGINGLIBRARY_H -#define QMLDEBUGGINGLIBRARY_H - -#include <utils/buildablehelperlibrary.h> - -QT_FORWARD_DECLARE_CLASS(QDir) - -namespace Utils { - class Environment; -} - -namespace ProjectExplorer { - class Project; -} - -namespace QtSupport { - -class BaseQtVersion; - -class QmlDebuggingLibrary : public Utils::BuildableHelperLibrary -{ -public: - static QString libraryByInstallData(const QString &qtInstallData, bool debugBuild); - - static bool canBuild(const BaseQtVersion *qtVersion, QString *reason = 0); - static bool build(BuildHelperArguments arguments, QString *log, QString *errorMessage); - - static QString copy(const QString &qtInstallData, QString *errorMessage); - -private: - static QStringList recursiveFileList(const QDir &dir, const QString &prefix = QString()); - static QStringList installDirectories(const QString &qtInstallData); - static QString sourcePath(); - static QStringList sourceFileNames(); -}; - -} // namespace - -#endif // QMLDEBUGGINGLIBRARY_H diff --git a/src/plugins/qtsupport/qmlobservertool.cpp b/src/plugins/qtsupport/qmlobservertool.cpp deleted file mode 100644 index 9479645293f4ab160b7f8eade06ac6ad932885fc..0000000000000000000000000000000000000000 --- a/src/plugins/qtsupport/qmlobservertool.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "qmlobservertool.h" - -#include "qtsupportconstants.h" -#include "baseqtversion.h" -#include <coreplugin/icore.h> - -#include <QDesktopServices> -#include <QCoreApplication> -#include <QDir> -#include <QDebug> - -namespace QtSupport { - -static QStringList recursiveFileList(const QDir &dir, const QString &prefix) -{ - QStringList files; - - QString _prefix = prefix; - if (!_prefix.isEmpty() && !_prefix.endsWith(QLatin1Char('/'))) - _prefix.append(QLatin1Char('/')); - - foreach (const QString &fileName, dir.entryList(QDir::Files)) - files << _prefix + fileName; - - foreach (const QString &subDir, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) - files += recursiveFileList(QDir(dir.absoluteFilePath(subDir)), _prefix + subDir); - - return files; -} - -static QStringList installDirectories(const QString &qtInstallData) -{ - const QChar slash = QLatin1Char('/'); - const uint hash = qHash(qtInstallData); - QStringList directories; - directories - << (qtInstallData + QLatin1String("/qtc-qmlobserver/")) - << QDir::cleanPath((QCoreApplication::applicationDirPath() + QLatin1String("/../qtc-qmlobserver/") + QString::number(hash))) + slash - << (QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QLatin1String("/qtc-qmlobserver/") + QString::number(hash)) + slash; - return directories; -} - -static QString sourcePath() -{ - return Core::ICore::resourcePath() + QLatin1String("/qml/qmlobserver/"); -} - -static QStringList sourceFileNames() -{ - return recursiveFileList(QDir(sourcePath()), QString()); -} - -static QStringList validBinaryFilenames() -{ - return QStringList() - << QLatin1String("debug/qmlobserver.exe") - << QLatin1String("qmlobserver.exe") - << QLatin1String("qmlobserver") - << QLatin1String("QMLObserver.app/Contents/MacOS/QMLObserver"); -} - -bool QmlObserverTool::canBuild(const BaseQtVersion *qtVersion, QString *reason) -{ - if (qtVersion->type() != QLatin1String(Constants::DESKTOPQT) - && qtVersion->type() != QLatin1String(Constants::SIMULATORQT)) { - if (reason) - *reason = QCoreApplication::translate("QmakeProjectManager::QmlObserverTool", "Only available for Qt for Desktop or Qt for Qt Simulator."); - return false; - } - - if (qtVersion->qtVersion() < QtVersionNumber(4, 7, 1)) { - if (reason) - *reason = QCoreApplication::translate("QmakeProjectManager::QmlObserverTool", "Only available for Qt 4.7.1 or newer."); - return false; - } - if (qtVersion->qtVersion() >= QtVersionNumber(4, 8, 0)) { - if (reason) - *reason = QCoreApplication::translate("QmakeProjectManager::QmlObserverTool", "Not needed."); - return false; - } - return true; -} - -QString QmlObserverTool::toolByInstallData(const QString &qtInstallData) -{ - if (!Core::ICore::instance()) - return QString(); - - const QStringList directories = installDirectories(qtInstallData); - const QStringList binFilenames = validBinaryFilenames(); - - return byInstallDataHelper(sourcePath(), sourceFileNames(), directories, binFilenames, false); -} - -QStringList QmlObserverTool::locationsByInstallData(const QString &qtInstallData) -{ - QStringList result; - QFileInfo fileInfo; - const QStringList binFilenames = validBinaryFilenames(); - foreach (const QString &directory, installDirectories(qtInstallData)) { - if (getHelperFileInfoFor(binFilenames, directory, &fileInfo)) - result << fileInfo.filePath(); - } - return result; -} - -bool QmlObserverTool::build(BuildHelperArguments arguments, QString *log, QString *errorMessage) -{ - arguments.helperName = QCoreApplication::translate("QmakeProjectManager::QmlObserverTool", "QMLObserver"); - arguments.proFilename = QLatin1String("qmlobserver.pro"); - - return buildHelper(arguments, log, errorMessage); -} - -static inline bool mkpath(const QString &targetDirectory, QString *errorMessage) -{ - if (!QDir().mkpath(targetDirectory)) { - *errorMessage = QCoreApplication::translate("ProjectExplorer::QmlObserverTool", "The target directory %1 could not be created.").arg(targetDirectory); - return false; - } - return true; -} - -QString QmlObserverTool::copy(const QString &qtInstallData, QString *errorMessage) -{ - const QStringList directories = installDirectories(qtInstallData); - - // Try to find a writable directory. - foreach (const QString &directory, directories) { - if (!mkpath(directory, errorMessage)) - continue; - - errorMessage->clear(); - - if (copyFiles(sourcePath(), sourceFileNames(), directory, errorMessage)) { - errorMessage->clear(); - return directory; - } - } - *errorMessage = QCoreApplication::translate("ProjectExplorer::QmlObserverTool", - "QMLObserver could not be built in any of the directories:\n- %1\n\nReason: %2") - .arg(directories.join(QLatin1String("\n- ")), *errorMessage); - return QString(); -} - -} // namespace diff --git a/src/plugins/qtsupport/qmlobservertool.h b/src/plugins/qtsupport/qmlobservertool.h deleted file mode 100644 index ab7985853a42d6c247cd36f6b2d24ddd0802d8c2..0000000000000000000000000000000000000000 --- a/src/plugins/qtsupport/qmlobservertool.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QMLOBSERVERTOOL_H -#define QMLOBSERVERTOOL_H - -#include "qtsupport_global.h" -#include <utils/buildablehelperlibrary.h> - -namespace QtSupport { - -class BaseQtVersion; - -class QTSUPPORT_EXPORT QmlObserverTool : public Utils::BuildableHelperLibrary -{ -public: - static bool canBuild(const BaseQtVersion *qtVersion, QString *reason = 0); - static QString toolByInstallData(const QString &qtInstallData); - static QStringList locationsByInstallData(const QString &qtInstallData); - - // Build the helpers and return the output log/errormessage. - static bool build(BuildHelperArguments arguments, QString *out, QString *err); - - // Copy the source files to a target location and return the chosen target location. - static QString copy(const QString &qtInstallData, QString *errorMessage); -}; - -} // namespace QtSupport - -#endif // QMLOBSERVERTOOL_H diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp index e3047d39c1b9c7361872418ae1d2ea33615d5d18..8ac4570e4f90b183f1c6001049717ef75a504676 100644 --- a/src/plugins/qtsupport/qtoptionspage.cpp +++ b/src/plugins/qtsupport/qtoptionspage.cpp @@ -37,8 +37,6 @@ #include "qtversionmanager.h" #include "qtversionfactory.h" #include "qmldumptool.h" -#include "qmldebugginglibrary.h" -#include "qmlobservertool.h" #include <coreplugin/progressmanager/progressmanager.h> #include <projectexplorer/toolchainmanager.h> @@ -179,10 +177,6 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent) this, SLOT(buildGdbHelper())); connect(m_debuggingHelperUi->qmlDumpBuildButton, SIGNAL(clicked()), this, SLOT(buildQmlDump())); - connect(m_debuggingHelperUi->qmlDebuggingLibBuildButton, SIGNAL(clicked()), - this, SLOT(buildQmlDebuggingLibrary())); - connect(m_debuggingHelperUi->qmlObserverBuildButton, SIGNAL(clicked()), - this, SLOT(buildQmlObserver())); connect(m_debuggingHelperUi->showLogButton, SIGNAL(clicked()), this, SLOT(slotShowDebuggingBuildLog())); @@ -248,12 +242,8 @@ void QtOptionsPageWidget::debuggingHelperBuildFinished(int qtVersionId, const QS bool success = true; if (tools & DebuggingHelperBuildTask::GdbDebugging) success &= version->hasGdbDebuggingHelper(); - if (tools & DebuggingHelperBuildTask::QmlDebugging) - success &= version->hasQmlDebuggingLibrary(); if (tools & DebuggingHelperBuildTask::QmlDump) success &= version->hasQmlDump(); - if (tools & DebuggingHelperBuildTask::QmlObserver) - success &= version->hasQmlObserver(); if (!success) showDebuggingBuildLog(item); @@ -470,19 +460,6 @@ void QtOptionsPageWidget::buildQmlDump() buildDebuggingHelper(DebuggingHelperBuildTask::QmlDump); } -void QtOptionsPageWidget::buildQmlDebuggingLibrary() -{ - buildDebuggingHelper(DebuggingHelperBuildTask::QmlDebugging); -} - -void QtOptionsPageWidget::buildQmlObserver() -{ - DebuggingHelperBuildTask::Tools qmlDbgTools = - DebuggingHelperBuildTask::QmlObserver; - qmlDbgTools |= DebuggingHelperBuildTask::QmlDebugging; - buildDebuggingHelper(qmlDbgTools); -} - // Non-modal dialog class BuildLogDialog : public QDialog { public: @@ -741,28 +718,19 @@ void QtOptionsPageWidget::updateDebuggingHelperUi() const DebuggingHelperBuildTask::Tools availableTools = DebuggingHelperBuildTask::availableTools(version); const bool canBuildGdbHelper = availableTools & DebuggingHelperBuildTask::GdbDebugging; const bool canBuildQmlDumper = availableTools & DebuggingHelperBuildTask::QmlDump; - const bool canBuildQmlDebuggingLib = availableTools & DebuggingHelperBuildTask::QmlDebugging; - const bool canBuildQmlObserver = availableTools & DebuggingHelperBuildTask::QmlObserver; const bool hasGdbHelper = !version->gdbDebuggingHelperLibrary().isEmpty(); const bool hasQmlDumper = version->hasQmlDump(); const bool needsQmlDumper = version->needsQmlDump(); - const bool hasQmlDebuggingLib = version->hasQmlDebuggingLibrary(); - const bool needsQmlDebuggingLib = version->needsQmlDebuggingLibrary(); - const bool hasQmlObserver = !version->qmlObserverTool().isEmpty(); bool isBuildingGdbHelper = false; bool isBuildingQmlDumper = false; - bool isBuildingQmlDebuggingLib = false; - bool isBuildingQmlObserver = false; if (currentItem) { DebuggingHelperBuildTask::Tools buildingTools = currentItem->data(0, BuildRunningRole).value<DebuggingHelperBuildTask::Tools>(); isBuildingGdbHelper = buildingTools & DebuggingHelperBuildTask::GdbDebugging; isBuildingQmlDumper = buildingTools & DebuggingHelperBuildTask::QmlDump; - isBuildingQmlDebuggingLib = buildingTools & DebuggingHelperBuildTask::QmlDebugging; - isBuildingQmlObserver = buildingTools & DebuggingHelperBuildTask::QmlObserver; } // get names of tools from labels @@ -772,10 +740,6 @@ void QtOptionsPageWidget::updateDebuggingHelperUi() helperNames << m_debuggingHelperUi->gdbHelperLabel->text().remove(colon); if (hasQmlDumper) helperNames << m_debuggingHelperUi->qmlDumpLabel->text().remove(colon); - if (hasQmlDebuggingLib) - helperNames << m_debuggingHelperUi->qmlDebuggingLibLabel->text().remove(colon); - if (hasQmlObserver) - helperNames << m_debuggingHelperUi->qmlObserverLabel->text().remove(colon); QString status; if (helperNames.isEmpty()) { @@ -829,60 +793,6 @@ void QtOptionsPageWidget::updateDebuggingHelperUi() m_debuggingHelperUi->qmlDumpStatus->setToolTip(qmlDumpStatusToolTip); m_debuggingHelperUi->qmlDumpBuildButton->setEnabled(canBuildQmlDumper & !isBuildingQmlDumper); - QString qmlDebuggingLibStatusText, qmlDebuggingLibToolTip; - Qt::TextInteractionFlags qmlDebuggingLibStatusTextFlags = Qt::NoTextInteraction; - if (hasQmlDebuggingLib) { - qmlDebuggingLibStatusText = QDir::toNativeSeparators( - version->qmlDebuggingHelperLibrary(false)); - const QString debugPath = QDir::toNativeSeparators( - version->qmlDebuggingHelperLibrary(true)); - - if (qmlDebuggingLibStatusText != debugPath) { - if (!qmlDebuggingLibStatusText.isEmpty() - && !debugPath.isEmpty()) { - qmlDebuggingLibStatusText += QLatin1Char('\n'); - } - qmlDebuggingLibStatusText += debugPath; - } - qmlDebuggingLibStatusTextFlags = Qt::TextSelectableByMouse; - } else { - if (!needsQmlDebuggingLib) { - qmlDebuggingLibStatusText = tr("<i>Not needed.</i>"); - } else if (canBuildQmlDebuggingLib) { - qmlDebuggingLibStatusText = tr("<i>Not yet built.</i>"); - } else { - qmlDebuggingLibStatusText = tr("<i>Cannot be compiled.</i>"); - QmlDebuggingLibrary::canBuild(version, &qmlDebuggingLibToolTip); - } - } - m_debuggingHelperUi->qmlDebuggingLibStatus->setText(qmlDebuggingLibStatusText); - m_debuggingHelperUi->qmlDebuggingLibStatus->setTextInteractionFlags(qmlDebuggingLibStatusTextFlags); - m_debuggingHelperUi->qmlDebuggingLibStatus->setToolTip(qmlDebuggingLibToolTip); - m_debuggingHelperUi->qmlDebuggingLibBuildButton->setEnabled(needsQmlDebuggingLib - && canBuildQmlDebuggingLib - && !isBuildingQmlDebuggingLib); - - QString qmlObserverStatusText, qmlObserverToolTip; - Qt::TextInteractionFlags qmlObserverStatusTextFlags = Qt::NoTextInteraction; - if (hasQmlObserver) { - qmlObserverStatusText = QDir::toNativeSeparators(version->qmlObserverTool()); - qmlObserverStatusTextFlags = Qt::TextSelectableByMouse; - } else { - if (!needsQmlDebuggingLib) { - qmlObserverStatusText = tr("<i>Not needed.</i>"); - } else if (canBuildQmlObserver) { - qmlObserverStatusText = tr("<i>Not yet built.</i>"); - } else { - qmlObserverStatusText = tr("<i>Cannot be compiled.</i>"); - QmlObserverTool::canBuild(version, &qmlObserverToolTip); - } - } - m_debuggingHelperUi->qmlObserverStatus->setText(qmlObserverStatusText); - m_debuggingHelperUi->qmlObserverStatus->setTextInteractionFlags(qmlObserverStatusTextFlags); - m_debuggingHelperUi->qmlObserverStatus->setToolTip(qmlObserverToolTip); - m_debuggingHelperUi->qmlObserverBuildButton->setEnabled(canBuildQmlObserver - & !isBuildingQmlObserver); - QList<ToolChain*> toolchains = toolChains(currentVersion()); QString selectedToolChainId = currentItem->data(0, ToolChainIdRole).toString(); m_debuggingHelperUi->toolChainComboBox->clear(); @@ -901,13 +811,9 @@ void QtOptionsPageWidget::updateDebuggingHelperUi() m_debuggingHelperUi->showLogButton->setEnabled(hasLog); const bool canBuild = canBuildGdbHelper - || canBuildQmlDumper - || (canBuildQmlDebuggingLib && needsQmlDebuggingLib) - || canBuildQmlObserver; + || canBuildQmlDumper; const bool isBuilding = isBuildingGdbHelper - || isBuildingQmlDumper - || isBuildingQmlDebuggingLib - || isBuildingQmlObserver; + || isBuildingQmlDumper; m_debuggingHelperUi->rebuildButton->setEnabled(canBuild && !isBuilding); m_debuggingHelperUi->toolChainComboBox->setEnabled(canBuild && !isBuilding); @@ -1112,8 +1018,7 @@ QString QtOptionsPageWidget::searchKeywords() const ts << sep << m_versionUi->versionNameLabel->text() << sep << m_versionUi->pathLabel->text() << sep << m_debuggingHelperUi->gdbHelperLabel->text() - << sep << m_debuggingHelperUi->qmlDumpLabel->text() - << sep << m_debuggingHelperUi->qmlObserverLabel->text(); + << sep << m_debuggingHelperUi->qmlDumpLabel->text(); rc.remove(QLatin1Char('&')); return rc; diff --git a/src/plugins/qtsupport/qtoptionspage.h b/src/plugins/qtsupport/qtoptionspage.h index 2e68d391f7cf1ae2bf7b3dc41c8d8e5d2048cb5e..5d506c3bbe9c7733675b4a605c3f309784191a33 100644 --- a/src/plugins/qtsupport/qtoptionspage.h +++ b/src/plugins/qtsupport/qtoptionspage.h @@ -108,8 +108,6 @@ private slots: = DebuggingHelperBuildTask::AllTools); void buildGdbHelper(); void buildQmlDump(); - void buildQmlDebuggingLibrary(); - void buildQmlObserver(); void slotShowDebuggingBuildLog(); void debuggingHelperBuildFinished(int qtVersionId, const QString &output, DebuggingHelperBuildTask::Tools tools); diff --git a/src/plugins/qtsupport/qtsupport.pro b/src/plugins/qtsupport/qtsupport.pro index b6c5cd40c8cbcc0fbe997934eaae26128d78a1aa..df7fe51a81bd004294fb4f326f9e42d62301f837 100644 --- a/src/plugins/qtsupport/qtsupport.pro +++ b/src/plugins/qtsupport/qtsupport.pro @@ -17,8 +17,6 @@ HEADERS += \ uicodemodelsupport.h \ baseqtversion.h \ qmldumptool.h \ - qmlobservertool.h \ - qmldebugginglibrary.h \ qtoptionspage.h \ customexecutablerunconfiguration.h \ customexecutableconfigurationwidget.h \ @@ -48,8 +46,6 @@ SOURCES += \ uicodemodelsupport.cpp \ baseqtversion.cpp \ qmldumptool.cpp \ - qmlobservertool.cpp \ - qmldebugginglibrary.cpp \ qtoptionspage.cpp \ customexecutablerunconfiguration.cpp \ customexecutableconfigurationwidget.cpp \ diff --git a/src/plugins/qtsupport/qtsupport.qbs b/src/plugins/qtsupport/qtsupport.qbs index e764c190cb58a716b5dd02b7e45369a4bea245e6..72f0597a6ad15257f6f691b03cc1694bc24821e4 100644 --- a/src/plugins/qtsupport/qtsupport.qbs +++ b/src/plugins/qtsupport/qtsupport.qbs @@ -74,12 +74,8 @@ QtcPlugin { "exampleslistmodel.h", "profilereader.cpp", "profilereader.h", - "qmldebugginglibrary.cpp", - "qmldebugginglibrary.h", "qmldumptool.cpp", "qmldumptool.h", - "qmlobservertool.cpp", - "qmlobservertool.h", "qtkitconfigwidget.cpp", "qtkitconfigwidget.h", "qtkitinformation.cpp",