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>
This commit is contained in:
Thorbjørn Lindeijer
2011-05-30 16:32:25 +02:00
committed by Kai Koehne
parent e0f79761f3
commit 335f6ad0f7
51 changed files with 528 additions and 474 deletions

View File

@@ -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()) {

View File

@@ -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;
};

View File

@@ -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)

View File

@@ -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;

View File

@@ -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);

View File

@@ -45,7 +45,7 @@ class ColorPickerTool : public AbstractLiveEditTool
{
Q_OBJECT
public:
explicit ColorPickerTool(QDeclarativeViewObserver *view);
explicit ColorPickerTool(QDeclarativeViewInspector *view);
virtual ~ColorPickerTool();

View File

@@ -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>

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -31,7 +31,7 @@
**************************************************************************/
#include "livelayeritem.h"
#include "qmlobserverconstants.h"
#include "qmlinspectorconstants.h"
#include <QGraphicsScene>

View File

@@ -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;

View File

@@ -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;
};

View File

@@ -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)
{
}

View File

@@ -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;
};
}

View File

@@ -31,7 +31,7 @@
**************************************************************************/
#include "liveselectionrectangle.h"
#include "qmlobserverconstants.h"
#include "qmlinspectorconstants.h"
#include <QtGui/QPen>
#include <QtGui/QGraphicsRectItem>

View File

@@ -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++;

View File

@@ -54,7 +54,7 @@ class LiveSelectionTool : public AbstractLiveEditTool
Q_OBJECT
public:
LiveSelectionTool(QDeclarativeViewObserver* editorView);
LiveSelectionTool(QDeclarativeViewInspector* editorView);
~LiveSelectionTool();
void mousePressEvent(QMouseEvent *event);

View File

@@ -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);
}

View File

@@ -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;
};

View File

@@ -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")),

View File

@@ -36,7 +36,7 @@
#include <QtGui/QToolBar>
#include <QtGui/QIcon>
#include "qmlobserverconstants.h"
#include "qmlinspectorconstants.h"
QT_FORWARD_DECLARE_CLASS(QActionGroup)

View File

@@ -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);

View File

@@ -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;

View File

@@ -31,7 +31,7 @@
**************************************************************************/
#include "toolbarcolorbox.h"
#include "qmlobserverconstants.h"
#include "qmlinspectorconstants.h"
#include <QtGui/QPixmap>
#include <QtGui/QPainter>

View File

@@ -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);

View File

@@ -49,7 +49,7 @@ public:
ZoomOut
};
explicit ZoomTool(QDeclarativeViewObserver *view);
explicit ZoomTool(QDeclarativeViewInspector *view);
virtual ~ZoomTool();

View File

@@ -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);

View File

@@ -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

View File

@@ -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;
explicit QDeclarativeViewObserver(QDeclarativeView *view, QObject *parent = 0)
: QDeclarativeViewInspector(view, parent)
{}
};
} // namespace QmlJSDebugger

View File

@@ -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

View File

@@ -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

View File

@@ -1,3 +1,3 @@
INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD
HEADERS += $$PWD/observerprotocol.h
HEADERS += $$PWD/inspectorprotocol.h

View File

@@ -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;

View File

@@ -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"

View File

@@ -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

View File

@@ -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 \

View File

@@ -54,8 +54,8 @@
#include <private/qabstractanimation_p.h>
#endif
#include <qdeclarativeviewobserver.h>
#include <qdeclarativeobserverservice.h>
#include <qdeclarativeviewinspector.h>
#include <qdeclarativeinspectorservice.h>
#include <QtNetwork/QNetworkReply>
#include <QtNetwork/QNetworkCookieJar>
@@ -648,7 +648,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
}
canvas = new DragAndDropView(this);
observer = new QmlJSDebugger::QDeclarativeViewObserver(canvas, this);
inspector = new QmlJSDebugger::QDeclarativeViewInspector(canvas, this);
new QmlJSDebugger::JSDebuggerAgent(canvas->engine());
canvas->setAttribute(Qt::WA_OpaquePaintEvent);
@@ -698,7 +698,7 @@ void QDeclarativeViewer::setDesignModeBehavior(bool value)
{
if (designModeBehaviorAction)
designModeBehaviorAction->setChecked(value);
observer->setDesignModeBehavior(value);
inspector->setDesignModeBehavior(value);
}
void QDeclarativeViewer::enableExperimentalGestures()
@@ -777,7 +777,7 @@ void QDeclarativeViewer::createMenu()
speedAction->setData(10.0f);
playSpeedMenuActions->addAction(speedAction);
pauseAnimationsAction = playSpeedMenu->addAction(tr("Pause"), observer, SLOT(setAnimationPaused(bool)));
pauseAnimationsAction = playSpeedMenu->addAction(tr("Pause"), inspector, SLOT(setAnimationPaused(bool)));
pauseAnimationsAction->setCheckable(true);
pauseAnimationsAction->setShortcut(QKeySequence("Ctrl+."));
@@ -790,30 +790,30 @@ void QDeclarativeViewer::createMenu()
QAction *playSpeedAction = new QAction(tr("Animations"), this);
playSpeedAction->setMenu(playSpeedMenu);
connect(observer, SIGNAL(animationSpeedChanged(qreal)), SLOT(animationSpeedChanged(qreal)));
connect(observer, SIGNAL(animationPausedChanged(bool)), pauseAnimationsAction, SLOT(setChecked(bool)));
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("&Observer Mode"), this);
designModeBehaviorAction = new QAction(tr("&Inspector Mode"), this);
designModeBehaviorAction->setShortcut(QKeySequence("Ctrl+D"));
designModeBehaviorAction->setCheckable(true);
designModeBehaviorAction->setChecked(observer->designModeBehavior());
designModeBehaviorAction->setEnabled(QmlJSDebugger::QDeclarativeObserverService::hasDebuggingClient());
designModeBehaviorAction->setChecked(inspector->designModeBehavior());
designModeBehaviorAction->setEnabled(QmlJSDebugger::QDeclarativeInspectorService::hasDebuggingClient());
connect(designModeBehaviorAction, SIGNAL(triggered(bool)), this, SLOT(setDesignModeBehavior(bool)));
connect(observer, SIGNAL(designModeBehaviorChanged(bool)), designModeBehaviorAction, SLOT(setChecked(bool)));
connect(QmlJSDebugger::QDeclarativeObserverService::instance(), SIGNAL(debuggingClientChanged(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(observer->showAppOnTop());
appOnTopAction->setChecked(inspector->showAppOnTop());
connect(appOnTopAction, SIGNAL(triggered(bool)), observer, SLOT(setShowAppOnTop(bool)));
connect(observer, SIGNAL(showAppOnTopChanged(bool)), appOnTopAction, SLOT(setChecked(bool)));
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()));
@@ -1070,12 +1070,12 @@ void QDeclarativeViewer::toggleRecording()
void QDeclarativeViewer::pauseAnimations()
{
observer->setAnimationPaused(true);
inspector->setAnimationPaused(true);
}
void QDeclarativeViewer::stepAnimations()
{
observer->setAnimationPaused(false);
inspector->setAnimationPaused(false);
QTimer::singleShot(m_stepSize, this, SLOT(pauseAnimations()));
}
@@ -1090,7 +1090,7 @@ void QDeclarativeViewer::setAnimationStep()
void QDeclarativeViewer::changeAnimationSpeed()
{
if (QAction *action = qobject_cast<QAction*>(sender()))
observer->setAnimationSpeed(action->data().toFloat());
inspector->setAnimationSpeed(action->data().toFloat());
}
void QDeclarativeViewer::addLibraryPath(const QString& lib)

View File

@@ -40,7 +40,7 @@
#include "loggerwidget.h"
namespace QmlJSDebugger {
class QDeclarativeViewObserver;
class QDeclarativeViewInspector;
}
QT_BEGIN_NAMESPACE
@@ -156,7 +156,7 @@ private:
LoggerWidget *loggerWindow;
QDeclarativeView *canvas;
QmlJSDebugger::QDeclarativeViewObserver *observer;
QmlJSDebugger::QDeclarativeViewInspector *inspector;
QSize initialSize;
QString currentFileOrUrl;
QTimer recordTimer;

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -66,7 +66,7 @@ static QToolButton *toolButton(QAction *action)
QmlInspectorToolBar::QmlInspectorToolBar(QObject *parent) :
QObject(parent),
m_fromQmlAction(0),
m_observerModeAction(0),
m_inspectorModeAction(0),
m_playAction(0),
m_selectAction(0),
m_zoomAction(0),
@@ -88,7 +88,7 @@ void QmlInspectorToolBar::setEnabled(bool value)
{
m_fromQmlAction->setEnabled(value);
m_showAppOnTopAction->setEnabled(value);
m_observerModeAction->setEnabled(value);
m_inspectorModeAction->setEnabled(value);
m_playAction->setEnabled(value);
m_selectAction->setEnabled(value);
m_zoomAction->setEnabled(value);
@@ -101,7 +101,7 @@ void QmlInspectorToolBar::enable()
setEnabled(true);
m_emitSignals = false;
m_showAppOnTopAction->setChecked(false);
m_observerModeAction->setChecked(false);
m_inspectorModeAction->setChecked(false);
setAnimationSpeed(1.0f);
activateDesignModeOnClick();
m_emitSignals = true;
@@ -165,7 +165,7 @@ void QmlInspectorToolBar::setAnimationPaused(bool paused)
void QmlInspectorToolBar::setDesignModeBehavior(bool inDesignMode)
{
m_emitSignals = false;
m_observerModeAction->setChecked(inDesignMode);
m_inspectorModeAction->setChecked(inDesignMode);
activateDesignModeOnClick();
m_emitSignals = true;
}
@@ -188,9 +188,9 @@ void QmlInspectorToolBar::createActions(const Core::Context &context)
m_showAppOnTopAction =
new QAction(QIcon(QLatin1String(":/qml/images/app-on-top.png")),
tr("Show application on top"), this);
m_observerModeAction =
new QAction(QIcon(QLatin1String(":/qml/images/observermode.png")),
tr("Observer Mode"), this);
m_inspectorModeAction =
new QAction(QIcon(QLatin1String(":/qml/images/inspectormode.png")),
tr("Inspector Mode"), this);
m_playAction =
new QAction(m_pauseIcon, tr("Play/Pause Animations"), this);
m_selectAction =
@@ -207,13 +207,13 @@ void QmlInspectorToolBar::createActions(const Core::Context &context)
m_fromQmlAction->setChecked(true);
m_showAppOnTopAction->setCheckable(true);
m_showAppOnTopAction->setChecked(false);
m_observerModeAction->setCheckable(true);
m_observerModeAction->setChecked(false);
m_inspectorModeAction->setCheckable(true);
m_inspectorModeAction->setChecked(false);
m_selectAction->setCheckable(true);
m_zoomAction->setCheckable(true);
m_colorPickerAction->setCheckable(true);
am->registerAction(m_observerModeAction, Constants::DESIGNMODE_ACTION, context);
am->registerAction(m_inspectorModeAction, Constants::DESIGNMODE_ACTION, context);
Core::Command *command = am->registerAction(m_playAction, Constants::PLAY_ACTION, context);
command->setAttribute(Core::Command::CA_UpdateIcon);
am->registerAction(m_selectAction, Constants::SELECT_ACTION, context);
@@ -292,7 +292,7 @@ void QmlInspectorToolBar::createActions(const Core::Context &context)
connect(m_fromQmlAction, SIGNAL(triggered()), SLOT(activateFromQml()));
connect(m_showAppOnTopAction, SIGNAL(triggered()), SLOT(showAppOnTopClick()));
connect(m_observerModeAction, SIGNAL(triggered()), SLOT(activateDesignModeOnClick()));
connect(m_inspectorModeAction, SIGNAL(triggered()), SLOT(activateDesignModeOnClick()));
connect(m_playAction, SIGNAL(triggered()), SLOT(activatePlayOnClick()));
connect(m_colorPickerAction, SIGNAL(triggered()), SLOT(activateColorPickerOnClick()));
connect(m_selectAction, SIGNAL(triggered()), SLOT(activateSelectToolOnClick()));
@@ -322,7 +322,7 @@ void QmlInspectorToolBar::changeAnimationSpeed()
void QmlInspectorToolBar::activateDesignModeOnClick()
{
bool checked = m_observerModeAction->isChecked();
bool checked = m_inspectorModeAction->isChecked();
m_selectAction->setEnabled(checked);
m_zoomAction->setEnabled(checked);

View File

@@ -127,7 +127,7 @@ private:
QToolButton *m_operateByInstructionButton;
QAction *m_fromQmlAction;
QAction *m_observerModeAction;
QAction *m_inspectorModeAction;
QAction *m_playAction;
QAction *m_selectAction;
QAction *m_zoomAction;

View File

@@ -32,7 +32,7 @@
#include "qmljsclientproxy.h"
#include "qmljsprivateapi.h"
#include "qmljsobserverclient.h"
#include "qmljsinspectorclient.h"
#include "qmljsinspector.h"
#include <debugger/debuggerplugin.h>
@@ -52,7 +52,7 @@ ClientProxy::ClientProxy(Debugger::QmlAdapter *adapter, QObject *parent)
: QObject(parent)
, m_adapter(adapter)
, m_engineClient(0)
, m_observerClient(0)
, m_inspectorClient(0)
, m_engineQuery(0)
, m_contextQuery(0)
, m_isConnected(false)
@@ -69,33 +69,33 @@ void ClientProxy::connectToServer()
connect(m_engineClient, SIGNAL(newObjects()), this, SLOT(newObjects()));
m_observerClient = new QmlJSObserverClient(m_adapter->connection(), this);
m_inspectorClient = new QmlJSInspectorClient(m_adapter->connection(), this);
connect(m_observerClient, SIGNAL(connectedStatusChanged(QDeclarativeDebugClient::Status)),
connect(m_inspectorClient, SIGNAL(connectedStatusChanged(QDeclarativeDebugClient::Status)),
this, SLOT(clientStatusChanged(QDeclarativeDebugClient::Status)));
connect(m_observerClient, SIGNAL(currentObjectsChanged(QList<int>)),
connect(m_inspectorClient, SIGNAL(currentObjectsChanged(QList<int>)),
SLOT(onCurrentObjectsChanged(QList<int>)));
connect(m_observerClient, SIGNAL(colorPickerActivated()),
connect(m_inspectorClient, SIGNAL(colorPickerActivated()),
SIGNAL(colorPickerActivated()));
connect(m_observerClient, SIGNAL(zoomToolActivated()),
connect(m_inspectorClient, SIGNAL(zoomToolActivated()),
SIGNAL(zoomToolActivated()));
connect(m_observerClient, SIGNAL(selectToolActivated()),
connect(m_inspectorClient, SIGNAL(selectToolActivated()),
SIGNAL(selectToolActivated()));
connect(m_observerClient, SIGNAL(selectMarqueeToolActivated()),
connect(m_inspectorClient, SIGNAL(selectMarqueeToolActivated()),
SIGNAL(selectMarqueeToolActivated()));
connect(m_observerClient, SIGNAL(animationSpeedChanged(qreal)),
connect(m_inspectorClient, SIGNAL(animationSpeedChanged(qreal)),
SIGNAL(animationSpeedChanged(qreal)));
connect(m_observerClient, SIGNAL(animationPausedChanged(bool)),
connect(m_inspectorClient, SIGNAL(animationPausedChanged(bool)),
SIGNAL(animationPausedChanged(bool)));
connect(m_observerClient, SIGNAL(designModeBehaviorChanged(bool)),
connect(m_inspectorClient, SIGNAL(designModeBehaviorChanged(bool)),
SIGNAL(designModeBehaviorChanged(bool)));
connect(m_observerClient, SIGNAL(showAppOnTopChanged(bool)),
connect(m_inspectorClient, SIGNAL(showAppOnTopChanged(bool)),
SIGNAL(showAppOnTopChanged(bool)));
connect(m_observerClient, SIGNAL(reloaded()), this,
connect(m_inspectorClient, SIGNAL(reloaded()), this,
SIGNAL(serverReloaded()));
connect(m_observerClient, SIGNAL(selectedColorChanged(QColor)),
connect(m_inspectorClient, SIGNAL(selectedColorChanged(QColor)),
SIGNAL(selectedColorChanged(QColor)));
connect(m_observerClient, SIGNAL(logActivity(QString,QString)),
connect(m_inspectorClient, SIGNAL(logActivity(QString,QString)),
m_adapter, SLOT(logServiceActivity(QString,QString)));
updateConnected();
@@ -150,7 +150,7 @@ void ClientProxy::setSelectedItemsByDebugId(const QList<int> &debugIds)
if (!isConnected())
return;
m_observerClient->setCurrentObjects(debugIds);
m_inspectorClient->setCurrentObjects(debugIds);
}
void ClientProxy::setSelectedItemsByObjectId(const QList<QDeclarativeDebugObjectReference> &objectRefs)
@@ -162,7 +162,7 @@ void ClientProxy::setSelectedItemsByObjectId(const QList<QDeclarativeDebugObject
debugIds << ref.debugId();
}
m_observerClient->setCurrentObjects(debugIds);
m_inspectorClient->setCurrentObjects(debugIds);
}
}
@@ -336,7 +336,7 @@ QDeclarativeDebugExpressionQuery *ClientProxy::queryExpressionResult(int objectD
void ClientProxy::clearComponentCache()
{
if (isConnected())
m_observerClient->clearComponentCache();
m_inspectorClient->clearComponentCache();
}
bool ClientProxy::addObjectWatch(int objectDebugId)
@@ -500,10 +500,10 @@ void ClientProxy::objectTreeFetched(QDeclarativeDebugQuery::State state)
emit objectTreeUpdated();
if (isConnected()) {
if (!m_observerClient->currentObjects().isEmpty())
onCurrentObjectsChanged(m_observerClient->currentObjects(), false);
if (!m_inspectorClient->currentObjects().isEmpty())
onCurrentObjectsChanged(m_inspectorClient->currentObjects(), false);
m_observerClient->setObjectIdList(m_rootObjects);
m_inspectorClient->setObjectIdList(m_rootObjects);
}
}
}
@@ -536,78 +536,78 @@ void ClientProxy::buildDebugIdHashRecursive(const QDeclarativeDebugObjectReferen
void ClientProxy::reloadQmlViewer()
{
if (isConnected())
m_observerClient->reloadViewer();
m_inspectorClient->reloadViewer();
}
void ClientProxy::setDesignModeBehavior(bool inDesignMode)
{
if (isConnected())
m_observerClient->setDesignModeBehavior(inDesignMode);
m_inspectorClient->setDesignModeBehavior(inDesignMode);
}
void ClientProxy::setAnimationSpeed(qreal slowDownFactor)
{
if (isConnected())
m_observerClient->setAnimationSpeed(slowDownFactor);
m_inspectorClient->setAnimationSpeed(slowDownFactor);
}
void ClientProxy::setAnimationPaused(bool paused)
{
if (isConnected())
m_observerClient->setAnimationPaused(paused);
m_inspectorClient->setAnimationPaused(paused);
}
void ClientProxy::changeToColorPickerTool()
{
if (isConnected())
m_observerClient->changeToColorPickerTool();
m_inspectorClient->changeToColorPickerTool();
}
void ClientProxy::changeToZoomTool()
{
if (isConnected())
m_observerClient->changeToZoomTool();
m_inspectorClient->changeToZoomTool();
}
void ClientProxy::changeToSelectTool()
{
if (isConnected())
m_observerClient->changeToSelectTool();
m_inspectorClient->changeToSelectTool();
}
void ClientProxy::changeToSelectMarqueeTool()
{
if (isConnected())
m_observerClient->changeToSelectMarqueeTool();
m_inspectorClient->changeToSelectMarqueeTool();
}
void ClientProxy::showAppOnTop(bool showOnTop)
{
if (isConnected())
m_observerClient->showAppOnTop(showOnTop);
m_inspectorClient->showAppOnTop(showOnTop);
}
void ClientProxy::createQmlObject(const QString &qmlText, int parentDebugId,
const QStringList &imports, const QString &filename, int order)
{
if (isConnected())
m_observerClient->createQmlObject(qmlText, parentDebugId, imports, filename, order);
m_inspectorClient->createQmlObject(qmlText, parentDebugId, imports, filename, order);
}
void ClientProxy::destroyQmlObject(int debugId)
{
if (isConnected())
m_observerClient->destroyQmlObject(debugId);
m_inspectorClient->destroyQmlObject(debugId);
}
void ClientProxy::reparentQmlObject(int debugId, int newParent)
{
if (isConnected())
m_observerClient->reparentQmlObject(debugId, newParent);
m_inspectorClient->reparentQmlObject(debugId, newParent);
}
void ClientProxy::updateConnected()
{
bool isConnected = m_observerClient && m_observerClient->status() == QDeclarativeDebugClient::Enabled
bool isConnected = m_inspectorClient && m_inspectorClient->status() == QDeclarativeDebugClient::Enabled
&& m_engineClient && m_engineClient->status() == QDeclarativeEngineDebug::Enabled;
if (isConnected != m_isConnected) {

View File

@@ -50,7 +50,7 @@ typedef QHash<QPair<QString, int>, QHash<QPair<int, int>, QList<int> > > DebugId
namespace Internal {
class InspectorPlugin;
class QmlJSObserverClient;
class QmlJSInspectorClient;
class ClientProxy : public QObject
{
@@ -167,7 +167,7 @@ private:
Debugger::QmlAdapter *m_adapter;
QDeclarativeEngineDebug *m_engineClient;
QmlJSObserverClient *m_observerClient;
QmlJSInspectorClient *m_inspectorClient;
QDeclarativeDebugEnginesQuery *m_engineQuery;
QDeclarativeDebugRootContextQuery *m_contextQuery;

View File

@@ -338,7 +338,7 @@ void InspectorUi::disconnected()
m_qmlEngine = 0;
resetViews();
applyChangesToQmlObserverHelper(false);
applyChangesToQmlInspectorHelper(false);
QHashIterator<QString, QmlJSLiveTextPreview *> iter(m_textPreviews);
while (iter.hasNext()) {
@@ -417,7 +417,7 @@ void InspectorUi::initializeDocuments()
createPreviewForEditor(editor);
}
applyChangesToQmlObserverHelper(true);
applyChangesToQmlInspectorHelper(true);
}
void InspectorUi::serverReloaded()
@@ -730,9 +730,9 @@ void InspectorUi::setupDockWidgets()
m_propertyInspector = new QmlJSPropertyInspector;
QWidget *observerWidget = new QWidget;
observerWidget->setWindowTitle(tr("QML Observer"));
observerWidget->setObjectName(Debugger::Constants::DOCKWIDGET_QML_INSPECTOR);
QWidget *inspectorWidget = new QWidget;
inspectorWidget->setWindowTitle(tr("QML Inspector"));
inspectorWidget->setObjectName(Debugger::Constants::DOCKWIDGET_QML_INSPECTOR);
QWidget *pathAndFilterWidget = new StyledBackground;
pathAndFilterWidget->setMaximumHeight(m_crumblePath->height());
@@ -747,14 +747,14 @@ void InspectorUi::setupDockWidgets()
pathAndFilterLayout->addWidget(m_crumblePath);
pathAndFilterLayout->addWidget(m_filterExp);
QVBoxLayout *wlay = new QVBoxLayout(observerWidget);
QVBoxLayout *wlay = new QVBoxLayout(inspectorWidget);
wlay->setMargin(0);
wlay->setSpacing(0);
observerWidget->setLayout(wlay);
inspectorWidget->setLayout(wlay);
wlay->addWidget(pathAndFilterWidget);
wlay->addWidget(m_propertyInspector);
QDockWidget *dock = mw->createDockWidget(Debugger::QmlLanguage, observerWidget);
QDockWidget *dock = mw->createDockWidget(Debugger::QmlLanguage, inspectorWidget);
dock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
dock->setTitleBarWidget(new QWidget(dock));
}
@@ -793,18 +793,18 @@ QString InspectorUi::findFileInProject(const QString &originalPath) const
return m_projectFinder.findFile(originalPath);
}
void InspectorUi::setApplyChangesToQmlObserver(bool applyChanges)
void InspectorUi::setApplyChangesToQmlInspector(bool applyChanges)
{
emit livePreviewActivated(applyChanges);
applyChangesToQmlObserverHelper(applyChanges);
applyChangesToQmlInspectorHelper(applyChanges);
}
void InspectorUi::applyChangesToQmlObserverHelper(bool applyChanges)
void InspectorUi::applyChangesToQmlInspectorHelper(bool applyChanges)
{
QHashIterator<QString, QmlJSLiveTextPreview *> iter(m_textPreviews);
while (iter.hasNext()) {
iter.next();
iter.value()->setApplyChangesToQmlObserver(applyChanges);
iter.value()->setApplyChangesToQmlInspector(applyChanges);
}
}
@@ -833,7 +833,7 @@ void InspectorUi::updatePendingPreviewDocuments(QmlJS::Document::Ptr doc)
void InspectorUi::disableLivePreview()
{
setApplyChangesToQmlObserver(false);
setApplyChangesToQmlInspector(false);
}
void InspectorUi::connectSignals()
@@ -875,7 +875,7 @@ void InspectorUi::connectSignals()
m_toolBar, SLOT(setAnimationPaused(bool)));
connect(m_toolBar, SIGNAL(applyChangesFromQmlFileTriggered(bool)),
this, SLOT(setApplyChangesToQmlObserver(bool)));
this, SLOT(setApplyChangesToQmlInspector(bool)));
connect(m_toolBar, SIGNAL(designModeSelected(bool)),
m_clientProxy, SLOT(setDesignModeBehavior(bool)));

View File

@@ -111,7 +111,7 @@ signals:
public slots:
void reloadQmlViewer();
void serverReloaded();
void setApplyChangesToQmlObserver(bool applyChanges);
void setApplyChangesToQmlInspector(bool applyChanges);
private slots:
void enable();
@@ -141,7 +141,7 @@ private:
void resetViews();
void initializeDocuments();
void applyChangesToQmlObserverHelper(bool applyChanges);
void applyChangesToQmlInspectorHelper(bool applyChanges);
void setupDockWidgets();
QString filenameForShadowBuildFile(const QString &filename) const;
void populateCrumblePath(const QDeclarativeDebugObjectReference &objRef);

View File

@@ -16,7 +16,7 @@ qmljsinspector.h \
qmlinspectortoolbar.h \
qmljslivetextpreview.h \
qmljstoolbarcolorbox.h \
qmljsobserverclient.h \
qmljsinspectorclient.h \
qmljscontextcrumblepath.h \
qmljsinspectorsettings.h \
qmljspropertyinspector.h
@@ -28,7 +28,7 @@ qmljsinspector.cpp \
qmlinspectortoolbar.cpp \
qmljslivetextpreview.cpp \
qmljstoolbarcolorbox.cpp \
qmljsobserverclient.cpp \
qmljsinspectorclient.cpp \
qmljscontextcrumblepath.cpp \
qmljsinspectorsettings.cpp \
qmljspropertyinspector.cpp

View File

@@ -18,7 +18,7 @@
<file>images/zoom-small.png</file>
<file>images/select-marquee-small.png</file>
<file>images/color-picker-small-hicontrast.png</file>
<file>images/observermode.png</file>
<file>images/inspectormode.png</file>
<file>images/app-on-top.png</file>
</qresource>
</RCC>

View File

@@ -29,7 +29,7 @@
**
**************************************************************************/
#include "qmljsobserverclient.h"
#include "qmljsinspectorclient.h"
#include "qmljsclientproxy.h"
#include "qmljsinspectorconstants.h"
@@ -40,27 +40,27 @@ using namespace QmlJSDebugger;
namespace QmlJSInspector {
namespace Internal {
QmlJSObserverClient::QmlJSObserverClient(QDeclarativeDebugConnection *client,
QmlJSInspectorClient::QmlJSInspectorClient(QDeclarativeDebugConnection *client,
QObject * /*parent*/)
: QDeclarativeDebugClient(QLatin1String("QDeclarativeObserverMode"), client) ,
m_connection(client)
{
}
void QmlJSObserverClient::statusChanged(Status status)
void QmlJSInspectorClient::statusChanged(Status status)
{
emit connectedStatusChanged(status);
}
void QmlJSObserverClient::messageReceived(const QByteArray &message)
void QmlJSInspectorClient::messageReceived(const QByteArray &message)
{
QDataStream ds(message);
ObserverProtocol::Message type;
InspectorProtocol::Message type;
ds >> type;
switch (type) {
case ObserverProtocol::CurrentObjectsChanged: {
case InspectorProtocol::CurrentObjectsChanged: {
int objectCount;
ds >> objectCount;
@@ -78,7 +78,7 @@ void QmlJSObserverClient::messageReceived(const QByteArray &message)
emit currentObjectsChanged(m_currentDebugIds);
break;
}
case ObserverProtocol::ToolChanged: {
case InspectorProtocol::ToolChanged: {
int toolId;
ds >> toolId;
@@ -95,7 +95,7 @@ void QmlJSObserverClient::messageReceived(const QByteArray &message)
}
break;
}
case ObserverProtocol::AnimationSpeedChanged: {
case InspectorProtocol::AnimationSpeedChanged: {
qreal slowDownFactor;
ds >> slowDownFactor;
@@ -104,7 +104,7 @@ void QmlJSObserverClient::messageReceived(const QByteArray &message)
emit animationSpeedChanged(slowDownFactor);
break;
}
case ObserverProtocol::AnimationPausedChanged: {
case InspectorProtocol::AnimationPausedChanged: {
bool paused;
ds >> paused;
@@ -113,7 +113,7 @@ void QmlJSObserverClient::messageReceived(const QByteArray &message)
emit animationPausedChanged(paused);
break;
}
case ObserverProtocol::SetDesignMode: {
case InspectorProtocol::SetDesignMode: {
bool inDesignMode;
ds >> inDesignMode;
@@ -122,7 +122,7 @@ void QmlJSObserverClient::messageReceived(const QByteArray &message)
emit designModeBehaviorChanged(inDesignMode);
break;
}
case ObserverProtocol::ShowAppOnTop: {
case InspectorProtocol::ShowAppOnTop: {
bool showAppOnTop;
ds >> showAppOnTop;
@@ -131,12 +131,12 @@ void QmlJSObserverClient::messageReceived(const QByteArray &message)
emit showAppOnTopChanged(showAppOnTop);
break;
}
case ObserverProtocol::Reloaded: {
case InspectorProtocol::Reloaded: {
log(LogReceive, type);
emit reloaded();
break;
}
case ObserverProtocol::ColorChanged: {
case InspectorProtocol::ColorChanged: {
QColor col;
ds >> col;
@@ -150,12 +150,12 @@ void QmlJSObserverClient::messageReceived(const QByteArray &message)
}
}
QList<int> QmlJSObserverClient::currentObjects() const
QList<int> QmlJSInspectorClient::currentObjects() const
{
return m_currentDebugIds;
}
void QmlJSObserverClient::setCurrentObjects(const QList<int> &debugIds)
void QmlJSInspectorClient::setCurrentObjects(const QList<int> &debugIds)
{
if (!m_connection || !m_connection->isConnected())
return;
@@ -168,7 +168,7 @@ void QmlJSObserverClient::setCurrentObjects(const QList<int> &debugIds)
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ObserverProtocol::Message cmd = ObserverProtocol::SetCurrentObjects;
InspectorProtocol::Message cmd = InspectorProtocol::SetCurrentObjects;
ds << cmd
<< debugIds.length();
@@ -189,7 +189,7 @@ void recurseObjectIdList(const QDeclarativeDebugObjectReference &ref, QList<int>
recurseObjectIdList(child, debugIds, objectIds);
}
void QmlJSObserverClient::setObjectIdList(const QList<QDeclarativeDebugObjectReference> &objectRoots)
void QmlJSInspectorClient::setObjectIdList(const QList<QDeclarativeDebugObjectReference> &objectRoots)
{
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
@@ -200,7 +200,7 @@ void QmlJSObserverClient::setObjectIdList(const QList<QDeclarativeDebugObjectRef
foreach (const QDeclarativeDebugObjectReference &ref, objectRoots)
recurseObjectIdList(ref, debugIds, objectIds);
ObserverProtocol::Message cmd = ObserverProtocol::ObjectIdList;
InspectorProtocol::Message cmd = InspectorProtocol::ObjectIdList;
ds << cmd
<< debugIds.length();
@@ -215,7 +215,7 @@ void QmlJSObserverClient::setObjectIdList(const QList<QDeclarativeDebugObjectRef
sendMessage(message);
}
void QmlJSObserverClient::clearComponentCache()
void QmlJSInspectorClient::clearComponentCache()
{
if (!m_connection || !m_connection->isConnected())
return;
@@ -223,7 +223,7 @@ void QmlJSObserverClient::clearComponentCache()
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ObserverProtocol::Message cmd = ObserverProtocol::ClearComponentCache;
InspectorProtocol::Message cmd = InspectorProtocol::ClearComponentCache;
ds << cmd;
log(LogSend, cmd);
@@ -231,7 +231,7 @@ void QmlJSObserverClient::clearComponentCache()
sendMessage(message);
}
void QmlJSObserverClient::reloadViewer()
void QmlJSInspectorClient::reloadViewer()
{
if (!m_connection || !m_connection->isConnected())
return;
@@ -239,7 +239,7 @@ void QmlJSObserverClient::reloadViewer()
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ObserverProtocol::Message cmd = ObserverProtocol::Reload;
InspectorProtocol::Message cmd = InspectorProtocol::Reload;
ds << cmd;
log(LogSend, cmd);
@@ -247,7 +247,7 @@ void QmlJSObserverClient::reloadViewer()
sendMessage(message);
}
void QmlJSObserverClient::setDesignModeBehavior(bool inDesignMode)
void QmlJSInspectorClient::setDesignModeBehavior(bool inDesignMode)
{
if (!m_connection || !m_connection->isConnected())
return;
@@ -255,7 +255,7 @@ void QmlJSObserverClient::setDesignModeBehavior(bool inDesignMode)
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ObserverProtocol::Message cmd = ObserverProtocol::SetDesignMode;
InspectorProtocol::Message cmd = InspectorProtocol::SetDesignMode;
ds << cmd
<< inDesignMode;
@@ -264,7 +264,7 @@ void QmlJSObserverClient::setDesignModeBehavior(bool inDesignMode)
sendMessage(message);
}
void QmlJSObserverClient::setAnimationSpeed(qreal slowDownFactor)
void QmlJSInspectorClient::setAnimationSpeed(qreal slowDownFactor)
{
if (!m_connection || !m_connection->isConnected())
return;
@@ -272,7 +272,7 @@ void QmlJSObserverClient::setAnimationSpeed(qreal slowDownFactor)
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ObserverProtocol::Message cmd = ObserverProtocol::SetAnimationSpeed;
InspectorProtocol::Message cmd = InspectorProtocol::SetAnimationSpeed;
ds << cmd
<< slowDownFactor;
@@ -282,7 +282,7 @@ void QmlJSObserverClient::setAnimationSpeed(qreal slowDownFactor)
sendMessage(message);
}
void QmlJSObserverClient::setAnimationPaused(bool paused)
void QmlJSInspectorClient::setAnimationPaused(bool paused)
{
if (!m_connection || !m_connection->isConnected())
return;
@@ -290,7 +290,7 @@ void QmlJSObserverClient::setAnimationPaused(bool paused)
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ObserverProtocol::Message cmd = ObserverProtocol::SetAnimationPaused;
InspectorProtocol::Message cmd = InspectorProtocol::SetAnimationPaused;
ds << cmd
<< paused;
@@ -299,7 +299,7 @@ void QmlJSObserverClient::setAnimationPaused(bool paused)
sendMessage(message);
}
void QmlJSObserverClient::changeToColorPickerTool()
void QmlJSInspectorClient::changeToColorPickerTool()
{
if (!m_connection || !m_connection->isConnected())
return;
@@ -307,17 +307,17 @@ void QmlJSObserverClient::changeToColorPickerTool()
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ObserverProtocol::Message cmd = ObserverProtocol::ChangeTool;
ObserverProtocol::Tool tool = ObserverProtocol::ColorPickerTool;
InspectorProtocol::Message cmd = InspectorProtocol::ChangeTool;
InspectorProtocol::Tool tool = InspectorProtocol::ColorPickerTool;
ds << cmd
<< tool;
log(LogSend, cmd, ObserverProtocol::toString(tool));
log(LogSend, cmd, InspectorProtocol::toString(tool));
sendMessage(message);
}
void QmlJSObserverClient::changeToSelectTool()
void QmlJSInspectorClient::changeToSelectTool()
{
if (!m_connection || !m_connection->isConnected())
return;
@@ -325,17 +325,17 @@ void QmlJSObserverClient::changeToSelectTool()
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ObserverProtocol::Message cmd = ObserverProtocol::ChangeTool;
ObserverProtocol::Tool tool = ObserverProtocol::SelectTool;
InspectorProtocol::Message cmd = InspectorProtocol::ChangeTool;
InspectorProtocol::Tool tool = InspectorProtocol::SelectTool;
ds << cmd
<< tool;
log(LogSend, cmd, ObserverProtocol::toString(tool));
log(LogSend, cmd, InspectorProtocol::toString(tool));
sendMessage(message);
}
void QmlJSObserverClient::changeToSelectMarqueeTool()
void QmlJSInspectorClient::changeToSelectMarqueeTool()
{
if (!m_connection || !m_connection->isConnected())
return;
@@ -343,17 +343,17 @@ void QmlJSObserverClient::changeToSelectMarqueeTool()
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ObserverProtocol::Message cmd = ObserverProtocol::ChangeTool;
ObserverProtocol::Tool tool = ObserverProtocol::SelectMarqueeTool;
InspectorProtocol::Message cmd = InspectorProtocol::ChangeTool;
InspectorProtocol::Tool tool = InspectorProtocol::SelectMarqueeTool;
ds << cmd
<< tool;
log(LogSend, cmd, ObserverProtocol::toString(tool));
log(LogSend, cmd, InspectorProtocol::toString(tool));
sendMessage(message);
}
void QmlJSObserverClient::changeToZoomTool()
void QmlJSInspectorClient::changeToZoomTool()
{
if (!m_connection || !m_connection->isConnected())
return;
@@ -361,17 +361,17 @@ void QmlJSObserverClient::changeToZoomTool()
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ObserverProtocol::Message cmd = ObserverProtocol::ChangeTool;
ObserverProtocol::Tool tool = ObserverProtocol::ZoomTool;
InspectorProtocol::Message cmd = InspectorProtocol::ChangeTool;
InspectorProtocol::Tool tool = InspectorProtocol::ZoomTool;
ds << cmd
<< tool;
log(LogSend, cmd, ObserverProtocol::toString(tool));
log(LogSend, cmd, InspectorProtocol::toString(tool));
sendMessage(message);
}
void QmlJSObserverClient::showAppOnTop(bool showOnTop)
void QmlJSInspectorClient::showAppOnTop(bool showOnTop)
{
if (!m_connection || !m_connection->isConnected())
return;
@@ -379,7 +379,7 @@ void QmlJSObserverClient::showAppOnTop(bool showOnTop)
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ObserverProtocol::Message cmd = ObserverProtocol::ShowAppOnTop;
InspectorProtocol::Message cmd = InspectorProtocol::ShowAppOnTop;
ds << cmd << showOnTop;
log(LogSend, cmd, QLatin1String(showOnTop ? "true" : "false"));
@@ -387,7 +387,7 @@ void QmlJSObserverClient::showAppOnTop(bool showOnTop)
sendMessage(message);
}
void QmlJSObserverClient::createQmlObject(const QString &qmlText, int parentDebugId,
void QmlJSInspectorClient::createQmlObject(const QString &qmlText, int parentDebugId,
const QStringList &imports, const QString &filename, int order)
{
if (!m_connection || !m_connection->isConnected())
@@ -396,7 +396,7 @@ void QmlJSObserverClient::createQmlObject(const QString &qmlText, int parentDebu
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ObserverProtocol::Message cmd = ObserverProtocol::CreateObject;
InspectorProtocol::Message cmd = InspectorProtocol::CreateObject;
ds << cmd
<< qmlText
<< parentDebugId
@@ -410,14 +410,14 @@ void QmlJSObserverClient::createQmlObject(const QString &qmlText, int parentDebu
sendMessage(message);
}
void QmlJSObserverClient::destroyQmlObject(int debugId)
void QmlJSInspectorClient::destroyQmlObject(int debugId)
{
if (!m_connection || !m_connection->isConnected())
return;
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ObserverProtocol::Message cmd = ObserverProtocol::DestroyObject;
InspectorProtocol::Message cmd = InspectorProtocol::DestroyObject;
ds << cmd << debugId;
log(LogSend, cmd, QString::number(debugId));
@@ -425,14 +425,14 @@ void QmlJSObserverClient::destroyQmlObject(int debugId)
sendMessage(message);
}
void QmlJSObserverClient::reparentQmlObject(int debugId, int newParent)
void QmlJSInspectorClient::reparentQmlObject(int debugId, int newParent)
{
if (!m_connection || !m_connection->isConnected())
return;
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ObserverProtocol::Message cmd = ObserverProtocol::MoveObject;
InspectorProtocol::Message cmd = InspectorProtocol::MoveObject;
ds << cmd
<< debugId
<< newParent;
@@ -444,7 +444,7 @@ void QmlJSObserverClient::reparentQmlObject(int debugId, int newParent)
}
void QmlJSObserverClient::applyChangesToQmlFile()
void QmlJSInspectorClient::applyChangesToQmlFile()
{
if (!m_connection || !m_connection->isConnected())
return;
@@ -452,7 +452,7 @@ void QmlJSObserverClient::applyChangesToQmlFile()
// TODO
}
void QmlJSObserverClient::applyChangesFromQmlFile()
void QmlJSInspectorClient::applyChangesFromQmlFile()
{
if (!m_connection || !m_connection->isConnected())
return;
@@ -460,7 +460,7 @@ void QmlJSObserverClient::applyChangesFromQmlFile()
// TODO
}
void QmlJSObserverClient::log(LogDirection direction, ObserverProtocol::Message message,
void QmlJSInspectorClient::log(LogDirection direction, InspectorProtocol::Message message,
const QString &extra)
{
QString msg;
@@ -469,7 +469,7 @@ void QmlJSObserverClient::log(LogDirection direction, ObserverProtocol::Message
else
msg += QLatin1String(" receiving ");
msg += ObserverProtocol::toString(message);
msg += InspectorProtocol::toString(message);
msg += QLatin1Char(' ');
msg += extra;
emit logActivity(name(), msg);

View File

@@ -34,16 +34,16 @@
#include "qmljsprivateapi.h"
#include <observerprotocol.h>
#include <inspectorprotocol.h>
namespace QmlJSInspector {
namespace Internal {
class QmlJSObserverClient : public QDeclarativeDebugClient
class QmlJSInspectorClient : public QDeclarativeDebugClient
{
Q_OBJECT
public:
explicit QmlJSObserverClient(QDeclarativeDebugConnection *client,
explicit QmlJSInspectorClient(QDeclarativeDebugConnection *client,
QObject *parent = 0);
void setCurrentObjects(const QList<int> &debugIds);
@@ -100,7 +100,7 @@ private:
};
void log(LogDirection direction,
QmlJSDebugger::ObserverProtocol::Message message,
QmlJSDebugger::InspectorProtocol::Message message,
const QString &extra = QString());
QList<int> m_currentDebugIds;

View File

@@ -176,7 +176,7 @@ QmlJSLiveTextPreview::QmlJSLiveTextPreview(const QmlJS::Document::Ptr &doc,
: QObject(parent)
, m_previousDoc(doc)
, m_initialDoc(initDoc)
, m_applyChangesToQmlObserver(true)
, m_applyChangesToQmlInspector(true)
, m_clientProxy(clientProxy)
{
Q_ASSERT(doc->fileName() == initDoc->fileName());
@@ -341,7 +341,7 @@ void QmlJSLiveTextPreview::updateDebugIds()
}
class UpdateObserver : public Delta {
class UpdateInspector : public Delta {
private:
static inline QString stripQuotes(const QString &str)
{
@@ -509,7 +509,7 @@ protected:
}
public:
UpdateObserver(ClientProxy *clientProxy)
UpdateInspector(ClientProxy *clientProxy)
: appliedChangesToViewer(false)
, referenceRefreshRequired(false)
, unsyncronizableChanges(QmlJSLiveTextPreview::NoUnsyncronizableChanges)
@@ -534,13 +534,13 @@ void QmlJSLiveTextPreview::documentChanged(QmlJS::Document::Ptr doc)
bool experimentalWarningShown = false;
if (m_applyChangesToQmlObserver) {
if (m_applyChangesToQmlInspector) {
m_docWithUnappliedChanges.clear();
if (doc && m_previousDoc && doc->fileName() == m_previousDoc->fileName()
&& doc->qmlProgram() && m_previousDoc->qmlProgram())
{
UpdateObserver delta(m_clientProxy.data());
UpdateInspector delta(m_clientProxy.data());
m_debugIds = delta(m_previousDoc, doc, m_debugIds);
if (delta.referenceRefreshRequired)
@@ -622,16 +622,16 @@ void QmlJSLiveTextPreview::disableLivePreview()
emit disableLivePreviewRequested();
}
void QmlJSLiveTextPreview::setApplyChangesToQmlObserver(bool applyChanges)
void QmlJSLiveTextPreview::setApplyChangesToQmlInspector(bool applyChanges)
{
if (applyChanges && !m_applyChangesToQmlObserver) {
if (applyChanges && !m_applyChangesToQmlInspector) {
if (m_docWithUnappliedChanges) {
m_applyChangesToQmlObserver = true;
m_applyChangesToQmlInspector = true;
documentChanged(m_docWithUnappliedChanges);
}
}
m_applyChangesToQmlObserver = applyChanges;
m_applyChangesToQmlInspector = applyChanges;
}
void QmlJSLiveTextPreview::setClientProxy(ClientProxy *clientProxy)

View File

@@ -90,7 +90,7 @@ signals:
void disableLivePreviewRequested();
public slots:
void setApplyChangesToQmlObserver(bool applyChanges);
void setApplyChangesToQmlInspector(bool applyChanges);
void updateDebugIds();
private slots:
@@ -117,7 +117,7 @@ private:
QList<QWeakPointer<QmlJSEditor::QmlJSTextEditorWidget> > m_editors;
bool m_applyChangesToQmlObserver;
bool m_applyChangesToQmlInspector;
QmlJS::Document::Ptr m_docWithUnappliedChanges;
QWeakPointer<ClientProxy> m_clientProxy;