diff options
author | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2011-05-30 16:32:25 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@nokia.com> | 2011-05-31 09:44:09 +0200 |
commit | 335f6ad0f7f81a2bd928346d30949bee646cebe7 (patch) | |
tree | 2d3b50d3c3ef2fb52521633fa82716bba1ab1d78 /share/qtcreator/qml/qmljsdebugger | |
parent | e0f79761f3a3d43bcff2b46736c0cf6aa4572bac (diff) | |
download | qt-creator-335f6ad0f7f81a2bd928346d30949bee646cebe7.tar.gz |
QmlJSInspector: Renamed Observer to Inspector
Manually redid Qt 4.8 commit 206ebd5af21d94c3f3b49d2cb645105a63e6f5fb,
to make future code synchronization easier.
In order not to have to change the QmlApplicationViewer again, a
compatibility class QDeclarativeViewObserver is retained that subclasses
QDeclarativeViewInspector.
Change-Id: Ief87ae2f8f76b1db0c9d65085e4832424b277603
Reviewed-on: http://codereview.qt.nokia.com/242
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Diffstat (limited to 'share/qtcreator/qml/qmljsdebugger')
36 files changed, 368 insertions, 314 deletions
diff --git a/share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.cpp index 0cad361bc6..58afa5a9e2 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.cpp @@ -31,8 +31,8 @@ **************************************************************************/ #include "abstractliveedittool.h" -#include "qdeclarativeviewobserver.h" -#include "../qdeclarativeviewobserver_p.h" +#include "qdeclarativeviewinspector.h" +#include "../qdeclarativeviewinspector_p.h" #include <QDeclarativeEngine> @@ -42,8 +42,8 @@ namespace QmlJSDebugger { -AbstractLiveEditTool::AbstractLiveEditTool(QDeclarativeViewObserver *editorView) - : QObject(editorView), m_observer(editorView) +AbstractLiveEditTool::AbstractLiveEditTool(QDeclarativeViewInspector *editorView) + : QObject(editorView), m_inspector(editorView) { } @@ -52,14 +52,14 @@ AbstractLiveEditTool::~AbstractLiveEditTool() { } -QDeclarativeViewObserver *AbstractLiveEditTool::observer() const +QDeclarativeViewInspector *AbstractLiveEditTool::inspector() const { - return m_observer; + return m_inspector; } QDeclarativeView *AbstractLiveEditTool::view() const { - return m_observer->declarativeView(); + return m_inspector->declarativeView(); } QGraphicsScene* AbstractLiveEditTool::scene() const @@ -74,7 +74,7 @@ void AbstractLiveEditTool::updateSelectedItems() QList<QGraphicsItem*> AbstractLiveEditTool::items() const { - return observer()->selectedItems(); + return inspector()->selectedItems(); } bool AbstractLiveEditTool::topItemIsMovable(const QList<QGraphicsItem*> & itemList) @@ -91,7 +91,7 @@ bool AbstractLiveEditTool::topItemIsMovable(const QList<QGraphicsItem*> & itemLi bool AbstractLiveEditTool::topSelectedItemIsMovable(const QList<QGraphicsItem*> &itemList) { - QList<QGraphicsItem*> selectedItems = observer()->selectedItems(); + QList<QGraphicsItem*> selectedItems = inspector()->selectedItems(); foreach (QGraphicsItem *item, itemList) { QDeclarativeItem *declarativeItem = toQDeclarativeItem(item); @@ -167,7 +167,7 @@ QString AbstractLiveEditTool::titleForItem(QGraphicsItem *item) QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem*>(gfxObject); if (declarativeItem) { - objectStringId = QDeclarativeViewObserver::idStringForObject(declarativeItem); + objectStringId = QDeclarativeViewInspector::idStringForObject(declarativeItem); } if (!objectStringId.isEmpty()) { diff --git a/share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.h b/share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.h index 66896564f3..8fbfc9af47 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.h @@ -49,7 +49,7 @@ QT_END_NAMESPACE namespace QmlJSDebugger { -class QDeclarativeViewObserver; +class QDeclarativeViewInspector; class FormEditorView; @@ -57,7 +57,7 @@ class AbstractLiveEditTool : public QObject { Q_OBJECT public: - AbstractLiveEditTool(QDeclarativeViewObserver *observer); + AbstractLiveEditTool(QDeclarativeViewInspector *inspector); virtual ~AbstractLiveEditTool(); @@ -93,12 +93,12 @@ public: protected: virtual void selectedItemsChanged(const QList<QGraphicsItem*> &objectList) = 0; - QDeclarativeViewObserver *observer() const; + QDeclarativeViewInspector *inspector() const; QDeclarativeView *view() const; QGraphicsScene *scene() const; private: - QDeclarativeViewObserver *m_observer; + QDeclarativeViewInspector *m_inspector; QList<QGraphicsItem*> m_itemList; }; diff --git a/share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.cpp b/share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.cpp index f174e1826f..0390e95f65 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.cpp @@ -31,8 +31,8 @@ **************************************************************************/ #include "boundingrecthighlighter.h" -#include "qdeclarativeviewobserver.h" -#include "qmlobserverconstants.h" +#include "qdeclarativeviewinspector.h" +#include "qmlinspectorconstants.h" #include <QtGui/QGraphicsPolygonItem> @@ -81,7 +81,7 @@ int BoundingBoxPolygonItem::type() const return Constants::EditorItemType; } -BoundingRectHighlighter::BoundingRectHighlighter(QDeclarativeViewObserver *view) : +BoundingRectHighlighter::BoundingRectHighlighter(QDeclarativeViewInspector *view) : LiveLayerItem(view->declarativeView()->scene()), m_view(view), m_animFrame(0) diff --git a/share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.h b/share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.h index 461ca60c24..6e0e2b2e91 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.h @@ -46,14 +46,14 @@ QT_FORWARD_DECLARE_CLASS(QTimer) namespace QmlJSDebugger { -class QDeclarativeViewObserver; +class QDeclarativeViewInspector; class BoundingBox; class BoundingRectHighlighter : public LiveLayerItem { Q_OBJECT public: - explicit BoundingRectHighlighter(QDeclarativeViewObserver *view); + explicit BoundingRectHighlighter(QDeclarativeViewInspector *view); ~BoundingRectHighlighter(); void clear(); void highlight(QList<QGraphicsObject*> items); @@ -74,7 +74,7 @@ private: private: Q_DISABLE_COPY(BoundingRectHighlighter) - QDeclarativeViewObserver *m_view; + QDeclarativeViewInspector *m_view; QList<BoundingBox* > m_boxes; QList<BoundingBox* > m_freeBoxes; QTimer *m_animTimer; diff --git a/share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.cpp index ada22cc3f7..2ccc2a79d8 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.cpp @@ -31,7 +31,7 @@ **************************************************************************/ #include "colorpickertool.h" -#include "qdeclarativeviewobserver.h" +#include "qdeclarativeviewinspector.h" #include <QtGui/QMouseEvent> #include <QtGui/QKeyEvent> @@ -43,7 +43,7 @@ namespace QmlJSDebugger { -ColorPickerTool::ColorPickerTool(QDeclarativeViewObserver *view) : +ColorPickerTool::ColorPickerTool(QDeclarativeViewInspector *view) : AbstractLiveEditTool(view) { m_selectedColor.setRgb(0,0,0); diff --git a/share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.h b/share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.h index 479bd2ee5e..d176dde093 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/colorpickertool.h @@ -45,7 +45,7 @@ class ColorPickerTool : public AbstractLiveEditTool { Q_OBJECT public: - explicit ColorPickerTool(QDeclarativeViewObserver *view); + explicit ColorPickerTool(QDeclarativeViewInspector *view); virtual ~ColorPickerTool(); diff --git a/share/qtcreator/qml/qmljsdebugger/editor/editor.qrc b/share/qtcreator/qml/qmljsdebugger/editor/editor.qrc index 77744d57bb..fb2393caa1 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/editor.qrc +++ b/share/qtcreator/qml/qmljsdebugger/editor/editor.qrc @@ -18,7 +18,7 @@ <file>images/zoom-24.png</file> <file>images/select-24.png</file> <file>images/select-marquee-24.png</file> - <file>images/observermode.png</file> - <file>images/observermode-24.png</file> + <file>images/inspectormode.png</file> + <file>images/inspectormode-24.png</file> </qresource> </RCC> diff --git a/share/qtcreator/qml/qmljsdebugger/editor/images/observermode-24.png b/share/qtcreator/qml/qmljsdebugger/editor/images/inspectormode-24.png Binary files differindex 5e74d867c0..5e74d867c0 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/images/observermode-24.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/inspectormode-24.png diff --git a/share/qtcreator/qml/qmljsdebugger/editor/images/observermode.png b/share/qtcreator/qml/qmljsdebugger/editor/images/inspectormode.png Binary files differindex daed21c944..daed21c944 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/images/observermode.png +++ b/share/qtcreator/qml/qmljsdebugger/editor/images/inspectormode.png diff --git a/share/qtcreator/qml/qmljsdebugger/editor/livelayeritem.cpp b/share/qtcreator/qml/qmljsdebugger/editor/livelayeritem.cpp index cc60449a76..5a8b8e1020 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/livelayeritem.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/livelayeritem.cpp @@ -31,7 +31,7 @@ **************************************************************************/ #include "livelayeritem.h" -#include "qmlobserverconstants.h" +#include "qmlinspectorconstants.h" #include <QGraphicsScene> diff --git a/share/qtcreator/qml/qmljsdebugger/editor/liverubberbandselectionmanipulator.cpp b/share/qtcreator/qml/qmljsdebugger/editor/liverubberbandselectionmanipulator.cpp index 9cf66391ee..b7a8ade5d3 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/liverubberbandselectionmanipulator.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/liverubberbandselectionmanipulator.cpp @@ -31,7 +31,7 @@ **************************************************************************/ #include "liverubberbandselectionmanipulator.h" -#include "../qdeclarativeviewobserver_p.h" +#include "../qdeclarativeviewinspector_p.h" #include <QtGui/QGraphicsItem> @@ -40,7 +40,7 @@ namespace QmlJSDebugger { LiveRubberBandSelectionManipulator::LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem, - QDeclarativeViewObserver *editorView) + QDeclarativeViewInspector *editorView) : m_selectionRectangleElement(layerItem), m_editorView(editorView), m_beginFormEditorItem(0), @@ -73,9 +73,9 @@ void LiveRubberBandSelectionManipulator::begin(const QPointF &beginPoint) m_selectionRectangleElement.setRect(m_beginPoint, m_beginPoint); m_selectionRectangleElement.show(); m_isActive = true; - QDeclarativeViewObserverPrivate *observerPrivate - = QDeclarativeViewObserverPrivate::get(m_editorView); - m_beginFormEditorItem = topFormEditorItem(observerPrivate->selectableItems(beginPoint)); + QDeclarativeViewInspectorPrivate *inspectorPrivate + = QDeclarativeViewInspectorPrivate::get(m_editorView); + m_beginFormEditorItem = topFormEditorItem(inspectorPrivate->selectableItems(beginPoint)); m_oldSelectionList = m_editorView->selectedItems(); } @@ -93,10 +93,10 @@ void LiveRubberBandSelectionManipulator::end() void LiveRubberBandSelectionManipulator::select(SelectionType selectionType) { - QDeclarativeViewObserverPrivate *observerPrivate - = QDeclarativeViewObserverPrivate::get(m_editorView); + QDeclarativeViewInspectorPrivate *inspectorPrivate + = QDeclarativeViewInspectorPrivate::get(m_editorView); QList<QGraphicsItem*> itemList - = observerPrivate->selectableItems(m_selectionRectangleElement.rect(), + = inspectorPrivate->selectableItems(m_selectionRectangleElement.rect(), Qt::IntersectsItemShape); QList<QGraphicsItem*> newSelectionList; diff --git a/share/qtcreator/qml/qmljsdebugger/editor/liverubberbandselectionmanipulator.h b/share/qtcreator/qml/qmljsdebugger/editor/liverubberbandselectionmanipulator.h index 056c3ecf7e..052284a409 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/liverubberbandselectionmanipulator.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/liverubberbandselectionmanipulator.h @@ -42,7 +42,7 @@ QT_FORWARD_DECLARE_CLASS(QGraphicsItem) namespace QmlJSDebugger { -class QDeclarativeViewObserver; +class QDeclarativeViewInspector; class LiveRubberBandSelectionManipulator { @@ -54,7 +54,7 @@ public: }; LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem, - QDeclarativeViewObserver *editorView); + QDeclarativeViewInspector *editorView); void setItems(const QList<QGraphicsItem*> &itemList); @@ -78,7 +78,7 @@ private: QList<QGraphicsItem*> m_oldSelectionList; LiveSelectionRectangle m_selectionRectangleElement; QPointF m_beginPoint; - QDeclarativeViewObserver *m_editorView; + QDeclarativeViewInspector *m_editorView; QGraphicsItem *m_beginFormEditorItem; bool m_isActive; }; diff --git a/share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.cpp b/share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.cpp index e046c23862..fb11850745 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.cpp @@ -31,8 +31,8 @@ **************************************************************************/ #include "liveselectionindicator.h" -#include "../qdeclarativeviewobserver_p.h" -#include "qmlobserverconstants.h" +#include "../qdeclarativeviewinspector_p.h" +#include "qmlinspectorconstants.h" #include <QtGui/QGraphicsRectItem> #include <QtGui/QGraphicsObject> @@ -41,10 +41,10 @@ namespace QmlJSDebugger { -LiveSelectionIndicator::LiveSelectionIndicator(QDeclarativeViewObserver *viewObserver, +LiveSelectionIndicator::LiveSelectionIndicator(QDeclarativeViewInspector *viewInspector, QGraphicsObject *layerItem) : m_layerItem(layerItem) - , m_view(viewObserver) + , m_view(viewInspector) { } diff --git a/share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.h b/share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.h index be49a0bcd0..78df3cff4b 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.h @@ -45,12 +45,12 @@ QT_END_NAMESPACE namespace QmlJSDebugger { -class QDeclarativeViewObserver; +class QDeclarativeViewInspector; class LiveSelectionIndicator { public: - LiveSelectionIndicator(QDeclarativeViewObserver *viewObserver, QGraphicsObject *layerItem); + LiveSelectionIndicator(QDeclarativeViewInspector *viewInspector, QGraphicsObject *layerItem); ~LiveSelectionIndicator(); void show(); @@ -63,7 +63,7 @@ public: private: QHash<QGraphicsItem*, QGraphicsRectItem *> m_indicatorShapeHash; QWeakPointer<QGraphicsObject> m_layerItem; - QDeclarativeViewObserver *m_view; + QDeclarativeViewInspector *m_view; }; } diff --git a/share/qtcreator/qml/qmljsdebugger/editor/liveselectionrectangle.cpp b/share/qtcreator/qml/qmljsdebugger/editor/liveselectionrectangle.cpp index 1202557469..98605e627b 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/liveselectionrectangle.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/liveselectionrectangle.cpp @@ -31,7 +31,7 @@ **************************************************************************/ #include "liveselectionrectangle.h" -#include "qmlobserverconstants.h" +#include "qmlinspectorconstants.h" #include <QtGui/QPen> #include <QtGui/QGraphicsRectItem> diff --git a/share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.cpp index 63bb690c51..f9b8902132 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.cpp @@ -33,7 +33,7 @@ #include "liveselectiontool.h" #include "livelayeritem.h" -#include "../qdeclarativeviewobserver_p.h" +#include "../qdeclarativeviewinspector_p.h" #include <QtGui/QApplication> #include <QtGui/QWheelEvent> @@ -50,14 +50,14 @@ namespace QmlJSDebugger { -LiveSelectionTool::LiveSelectionTool(QDeclarativeViewObserver *editorView) : +LiveSelectionTool::LiveSelectionTool(QDeclarativeViewInspector *editorView) : AbstractLiveEditTool(editorView), m_rubberbandSelectionMode(false), m_rubberbandSelectionManipulator( - QDeclarativeViewObserverPrivate::get(editorView)->manipulatorLayer, editorView), + QDeclarativeViewInspectorPrivate::get(editorView)->manipulatorLayer, editorView), m_singleSelectionManipulator(editorView), m_selectionIndicator(editorView, - QDeclarativeViewObserverPrivate::get(editorView)->manipulatorLayer), + QDeclarativeViewInspectorPrivate::get(editorView)->manipulatorLayer), //m_resizeIndicator(editorView->manipulatorLayer()), m_selectOnlyContentItems(true) { @@ -88,9 +88,9 @@ LiveSingleSelectionManipulator::SelectionType LiveSelectionTool::getSelectionTyp bool LiveSelectionTool::alreadySelected(const QList<QGraphicsItem*> &itemList) const { - QDeclarativeViewObserverPrivate *observerPrivate - = QDeclarativeViewObserverPrivate::get(observer()); - const QList<QGraphicsItem*> selectedItems = observerPrivate->selectedItems(); + QDeclarativeViewInspectorPrivate *inspectorPrivate + = QDeclarativeViewInspectorPrivate::get(inspector()); + const QList<QGraphicsItem*> selectedItems = inspectorPrivate->selectedItems(); if (selectedItems.isEmpty()) return false; @@ -104,9 +104,9 @@ bool LiveSelectionTool::alreadySelected(const QList<QGraphicsItem*> &itemList) c void LiveSelectionTool::mousePressEvent(QMouseEvent *event) { - QDeclarativeViewObserverPrivate *observerPrivate - = QDeclarativeViewObserverPrivate::get(observer()); - QList<QGraphicsItem*> itemList = observerPrivate->selectableItems(event->pos()); + QDeclarativeViewInspectorPrivate *inspectorPrivate + = QDeclarativeViewInspectorPrivate::get(inspector()); + QList<QGraphicsItem*> itemList = inspectorPrivate->selectableItems(event->pos()); LiveSingleSelectionManipulator::SelectionType selectionType = getSelectionType(event->modifiers()); if (event->buttons() & Qt::LeftButton) { @@ -142,7 +142,7 @@ void LiveSelectionTool::createContextMenu(QList<QGraphicsItem*> itemList, QPoint QAction *elementAction = contextMenu.addAction(itemTitle, this, SLOT(contextMenuElementSelected())); - if (observer()->selectedItems().contains(item)) { + if (inspector()->selectedItems().contains(item)) { QFont boldFont = elementAction->font(); boldFont.setBold(true); elementAction->setFont(boldFont); @@ -188,7 +188,7 @@ void LiveSelectionTool::contextMenuElementHovered(QAction *action) int itemListIndex = action->data().toInt(); if (itemListIndex >= 0 && itemListIndex < m_contextMenuItemList.length()) { QGraphicsObject *item = m_contextMenuItemList.at(itemListIndex)->toGraphicsObject(); - QDeclarativeViewObserverPrivate::get(observer())->highlight(item); + QDeclarativeViewInspectorPrivate::get(inspector())->highlight(item); } } @@ -241,19 +241,19 @@ void LiveSelectionTool::hoverMoveEvent(QMouseEvent * event) // if (topSelectedItemIsMovable(itemList)) // view()->changeTool(Constants::MoveToolMode); // } - QDeclarativeViewObserverPrivate *observerPrivate - = QDeclarativeViewObserverPrivate::get(observer()); + QDeclarativeViewInspectorPrivate *inspectorPrivate + = QDeclarativeViewInspectorPrivate::get(inspector()); - QList<QGraphicsItem*> selectableItemList = observerPrivate->selectableItems(event->pos()); + QList<QGraphicsItem*> selectableItemList = inspectorPrivate->selectableItems(event->pos()); if (!selectableItemList.isEmpty()) { QGraphicsObject *item = selectableItemList.first()->toGraphicsObject(); if (item) - QDeclarativeViewObserverPrivate::get(observer())->highlight(item); + QDeclarativeViewInspectorPrivate::get(inspector())->highlight(item); return; } - QDeclarativeViewObserverPrivate::get(observer())->clearHighlight(); + QDeclarativeViewInspectorPrivate::get(inspector())->clearHighlight(); } void LiveSelectionTool::mouseReleaseEvent(QMouseEvent *event) @@ -324,16 +324,16 @@ void LiveSelectionTool::wheelEvent(QWheelEvent *event) if (event->orientation() == Qt::Horizontal || m_rubberbandSelectionMode) return; - QDeclarativeViewObserverPrivate *observerPrivate - = QDeclarativeViewObserverPrivate::get(observer()); - QList<QGraphicsItem*> itemList = observerPrivate->selectableItems(event->pos()); + QDeclarativeViewInspectorPrivate *inspectorPrivate + = QDeclarativeViewInspectorPrivate::get(inspector()); + QList<QGraphicsItem*> itemList = inspectorPrivate->selectableItems(event->pos()); if (itemList.isEmpty()) return; int selectedIdx = 0; - if (!observer()->selectedItems().isEmpty()) { - selectedIdx = itemList.indexOf(observer()->selectedItems().first()); + if (!inspector()->selectedItems().isEmpty()) { + selectedIdx = itemList.indexOf(inspector()->selectedItems().first()); if (selectedIdx >= 0) { if (event->delta() > 0) { selectedIdx++; diff --git a/share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.h b/share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.h index 4f0002aba4..4f843e4477 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.h @@ -54,7 +54,7 @@ class LiveSelectionTool : public AbstractLiveEditTool Q_OBJECT public: - LiveSelectionTool(QDeclarativeViewObserver* editorView); + LiveSelectionTool(QDeclarativeViewInspector* editorView); ~LiveSelectionTool(); void mousePressEvent(QMouseEvent *event); diff --git a/share/qtcreator/qml/qmljsdebugger/editor/livesingleselectionmanipulator.cpp b/share/qtcreator/qml/qmljsdebugger/editor/livesingleselectionmanipulator.cpp index 1a3fff9c58..bdf8abcb27 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/livesingleselectionmanipulator.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/livesingleselectionmanipulator.cpp @@ -31,13 +31,13 @@ **************************************************************************/ #include "livesingleselectionmanipulator.h" -#include "qdeclarativeviewobserver.h" -#include "../qdeclarativeviewobserver_p.h" +#include "qdeclarativeviewinspector.h" +#include "../qdeclarativeviewinspector_p.h" #include <QtDebug> namespace QmlJSDebugger { -LiveSingleSelectionManipulator::LiveSingleSelectionManipulator(QDeclarativeViewObserver *editorView) +LiveSingleSelectionManipulator::LiveSingleSelectionManipulator(QDeclarativeViewInspector *editorView) : m_editorView(editorView), m_isActive(false) { @@ -48,7 +48,7 @@ void LiveSingleSelectionManipulator::begin(const QPointF &beginPoint) { m_beginPoint = beginPoint; m_isActive = true; - m_oldSelectionList = QDeclarativeViewObserverPrivate::get(m_editorView)->selectedItems(); + m_oldSelectionList = QDeclarativeViewInspectorPrivate::get(m_editorView)->selectedItems(); } void LiveSingleSelectionManipulator::update(const QPointF &/*updatePoint*/) @@ -121,9 +121,9 @@ void LiveSingleSelectionManipulator::select(SelectionType selectionType, void LiveSingleSelectionManipulator::select(SelectionType selectionType, bool selectOnlyContentItems) { - QDeclarativeViewObserverPrivate *observerPrivate = - QDeclarativeViewObserverPrivate::get(m_editorView); - QList<QGraphicsItem*> itemList = observerPrivate->selectableItems(m_beginPoint); + QDeclarativeViewInspectorPrivate *inspectorPrivate = + QDeclarativeViewInspectorPrivate::get(m_editorView); + QList<QGraphicsItem*> itemList = inspectorPrivate->selectableItems(m_beginPoint); select(selectionType, itemList, selectOnlyContentItems); } diff --git a/share/qtcreator/qml/qmljsdebugger/editor/livesingleselectionmanipulator.h b/share/qtcreator/qml/qmljsdebugger/editor/livesingleselectionmanipulator.h index ab1b9c4268..2850e624ed 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/livesingleselectionmanipulator.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/livesingleselectionmanipulator.h @@ -40,12 +40,12 @@ QT_FORWARD_DECLARE_CLASS(QGraphicsItem); namespace QmlJSDebugger { -class QDeclarativeViewObserver; +class QDeclarativeViewInspector; class LiveSingleSelectionManipulator { public: - LiveSingleSelectionManipulator(QDeclarativeViewObserver *editorView); + LiveSingleSelectionManipulator(QDeclarativeViewInspector *editorView); enum SelectionType { ReplaceSelection, @@ -71,7 +71,7 @@ public: private: QList<QGraphicsItem*> m_oldSelectionList; QPointF m_beginPoint; - QDeclarativeViewObserver *m_editorView; + QDeclarativeViewInspector *m_editorView; bool m_isActive; }; diff --git a/share/qtcreator/qml/qmljsdebugger/editor/qmltoolbar.cpp b/share/qtcreator/qml/qmljsdebugger/editor/qmltoolbar.cpp index b1c94221c7..02ec9d1b06 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/qmltoolbar.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/qmltoolbar.cpp @@ -52,8 +52,8 @@ QmlToolBar::QmlToolBar(QWidget *parent) ui->playIcon = QIcon(QLatin1String(":/qml/images/play-24.png")); ui->pauseIcon = QIcon(QLatin1String(":/qml/images/pause-24.png")); - ui->designmode = new QAction(QIcon(QLatin1String(":/qml/images/observermode-24.png")), - tr("Observer Mode"), this); + ui->designmode = new QAction(QIcon(QLatin1String(":/qml/images/inspectormode-24.png")), + tr("Inspector Mode"), this); ui->play = new QAction(ui->pauseIcon, tr("Play/Pause Animations"), this); ui->select = new QAction(QIcon(QLatin1String(":/qml/images/select-24.png")), tr("Select"), this); ui->selectMarquee = new QAction(QIcon(QLatin1String(":/qml/images/select-marquee-24.png")), diff --git a/share/qtcreator/qml/qmljsdebugger/editor/qmltoolbar.h b/share/qtcreator/qml/qmljsdebugger/editor/qmltoolbar.h index 81029de4d4..b1bf62f9e9 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/qmltoolbar.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/qmltoolbar.h @@ -36,7 +36,7 @@ #include <QtGui/QToolBar> #include <QtGui/QIcon> -#include "qmlobserverconstants.h" +#include "qmlinspectorconstants.h" QT_FORWARD_DECLARE_CLASS(QActionGroup) diff --git a/share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.cpp b/share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.cpp index de54329284..33674c0efe 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.cpp @@ -31,16 +31,16 @@ **************************************************************************/ #include "subcomponentmasklayeritem.h" -#include "qmlobserverconstants.h" -#include "qdeclarativeviewobserver.h" +#include "qmlinspectorconstants.h" +#include "qdeclarativeviewinspector.h" #include <QtGui/QPolygonF> namespace QmlJSDebugger { -SubcomponentMaskLayerItem::SubcomponentMaskLayerItem(QDeclarativeViewObserver *observer, +SubcomponentMaskLayerItem::SubcomponentMaskLayerItem(QDeclarativeViewInspector *inspector, QGraphicsItem *parentItem) : QGraphicsPolygonItem(parentItem), - m_observer(observer), + m_inspector(inspector), m_currentItem(0), m_borderRect(new QGraphicsRectItem(this)) { @@ -91,8 +91,8 @@ void SubcomponentMaskLayerItem::setCurrentItem(QGraphicsItem *item) if (!m_currentItem) return; - QRect viewRect = m_observer->declarativeView()->rect(); - viewRect = m_observer->declarativeView()->mapToScene(viewRect).boundingRect().toRect(); + QRect viewRect = m_inspector->declarativeView()->rect(); + viewRect = m_inspector->declarativeView()->mapToScene(viewRect).boundingRect().toRect(); QRectF itemRect = item->boundingRect() | item->childrenBoundingRect(); itemRect = item->mapRectToScene(itemRect); diff --git a/share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.h b/share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.h index 124e6799f4..02c56a3b19 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/subcomponentmasklayeritem.h @@ -37,12 +37,12 @@ namespace QmlJSDebugger { -class QDeclarativeViewObserver; +class QDeclarativeViewInspector; class SubcomponentMaskLayerItem : public QGraphicsPolygonItem { public: - explicit SubcomponentMaskLayerItem(QDeclarativeViewObserver *observer, + explicit SubcomponentMaskLayerItem(QDeclarativeViewInspector *inspector, QGraphicsItem *parentItem = 0); int type() const; void setCurrentItem(QGraphicsItem *item); @@ -51,7 +51,7 @@ public: QRectF itemRect() const; private: - QDeclarativeViewObserver *m_observer; + QDeclarativeViewInspector *m_inspector; QGraphicsItem *m_currentItem; QGraphicsRectItem *m_borderRect; QRectF m_itemPolyRect; diff --git a/share/qtcreator/qml/qmljsdebugger/editor/toolbarcolorbox.cpp b/share/qtcreator/qml/qmljsdebugger/editor/toolbarcolorbox.cpp index ad76000c74..76c7df7391 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/toolbarcolorbox.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/toolbarcolorbox.cpp @@ -31,7 +31,7 @@ **************************************************************************/ #include "toolbarcolorbox.h" -#include "qmlobserverconstants.h" +#include "qmlinspectorconstants.h" #include <QtGui/QPixmap> #include <QtGui/QPainter> diff --git a/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.cpp index 08b67d8377..a2683092b0 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.cpp @@ -31,7 +31,7 @@ **************************************************************************/ #include "zoomtool.h" -#include "../qdeclarativeviewobserver_p.h" +#include "../qdeclarativeviewinspector_p.h" #include <QtGui/QMouseEvent> #include <QtGui/QWheelEvent> @@ -44,7 +44,7 @@ namespace QmlJSDebugger { -ZoomTool::ZoomTool(QDeclarativeViewObserver *view) : +ZoomTool::ZoomTool(QDeclarativeViewInspector *view) : AbstractLiveEditTool(view), m_rubberbandManipulator(), m_smoothZoomMultiplier(0.05f), @@ -57,7 +57,7 @@ ZoomTool::ZoomTool(QDeclarativeViewObserver *view) : m_zoomOutAction->setShortcut(QKeySequence(Qt::Key_Minus)); - LiveLayerItem *layerItem = QDeclarativeViewObserverPrivate::get(view)->manipulatorLayer; + LiveLayerItem *layerItem = QDeclarativeViewInspectorPrivate::get(view)->manipulatorLayer; QGraphicsObject *layerObject = reinterpret_cast<QGraphicsObject *>(layerItem); m_rubberbandManipulator = new LiveRubberBandSelectionManipulator(layerObject, view); diff --git a/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.h b/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.h index c35ec4aec9..7eb35bdaef 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.h +++ b/share/qtcreator/qml/qmljsdebugger/editor/zoomtool.h @@ -49,7 +49,7 @@ public: ZoomOut }; - explicit ZoomTool(QDeclarativeViewObserver *view); + explicit ZoomTool(QDeclarativeViewInspector *view); virtual ~ZoomTool(); diff --git a/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeobserverservice.h b/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeinspectorservice.h index 972a362788..c28f0b50ba 100644 --- a/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeobserverservice.h +++ b/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeinspectorservice.h @@ -33,7 +33,7 @@ #define QDECLARATIVEDESIGNDEBUGSERVER_H #include "qt_private/qdeclarativedebugservice_p.h" -#include "qmlobserverconstants.h" +#include "qmlinspectorconstants.h" #include "qmljsdebugger_global.h" #include <QtCore/QHash> @@ -46,12 +46,12 @@ QT_FORWARD_DECLARE_CLASS(QDataStream) namespace QmlJSDebugger { -class QMLJSDEBUGGER_EXPORT QDeclarativeObserverService : public QDeclarativeDebugService +class QMLJSDEBUGGER_EXPORT QDeclarativeInspectorService : public QDeclarativeDebugService { Q_OBJECT public: - QDeclarativeObserverService(); - static QDeclarativeObserverService *instance(); + QDeclarativeInspectorService(); + static QDeclarativeInspectorService *instance(); void setDesignModeBehavior(bool inDesignMode); void setCurrentObjects(QList<QObject*> items); diff --git a/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewinspector.h b/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewinspector.h new file mode 100644 index 0000000000..6ba0427187 --- /dev/null +++ b/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewinspector.h @@ -0,0 +1,120 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#ifndef QDECLARATIVEVIEWINSPECTOR_H +#define QDECLARATIVEVIEWINSPECTOR_H + +#include "qmljsdebugger_global.h" +#include "qmlinspectorconstants.h" + +#include <QtCore/QScopedPointer> +#include <QtDeclarative/QDeclarativeView> + +QT_FORWARD_DECLARE_CLASS(QDeclarativeItem) +QT_FORWARD_DECLARE_CLASS(QMouseEvent) +QT_FORWARD_DECLARE_CLASS(QToolBar) + +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 index 2accbfa700..7621a9e8d7 100644 --- a/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewobserver.h +++ b/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewobserver.h @@ -33,86 +33,19 @@ #ifndef QDECLARATIVEVIEWOBSERVER_H #define QDECLARATIVEVIEWOBSERVER_H -#include "qmljsdebugger_global.h" -#include "qmlobserverconstants.h" - -#include <QtCore/QScopedPointer> -#include <QtDeclarative/QDeclarativeView> - -QT_FORWARD_DECLARE_CLASS(QDeclarativeItem) -QT_FORWARD_DECLARE_CLASS(QMouseEvent) -QT_FORWARD_DECLARE_CLASS(QToolBar) +#include "qdeclarativeviewinspector.h" namespace QmlJSDebugger { -class CrumblePath; -class QDeclarativeViewObserverPrivate; - -class QMLJSDEBUGGER_EXPORT QDeclarativeViewObserver : public QObject +// Provided for compatibility with QmlApplicationViewer +class QMLJSDEBUGGER_EXPORT QDeclarativeViewObserver : public QDeclarativeViewInspector { Q_OBJECT -public: - - explicit QDeclarativeViewObserver(QDeclarativeView *view, QObject *parent = 0); - ~QDeclarativeViewObserver(); - - 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(QDeclarativeViewObserver) - - inline QDeclarativeViewObserverPrivate *d_func() { return data.data(); } - QScopedPointer<QDeclarativeViewObserverPrivate> data; - friend class QDeclarativeViewObserverPrivate; - friend class AbstractLiveEditTool; +public: + explicit QDeclarativeViewObserver(QDeclarativeView *view, QObject *parent = 0) + : QDeclarativeViewInspector(view, parent) + {} }; } // namespace QmlJSDebugger diff --git a/share/qtcreator/qml/qmljsdebugger/include/qmlobserverconstants.h b/share/qtcreator/qml/qmljsdebugger/include/qmlinspectorconstants.h index 30aefdf1f6..eb5ac317e8 100644 --- a/share/qtcreator/qml/qmljsdebugger/include/qmlobserverconstants.h +++ b/share/qtcreator/qml/qmljsdebugger/include/qmlinspectorconstants.h @@ -30,8 +30,8 @@ ** **************************************************************************/ -#ifndef QMLOBSERVERCONSTANTS_H -#define QMLOBSERVERCONSTANTS_H +#ifndef QMLINSPECTORCONSTANTS_H +#define QMLINSPECTORCONSTANTS_H namespace QmlJSDebugger { namespace Constants { @@ -68,4 +68,4 @@ enum GraphicsItemTypes { } // namespace Constants } // namespace QmlJSDebugger -#endif // QMLOBSERVERCONSTANTS_H +#endif // QMLINSPECTORCONSTANTS_H diff --git a/share/qtcreator/qml/qmljsdebugger/protocol/observerprotocol.h b/share/qtcreator/qml/qmljsdebugger/protocol/inspectorprotocol.h index 828a3f232c..b80c5e49d8 100644 --- a/share/qtcreator/qml/qmljsdebugger/protocol/observerprotocol.h +++ b/share/qtcreator/qml/qmljsdebugger/protocol/inspectorprotocol.h @@ -30,8 +30,8 @@ ** **************************************************************************/ -#ifndef OBSERVERPROTOCOL_H -#define OBSERVERPROTOCOL_H +#ifndef INSPECTORPROTOCOL_H +#define INSPECTORPROTOCOL_H #include <QtCore/QDebug> #include <QtCore/QMetaType> @@ -40,7 +40,7 @@ namespace QmlJSDebugger { -class ObserverProtocol : public QObject +class InspectorProtocol : public QObject { Q_OBJECT Q_ENUMS(Message Tool) @@ -85,44 +85,44 @@ public: } }; -inline QDataStream & operator<< (QDataStream &stream, ObserverProtocol::Message message) +inline QDataStream & operator<< (QDataStream &stream, InspectorProtocol::Message message) { return stream << static_cast<quint32>(message); } -inline QDataStream & operator>> (QDataStream &stream, ObserverProtocol::Message &message) +inline QDataStream & operator>> (QDataStream &stream, InspectorProtocol::Message &message) { quint32 i; stream >> i; - message = static_cast<ObserverProtocol::Message>(i); + message = static_cast<InspectorProtocol::Message>(i); return stream; } -inline QDebug operator<< (QDebug dbg, ObserverProtocol::Message message) +inline QDebug operator<< (QDebug dbg, InspectorProtocol::Message message) { - dbg << ObserverProtocol::toString(message); + dbg << InspectorProtocol::toString(message); return dbg; } -inline QDataStream & operator<< (QDataStream &stream, ObserverProtocol::Tool tool) +inline QDataStream & operator<< (QDataStream &stream, InspectorProtocol::Tool tool) { return stream << static_cast<quint32>(tool); } -inline QDataStream & operator>> (QDataStream &stream, ObserverProtocol::Tool &tool) +inline QDataStream & operator>> (QDataStream &stream, InspectorProtocol::Tool &tool) { quint32 i; stream >> i; - tool = static_cast<ObserverProtocol::Tool>(i); + tool = static_cast<InspectorProtocol::Tool>(i); return stream; } -inline QDebug operator<< (QDebug dbg, ObserverProtocol::Tool tool) +inline QDebug operator<< (QDebug dbg, InspectorProtocol::Tool tool) { - dbg << ObserverProtocol::toString(tool); + dbg << InspectorProtocol::toString(tool); return dbg; } } // namespace QmlJSDebugger -#endif // OBSERVERPROTOCOL_H +#endif // INSPECTORPROTOCOL_H diff --git a/share/qtcreator/qml/qmljsdebugger/protocol/protocol.pri b/share/qtcreator/qml/qmljsdebugger/protocol/protocol.pri index 9db20ff863..dfb18fb864 100644 --- a/share/qtcreator/qml/qmljsdebugger/protocol/protocol.pri +++ b/share/qtcreator/qml/qmljsdebugger/protocol/protocol.pri @@ -1,3 +1,3 @@ INCLUDEPATH += $$PWD DEPENDPATH += $$PWD -HEADERS += $$PWD/observerprotocol.h +HEADERS += $$PWD/inspectorprotocol.h diff --git a/share/qtcreator/qml/qmljsdebugger/qdeclarativeobserverservice.cpp b/share/qtcreator/qml/qmljsdebugger/qdeclarativeinspectorservice.cpp index 255aa1e407..b3c94ec6b0 100644 --- a/share/qtcreator/qml/qmljsdebugger/qdeclarativeobserverservice.cpp +++ b/share/qtcreator/qml/qmljsdebugger/qdeclarativeinspectorservice.cpp @@ -29,41 +29,41 @@ ** **************************************************************************/ -#include "qdeclarativeobserverservice.h" +#include "qdeclarativeinspectorservice.h" -#include <observerprotocol.h> +#include <inspectorprotocol.h> #include <QStringList> #include <QColor> namespace QmlJSDebugger { -Q_GLOBAL_STATIC(QDeclarativeObserverService, serviceInstance) +Q_GLOBAL_STATIC(QDeclarativeInspectorService, serviceInstance) -QDeclarativeObserverService::QDeclarativeObserverService() +QDeclarativeInspectorService::QDeclarativeInspectorService() : QDeclarativeDebugService(QLatin1String("QDeclarativeObserverMode")) { } -QDeclarativeObserverService *QDeclarativeObserverService::instance() +QDeclarativeInspectorService *QDeclarativeInspectorService::instance() { return serviceInstance(); } -void QDeclarativeObserverService::statusChanged(Status status) +void QDeclarativeInspectorService::statusChanged(Status status) { emit debuggingClientChanged((status == Enabled)); } -void QDeclarativeObserverService::messageReceived(const QByteArray &message) +void QDeclarativeInspectorService::messageReceived(const QByteArray &message) { QDataStream ds(message); - ObserverProtocol::Message type; + InspectorProtocol::Message type; ds >> type; switch (type) { - case ObserverProtocol::SetCurrentObjects: { + case InspectorProtocol::SetCurrentObjects: { int itemCount = 0; ds >> itemCount; @@ -78,36 +78,36 @@ void QDeclarativeObserverService::messageReceived(const QByteArray &message) emit currentObjectsChanged(selectedObjects); break; } - case ObserverProtocol::Reload: { + case InspectorProtocol::Reload: { emit reloadRequested(); break; } - case ObserverProtocol::SetAnimationSpeed: { + case InspectorProtocol::SetAnimationSpeed: { qreal speed; ds >> speed; emit animationSpeedChangeRequested(speed); break; } - case ObserverProtocol::SetAnimationPaused: { + case InspectorProtocol::SetAnimationPaused: { bool paused; ds >> paused; emit executionPauseChangeRequested(paused); break; } - case ObserverProtocol::ChangeTool: { - ObserverProtocol::Tool tool; + case InspectorProtocol::ChangeTool: { + InspectorProtocol::Tool tool; ds >> tool; switch (tool) { - case ObserverProtocol::ColorPickerTool: + case InspectorProtocol::ColorPickerTool: emit colorPickerToolRequested(); break; - case ObserverProtocol::SelectTool: + case InspectorProtocol::SelectTool: emit selectToolRequested(); break; - case ObserverProtocol::SelectMarqueeTool: + case InspectorProtocol::SelectMarqueeTool: emit selectMarqueeToolRequested(); break; - case ObserverProtocol::ZoomTool: + case InspectorProtocol::ZoomTool: emit zoomToolRequested(); break; default: @@ -115,19 +115,19 @@ void QDeclarativeObserverService::messageReceived(const QByteArray &message) } break; } - case ObserverProtocol::SetDesignMode: { + case InspectorProtocol::SetDesignMode: { bool inDesignMode; ds >> inDesignMode; emit designModeBehaviorChanged(inDesignMode); break; } - case ObserverProtocol::ShowAppOnTop: { + case InspectorProtocol::ShowAppOnTop: { bool showOnTop; ds >> showOnTop; emit showAppOnTopChanged(showOnTop); break; } - case ObserverProtocol::CreateObject: { + case InspectorProtocol::CreateObject: { QString qml; int parentId; QString filename; @@ -140,7 +140,7 @@ void QDeclarativeObserverService::messageReceived(const QByteArray &message) emit objectCreationRequested(qml, objectForId(parentId), imports, filename, order); break; } - case ObserverProtocol::DestroyObject: { + case InspectorProtocol::DestroyObject: { int debugId; ds >> debugId; if (QObject* obj = objectForId(debugId)) { @@ -148,13 +148,13 @@ void QDeclarativeObserverService::messageReceived(const QByteArray &message) } break; } - case ObserverProtocol::MoveObject: { + case InspectorProtocol::MoveObject: { int debugId, newParent; ds >> debugId >> newParent; emit objectReparentRequested(objectForId(debugId), objectForId(newParent)); break; } - case ObserverProtocol::ObjectIdList: { + case InspectorProtocol::ObjectIdList: { int itemCount; ds >> itemCount; m_stringIdForObjectId.clear(); @@ -168,7 +168,7 @@ void QDeclarativeObserverService::messageReceived(const QByteArray &message) } break; } - case ObserverProtocol::ClearComponentCache: { + case InspectorProtocol::ClearComponentCache: { emit clearComponentCacheRequested(); break; } @@ -177,23 +177,23 @@ void QDeclarativeObserverService::messageReceived(const QByteArray &message) } } -void QDeclarativeObserverService::setDesignModeBehavior(bool inDesignMode) +void QDeclarativeInspectorService::setDesignModeBehavior(bool inDesignMode) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << ObserverProtocol::SetDesignMode + ds << InspectorProtocol::SetDesignMode << inDesignMode; sendMessage(message); } -void QDeclarativeObserverService::setCurrentObjects(QList<QObject*> objects) +void QDeclarativeInspectorService::setCurrentObjects(QList<QObject*> objects) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << ObserverProtocol::CurrentObjectsChanged + ds << InspectorProtocol::CurrentObjectsChanged << objects.length(); foreach (QObject *object, objects) { @@ -204,78 +204,78 @@ void QDeclarativeObserverService::setCurrentObjects(QList<QObject*> objects) sendMessage(message); } -void QDeclarativeObserverService::setCurrentTool(QmlJSDebugger::Constants::DesignTool toolId) +void QDeclarativeInspectorService::setCurrentTool(QmlJSDebugger::Constants::DesignTool toolId) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << ObserverProtocol::ToolChanged + ds << InspectorProtocol::ToolChanged << toolId; sendMessage(message); } -void QDeclarativeObserverService::setAnimationSpeed(qreal slowDownFactor) +void QDeclarativeInspectorService::setAnimationSpeed(qreal slowDownFactor) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << ObserverProtocol::AnimationSpeedChanged + ds << InspectorProtocol::AnimationSpeedChanged << slowDownFactor; sendMessage(message); } -void QDeclarativeObserverService::setAnimationPaused(bool paused) +void QDeclarativeInspectorService::setAnimationPaused(bool paused) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << ObserverProtocol::AnimationPausedChanged + ds << InspectorProtocol::AnimationPausedChanged << paused; sendMessage(message); } -void QDeclarativeObserverService::reloaded() +void QDeclarativeInspectorService::reloaded() { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << ObserverProtocol::Reloaded; + ds << InspectorProtocol::Reloaded; sendMessage(message); } -void QDeclarativeObserverService::setShowAppOnTop(bool showAppOnTop) +void QDeclarativeInspectorService::setShowAppOnTop(bool showAppOnTop) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << ObserverProtocol::ShowAppOnTop << showAppOnTop; + ds << InspectorProtocol::ShowAppOnTop << showAppOnTop; sendMessage(message); } -void QDeclarativeObserverService::selectedColorChanged(const QColor &color) +void QDeclarativeInspectorService::selectedColorChanged(const QColor &color) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << ObserverProtocol::ColorChanged + ds << InspectorProtocol::ColorChanged << color; sendMessage(message); } -QString QDeclarativeObserverService::idStringForObject(QObject *obj) const +QString QDeclarativeInspectorService::idStringForObject(QObject *obj) const { int id = idForObject(obj); QString idString = m_stringIdForObjectId.value(id, QString()); return idString; } -void QDeclarativeObserverService::sendMessage(const QByteArray &message) +void QDeclarativeInspectorService::sendMessage(const QByteArray &message) { if (status() != Enabled) return; diff --git a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewinspector.cpp index f3524cfb31..f0777e922b 100644 --- a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp +++ b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewinspector.cpp @@ -30,9 +30,9 @@ ** **************************************************************************/ -#include "qdeclarativeviewobserver.h" -#include "qdeclarativeviewobserver_p.h" -#include "qdeclarativeobserverservice.h" +#include "qdeclarativeviewinspector.h" +#include "qdeclarativeviewinspector_p.h" +#include "qdeclarativeinspectorservice.h" #include "editor/liveselectiontool.h" #include "editor/zoomtool.h" #include "editor/colorpickertool.h" @@ -81,7 +81,7 @@ private: ToolBox::ToolBox(QWidget *parent) : QWidget(parent, Qt::Tool) - , m_settings(QLatin1String("Nokia"), QLatin1String("QmlObserver"), this) + , m_settings(QLatin1String("Nokia"), QLatin1String("QmlInspector"), this) , m_toolBar(new QmlToolBar) { setWindowFlags((windowFlags() & ~Qt::WindowCloseButtonHint) | Qt::CustomizeWindowHint); @@ -101,7 +101,7 @@ ToolBox::~ToolBox() } -QDeclarativeViewObserverPrivate::QDeclarativeViewObserverPrivate(QDeclarativeViewObserver *q) : +QDeclarativeViewInspectorPrivate::QDeclarativeViewInspectorPrivate(QDeclarativeViewInspector *q) : q(q), designModeBehavior(false), showAppOnTop(false), @@ -111,12 +111,12 @@ QDeclarativeViewObserverPrivate::QDeclarativeViewObserverPrivate(QDeclarativeVie { } -QDeclarativeViewObserverPrivate::~QDeclarativeViewObserverPrivate() +QDeclarativeViewInspectorPrivate::~QDeclarativeViewInspectorPrivate() { } -QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, QObject *parent) : - QObject(parent), data(new QDeclarativeViewObserverPrivate(this)) +QDeclarativeViewInspector::QDeclarativeViewInspector(QDeclarativeView *view, QObject *parent) : + QObject(parent), data(new QDeclarativeViewInspectorPrivate(this)) { initEditorResource(); @@ -133,7 +133,7 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, QObje data->setViewport(data->view->viewport()); - data->debugService = QDeclarativeObserverService::instance(); + data->debugService = QDeclarativeInspectorService::instance(); // tool box is disabled //connect(data->debugService, SIGNAL(debuggingClientChanged(bool)), @@ -179,11 +179,11 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, QObje data->_q_changeToSingleSelectTool(); } -QDeclarativeViewObserver::~QDeclarativeViewObserver() +QDeclarativeViewInspector::~QDeclarativeViewInspector() { } -void QDeclarativeViewObserverPrivate::_q_setToolBoxVisible(bool visible) +void QDeclarativeViewInspectorPrivate::_q_setToolBoxVisible(bool visible) { #if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR) if (!toolBox && visible) @@ -195,13 +195,13 @@ void QDeclarativeViewObserverPrivate::_q_setToolBoxVisible(bool visible) #endif } -void QDeclarativeViewObserverPrivate::_q_reloadView() +void QDeclarativeViewInspectorPrivate::_q_reloadView() { clearHighlight(); emit q->reloadRequested(); } -void QDeclarativeViewObserverPrivate::setViewport(QWidget *widget) +void QDeclarativeViewInspectorPrivate::setViewport(QWidget *widget) { if (viewport.data() == widget) return; @@ -217,13 +217,13 @@ void QDeclarativeViewObserverPrivate::setViewport(QWidget *widget) } } -void QDeclarativeViewObserverPrivate::clearEditorItems() +void QDeclarativeViewInspectorPrivate::clearEditorItems() { clearHighlight(); setSelectedItems(QList<QGraphicsItem*>()); } -bool QDeclarativeViewObserver::eventFilter(QObject *obj, QEvent *event) +bool QDeclarativeViewInspector::eventFilter(QObject *obj, QEvent *event) { if (obj == data->view) { // Event from view @@ -286,7 +286,7 @@ bool QDeclarativeViewObserver::eventFilter(QObject *obj, QEvent *event) return QObject::eventFilter(obj, event); } -bool QDeclarativeViewObserver::leaveEvent(QEvent * /*event*/) +bool QDeclarativeViewInspector::leaveEvent(QEvent * /*event*/) { if (!data->designModeBehavior) return false; @@ -294,7 +294,7 @@ bool QDeclarativeViewObserver::leaveEvent(QEvent * /*event*/) return true; } -bool QDeclarativeViewObserver::mousePressEvent(QMouseEvent *event) +bool QDeclarativeViewInspector::mousePressEvent(QMouseEvent *event) { if (!data->designModeBehavior) return false; @@ -303,7 +303,7 @@ bool QDeclarativeViewObserver::mousePressEvent(QMouseEvent *event) return true; } -bool QDeclarativeViewObserver::mouseMoveEvent(QMouseEvent *event) +bool QDeclarativeViewInspector::mouseMoveEvent(QMouseEvent *event) { if (!data->designModeBehavior) { data->clearEditorItems(); @@ -325,7 +325,7 @@ bool QDeclarativeViewObserver::mouseMoveEvent(QMouseEvent *event) return true; } -bool QDeclarativeViewObserver::mouseReleaseEvent(QMouseEvent *event) +bool QDeclarativeViewInspector::mouseReleaseEvent(QMouseEvent *event) { if (!data->designModeBehavior) return false; @@ -335,7 +335,7 @@ bool QDeclarativeViewObserver::mouseReleaseEvent(QMouseEvent *event) return true; } -bool QDeclarativeViewObserver::keyPressEvent(QKeyEvent *event) +bool QDeclarativeViewInspector::keyPressEvent(QKeyEvent *event) { if (!data->designModeBehavior) return false; @@ -344,7 +344,7 @@ bool QDeclarativeViewObserver::keyPressEvent(QKeyEvent *event) return true; } -bool QDeclarativeViewObserver::keyReleaseEvent(QKeyEvent *event) +bool QDeclarativeViewInspector::keyReleaseEvent(QKeyEvent *event) { if (!data->designModeBehavior) return false; @@ -421,7 +421,7 @@ bool removeObjectFromListProperty(QDeclarativeListReference &fromList, QObject * return true; } -void QDeclarativeViewObserverPrivate::_q_createQmlObject(const QString &qml, QObject *parent, +void QDeclarativeViewInspectorPrivate::_q_createQmlObject(const QString &qml, QObject *parent, const QStringList &importList, const QString &filename, int order) { @@ -503,7 +503,7 @@ void QDeclarativeViewObserverPrivate::_q_createQmlObject(const QString &qml, QOb } } -void QDeclarativeViewObserverPrivate::_q_reparentQmlObject(QObject *object, QObject *newParent) +void QDeclarativeViewInspectorPrivate::_q_reparentQmlObject(QObject *object, QObject *newParent) { if (!newParent) return; @@ -515,7 +515,7 @@ void QDeclarativeViewObserverPrivate::_q_reparentQmlObject(QObject *object, QObj item->setParentItem(newParentItem); } -void QDeclarativeViewObserverPrivate::_q_deleteQmlObject(QObject *object) +void QDeclarativeViewInspectorPrivate::_q_deleteQmlObject(QObject *object) { // special cases for transitions/animations if (object->inherits("QDeclarativeAbstractAnimation")) { @@ -535,12 +535,12 @@ void QDeclarativeViewObserverPrivate::_q_deleteQmlObject(QObject *object) } } -void QDeclarativeViewObserverPrivate::_q_clearComponentCache() +void QDeclarativeViewInspectorPrivate::_q_clearComponentCache() { view->engine()->clearComponentCache(); } -void QDeclarativeViewObserverPrivate::_q_removeFromSelection(QObject *obj) +void QDeclarativeViewInspectorPrivate::_q_removeFromSelection(QObject *obj) { QList<QGraphicsItem*> items = selectedItems(); if (QGraphicsItem *item = qobject_cast<QGraphicsObject*>(obj)) @@ -548,7 +548,7 @@ void QDeclarativeViewObserverPrivate::_q_removeFromSelection(QObject *obj) setSelectedItems(items); } -bool QDeclarativeViewObserver::mouseDoubleClickEvent(QMouseEvent * /*event*/) +bool QDeclarativeViewInspector::mouseDoubleClickEvent(QMouseEvent * /*event*/) { if (!data->designModeBehavior) return false; @@ -556,7 +556,7 @@ bool QDeclarativeViewObserver::mouseDoubleClickEvent(QMouseEvent * /*event*/) return true; } -bool QDeclarativeViewObserver::wheelEvent(QWheelEvent *event) +bool QDeclarativeViewInspector::wheelEvent(QWheelEvent *event) { if (!data->designModeBehavior) return false; @@ -564,7 +564,7 @@ bool QDeclarativeViewObserver::wheelEvent(QWheelEvent *event) return true; } -void QDeclarativeViewObserver::setDesignModeBehavior(bool value) +void QDeclarativeViewInspector::setDesignModeBehavior(bool value) { emit designModeBehaviorChanged(value); @@ -578,17 +578,17 @@ void QDeclarativeViewObserver::setDesignModeBehavior(bool value) data->clearEditorItems(); } -bool QDeclarativeViewObserver::designModeBehavior() +bool QDeclarativeViewInspector::designModeBehavior() { return data->designModeBehavior; } -bool QDeclarativeViewObserver::showAppOnTop() const +bool QDeclarativeViewInspector::showAppOnTop() const { return data->showAppOnTop; } -void QDeclarativeViewObserver::setShowAppOnTop(bool appOnTop) +void QDeclarativeViewInspector::setShowAppOnTop(bool appOnTop) { if (data->view) { QWidget *window = data->view->window(); @@ -608,7 +608,7 @@ void QDeclarativeViewObserver::setShowAppOnTop(bool appOnTop) emit showAppOnTopChanged(appOnTop); } -void QDeclarativeViewObserverPrivate::changeTool(Constants::DesignTool tool, +void QDeclarativeViewInspectorPrivate::changeTool(Constants::DesignTool tool, Constants::ToolFlags /*flags*/) { switch(tool) { @@ -622,7 +622,7 @@ void QDeclarativeViewObserverPrivate::changeTool(Constants::DesignTool tool, } } -void QDeclarativeViewObserverPrivate::setSelectedItemsForTools(QList<QGraphicsItem *> items) +void QDeclarativeViewInspectorPrivate::setSelectedItemsForTools(QList<QGraphicsItem *> items) { foreach (const QWeakPointer<QGraphicsObject> &obj, currentSelection) { if (QGraphicsItem *item = obj.data()) { @@ -647,7 +647,7 @@ void QDeclarativeViewObserverPrivate::setSelectedItemsForTools(QList<QGraphicsIt currentTool->updateSelectedItems(); } -void QDeclarativeViewObserverPrivate::setSelectedItems(QList<QGraphicsItem *> items) +void QDeclarativeViewInspectorPrivate::setSelectedItems(QList<QGraphicsItem *> items) { QList<QWeakPointer<QGraphicsObject> > oldList = currentSelection; setSelectedItemsForTools(items); @@ -662,7 +662,7 @@ void QDeclarativeViewObserverPrivate::setSelectedItems(QList<QGraphicsItem *> it } } -QList<QGraphicsItem *> QDeclarativeViewObserverPrivate::selectedItems() +QList<QGraphicsItem *> QDeclarativeViewInspectorPrivate::selectedItems() { QList<QGraphicsItem *> selection; foreach (const QWeakPointer<QGraphicsObject> &selectedObject, currentSelection) { @@ -673,27 +673,27 @@ QList<QGraphicsItem *> QDeclarativeViewObserverPrivate::selectedItems() return selection; } -void QDeclarativeViewObserver::setSelectedItems(QList<QGraphicsItem *> items) +void QDeclarativeViewInspector::setSelectedItems(QList<QGraphicsItem *> items) { data->setSelectedItems(items); } -QList<QGraphicsItem *> QDeclarativeViewObserver::selectedItems() +QList<QGraphicsItem *> QDeclarativeViewInspector::selectedItems() { return data->selectedItems(); } -QDeclarativeView *QDeclarativeViewObserver::declarativeView() +QDeclarativeView *QDeclarativeViewInspector::declarativeView() { return data->view; } -void QDeclarativeViewObserverPrivate::clearHighlight() +void QDeclarativeViewInspectorPrivate::clearHighlight() { boundingRectHighlighter->clear(); } -void QDeclarativeViewObserverPrivate::highlight(const QList<QGraphicsObject *> &items) +void QDeclarativeViewInspectorPrivate::highlight(const QList<QGraphicsObject *> &items) { if (items.isEmpty()) return; @@ -712,27 +712,27 @@ void QDeclarativeViewObserverPrivate::highlight(const QList<QGraphicsObject *> & boundingRectHighlighter->highlight(objectList); } -QList<QGraphicsItem*> QDeclarativeViewObserverPrivate::selectableItems( +QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::selectableItems( const QPointF &scenePos) const { QList<QGraphicsItem*> itemlist = view->scene()->items(scenePos); return filterForSelection(itemlist); } -QList<QGraphicsItem*> QDeclarativeViewObserverPrivate::selectableItems(const QPoint &pos) const +QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::selectableItems(const QPoint &pos) const { QList<QGraphicsItem*> itemlist = view->items(pos); return filterForSelection(itemlist); } -QList<QGraphicsItem*> QDeclarativeViewObserverPrivate::selectableItems( +QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::selectableItems( const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const { QList<QGraphicsItem*> itemlist = view->scene()->items(sceneRect, selectionMode); return filterForSelection(itemlist); } -void QDeclarativeViewObserverPrivate::_q_changeToSingleSelectTool() +void QDeclarativeViewInspectorPrivate::_q_changeToSingleSelectTool() { currentToolMode = Constants::SelectionToolMode; selectionTool->setRubberbandSelectionMode(false); @@ -743,7 +743,7 @@ void QDeclarativeViewObserverPrivate::_q_changeToSingleSelectTool() debugService->setCurrentTool(Constants::SelectionToolMode); } -void QDeclarativeViewObserverPrivate::changeToSelectTool() +void QDeclarativeViewInspectorPrivate::changeToSelectTool() { if (currentTool == selectionTool) return; @@ -754,7 +754,7 @@ void QDeclarativeViewObserverPrivate::changeToSelectTool() currentTool->updateSelectedItems(); } -void QDeclarativeViewObserverPrivate::_q_changeToMarqueeSelectTool() +void QDeclarativeViewInspectorPrivate::_q_changeToMarqueeSelectTool() { changeToSelectTool(); currentToolMode = Constants::MarqueeSelectionToolMode; @@ -764,7 +764,7 @@ void QDeclarativeViewObserverPrivate::_q_changeToMarqueeSelectTool() debugService->setCurrentTool(Constants::MarqueeSelectionToolMode); } -void QDeclarativeViewObserverPrivate::_q_changeToZoomTool() +void QDeclarativeViewInspectorPrivate::_q_changeToZoomTool() { currentToolMode = Constants::ZoomMode; currentTool->clear(); @@ -775,7 +775,7 @@ void QDeclarativeViewObserverPrivate::_q_changeToZoomTool() debugService->setCurrentTool(Constants::ZoomMode); } -void QDeclarativeViewObserverPrivate::_q_changeToColorPickerTool() +void QDeclarativeViewInspectorPrivate::_q_changeToColorPickerTool() { if (currentTool == colorPickerTool) return; @@ -789,7 +789,7 @@ void QDeclarativeViewObserverPrivate::_q_changeToColorPickerTool() debugService->setCurrentTool(Constants::ColorPickerMode); } -void QDeclarativeViewObserver::setAnimationSpeed(qreal slowDownFactor) +void QDeclarativeViewInspector::setAnimationSpeed(qreal slowDownFactor) { Q_ASSERT(slowDownFactor > 0); if (data->slowDownFactor == slowDownFactor) @@ -799,7 +799,7 @@ void QDeclarativeViewObserver::setAnimationSpeed(qreal slowDownFactor) data->debugService->setAnimationSpeed(slowDownFactor); } -void QDeclarativeViewObserver::setAnimationPaused(bool paused) +void QDeclarativeViewInspector::setAnimationPaused(bool paused) { if (data->animationPaused == paused) return; @@ -808,7 +808,7 @@ void QDeclarativeViewObserver::setAnimationPaused(bool paused) data->debugService->setAnimationPaused(paused); } -void QDeclarativeViewObserver::animationSpeedChangeRequested(qreal factor) +void QDeclarativeViewInspector::animationSpeedChangeRequested(qreal factor) { if (data->slowDownFactor != factor) { data->slowDownFactor = factor; @@ -819,7 +819,7 @@ void QDeclarativeViewObserver::animationSpeedChangeRequested(qreal factor) QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor); } -void QDeclarativeViewObserver::animationPausedChangeRequested(bool paused) +void QDeclarativeViewInspector::animationPausedChangeRequested(bool paused) { if (data->animationPaused != paused) { data->animationPaused = paused; @@ -831,12 +831,12 @@ void QDeclarativeViewObserver::animationPausedChangeRequested(bool paused) } -void QDeclarativeViewObserverPrivate::_q_applyChangesFromClient() +void QDeclarativeViewInspectorPrivate::_q_applyChangesFromClient() { } -QList<QGraphicsItem*> QDeclarativeViewObserverPrivate::filterForSelection( +QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::filterForSelection( QList<QGraphicsItem*> &itemlist) const { foreach (QGraphicsItem *item, itemlist) { @@ -847,20 +847,20 @@ QList<QGraphicsItem*> QDeclarativeViewObserverPrivate::filterForSelection( return itemlist; } -bool QDeclarativeViewObserverPrivate::isEditorItem(QGraphicsItem *item) const +bool QDeclarativeViewInspectorPrivate::isEditorItem(QGraphicsItem *item) const { return (item->type() == Constants::EditorItemType || item->type() == Constants::ResizeHandleItemType || item->data(Constants::EditorItemDataKey).toBool()); } -void QDeclarativeViewObserverPrivate::_q_onStatusChanged(QDeclarativeView::Status status) +void QDeclarativeViewInspectorPrivate::_q_onStatusChanged(QDeclarativeView::Status status) { if (status == QDeclarativeView::Ready) debugService->reloaded(); } -void QDeclarativeViewObserverPrivate::_q_onCurrentObjectsChanged(QList<QObject*> objects) +void QDeclarativeViewInspectorPrivate::_q_onCurrentObjectsChanged(QList<QObject*> objects) { QList<QGraphicsItem*> items; QList<QGraphicsObject*> gfxObjects; @@ -877,13 +877,13 @@ void QDeclarativeViewObserverPrivate::_q_onCurrentObjectsChanged(QList<QObject*> } } -QString QDeclarativeViewObserver::idStringForObject(QObject *obj) +QString QDeclarativeViewInspector::idStringForObject(QObject *obj) { - return QDeclarativeObserverService::instance()->idStringForObject(obj); + return QDeclarativeInspectorService::instance()->idStringForObject(obj); } // adjusts bounding boxes on edges of screen to be visible -QRectF QDeclarativeViewObserver::adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace) +QRectF QDeclarativeViewInspector::adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace) { int marginFromEdge = 1; QRectF boundingRect(boundingRectInSceneSpace); @@ -904,7 +904,7 @@ QRectF QDeclarativeViewObserver::adjustToScreenBoundaries(const QRectF &bounding return boundingRect; } -void QDeclarativeViewObserverPrivate::createToolBox() +void QDeclarativeViewInspectorPrivate::createToolBox() { toolBox = new ToolBox(q->declarativeView()); @@ -947,4 +947,4 @@ void QDeclarativeViewObserverPrivate::createToolBox() } // namespace QmlJSDebugger -#include "qdeclarativeviewobserver.moc" +#include "qdeclarativeviewinspector.moc" diff --git a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver_p.h b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewinspector_p.h index 543fd10786..ed2e007cc2 100644 --- a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver_p.h +++ b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewinspector_p.h @@ -30,19 +30,19 @@ ** **************************************************************************/ -#ifndef QDECLARATIVEVIEWOBSERVER_P_H -#define QDECLARATIVEVIEWOBSERVER_P_H +#ifndef QDECLARATIVEVIEWINSPECTOR_P_H +#define QDECLARATIVEVIEWINSPECTOR_P_H #include <QtCore/QWeakPointer> #include <QtCore/QPointF> -#include "qdeclarativeviewobserver.h" -#include "qdeclarativeobserverservice.h" +#include "qdeclarativeviewinspector.h" +#include "qdeclarativeinspectorservice.h" namespace QmlJSDebugger { class JSDebuggerAgent; -class QDeclarativeViewObserver; +class QDeclarativeViewInspector; class LiveSelectionTool; class ZoomTool; class ColorPickerTool; @@ -52,16 +52,16 @@ class ToolBox; class CrumblePath; class AbstractLiveEditTool; -class QDeclarativeViewObserverPrivate : public QObject +class QDeclarativeViewInspectorPrivate : public QObject { Q_OBJECT public: - QDeclarativeViewObserverPrivate(QDeclarativeViewObserver *); - ~QDeclarativeViewObserverPrivate(); + QDeclarativeViewInspectorPrivate(QDeclarativeViewInspector *); + ~QDeclarativeViewInspectorPrivate(); QDeclarativeView *view; - QDeclarativeViewObserver *q; - QDeclarativeObserverService *debugService; + QDeclarativeViewInspector *q; + QDeclarativeInspectorService *debugService; QWeakPointer<QWidget> viewport; QPointF cursorPos; @@ -130,9 +130,9 @@ public slots: void _q_removeFromSelection(QObject *); public: - static QDeclarativeViewObserverPrivate *get(QDeclarativeViewObserver *v) { return v->d_func(); } + static QDeclarativeViewInspectorPrivate *get(QDeclarativeViewInspector *v) { return v->d_func(); } }; } // namespace QmlJSDebugger -#endif // QDECLARATIVEVIEWOBSERVER_P_H +#endif // QDECLARATIVEVIEWINSPECTOR_P_H diff --git a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-src.pri b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-src.pri index 025f758adb..4e93f4339b 100644 --- a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-src.pri +++ b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-src.pri @@ -10,9 +10,10 @@ SOURCES += \ $$PWD/jsdebuggeragent.cpp HEADERS += \ + $$PWD/include/qdeclarativeviewinspector.h \ $$PWD/include/qdeclarativeviewobserver.h \ - $$PWD/include/qdeclarativeobserverservice.h \ - $$PWD/include/qmlobserverconstants.h \ + $$PWD/include/qdeclarativeinspectorservice.h \ + $$PWD/include/qmlinspectorconstants.h \ $$PWD/editor/abstractliveedittool.h \ $$PWD/editor/liveselectiontool.h \ $$PWD/editor/livelayeritem.h \ @@ -26,11 +27,11 @@ HEADERS += \ $$PWD/editor/colorpickertool.h \ $$PWD/editor/qmltoolbar.h \ $$PWD/editor/toolbarcolorbox.h \ - $$PWD/qdeclarativeviewobserver_p.h + $$PWD/qdeclarativeviewinspector_p.h SOURCES += \ - $$PWD/qdeclarativeviewobserver.cpp \ - $$PWD/qdeclarativeobserverservice.cpp \ + $$PWD/qdeclarativeviewinspector.cpp \ + $$PWD/qdeclarativeinspectorservice.cpp \ $$PWD/editor/abstractliveedittool.cpp \ $$PWD/editor/liveselectiontool.cpp \ $$PWD/editor/livelayeritem.cpp \ |