forked from qt-creator/qt-creator
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:
committed by
Kai Koehne
parent
e0f79761f3
commit
335f6ad0f7
@@ -31,8 +31,8 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "abstractliveedittool.h"
|
#include "abstractliveedittool.h"
|
||||||
#include "qdeclarativeviewobserver.h"
|
#include "qdeclarativeviewinspector.h"
|
||||||
#include "../qdeclarativeviewobserver_p.h"
|
#include "../qdeclarativeviewinspector_p.h"
|
||||||
|
|
||||||
#include <QDeclarativeEngine>
|
#include <QDeclarativeEngine>
|
||||||
|
|
||||||
@@ -42,8 +42,8 @@
|
|||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
AbstractLiveEditTool::AbstractLiveEditTool(QDeclarativeViewObserver *editorView)
|
AbstractLiveEditTool::AbstractLiveEditTool(QDeclarativeViewInspector *editorView)
|
||||||
: QObject(editorView), m_observer(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
|
QDeclarativeView *AbstractLiveEditTool::view() const
|
||||||
{
|
{
|
||||||
return m_observer->declarativeView();
|
return m_inspector->declarativeView();
|
||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsScene* AbstractLiveEditTool::scene() const
|
QGraphicsScene* AbstractLiveEditTool::scene() const
|
||||||
@@ -74,7 +74,7 @@ void AbstractLiveEditTool::updateSelectedItems()
|
|||||||
|
|
||||||
QList<QGraphicsItem*> AbstractLiveEditTool::items() const
|
QList<QGraphicsItem*> AbstractLiveEditTool::items() const
|
||||||
{
|
{
|
||||||
return observer()->selectedItems();
|
return inspector()->selectedItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractLiveEditTool::topItemIsMovable(const QList<QGraphicsItem*> & itemList)
|
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)
|
bool AbstractLiveEditTool::topSelectedItemIsMovable(const QList<QGraphicsItem*> &itemList)
|
||||||
{
|
{
|
||||||
QList<QGraphicsItem*> selectedItems = observer()->selectedItems();
|
QList<QGraphicsItem*> selectedItems = inspector()->selectedItems();
|
||||||
|
|
||||||
foreach (QGraphicsItem *item, itemList) {
|
foreach (QGraphicsItem *item, itemList) {
|
||||||
QDeclarativeItem *declarativeItem = toQDeclarativeItem(item);
|
QDeclarativeItem *declarativeItem = toQDeclarativeItem(item);
|
||||||
@@ -167,7 +167,7 @@ QString AbstractLiveEditTool::titleForItem(QGraphicsItem *item)
|
|||||||
|
|
||||||
QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem*>(gfxObject);
|
QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem*>(gfxObject);
|
||||||
if (declarativeItem) {
|
if (declarativeItem) {
|
||||||
objectStringId = QDeclarativeViewObserver::idStringForObject(declarativeItem);
|
objectStringId = QDeclarativeViewInspector::idStringForObject(declarativeItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!objectStringId.isEmpty()) {
|
if (!objectStringId.isEmpty()) {
|
||||||
|
@@ -49,7 +49,7 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
class QDeclarativeViewObserver;
|
class QDeclarativeViewInspector;
|
||||||
|
|
||||||
class FormEditorView;
|
class FormEditorView;
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ class AbstractLiveEditTool : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AbstractLiveEditTool(QDeclarativeViewObserver *observer);
|
AbstractLiveEditTool(QDeclarativeViewInspector *inspector);
|
||||||
|
|
||||||
virtual ~AbstractLiveEditTool();
|
virtual ~AbstractLiveEditTool();
|
||||||
|
|
||||||
@@ -93,12 +93,12 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual void selectedItemsChanged(const QList<QGraphicsItem*> &objectList) = 0;
|
virtual void selectedItemsChanged(const QList<QGraphicsItem*> &objectList) = 0;
|
||||||
|
|
||||||
QDeclarativeViewObserver *observer() const;
|
QDeclarativeViewInspector *inspector() const;
|
||||||
QDeclarativeView *view() const;
|
QDeclarativeView *view() const;
|
||||||
QGraphicsScene *scene() const;
|
QGraphicsScene *scene() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QDeclarativeViewObserver *m_observer;
|
QDeclarativeViewInspector *m_inspector;
|
||||||
QList<QGraphicsItem*> m_itemList;
|
QList<QGraphicsItem*> m_itemList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -31,8 +31,8 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "boundingrecthighlighter.h"
|
#include "boundingrecthighlighter.h"
|
||||||
#include "qdeclarativeviewobserver.h"
|
#include "qdeclarativeviewinspector.h"
|
||||||
#include "qmlobserverconstants.h"
|
#include "qmlinspectorconstants.h"
|
||||||
|
|
||||||
#include <QtGui/QGraphicsPolygonItem>
|
#include <QtGui/QGraphicsPolygonItem>
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ int BoundingBoxPolygonItem::type() const
|
|||||||
return Constants::EditorItemType;
|
return Constants::EditorItemType;
|
||||||
}
|
}
|
||||||
|
|
||||||
BoundingRectHighlighter::BoundingRectHighlighter(QDeclarativeViewObserver *view) :
|
BoundingRectHighlighter::BoundingRectHighlighter(QDeclarativeViewInspector *view) :
|
||||||
LiveLayerItem(view->declarativeView()->scene()),
|
LiveLayerItem(view->declarativeView()->scene()),
|
||||||
m_view(view),
|
m_view(view),
|
||||||
m_animFrame(0)
|
m_animFrame(0)
|
||||||
|
@@ -46,14 +46,14 @@ QT_FORWARD_DECLARE_CLASS(QTimer)
|
|||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
class QDeclarativeViewObserver;
|
class QDeclarativeViewInspector;
|
||||||
class BoundingBox;
|
class BoundingBox;
|
||||||
|
|
||||||
class BoundingRectHighlighter : public LiveLayerItem
|
class BoundingRectHighlighter : public LiveLayerItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit BoundingRectHighlighter(QDeclarativeViewObserver *view);
|
explicit BoundingRectHighlighter(QDeclarativeViewInspector *view);
|
||||||
~BoundingRectHighlighter();
|
~BoundingRectHighlighter();
|
||||||
void clear();
|
void clear();
|
||||||
void highlight(QList<QGraphicsObject*> items);
|
void highlight(QList<QGraphicsObject*> items);
|
||||||
@@ -74,7 +74,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(BoundingRectHighlighter)
|
Q_DISABLE_COPY(BoundingRectHighlighter)
|
||||||
|
|
||||||
QDeclarativeViewObserver *m_view;
|
QDeclarativeViewInspector *m_view;
|
||||||
QList<BoundingBox* > m_boxes;
|
QList<BoundingBox* > m_boxes;
|
||||||
QList<BoundingBox* > m_freeBoxes;
|
QList<BoundingBox* > m_freeBoxes;
|
||||||
QTimer *m_animTimer;
|
QTimer *m_animTimer;
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "colorpickertool.h"
|
#include "colorpickertool.h"
|
||||||
#include "qdeclarativeviewobserver.h"
|
#include "qdeclarativeviewinspector.h"
|
||||||
|
|
||||||
#include <QtGui/QMouseEvent>
|
#include <QtGui/QMouseEvent>
|
||||||
#include <QtGui/QKeyEvent>
|
#include <QtGui/QKeyEvent>
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
ColorPickerTool::ColorPickerTool(QDeclarativeViewObserver *view) :
|
ColorPickerTool::ColorPickerTool(QDeclarativeViewInspector *view) :
|
||||||
AbstractLiveEditTool(view)
|
AbstractLiveEditTool(view)
|
||||||
{
|
{
|
||||||
m_selectedColor.setRgb(0,0,0);
|
m_selectedColor.setRgb(0,0,0);
|
||||||
|
@@ -45,7 +45,7 @@ class ColorPickerTool : public AbstractLiveEditTool
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ColorPickerTool(QDeclarativeViewObserver *view);
|
explicit ColorPickerTool(QDeclarativeViewInspector *view);
|
||||||
|
|
||||||
virtual ~ColorPickerTool();
|
virtual ~ColorPickerTool();
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
<file>images/zoom-24.png</file>
|
<file>images/zoom-24.png</file>
|
||||||
<file>images/select-24.png</file>
|
<file>images/select-24.png</file>
|
||||||
<file>images/select-marquee-24.png</file>
|
<file>images/select-marquee-24.png</file>
|
||||||
<file>images/observermode.png</file>
|
<file>images/inspectormode.png</file>
|
||||||
<file>images/observermode-24.png</file>
|
<file>images/inspectormode-24.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
@@ -31,7 +31,7 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "livelayeritem.h"
|
#include "livelayeritem.h"
|
||||||
#include "qmlobserverconstants.h"
|
#include "qmlinspectorconstants.h"
|
||||||
|
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "liverubberbandselectionmanipulator.h"
|
#include "liverubberbandselectionmanipulator.h"
|
||||||
#include "../qdeclarativeviewobserver_p.h"
|
#include "../qdeclarativeviewinspector_p.h"
|
||||||
|
|
||||||
#include <QtGui/QGraphicsItem>
|
#include <QtGui/QGraphicsItem>
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
LiveRubberBandSelectionManipulator::LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem,
|
LiveRubberBandSelectionManipulator::LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem,
|
||||||
QDeclarativeViewObserver *editorView)
|
QDeclarativeViewInspector *editorView)
|
||||||
: m_selectionRectangleElement(layerItem),
|
: m_selectionRectangleElement(layerItem),
|
||||||
m_editorView(editorView),
|
m_editorView(editorView),
|
||||||
m_beginFormEditorItem(0),
|
m_beginFormEditorItem(0),
|
||||||
@@ -73,9 +73,9 @@ void LiveRubberBandSelectionManipulator::begin(const QPointF &beginPoint)
|
|||||||
m_selectionRectangleElement.setRect(m_beginPoint, m_beginPoint);
|
m_selectionRectangleElement.setRect(m_beginPoint, m_beginPoint);
|
||||||
m_selectionRectangleElement.show();
|
m_selectionRectangleElement.show();
|
||||||
m_isActive = true;
|
m_isActive = true;
|
||||||
QDeclarativeViewObserverPrivate *observerPrivate
|
QDeclarativeViewInspectorPrivate *inspectorPrivate
|
||||||
= QDeclarativeViewObserverPrivate::get(m_editorView);
|
= QDeclarativeViewInspectorPrivate::get(m_editorView);
|
||||||
m_beginFormEditorItem = topFormEditorItem(observerPrivate->selectableItems(beginPoint));
|
m_beginFormEditorItem = topFormEditorItem(inspectorPrivate->selectableItems(beginPoint));
|
||||||
m_oldSelectionList = m_editorView->selectedItems();
|
m_oldSelectionList = m_editorView->selectedItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,10 +93,10 @@ void LiveRubberBandSelectionManipulator::end()
|
|||||||
|
|
||||||
void LiveRubberBandSelectionManipulator::select(SelectionType selectionType)
|
void LiveRubberBandSelectionManipulator::select(SelectionType selectionType)
|
||||||
{
|
{
|
||||||
QDeclarativeViewObserverPrivate *observerPrivate
|
QDeclarativeViewInspectorPrivate *inspectorPrivate
|
||||||
= QDeclarativeViewObserverPrivate::get(m_editorView);
|
= QDeclarativeViewInspectorPrivate::get(m_editorView);
|
||||||
QList<QGraphicsItem*> itemList
|
QList<QGraphicsItem*> itemList
|
||||||
= observerPrivate->selectableItems(m_selectionRectangleElement.rect(),
|
= inspectorPrivate->selectableItems(m_selectionRectangleElement.rect(),
|
||||||
Qt::IntersectsItemShape);
|
Qt::IntersectsItemShape);
|
||||||
QList<QGraphicsItem*> newSelectionList;
|
QList<QGraphicsItem*> newSelectionList;
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ QT_FORWARD_DECLARE_CLASS(QGraphicsItem)
|
|||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
class QDeclarativeViewObserver;
|
class QDeclarativeViewInspector;
|
||||||
|
|
||||||
class LiveRubberBandSelectionManipulator
|
class LiveRubberBandSelectionManipulator
|
||||||
{
|
{
|
||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem,
|
LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem,
|
||||||
QDeclarativeViewObserver *editorView);
|
QDeclarativeViewInspector *editorView);
|
||||||
|
|
||||||
void setItems(const QList<QGraphicsItem*> &itemList);
|
void setItems(const QList<QGraphicsItem*> &itemList);
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ private:
|
|||||||
QList<QGraphicsItem*> m_oldSelectionList;
|
QList<QGraphicsItem*> m_oldSelectionList;
|
||||||
LiveSelectionRectangle m_selectionRectangleElement;
|
LiveSelectionRectangle m_selectionRectangleElement;
|
||||||
QPointF m_beginPoint;
|
QPointF m_beginPoint;
|
||||||
QDeclarativeViewObserver *m_editorView;
|
QDeclarativeViewInspector *m_editorView;
|
||||||
QGraphicsItem *m_beginFormEditorItem;
|
QGraphicsItem *m_beginFormEditorItem;
|
||||||
bool m_isActive;
|
bool m_isActive;
|
||||||
};
|
};
|
||||||
|
@@ -31,8 +31,8 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "liveselectionindicator.h"
|
#include "liveselectionindicator.h"
|
||||||
#include "../qdeclarativeviewobserver_p.h"
|
#include "../qdeclarativeviewinspector_p.h"
|
||||||
#include "qmlobserverconstants.h"
|
#include "qmlinspectorconstants.h"
|
||||||
|
|
||||||
#include <QtGui/QGraphicsRectItem>
|
#include <QtGui/QGraphicsRectItem>
|
||||||
#include <QtGui/QGraphicsObject>
|
#include <QtGui/QGraphicsObject>
|
||||||
@@ -41,10 +41,10 @@
|
|||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
LiveSelectionIndicator::LiveSelectionIndicator(QDeclarativeViewObserver *viewObserver,
|
LiveSelectionIndicator::LiveSelectionIndicator(QDeclarativeViewInspector *viewInspector,
|
||||||
QGraphicsObject *layerItem)
|
QGraphicsObject *layerItem)
|
||||||
: m_layerItem(layerItem)
|
: m_layerItem(layerItem)
|
||||||
, m_view(viewObserver)
|
, m_view(viewInspector)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -45,12 +45,12 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
class QDeclarativeViewObserver;
|
class QDeclarativeViewInspector;
|
||||||
|
|
||||||
class LiveSelectionIndicator
|
class LiveSelectionIndicator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LiveSelectionIndicator(QDeclarativeViewObserver *viewObserver, QGraphicsObject *layerItem);
|
LiveSelectionIndicator(QDeclarativeViewInspector *viewInspector, QGraphicsObject *layerItem);
|
||||||
~LiveSelectionIndicator();
|
~LiveSelectionIndicator();
|
||||||
|
|
||||||
void show();
|
void show();
|
||||||
@@ -63,7 +63,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
QHash<QGraphicsItem*, QGraphicsRectItem *> m_indicatorShapeHash;
|
QHash<QGraphicsItem*, QGraphicsRectItem *> m_indicatorShapeHash;
|
||||||
QWeakPointer<QGraphicsObject> m_layerItem;
|
QWeakPointer<QGraphicsObject> m_layerItem;
|
||||||
QDeclarativeViewObserver *m_view;
|
QDeclarativeViewInspector *m_view;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "liveselectionrectangle.h"
|
#include "liveselectionrectangle.h"
|
||||||
#include "qmlobserverconstants.h"
|
#include "qmlinspectorconstants.h"
|
||||||
|
|
||||||
#include <QtGui/QPen>
|
#include <QtGui/QPen>
|
||||||
#include <QtGui/QGraphicsRectItem>
|
#include <QtGui/QGraphicsRectItem>
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
#include "liveselectiontool.h"
|
#include "liveselectiontool.h"
|
||||||
#include "livelayeritem.h"
|
#include "livelayeritem.h"
|
||||||
|
|
||||||
#include "../qdeclarativeviewobserver_p.h"
|
#include "../qdeclarativeviewinspector_p.h"
|
||||||
|
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QtGui/QWheelEvent>
|
#include <QtGui/QWheelEvent>
|
||||||
@@ -50,14 +50,14 @@
|
|||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
LiveSelectionTool::LiveSelectionTool(QDeclarativeViewObserver *editorView) :
|
LiveSelectionTool::LiveSelectionTool(QDeclarativeViewInspector *editorView) :
|
||||||
AbstractLiveEditTool(editorView),
|
AbstractLiveEditTool(editorView),
|
||||||
m_rubberbandSelectionMode(false),
|
m_rubberbandSelectionMode(false),
|
||||||
m_rubberbandSelectionManipulator(
|
m_rubberbandSelectionManipulator(
|
||||||
QDeclarativeViewObserverPrivate::get(editorView)->manipulatorLayer, editorView),
|
QDeclarativeViewInspectorPrivate::get(editorView)->manipulatorLayer, editorView),
|
||||||
m_singleSelectionManipulator(editorView),
|
m_singleSelectionManipulator(editorView),
|
||||||
m_selectionIndicator(editorView,
|
m_selectionIndicator(editorView,
|
||||||
QDeclarativeViewObserverPrivate::get(editorView)->manipulatorLayer),
|
QDeclarativeViewInspectorPrivate::get(editorView)->manipulatorLayer),
|
||||||
//m_resizeIndicator(editorView->manipulatorLayer()),
|
//m_resizeIndicator(editorView->manipulatorLayer()),
|
||||||
m_selectOnlyContentItems(true)
|
m_selectOnlyContentItems(true)
|
||||||
{
|
{
|
||||||
@@ -88,9 +88,9 @@ LiveSingleSelectionManipulator::SelectionType LiveSelectionTool::getSelectionTyp
|
|||||||
|
|
||||||
bool LiveSelectionTool::alreadySelected(const QList<QGraphicsItem*> &itemList) const
|
bool LiveSelectionTool::alreadySelected(const QList<QGraphicsItem*> &itemList) const
|
||||||
{
|
{
|
||||||
QDeclarativeViewObserverPrivate *observerPrivate
|
QDeclarativeViewInspectorPrivate *inspectorPrivate
|
||||||
= QDeclarativeViewObserverPrivate::get(observer());
|
= QDeclarativeViewInspectorPrivate::get(inspector());
|
||||||
const QList<QGraphicsItem*> selectedItems = observerPrivate->selectedItems();
|
const QList<QGraphicsItem*> selectedItems = inspectorPrivate->selectedItems();
|
||||||
|
|
||||||
if (selectedItems.isEmpty())
|
if (selectedItems.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
@@ -104,9 +104,9 @@ bool LiveSelectionTool::alreadySelected(const QList<QGraphicsItem*> &itemList) c
|
|||||||
|
|
||||||
void LiveSelectionTool::mousePressEvent(QMouseEvent *event)
|
void LiveSelectionTool::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
QDeclarativeViewObserverPrivate *observerPrivate
|
QDeclarativeViewInspectorPrivate *inspectorPrivate
|
||||||
= QDeclarativeViewObserverPrivate::get(observer());
|
= QDeclarativeViewInspectorPrivate::get(inspector());
|
||||||
QList<QGraphicsItem*> itemList = observerPrivate->selectableItems(event->pos());
|
QList<QGraphicsItem*> itemList = inspectorPrivate->selectableItems(event->pos());
|
||||||
LiveSingleSelectionManipulator::SelectionType selectionType = getSelectionType(event->modifiers());
|
LiveSingleSelectionManipulator::SelectionType selectionType = getSelectionType(event->modifiers());
|
||||||
|
|
||||||
if (event->buttons() & Qt::LeftButton) {
|
if (event->buttons() & Qt::LeftButton) {
|
||||||
@@ -142,7 +142,7 @@ void LiveSelectionTool::createContextMenu(QList<QGraphicsItem*> itemList, QPoint
|
|||||||
QAction *elementAction = contextMenu.addAction(itemTitle, this,
|
QAction *elementAction = contextMenu.addAction(itemTitle, this,
|
||||||
SLOT(contextMenuElementSelected()));
|
SLOT(contextMenuElementSelected()));
|
||||||
|
|
||||||
if (observer()->selectedItems().contains(item)) {
|
if (inspector()->selectedItems().contains(item)) {
|
||||||
QFont boldFont = elementAction->font();
|
QFont boldFont = elementAction->font();
|
||||||
boldFont.setBold(true);
|
boldFont.setBold(true);
|
||||||
elementAction->setFont(boldFont);
|
elementAction->setFont(boldFont);
|
||||||
@@ -188,7 +188,7 @@ void LiveSelectionTool::contextMenuElementHovered(QAction *action)
|
|||||||
int itemListIndex = action->data().toInt();
|
int itemListIndex = action->data().toInt();
|
||||||
if (itemListIndex >= 0 && itemListIndex < m_contextMenuItemList.length()) {
|
if (itemListIndex >= 0 && itemListIndex < m_contextMenuItemList.length()) {
|
||||||
QGraphicsObject *item = m_contextMenuItemList.at(itemListIndex)->toGraphicsObject();
|
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))
|
// if (topSelectedItemIsMovable(itemList))
|
||||||
// view()->changeTool(Constants::MoveToolMode);
|
// view()->changeTool(Constants::MoveToolMode);
|
||||||
// }
|
// }
|
||||||
QDeclarativeViewObserverPrivate *observerPrivate
|
QDeclarativeViewInspectorPrivate *inspectorPrivate
|
||||||
= QDeclarativeViewObserverPrivate::get(observer());
|
= QDeclarativeViewInspectorPrivate::get(inspector());
|
||||||
|
|
||||||
QList<QGraphicsItem*> selectableItemList = observerPrivate->selectableItems(event->pos());
|
QList<QGraphicsItem*> selectableItemList = inspectorPrivate->selectableItems(event->pos());
|
||||||
if (!selectableItemList.isEmpty()) {
|
if (!selectableItemList.isEmpty()) {
|
||||||
QGraphicsObject *item = selectableItemList.first()->toGraphicsObject();
|
QGraphicsObject *item = selectableItemList.first()->toGraphicsObject();
|
||||||
if (item)
|
if (item)
|
||||||
QDeclarativeViewObserverPrivate::get(observer())->highlight(item);
|
QDeclarativeViewInspectorPrivate::get(inspector())->highlight(item);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDeclarativeViewObserverPrivate::get(observer())->clearHighlight();
|
QDeclarativeViewInspectorPrivate::get(inspector())->clearHighlight();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiveSelectionTool::mouseReleaseEvent(QMouseEvent *event)
|
void LiveSelectionTool::mouseReleaseEvent(QMouseEvent *event)
|
||||||
@@ -324,16 +324,16 @@ void LiveSelectionTool::wheelEvent(QWheelEvent *event)
|
|||||||
if (event->orientation() == Qt::Horizontal || m_rubberbandSelectionMode)
|
if (event->orientation() == Qt::Horizontal || m_rubberbandSelectionMode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QDeclarativeViewObserverPrivate *observerPrivate
|
QDeclarativeViewInspectorPrivate *inspectorPrivate
|
||||||
= QDeclarativeViewObserverPrivate::get(observer());
|
= QDeclarativeViewInspectorPrivate::get(inspector());
|
||||||
QList<QGraphicsItem*> itemList = observerPrivate->selectableItems(event->pos());
|
QList<QGraphicsItem*> itemList = inspectorPrivate->selectableItems(event->pos());
|
||||||
|
|
||||||
if (itemList.isEmpty())
|
if (itemList.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int selectedIdx = 0;
|
int selectedIdx = 0;
|
||||||
if (!observer()->selectedItems().isEmpty()) {
|
if (!inspector()->selectedItems().isEmpty()) {
|
||||||
selectedIdx = itemList.indexOf(observer()->selectedItems().first());
|
selectedIdx = itemList.indexOf(inspector()->selectedItems().first());
|
||||||
if (selectedIdx >= 0) {
|
if (selectedIdx >= 0) {
|
||||||
if (event->delta() > 0) {
|
if (event->delta() > 0) {
|
||||||
selectedIdx++;
|
selectedIdx++;
|
||||||
|
@@ -54,7 +54,7 @@ class LiveSelectionTool : public AbstractLiveEditTool
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LiveSelectionTool(QDeclarativeViewObserver* editorView);
|
LiveSelectionTool(QDeclarativeViewInspector* editorView);
|
||||||
~LiveSelectionTool();
|
~LiveSelectionTool();
|
||||||
|
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
|
@@ -31,13 +31,13 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "livesingleselectionmanipulator.h"
|
#include "livesingleselectionmanipulator.h"
|
||||||
#include "qdeclarativeviewobserver.h"
|
#include "qdeclarativeviewinspector.h"
|
||||||
#include "../qdeclarativeviewobserver_p.h"
|
#include "../qdeclarativeviewinspector_p.h"
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
LiveSingleSelectionManipulator::LiveSingleSelectionManipulator(QDeclarativeViewObserver *editorView)
|
LiveSingleSelectionManipulator::LiveSingleSelectionManipulator(QDeclarativeViewInspector *editorView)
|
||||||
: m_editorView(editorView),
|
: m_editorView(editorView),
|
||||||
m_isActive(false)
|
m_isActive(false)
|
||||||
{
|
{
|
||||||
@@ -48,7 +48,7 @@ void LiveSingleSelectionManipulator::begin(const QPointF &beginPoint)
|
|||||||
{
|
{
|
||||||
m_beginPoint = beginPoint;
|
m_beginPoint = beginPoint;
|
||||||
m_isActive = true;
|
m_isActive = true;
|
||||||
m_oldSelectionList = QDeclarativeViewObserverPrivate::get(m_editorView)->selectedItems();
|
m_oldSelectionList = QDeclarativeViewInspectorPrivate::get(m_editorView)->selectedItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiveSingleSelectionManipulator::update(const QPointF &/*updatePoint*/)
|
void LiveSingleSelectionManipulator::update(const QPointF &/*updatePoint*/)
|
||||||
@@ -121,9 +121,9 @@ void LiveSingleSelectionManipulator::select(SelectionType selectionType,
|
|||||||
|
|
||||||
void LiveSingleSelectionManipulator::select(SelectionType selectionType, bool selectOnlyContentItems)
|
void LiveSingleSelectionManipulator::select(SelectionType selectionType, bool selectOnlyContentItems)
|
||||||
{
|
{
|
||||||
QDeclarativeViewObserverPrivate *observerPrivate =
|
QDeclarativeViewInspectorPrivate *inspectorPrivate =
|
||||||
QDeclarativeViewObserverPrivate::get(m_editorView);
|
QDeclarativeViewInspectorPrivate::get(m_editorView);
|
||||||
QList<QGraphicsItem*> itemList = observerPrivate->selectableItems(m_beginPoint);
|
QList<QGraphicsItem*> itemList = inspectorPrivate->selectableItems(m_beginPoint);
|
||||||
select(selectionType, itemList, selectOnlyContentItems);
|
select(selectionType, itemList, selectOnlyContentItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -40,12 +40,12 @@ QT_FORWARD_DECLARE_CLASS(QGraphicsItem);
|
|||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
class QDeclarativeViewObserver;
|
class QDeclarativeViewInspector;
|
||||||
|
|
||||||
class LiveSingleSelectionManipulator
|
class LiveSingleSelectionManipulator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LiveSingleSelectionManipulator(QDeclarativeViewObserver *editorView);
|
LiveSingleSelectionManipulator(QDeclarativeViewInspector *editorView);
|
||||||
|
|
||||||
enum SelectionType {
|
enum SelectionType {
|
||||||
ReplaceSelection,
|
ReplaceSelection,
|
||||||
@@ -71,7 +71,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
QList<QGraphicsItem*> m_oldSelectionList;
|
QList<QGraphicsItem*> m_oldSelectionList;
|
||||||
QPointF m_beginPoint;
|
QPointF m_beginPoint;
|
||||||
QDeclarativeViewObserver *m_editorView;
|
QDeclarativeViewInspector *m_editorView;
|
||||||
bool m_isActive;
|
bool m_isActive;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -52,8 +52,8 @@ QmlToolBar::QmlToolBar(QWidget *parent)
|
|||||||
ui->playIcon = QIcon(QLatin1String(":/qml/images/play-24.png"));
|
ui->playIcon = QIcon(QLatin1String(":/qml/images/play-24.png"));
|
||||||
ui->pauseIcon = QIcon(QLatin1String(":/qml/images/pause-24.png"));
|
ui->pauseIcon = QIcon(QLatin1String(":/qml/images/pause-24.png"));
|
||||||
|
|
||||||
ui->designmode = new QAction(QIcon(QLatin1String(":/qml/images/observermode-24.png")),
|
ui->designmode = new QAction(QIcon(QLatin1String(":/qml/images/inspectormode-24.png")),
|
||||||
tr("Observer Mode"), this);
|
tr("Inspector Mode"), this);
|
||||||
ui->play = new QAction(ui->pauseIcon, tr("Play/Pause Animations"), 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->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")),
|
ui->selectMarquee = new QAction(QIcon(QLatin1String(":/qml/images/select-marquee-24.png")),
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
#include <QtGui/QToolBar>
|
#include <QtGui/QToolBar>
|
||||||
#include <QtGui/QIcon>
|
#include <QtGui/QIcon>
|
||||||
|
|
||||||
#include "qmlobserverconstants.h"
|
#include "qmlinspectorconstants.h"
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QActionGroup)
|
QT_FORWARD_DECLARE_CLASS(QActionGroup)
|
||||||
|
|
||||||
|
@@ -31,16 +31,16 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "subcomponentmasklayeritem.h"
|
#include "subcomponentmasklayeritem.h"
|
||||||
#include "qmlobserverconstants.h"
|
#include "qmlinspectorconstants.h"
|
||||||
#include "qdeclarativeviewobserver.h"
|
#include "qdeclarativeviewinspector.h"
|
||||||
#include <QtGui/QPolygonF>
|
#include <QtGui/QPolygonF>
|
||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
SubcomponentMaskLayerItem::SubcomponentMaskLayerItem(QDeclarativeViewObserver *observer,
|
SubcomponentMaskLayerItem::SubcomponentMaskLayerItem(QDeclarativeViewInspector *inspector,
|
||||||
QGraphicsItem *parentItem) :
|
QGraphicsItem *parentItem) :
|
||||||
QGraphicsPolygonItem(parentItem),
|
QGraphicsPolygonItem(parentItem),
|
||||||
m_observer(observer),
|
m_inspector(inspector),
|
||||||
m_currentItem(0),
|
m_currentItem(0),
|
||||||
m_borderRect(new QGraphicsRectItem(this))
|
m_borderRect(new QGraphicsRectItem(this))
|
||||||
{
|
{
|
||||||
@@ -91,8 +91,8 @@ void SubcomponentMaskLayerItem::setCurrentItem(QGraphicsItem *item)
|
|||||||
if (!m_currentItem)
|
if (!m_currentItem)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QRect viewRect = m_observer->declarativeView()->rect();
|
QRect viewRect = m_inspector->declarativeView()->rect();
|
||||||
viewRect = m_observer->declarativeView()->mapToScene(viewRect).boundingRect().toRect();
|
viewRect = m_inspector->declarativeView()->mapToScene(viewRect).boundingRect().toRect();
|
||||||
|
|
||||||
QRectF itemRect = item->boundingRect() | item->childrenBoundingRect();
|
QRectF itemRect = item->boundingRect() | item->childrenBoundingRect();
|
||||||
itemRect = item->mapRectToScene(itemRect);
|
itemRect = item->mapRectToScene(itemRect);
|
||||||
|
@@ -37,12 +37,12 @@
|
|||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
class QDeclarativeViewObserver;
|
class QDeclarativeViewInspector;
|
||||||
|
|
||||||
class SubcomponentMaskLayerItem : public QGraphicsPolygonItem
|
class SubcomponentMaskLayerItem : public QGraphicsPolygonItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit SubcomponentMaskLayerItem(QDeclarativeViewObserver *observer,
|
explicit SubcomponentMaskLayerItem(QDeclarativeViewInspector *inspector,
|
||||||
QGraphicsItem *parentItem = 0);
|
QGraphicsItem *parentItem = 0);
|
||||||
int type() const;
|
int type() const;
|
||||||
void setCurrentItem(QGraphicsItem *item);
|
void setCurrentItem(QGraphicsItem *item);
|
||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
QRectF itemRect() const;
|
QRectF itemRect() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QDeclarativeViewObserver *m_observer;
|
QDeclarativeViewInspector *m_inspector;
|
||||||
QGraphicsItem *m_currentItem;
|
QGraphicsItem *m_currentItem;
|
||||||
QGraphicsRectItem *m_borderRect;
|
QGraphicsRectItem *m_borderRect;
|
||||||
QRectF m_itemPolyRect;
|
QRectF m_itemPolyRect;
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "toolbarcolorbox.h"
|
#include "toolbarcolorbox.h"
|
||||||
#include "qmlobserverconstants.h"
|
#include "qmlinspectorconstants.h"
|
||||||
|
|
||||||
#include <QtGui/QPixmap>
|
#include <QtGui/QPixmap>
|
||||||
#include <QtGui/QPainter>
|
#include <QtGui/QPainter>
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "zoomtool.h"
|
#include "zoomtool.h"
|
||||||
#include "../qdeclarativeviewobserver_p.h"
|
#include "../qdeclarativeviewinspector_p.h"
|
||||||
|
|
||||||
#include <QtGui/QMouseEvent>
|
#include <QtGui/QMouseEvent>
|
||||||
#include <QtGui/QWheelEvent>
|
#include <QtGui/QWheelEvent>
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
ZoomTool::ZoomTool(QDeclarativeViewObserver *view) :
|
ZoomTool::ZoomTool(QDeclarativeViewInspector *view) :
|
||||||
AbstractLiveEditTool(view),
|
AbstractLiveEditTool(view),
|
||||||
m_rubberbandManipulator(),
|
m_rubberbandManipulator(),
|
||||||
m_smoothZoomMultiplier(0.05f),
|
m_smoothZoomMultiplier(0.05f),
|
||||||
@@ -57,7 +57,7 @@ ZoomTool::ZoomTool(QDeclarativeViewObserver *view) :
|
|||||||
m_zoomOutAction->setShortcut(QKeySequence(Qt::Key_Minus));
|
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);
|
QGraphicsObject *layerObject = reinterpret_cast<QGraphicsObject *>(layerItem);
|
||||||
m_rubberbandManipulator = new LiveRubberBandSelectionManipulator(layerObject, view);
|
m_rubberbandManipulator = new LiveRubberBandSelectionManipulator(layerObject, view);
|
||||||
|
|
||||||
|
@@ -49,7 +49,7 @@ public:
|
|||||||
ZoomOut
|
ZoomOut
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit ZoomTool(QDeclarativeViewObserver *view);
|
explicit ZoomTool(QDeclarativeViewInspector *view);
|
||||||
|
|
||||||
virtual ~ZoomTool();
|
virtual ~ZoomTool();
|
||||||
|
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
#define QDECLARATIVEDESIGNDEBUGSERVER_H
|
#define QDECLARATIVEDESIGNDEBUGSERVER_H
|
||||||
|
|
||||||
#include "qt_private/qdeclarativedebugservice_p.h"
|
#include "qt_private/qdeclarativedebugservice_p.h"
|
||||||
#include "qmlobserverconstants.h"
|
#include "qmlinspectorconstants.h"
|
||||||
#include "qmljsdebugger_global.h"
|
#include "qmljsdebugger_global.h"
|
||||||
|
|
||||||
#include <QtCore/QHash>
|
#include <QtCore/QHash>
|
||||||
@@ -46,12 +46,12 @@ QT_FORWARD_DECLARE_CLASS(QDataStream)
|
|||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
class QMLJSDEBUGGER_EXPORT QDeclarativeObserverService : public QDeclarativeDebugService
|
class QMLJSDEBUGGER_EXPORT QDeclarativeInspectorService : public QDeclarativeDebugService
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
QDeclarativeObserverService();
|
QDeclarativeInspectorService();
|
||||||
static QDeclarativeObserverService *instance();
|
static QDeclarativeInspectorService *instance();
|
||||||
|
|
||||||
void setDesignModeBehavior(bool inDesignMode);
|
void setDesignModeBehavior(bool inDesignMode);
|
||||||
void setCurrentObjects(QList<QObject*> items);
|
void setCurrentObjects(QList<QObject*> items);
|
@@ -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
|
@@ -33,86 +33,19 @@
|
|||||||
#ifndef QDECLARATIVEVIEWOBSERVER_H
|
#ifndef QDECLARATIVEVIEWOBSERVER_H
|
||||||
#define QDECLARATIVEVIEWOBSERVER_H
|
#define QDECLARATIVEVIEWOBSERVER_H
|
||||||
|
|
||||||
#include "qmljsdebugger_global.h"
|
#include "qdeclarativeviewinspector.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)
|
|
||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
class CrumblePath;
|
// Provided for compatibility with QmlApplicationViewer
|
||||||
class QDeclarativeViewObserverPrivate;
|
class QMLJSDEBUGGER_EXPORT QDeclarativeViewObserver : public QDeclarativeViewInspector
|
||||||
|
|
||||||
class QMLJSDEBUGGER_EXPORT QDeclarativeViewObserver : public QObject
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
explicit QDeclarativeViewObserver(QDeclarativeView *view, QObject *parent = 0)
|
||||||
explicit QDeclarativeViewObserver(QDeclarativeView *view, QObject *parent = 0);
|
: QDeclarativeViewInspector(view, parent)
|
||||||
~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;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlJSDebugger
|
} // namespace QmlJSDebugger
|
||||||
|
@@ -30,8 +30,8 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef QMLOBSERVERCONSTANTS_H
|
#ifndef QMLINSPECTORCONSTANTS_H
|
||||||
#define QMLOBSERVERCONSTANTS_H
|
#define QMLINSPECTORCONSTANTS_H
|
||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
namespace Constants {
|
namespace Constants {
|
||||||
@@ -68,4 +68,4 @@ enum GraphicsItemTypes {
|
|||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
} // namespace QmlJSDebugger
|
} // namespace QmlJSDebugger
|
||||||
|
|
||||||
#endif // QMLOBSERVERCONSTANTS_H
|
#endif // QMLINSPECTORCONSTANTS_H
|
@@ -30,8 +30,8 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef OBSERVERPROTOCOL_H
|
#ifndef INSPECTORPROTOCOL_H
|
||||||
#define OBSERVERPROTOCOL_H
|
#define INSPECTORPROTOCOL_H
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QMetaType>
|
#include <QtCore/QMetaType>
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
class ObserverProtocol : public QObject
|
class InspectorProtocol : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_ENUMS(Message Tool)
|
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);
|
return stream << static_cast<quint32>(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QDataStream & operator>> (QDataStream &stream, ObserverProtocol::Message &message)
|
inline QDataStream & operator>> (QDataStream &stream, InspectorProtocol::Message &message)
|
||||||
{
|
{
|
||||||
quint32 i;
|
quint32 i;
|
||||||
stream >> i;
|
stream >> i;
|
||||||
message = static_cast<ObserverProtocol::Message>(i);
|
message = static_cast<InspectorProtocol::Message>(i);
|
||||||
return stream;
|
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;
|
return dbg;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QDataStream & operator<< (QDataStream &stream, ObserverProtocol::Tool tool)
|
inline QDataStream & operator<< (QDataStream &stream, InspectorProtocol::Tool tool)
|
||||||
{
|
{
|
||||||
return stream << static_cast<quint32>(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;
|
quint32 i;
|
||||||
stream >> i;
|
stream >> i;
|
||||||
tool = static_cast<ObserverProtocol::Tool>(i);
|
tool = static_cast<InspectorProtocol::Tool>(i);
|
||||||
return stream;
|
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;
|
return dbg;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace QmlJSDebugger
|
} // namespace QmlJSDebugger
|
||||||
|
|
||||||
#endif // OBSERVERPROTOCOL_H
|
#endif // INSPECTORPROTOCOL_H
|
@@ -1,3 +1,3 @@
|
|||||||
INCLUDEPATH += $$PWD
|
INCLUDEPATH += $$PWD
|
||||||
DEPENDPATH += $$PWD
|
DEPENDPATH += $$PWD
|
||||||
HEADERS += $$PWD/observerprotocol.h
|
HEADERS += $$PWD/inspectorprotocol.h
|
||||||
|
@@ -29,41 +29,41 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "qdeclarativeobserverservice.h"
|
#include "qdeclarativeinspectorservice.h"
|
||||||
|
|
||||||
#include <observerprotocol.h>
|
#include <inspectorprotocol.h>
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
Q_GLOBAL_STATIC(QDeclarativeObserverService, serviceInstance)
|
Q_GLOBAL_STATIC(QDeclarativeInspectorService, serviceInstance)
|
||||||
|
|
||||||
QDeclarativeObserverService::QDeclarativeObserverService()
|
QDeclarativeInspectorService::QDeclarativeInspectorService()
|
||||||
: QDeclarativeDebugService(QLatin1String("QDeclarativeObserverMode"))
|
: QDeclarativeDebugService(QLatin1String("QDeclarativeObserverMode"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QDeclarativeObserverService *QDeclarativeObserverService::instance()
|
QDeclarativeInspectorService *QDeclarativeInspectorService::instance()
|
||||||
{
|
{
|
||||||
return serviceInstance();
|
return serviceInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeObserverService::statusChanged(Status status)
|
void QDeclarativeInspectorService::statusChanged(Status status)
|
||||||
{
|
{
|
||||||
emit debuggingClientChanged((status == Enabled));
|
emit debuggingClientChanged((status == Enabled));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeObserverService::messageReceived(const QByteArray &message)
|
void QDeclarativeInspectorService::messageReceived(const QByteArray &message)
|
||||||
{
|
{
|
||||||
QDataStream ds(message);
|
QDataStream ds(message);
|
||||||
|
|
||||||
ObserverProtocol::Message type;
|
InspectorProtocol::Message type;
|
||||||
ds >> type;
|
ds >> type;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ObserverProtocol::SetCurrentObjects: {
|
case InspectorProtocol::SetCurrentObjects: {
|
||||||
int itemCount = 0;
|
int itemCount = 0;
|
||||||
ds >> itemCount;
|
ds >> itemCount;
|
||||||
|
|
||||||
@@ -78,36 +78,36 @@ void QDeclarativeObserverService::messageReceived(const QByteArray &message)
|
|||||||
emit currentObjectsChanged(selectedObjects);
|
emit currentObjectsChanged(selectedObjects);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObserverProtocol::Reload: {
|
case InspectorProtocol::Reload: {
|
||||||
emit reloadRequested();
|
emit reloadRequested();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObserverProtocol::SetAnimationSpeed: {
|
case InspectorProtocol::SetAnimationSpeed: {
|
||||||
qreal speed;
|
qreal speed;
|
||||||
ds >> speed;
|
ds >> speed;
|
||||||
emit animationSpeedChangeRequested(speed);
|
emit animationSpeedChangeRequested(speed);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObserverProtocol::SetAnimationPaused: {
|
case InspectorProtocol::SetAnimationPaused: {
|
||||||
bool paused;
|
bool paused;
|
||||||
ds >> paused;
|
ds >> paused;
|
||||||
emit executionPauseChangeRequested(paused);
|
emit executionPauseChangeRequested(paused);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObserverProtocol::ChangeTool: {
|
case InspectorProtocol::ChangeTool: {
|
||||||
ObserverProtocol::Tool tool;
|
InspectorProtocol::Tool tool;
|
||||||
ds >> tool;
|
ds >> tool;
|
||||||
switch (tool) {
|
switch (tool) {
|
||||||
case ObserverProtocol::ColorPickerTool:
|
case InspectorProtocol::ColorPickerTool:
|
||||||
emit colorPickerToolRequested();
|
emit colorPickerToolRequested();
|
||||||
break;
|
break;
|
||||||
case ObserverProtocol::SelectTool:
|
case InspectorProtocol::SelectTool:
|
||||||
emit selectToolRequested();
|
emit selectToolRequested();
|
||||||
break;
|
break;
|
||||||
case ObserverProtocol::SelectMarqueeTool:
|
case InspectorProtocol::SelectMarqueeTool:
|
||||||
emit selectMarqueeToolRequested();
|
emit selectMarqueeToolRequested();
|
||||||
break;
|
break;
|
||||||
case ObserverProtocol::ZoomTool:
|
case InspectorProtocol::ZoomTool:
|
||||||
emit zoomToolRequested();
|
emit zoomToolRequested();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -115,19 +115,19 @@ void QDeclarativeObserverService::messageReceived(const QByteArray &message)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObserverProtocol::SetDesignMode: {
|
case InspectorProtocol::SetDesignMode: {
|
||||||
bool inDesignMode;
|
bool inDesignMode;
|
||||||
ds >> inDesignMode;
|
ds >> inDesignMode;
|
||||||
emit designModeBehaviorChanged(inDesignMode);
|
emit designModeBehaviorChanged(inDesignMode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObserverProtocol::ShowAppOnTop: {
|
case InspectorProtocol::ShowAppOnTop: {
|
||||||
bool showOnTop;
|
bool showOnTop;
|
||||||
ds >> showOnTop;
|
ds >> showOnTop;
|
||||||
emit showAppOnTopChanged(showOnTop);
|
emit showAppOnTopChanged(showOnTop);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObserverProtocol::CreateObject: {
|
case InspectorProtocol::CreateObject: {
|
||||||
QString qml;
|
QString qml;
|
||||||
int parentId;
|
int parentId;
|
||||||
QString filename;
|
QString filename;
|
||||||
@@ -140,7 +140,7 @@ void QDeclarativeObserverService::messageReceived(const QByteArray &message)
|
|||||||
emit objectCreationRequested(qml, objectForId(parentId), imports, filename, order);
|
emit objectCreationRequested(qml, objectForId(parentId), imports, filename, order);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObserverProtocol::DestroyObject: {
|
case InspectorProtocol::DestroyObject: {
|
||||||
int debugId;
|
int debugId;
|
||||||
ds >> debugId;
|
ds >> debugId;
|
||||||
if (QObject* obj = objectForId(debugId)) {
|
if (QObject* obj = objectForId(debugId)) {
|
||||||
@@ -148,13 +148,13 @@ void QDeclarativeObserverService::messageReceived(const QByteArray &message)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObserverProtocol::MoveObject: {
|
case InspectorProtocol::MoveObject: {
|
||||||
int debugId, newParent;
|
int debugId, newParent;
|
||||||
ds >> debugId >> newParent;
|
ds >> debugId >> newParent;
|
||||||
emit objectReparentRequested(objectForId(debugId), objectForId(newParent));
|
emit objectReparentRequested(objectForId(debugId), objectForId(newParent));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObserverProtocol::ObjectIdList: {
|
case InspectorProtocol::ObjectIdList: {
|
||||||
int itemCount;
|
int itemCount;
|
||||||
ds >> itemCount;
|
ds >> itemCount;
|
||||||
m_stringIdForObjectId.clear();
|
m_stringIdForObjectId.clear();
|
||||||
@@ -168,7 +168,7 @@ void QDeclarativeObserverService::messageReceived(const QByteArray &message)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObserverProtocol::ClearComponentCache: {
|
case InspectorProtocol::ClearComponentCache: {
|
||||||
emit clearComponentCacheRequested();
|
emit clearComponentCacheRequested();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -177,23 +177,23 @@ void QDeclarativeObserverService::messageReceived(const QByteArray &message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeObserverService::setDesignModeBehavior(bool inDesignMode)
|
void QDeclarativeInspectorService::setDesignModeBehavior(bool inDesignMode)
|
||||||
{
|
{
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ds << ObserverProtocol::SetDesignMode
|
ds << InspectorProtocol::SetDesignMode
|
||||||
<< inDesignMode;
|
<< inDesignMode;
|
||||||
|
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeObserverService::setCurrentObjects(QList<QObject*> objects)
|
void QDeclarativeInspectorService::setCurrentObjects(QList<QObject*> objects)
|
||||||
{
|
{
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ds << ObserverProtocol::CurrentObjectsChanged
|
ds << InspectorProtocol::CurrentObjectsChanged
|
||||||
<< objects.length();
|
<< objects.length();
|
||||||
|
|
||||||
foreach (QObject *object, objects) {
|
foreach (QObject *object, objects) {
|
||||||
@@ -204,78 +204,78 @@ void QDeclarativeObserverService::setCurrentObjects(QList<QObject*> objects)
|
|||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeObserverService::setCurrentTool(QmlJSDebugger::Constants::DesignTool toolId)
|
void QDeclarativeInspectorService::setCurrentTool(QmlJSDebugger::Constants::DesignTool toolId)
|
||||||
{
|
{
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ds << ObserverProtocol::ToolChanged
|
ds << InspectorProtocol::ToolChanged
|
||||||
<< toolId;
|
<< toolId;
|
||||||
|
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeObserverService::setAnimationSpeed(qreal slowDownFactor)
|
void QDeclarativeInspectorService::setAnimationSpeed(qreal slowDownFactor)
|
||||||
{
|
{
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ds << ObserverProtocol::AnimationSpeedChanged
|
ds << InspectorProtocol::AnimationSpeedChanged
|
||||||
<< slowDownFactor;
|
<< slowDownFactor;
|
||||||
|
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeObserverService::setAnimationPaused(bool paused)
|
void QDeclarativeInspectorService::setAnimationPaused(bool paused)
|
||||||
{
|
{
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ds << ObserverProtocol::AnimationPausedChanged
|
ds << InspectorProtocol::AnimationPausedChanged
|
||||||
<< paused;
|
<< paused;
|
||||||
|
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeObserverService::reloaded()
|
void QDeclarativeInspectorService::reloaded()
|
||||||
{
|
{
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ds << ObserverProtocol::Reloaded;
|
ds << InspectorProtocol::Reloaded;
|
||||||
|
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeObserverService::setShowAppOnTop(bool showAppOnTop)
|
void QDeclarativeInspectorService::setShowAppOnTop(bool showAppOnTop)
|
||||||
{
|
{
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ds << ObserverProtocol::ShowAppOnTop << showAppOnTop;
|
ds << InspectorProtocol::ShowAppOnTop << showAppOnTop;
|
||||||
|
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeObserverService::selectedColorChanged(const QColor &color)
|
void QDeclarativeInspectorService::selectedColorChanged(const QColor &color)
|
||||||
{
|
{
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ds << ObserverProtocol::ColorChanged
|
ds << InspectorProtocol::ColorChanged
|
||||||
<< color;
|
<< color;
|
||||||
|
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QDeclarativeObserverService::idStringForObject(QObject *obj) const
|
QString QDeclarativeInspectorService::idStringForObject(QObject *obj) const
|
||||||
{
|
{
|
||||||
int id = idForObject(obj);
|
int id = idForObject(obj);
|
||||||
QString idString = m_stringIdForObjectId.value(id, QString());
|
QString idString = m_stringIdForObjectId.value(id, QString());
|
||||||
return idString;
|
return idString;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeObserverService::sendMessage(const QByteArray &message)
|
void QDeclarativeInspectorService::sendMessage(const QByteArray &message)
|
||||||
{
|
{
|
||||||
if (status() != Enabled)
|
if (status() != Enabled)
|
||||||
return;
|
return;
|
@@ -30,9 +30,9 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "qdeclarativeviewobserver.h"
|
#include "qdeclarativeviewinspector.h"
|
||||||
#include "qdeclarativeviewobserver_p.h"
|
#include "qdeclarativeviewinspector_p.h"
|
||||||
#include "qdeclarativeobserverservice.h"
|
#include "qdeclarativeinspectorservice.h"
|
||||||
#include "editor/liveselectiontool.h"
|
#include "editor/liveselectiontool.h"
|
||||||
#include "editor/zoomtool.h"
|
#include "editor/zoomtool.h"
|
||||||
#include "editor/colorpickertool.h"
|
#include "editor/colorpickertool.h"
|
||||||
@@ -81,7 +81,7 @@ private:
|
|||||||
|
|
||||||
ToolBox::ToolBox(QWidget *parent)
|
ToolBox::ToolBox(QWidget *parent)
|
||||||
: QWidget(parent, Qt::Tool)
|
: QWidget(parent, Qt::Tool)
|
||||||
, m_settings(QLatin1String("Nokia"), QLatin1String("QmlObserver"), this)
|
, m_settings(QLatin1String("Nokia"), QLatin1String("QmlInspector"), this)
|
||||||
, m_toolBar(new QmlToolBar)
|
, m_toolBar(new QmlToolBar)
|
||||||
{
|
{
|
||||||
setWindowFlags((windowFlags() & ~Qt::WindowCloseButtonHint) | Qt::CustomizeWindowHint);
|
setWindowFlags((windowFlags() & ~Qt::WindowCloseButtonHint) | Qt::CustomizeWindowHint);
|
||||||
@@ -101,7 +101,7 @@ ToolBox::~ToolBox()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QDeclarativeViewObserverPrivate::QDeclarativeViewObserverPrivate(QDeclarativeViewObserver *q) :
|
QDeclarativeViewInspectorPrivate::QDeclarativeViewInspectorPrivate(QDeclarativeViewInspector *q) :
|
||||||
q(q),
|
q(q),
|
||||||
designModeBehavior(false),
|
designModeBehavior(false),
|
||||||
showAppOnTop(false),
|
showAppOnTop(false),
|
||||||
@@ -111,12 +111,12 @@ QDeclarativeViewObserverPrivate::QDeclarativeViewObserverPrivate(QDeclarativeVie
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QDeclarativeViewObserverPrivate::~QDeclarativeViewObserverPrivate()
|
QDeclarativeViewInspectorPrivate::~QDeclarativeViewInspectorPrivate()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, QObject *parent) :
|
QDeclarativeViewInspector::QDeclarativeViewInspector(QDeclarativeView *view, QObject *parent) :
|
||||||
QObject(parent), data(new QDeclarativeViewObserverPrivate(this))
|
QObject(parent), data(new QDeclarativeViewInspectorPrivate(this))
|
||||||
{
|
{
|
||||||
initEditorResource();
|
initEditorResource();
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, QObje
|
|||||||
|
|
||||||
data->setViewport(data->view->viewport());
|
data->setViewport(data->view->viewport());
|
||||||
|
|
||||||
data->debugService = QDeclarativeObserverService::instance();
|
data->debugService = QDeclarativeInspectorService::instance();
|
||||||
|
|
||||||
// tool box is disabled
|
// tool box is disabled
|
||||||
//connect(data->debugService, SIGNAL(debuggingClientChanged(bool)),
|
//connect(data->debugService, SIGNAL(debuggingClientChanged(bool)),
|
||||||
@@ -179,11 +179,11 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, QObje
|
|||||||
data->_q_changeToSingleSelectTool();
|
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 !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR)
|
||||||
if (!toolBox && visible)
|
if (!toolBox && visible)
|
||||||
@@ -195,13 +195,13 @@ void QDeclarativeViewObserverPrivate::_q_setToolBoxVisible(bool visible)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserverPrivate::_q_reloadView()
|
void QDeclarativeViewInspectorPrivate::_q_reloadView()
|
||||||
{
|
{
|
||||||
clearHighlight();
|
clearHighlight();
|
||||||
emit q->reloadRequested();
|
emit q->reloadRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserverPrivate::setViewport(QWidget *widget)
|
void QDeclarativeViewInspectorPrivate::setViewport(QWidget *widget)
|
||||||
{
|
{
|
||||||
if (viewport.data() == widget)
|
if (viewport.data() == widget)
|
||||||
return;
|
return;
|
||||||
@@ -217,13 +217,13 @@ void QDeclarativeViewObserverPrivate::setViewport(QWidget *widget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserverPrivate::clearEditorItems()
|
void QDeclarativeViewInspectorPrivate::clearEditorItems()
|
||||||
{
|
{
|
||||||
clearHighlight();
|
clearHighlight();
|
||||||
setSelectedItems(QList<QGraphicsItem*>());
|
setSelectedItems(QList<QGraphicsItem*>());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QDeclarativeViewObserver::eventFilter(QObject *obj, QEvent *event)
|
bool QDeclarativeViewInspector::eventFilter(QObject *obj, QEvent *event)
|
||||||
{
|
{
|
||||||
if (obj == data->view) {
|
if (obj == data->view) {
|
||||||
// Event from view
|
// Event from view
|
||||||
@@ -286,7 +286,7 @@ bool QDeclarativeViewObserver::eventFilter(QObject *obj, QEvent *event)
|
|||||||
return QObject::eventFilter(obj, event);
|
return QObject::eventFilter(obj, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QDeclarativeViewObserver::leaveEvent(QEvent * /*event*/)
|
bool QDeclarativeViewInspector::leaveEvent(QEvent * /*event*/)
|
||||||
{
|
{
|
||||||
if (!data->designModeBehavior)
|
if (!data->designModeBehavior)
|
||||||
return false;
|
return false;
|
||||||
@@ -294,7 +294,7 @@ bool QDeclarativeViewObserver::leaveEvent(QEvent * /*event*/)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QDeclarativeViewObserver::mousePressEvent(QMouseEvent *event)
|
bool QDeclarativeViewInspector::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (!data->designModeBehavior)
|
if (!data->designModeBehavior)
|
||||||
return false;
|
return false;
|
||||||
@@ -303,7 +303,7 @@ bool QDeclarativeViewObserver::mousePressEvent(QMouseEvent *event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QDeclarativeViewObserver::mouseMoveEvent(QMouseEvent *event)
|
bool QDeclarativeViewInspector::mouseMoveEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (!data->designModeBehavior) {
|
if (!data->designModeBehavior) {
|
||||||
data->clearEditorItems();
|
data->clearEditorItems();
|
||||||
@@ -325,7 +325,7 @@ bool QDeclarativeViewObserver::mouseMoveEvent(QMouseEvent *event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QDeclarativeViewObserver::mouseReleaseEvent(QMouseEvent *event)
|
bool QDeclarativeViewInspector::mouseReleaseEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (!data->designModeBehavior)
|
if (!data->designModeBehavior)
|
||||||
return false;
|
return false;
|
||||||
@@ -335,7 +335,7 @@ bool QDeclarativeViewObserver::mouseReleaseEvent(QMouseEvent *event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QDeclarativeViewObserver::keyPressEvent(QKeyEvent *event)
|
bool QDeclarativeViewInspector::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
if (!data->designModeBehavior)
|
if (!data->designModeBehavior)
|
||||||
return false;
|
return false;
|
||||||
@@ -344,7 +344,7 @@ bool QDeclarativeViewObserver::keyPressEvent(QKeyEvent *event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QDeclarativeViewObserver::keyReleaseEvent(QKeyEvent *event)
|
bool QDeclarativeViewInspector::keyReleaseEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
if (!data->designModeBehavior)
|
if (!data->designModeBehavior)
|
||||||
return false;
|
return false;
|
||||||
@@ -421,7 +421,7 @@ bool removeObjectFromListProperty(QDeclarativeListReference &fromList, QObject *
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserverPrivate::_q_createQmlObject(const QString &qml, QObject *parent,
|
void QDeclarativeViewInspectorPrivate::_q_createQmlObject(const QString &qml, QObject *parent,
|
||||||
const QStringList &importList,
|
const QStringList &importList,
|
||||||
const QString &filename, int order)
|
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)
|
if (!newParent)
|
||||||
return;
|
return;
|
||||||
@@ -515,7 +515,7 @@ void QDeclarativeViewObserverPrivate::_q_reparentQmlObject(QObject *object, QObj
|
|||||||
item->setParentItem(newParentItem);
|
item->setParentItem(newParentItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserverPrivate::_q_deleteQmlObject(QObject *object)
|
void QDeclarativeViewInspectorPrivate::_q_deleteQmlObject(QObject *object)
|
||||||
{
|
{
|
||||||
// special cases for transitions/animations
|
// special cases for transitions/animations
|
||||||
if (object->inherits("QDeclarativeAbstractAnimation")) {
|
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();
|
view->engine()->clearComponentCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserverPrivate::_q_removeFromSelection(QObject *obj)
|
void QDeclarativeViewInspectorPrivate::_q_removeFromSelection(QObject *obj)
|
||||||
{
|
{
|
||||||
QList<QGraphicsItem*> items = selectedItems();
|
QList<QGraphicsItem*> items = selectedItems();
|
||||||
if (QGraphicsItem *item = qobject_cast<QGraphicsObject*>(obj))
|
if (QGraphicsItem *item = qobject_cast<QGraphicsObject*>(obj))
|
||||||
@@ -548,7 +548,7 @@ void QDeclarativeViewObserverPrivate::_q_removeFromSelection(QObject *obj)
|
|||||||
setSelectedItems(items);
|
setSelectedItems(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QDeclarativeViewObserver::mouseDoubleClickEvent(QMouseEvent * /*event*/)
|
bool QDeclarativeViewInspector::mouseDoubleClickEvent(QMouseEvent * /*event*/)
|
||||||
{
|
{
|
||||||
if (!data->designModeBehavior)
|
if (!data->designModeBehavior)
|
||||||
return false;
|
return false;
|
||||||
@@ -556,7 +556,7 @@ bool QDeclarativeViewObserver::mouseDoubleClickEvent(QMouseEvent * /*event*/)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QDeclarativeViewObserver::wheelEvent(QWheelEvent *event)
|
bool QDeclarativeViewInspector::wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
if (!data->designModeBehavior)
|
if (!data->designModeBehavior)
|
||||||
return false;
|
return false;
|
||||||
@@ -564,7 +564,7 @@ bool QDeclarativeViewObserver::wheelEvent(QWheelEvent *event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserver::setDesignModeBehavior(bool value)
|
void QDeclarativeViewInspector::setDesignModeBehavior(bool value)
|
||||||
{
|
{
|
||||||
emit designModeBehaviorChanged(value);
|
emit designModeBehaviorChanged(value);
|
||||||
|
|
||||||
@@ -578,17 +578,17 @@ void QDeclarativeViewObserver::setDesignModeBehavior(bool value)
|
|||||||
data->clearEditorItems();
|
data->clearEditorItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QDeclarativeViewObserver::designModeBehavior()
|
bool QDeclarativeViewInspector::designModeBehavior()
|
||||||
{
|
{
|
||||||
return data->designModeBehavior;
|
return data->designModeBehavior;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QDeclarativeViewObserver::showAppOnTop() const
|
bool QDeclarativeViewInspector::showAppOnTop() const
|
||||||
{
|
{
|
||||||
return data->showAppOnTop;
|
return data->showAppOnTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserver::setShowAppOnTop(bool appOnTop)
|
void QDeclarativeViewInspector::setShowAppOnTop(bool appOnTop)
|
||||||
{
|
{
|
||||||
if (data->view) {
|
if (data->view) {
|
||||||
QWidget *window = data->view->window();
|
QWidget *window = data->view->window();
|
||||||
@@ -608,7 +608,7 @@ void QDeclarativeViewObserver::setShowAppOnTop(bool appOnTop)
|
|||||||
emit showAppOnTopChanged(appOnTop);
|
emit showAppOnTopChanged(appOnTop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserverPrivate::changeTool(Constants::DesignTool tool,
|
void QDeclarativeViewInspectorPrivate::changeTool(Constants::DesignTool tool,
|
||||||
Constants::ToolFlags /*flags*/)
|
Constants::ToolFlags /*flags*/)
|
||||||
{
|
{
|
||||||
switch(tool) {
|
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) {
|
foreach (const QWeakPointer<QGraphicsObject> &obj, currentSelection) {
|
||||||
if (QGraphicsItem *item = obj.data()) {
|
if (QGraphicsItem *item = obj.data()) {
|
||||||
@@ -647,7 +647,7 @@ void QDeclarativeViewObserverPrivate::setSelectedItemsForTools(QList<QGraphicsIt
|
|||||||
currentTool->updateSelectedItems();
|
currentTool->updateSelectedItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserverPrivate::setSelectedItems(QList<QGraphicsItem *> items)
|
void QDeclarativeViewInspectorPrivate::setSelectedItems(QList<QGraphicsItem *> items)
|
||||||
{
|
{
|
||||||
QList<QWeakPointer<QGraphicsObject> > oldList = currentSelection;
|
QList<QWeakPointer<QGraphicsObject> > oldList = currentSelection;
|
||||||
setSelectedItemsForTools(items);
|
setSelectedItemsForTools(items);
|
||||||
@@ -662,7 +662,7 @@ void QDeclarativeViewObserverPrivate::setSelectedItems(QList<QGraphicsItem *> it
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QGraphicsItem *> QDeclarativeViewObserverPrivate::selectedItems()
|
QList<QGraphicsItem *> QDeclarativeViewInspectorPrivate::selectedItems()
|
||||||
{
|
{
|
||||||
QList<QGraphicsItem *> selection;
|
QList<QGraphicsItem *> selection;
|
||||||
foreach (const QWeakPointer<QGraphicsObject> &selectedObject, currentSelection) {
|
foreach (const QWeakPointer<QGraphicsObject> &selectedObject, currentSelection) {
|
||||||
@@ -673,27 +673,27 @@ QList<QGraphicsItem *> QDeclarativeViewObserverPrivate::selectedItems()
|
|||||||
return selection;
|
return selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserver::setSelectedItems(QList<QGraphicsItem *> items)
|
void QDeclarativeViewInspector::setSelectedItems(QList<QGraphicsItem *> items)
|
||||||
{
|
{
|
||||||
data->setSelectedItems(items);
|
data->setSelectedItems(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QGraphicsItem *> QDeclarativeViewObserver::selectedItems()
|
QList<QGraphicsItem *> QDeclarativeViewInspector::selectedItems()
|
||||||
{
|
{
|
||||||
return data->selectedItems();
|
return data->selectedItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
QDeclarativeView *QDeclarativeViewObserver::declarativeView()
|
QDeclarativeView *QDeclarativeViewInspector::declarativeView()
|
||||||
{
|
{
|
||||||
return data->view;
|
return data->view;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserverPrivate::clearHighlight()
|
void QDeclarativeViewInspectorPrivate::clearHighlight()
|
||||||
{
|
{
|
||||||
boundingRectHighlighter->clear();
|
boundingRectHighlighter->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserverPrivate::highlight(const QList<QGraphicsObject *> &items)
|
void QDeclarativeViewInspectorPrivate::highlight(const QList<QGraphicsObject *> &items)
|
||||||
{
|
{
|
||||||
if (items.isEmpty())
|
if (items.isEmpty())
|
||||||
return;
|
return;
|
||||||
@@ -712,27 +712,27 @@ void QDeclarativeViewObserverPrivate::highlight(const QList<QGraphicsObject *> &
|
|||||||
boundingRectHighlighter->highlight(objectList);
|
boundingRectHighlighter->highlight(objectList);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QGraphicsItem*> QDeclarativeViewObserverPrivate::selectableItems(
|
QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::selectableItems(
|
||||||
const QPointF &scenePos) const
|
const QPointF &scenePos) const
|
||||||
{
|
{
|
||||||
QList<QGraphicsItem*> itemlist = view->scene()->items(scenePos);
|
QList<QGraphicsItem*> itemlist = view->scene()->items(scenePos);
|
||||||
return filterForSelection(itemlist);
|
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);
|
QList<QGraphicsItem*> itemlist = view->items(pos);
|
||||||
return filterForSelection(itemlist);
|
return filterForSelection(itemlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QGraphicsItem*> QDeclarativeViewObserverPrivate::selectableItems(
|
QList<QGraphicsItem*> QDeclarativeViewInspectorPrivate::selectableItems(
|
||||||
const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const
|
const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const
|
||||||
{
|
{
|
||||||
QList<QGraphicsItem*> itemlist = view->scene()->items(sceneRect, selectionMode);
|
QList<QGraphicsItem*> itemlist = view->scene()->items(sceneRect, selectionMode);
|
||||||
return filterForSelection(itemlist);
|
return filterForSelection(itemlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserverPrivate::_q_changeToSingleSelectTool()
|
void QDeclarativeViewInspectorPrivate::_q_changeToSingleSelectTool()
|
||||||
{
|
{
|
||||||
currentToolMode = Constants::SelectionToolMode;
|
currentToolMode = Constants::SelectionToolMode;
|
||||||
selectionTool->setRubberbandSelectionMode(false);
|
selectionTool->setRubberbandSelectionMode(false);
|
||||||
@@ -743,7 +743,7 @@ void QDeclarativeViewObserverPrivate::_q_changeToSingleSelectTool()
|
|||||||
debugService->setCurrentTool(Constants::SelectionToolMode);
|
debugService->setCurrentTool(Constants::SelectionToolMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserverPrivate::changeToSelectTool()
|
void QDeclarativeViewInspectorPrivate::changeToSelectTool()
|
||||||
{
|
{
|
||||||
if (currentTool == selectionTool)
|
if (currentTool == selectionTool)
|
||||||
return;
|
return;
|
||||||
@@ -754,7 +754,7 @@ void QDeclarativeViewObserverPrivate::changeToSelectTool()
|
|||||||
currentTool->updateSelectedItems();
|
currentTool->updateSelectedItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserverPrivate::_q_changeToMarqueeSelectTool()
|
void QDeclarativeViewInspectorPrivate::_q_changeToMarqueeSelectTool()
|
||||||
{
|
{
|
||||||
changeToSelectTool();
|
changeToSelectTool();
|
||||||
currentToolMode = Constants::MarqueeSelectionToolMode;
|
currentToolMode = Constants::MarqueeSelectionToolMode;
|
||||||
@@ -764,7 +764,7 @@ void QDeclarativeViewObserverPrivate::_q_changeToMarqueeSelectTool()
|
|||||||
debugService->setCurrentTool(Constants::MarqueeSelectionToolMode);
|
debugService->setCurrentTool(Constants::MarqueeSelectionToolMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserverPrivate::_q_changeToZoomTool()
|
void QDeclarativeViewInspectorPrivate::_q_changeToZoomTool()
|
||||||
{
|
{
|
||||||
currentToolMode = Constants::ZoomMode;
|
currentToolMode = Constants::ZoomMode;
|
||||||
currentTool->clear();
|
currentTool->clear();
|
||||||
@@ -775,7 +775,7 @@ void QDeclarativeViewObserverPrivate::_q_changeToZoomTool()
|
|||||||
debugService->setCurrentTool(Constants::ZoomMode);
|
debugService->setCurrentTool(Constants::ZoomMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserverPrivate::_q_changeToColorPickerTool()
|
void QDeclarativeViewInspectorPrivate::_q_changeToColorPickerTool()
|
||||||
{
|
{
|
||||||
if (currentTool == colorPickerTool)
|
if (currentTool == colorPickerTool)
|
||||||
return;
|
return;
|
||||||
@@ -789,7 +789,7 @@ void QDeclarativeViewObserverPrivate::_q_changeToColorPickerTool()
|
|||||||
debugService->setCurrentTool(Constants::ColorPickerMode);
|
debugService->setCurrentTool(Constants::ColorPickerMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserver::setAnimationSpeed(qreal slowDownFactor)
|
void QDeclarativeViewInspector::setAnimationSpeed(qreal slowDownFactor)
|
||||||
{
|
{
|
||||||
Q_ASSERT(slowDownFactor > 0);
|
Q_ASSERT(slowDownFactor > 0);
|
||||||
if (data->slowDownFactor == slowDownFactor)
|
if (data->slowDownFactor == slowDownFactor)
|
||||||
@@ -799,7 +799,7 @@ void QDeclarativeViewObserver::setAnimationSpeed(qreal slowDownFactor)
|
|||||||
data->debugService->setAnimationSpeed(slowDownFactor);
|
data->debugService->setAnimationSpeed(slowDownFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserver::setAnimationPaused(bool paused)
|
void QDeclarativeViewInspector::setAnimationPaused(bool paused)
|
||||||
{
|
{
|
||||||
if (data->animationPaused == paused)
|
if (data->animationPaused == paused)
|
||||||
return;
|
return;
|
||||||
@@ -808,7 +808,7 @@ void QDeclarativeViewObserver::setAnimationPaused(bool paused)
|
|||||||
data->debugService->setAnimationPaused(paused);
|
data->debugService->setAnimationPaused(paused);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserver::animationSpeedChangeRequested(qreal factor)
|
void QDeclarativeViewInspector::animationSpeedChangeRequested(qreal factor)
|
||||||
{
|
{
|
||||||
if (data->slowDownFactor != factor) {
|
if (data->slowDownFactor != factor) {
|
||||||
data->slowDownFactor = factor;
|
data->slowDownFactor = factor;
|
||||||
@@ -819,7 +819,7 @@ void QDeclarativeViewObserver::animationSpeedChangeRequested(qreal factor)
|
|||||||
QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor);
|
QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserver::animationPausedChangeRequested(bool paused)
|
void QDeclarativeViewInspector::animationPausedChangeRequested(bool paused)
|
||||||
{
|
{
|
||||||
if (data->animationPaused != paused) {
|
if (data->animationPaused != paused) {
|
||||||
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
|
QList<QGraphicsItem*> &itemlist) const
|
||||||
{
|
{
|
||||||
foreach (QGraphicsItem *item, itemlist) {
|
foreach (QGraphicsItem *item, itemlist) {
|
||||||
@@ -847,20 +847,20 @@ QList<QGraphicsItem*> QDeclarativeViewObserverPrivate::filterForSelection(
|
|||||||
return itemlist;
|
return itemlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QDeclarativeViewObserverPrivate::isEditorItem(QGraphicsItem *item) const
|
bool QDeclarativeViewInspectorPrivate::isEditorItem(QGraphicsItem *item) const
|
||||||
{
|
{
|
||||||
return (item->type() == Constants::EditorItemType
|
return (item->type() == Constants::EditorItemType
|
||||||
|| item->type() == Constants::ResizeHandleItemType
|
|| item->type() == Constants::ResizeHandleItemType
|
||||||
|| item->data(Constants::EditorItemDataKey).toBool());
|
|| item->data(Constants::EditorItemDataKey).toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserverPrivate::_q_onStatusChanged(QDeclarativeView::Status status)
|
void QDeclarativeViewInspectorPrivate::_q_onStatusChanged(QDeclarativeView::Status status)
|
||||||
{
|
{
|
||||||
if (status == QDeclarativeView::Ready)
|
if (status == QDeclarativeView::Ready)
|
||||||
debugService->reloaded();
|
debugService->reloaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserverPrivate::_q_onCurrentObjectsChanged(QList<QObject*> objects)
|
void QDeclarativeViewInspectorPrivate::_q_onCurrentObjectsChanged(QList<QObject*> objects)
|
||||||
{
|
{
|
||||||
QList<QGraphicsItem*> items;
|
QList<QGraphicsItem*> items;
|
||||||
QList<QGraphicsObject*> gfxObjects;
|
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
|
// 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;
|
int marginFromEdge = 1;
|
||||||
QRectF boundingRect(boundingRectInSceneSpace);
|
QRectF boundingRect(boundingRectInSceneSpace);
|
||||||
@@ -904,7 +904,7 @@ QRectF QDeclarativeViewObserver::adjustToScreenBoundaries(const QRectF &bounding
|
|||||||
return boundingRect;
|
return boundingRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewObserverPrivate::createToolBox()
|
void QDeclarativeViewInspectorPrivate::createToolBox()
|
||||||
{
|
{
|
||||||
toolBox = new ToolBox(q->declarativeView());
|
toolBox = new ToolBox(q->declarativeView());
|
||||||
|
|
||||||
@@ -947,4 +947,4 @@ void QDeclarativeViewObserverPrivate::createToolBox()
|
|||||||
|
|
||||||
} // namespace QmlJSDebugger
|
} // namespace QmlJSDebugger
|
||||||
|
|
||||||
#include "qdeclarativeviewobserver.moc"
|
#include "qdeclarativeviewinspector.moc"
|
@@ -30,19 +30,19 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef QDECLARATIVEVIEWOBSERVER_P_H
|
#ifndef QDECLARATIVEVIEWINSPECTOR_P_H
|
||||||
#define QDECLARATIVEVIEWOBSERVER_P_H
|
#define QDECLARATIVEVIEWINSPECTOR_P_H
|
||||||
|
|
||||||
#include <QtCore/QWeakPointer>
|
#include <QtCore/QWeakPointer>
|
||||||
#include <QtCore/QPointF>
|
#include <QtCore/QPointF>
|
||||||
|
|
||||||
#include "qdeclarativeviewobserver.h"
|
#include "qdeclarativeviewinspector.h"
|
||||||
#include "qdeclarativeobserverservice.h"
|
#include "qdeclarativeinspectorservice.h"
|
||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
|
|
||||||
class JSDebuggerAgent;
|
class JSDebuggerAgent;
|
||||||
class QDeclarativeViewObserver;
|
class QDeclarativeViewInspector;
|
||||||
class LiveSelectionTool;
|
class LiveSelectionTool;
|
||||||
class ZoomTool;
|
class ZoomTool;
|
||||||
class ColorPickerTool;
|
class ColorPickerTool;
|
||||||
@@ -52,16 +52,16 @@ class ToolBox;
|
|||||||
class CrumblePath;
|
class CrumblePath;
|
||||||
class AbstractLiveEditTool;
|
class AbstractLiveEditTool;
|
||||||
|
|
||||||
class QDeclarativeViewObserverPrivate : public QObject
|
class QDeclarativeViewInspectorPrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
QDeclarativeViewObserverPrivate(QDeclarativeViewObserver *);
|
QDeclarativeViewInspectorPrivate(QDeclarativeViewInspector *);
|
||||||
~QDeclarativeViewObserverPrivate();
|
~QDeclarativeViewInspectorPrivate();
|
||||||
|
|
||||||
QDeclarativeView *view;
|
QDeclarativeView *view;
|
||||||
QDeclarativeViewObserver *q;
|
QDeclarativeViewInspector *q;
|
||||||
QDeclarativeObserverService *debugService;
|
QDeclarativeInspectorService *debugService;
|
||||||
QWeakPointer<QWidget> viewport;
|
QWeakPointer<QWidget> viewport;
|
||||||
|
|
||||||
QPointF cursorPos;
|
QPointF cursorPos;
|
||||||
@@ -130,9 +130,9 @@ public slots:
|
|||||||
void _q_removeFromSelection(QObject *);
|
void _q_removeFromSelection(QObject *);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static QDeclarativeViewObserverPrivate *get(QDeclarativeViewObserver *v) { return v->d_func(); }
|
static QDeclarativeViewInspectorPrivate *get(QDeclarativeViewInspector *v) { return v->d_func(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlJSDebugger
|
} // namespace QmlJSDebugger
|
||||||
|
|
||||||
#endif // QDECLARATIVEVIEWOBSERVER_P_H
|
#endif // QDECLARATIVEVIEWINSPECTOR_P_H
|
@@ -10,9 +10,10 @@ SOURCES += \
|
|||||||
$$PWD/jsdebuggeragent.cpp
|
$$PWD/jsdebuggeragent.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
$$PWD/include/qdeclarativeviewinspector.h \
|
||||||
$$PWD/include/qdeclarativeviewobserver.h \
|
$$PWD/include/qdeclarativeviewobserver.h \
|
||||||
$$PWD/include/qdeclarativeobserverservice.h \
|
$$PWD/include/qdeclarativeinspectorservice.h \
|
||||||
$$PWD/include/qmlobserverconstants.h \
|
$$PWD/include/qmlinspectorconstants.h \
|
||||||
$$PWD/editor/abstractliveedittool.h \
|
$$PWD/editor/abstractliveedittool.h \
|
||||||
$$PWD/editor/liveselectiontool.h \
|
$$PWD/editor/liveselectiontool.h \
|
||||||
$$PWD/editor/livelayeritem.h \
|
$$PWD/editor/livelayeritem.h \
|
||||||
@@ -26,11 +27,11 @@ HEADERS += \
|
|||||||
$$PWD/editor/colorpickertool.h \
|
$$PWD/editor/colorpickertool.h \
|
||||||
$$PWD/editor/qmltoolbar.h \
|
$$PWD/editor/qmltoolbar.h \
|
||||||
$$PWD/editor/toolbarcolorbox.h \
|
$$PWD/editor/toolbarcolorbox.h \
|
||||||
$$PWD/qdeclarativeviewobserver_p.h
|
$$PWD/qdeclarativeviewinspector_p.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/qdeclarativeviewobserver.cpp \
|
$$PWD/qdeclarativeviewinspector.cpp \
|
||||||
$$PWD/qdeclarativeobserverservice.cpp \
|
$$PWD/qdeclarativeinspectorservice.cpp \
|
||||||
$$PWD/editor/abstractliveedittool.cpp \
|
$$PWD/editor/abstractliveedittool.cpp \
|
||||||
$$PWD/editor/liveselectiontool.cpp \
|
$$PWD/editor/liveselectiontool.cpp \
|
||||||
$$PWD/editor/livelayeritem.cpp \
|
$$PWD/editor/livelayeritem.cpp \
|
||||||
|
@@ -54,8 +54,8 @@
|
|||||||
#include <private/qabstractanimation_p.h>
|
#include <private/qabstractanimation_p.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <qdeclarativeviewobserver.h>
|
#include <qdeclarativeviewinspector.h>
|
||||||
#include <qdeclarativeobserverservice.h>
|
#include <qdeclarativeinspectorservice.h>
|
||||||
|
|
||||||
#include <QtNetwork/QNetworkReply>
|
#include <QtNetwork/QNetworkReply>
|
||||||
#include <QtNetwork/QNetworkCookieJar>
|
#include <QtNetwork/QNetworkCookieJar>
|
||||||
@@ -648,7 +648,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
canvas = new DragAndDropView(this);
|
canvas = new DragAndDropView(this);
|
||||||
observer = new QmlJSDebugger::QDeclarativeViewObserver(canvas, this);
|
inspector = new QmlJSDebugger::QDeclarativeViewInspector(canvas, this);
|
||||||
new QmlJSDebugger::JSDebuggerAgent(canvas->engine());
|
new QmlJSDebugger::JSDebuggerAgent(canvas->engine());
|
||||||
|
|
||||||
canvas->setAttribute(Qt::WA_OpaquePaintEvent);
|
canvas->setAttribute(Qt::WA_OpaquePaintEvent);
|
||||||
@@ -698,7 +698,7 @@ void QDeclarativeViewer::setDesignModeBehavior(bool value)
|
|||||||
{
|
{
|
||||||
if (designModeBehaviorAction)
|
if (designModeBehaviorAction)
|
||||||
designModeBehaviorAction->setChecked(value);
|
designModeBehaviorAction->setChecked(value);
|
||||||
observer->setDesignModeBehavior(value);
|
inspector->setDesignModeBehavior(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewer::enableExperimentalGestures()
|
void QDeclarativeViewer::enableExperimentalGestures()
|
||||||
@@ -777,7 +777,7 @@ void QDeclarativeViewer::createMenu()
|
|||||||
speedAction->setData(10.0f);
|
speedAction->setData(10.0f);
|
||||||
playSpeedMenuActions->addAction(speedAction);
|
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->setCheckable(true);
|
||||||
pauseAnimationsAction->setShortcut(QKeySequence("Ctrl+."));
|
pauseAnimationsAction->setShortcut(QKeySequence("Ctrl+."));
|
||||||
|
|
||||||
@@ -790,30 +790,30 @@ void QDeclarativeViewer::createMenu()
|
|||||||
QAction *playSpeedAction = new QAction(tr("Animations"), this);
|
QAction *playSpeedAction = new QAction(tr("Animations"), this);
|
||||||
playSpeedAction->setMenu(playSpeedMenu);
|
playSpeedAction->setMenu(playSpeedMenu);
|
||||||
|
|
||||||
connect(observer, SIGNAL(animationSpeedChanged(qreal)), SLOT(animationSpeedChanged(qreal)));
|
connect(inspector, SIGNAL(animationSpeedChanged(qreal)), SLOT(animationSpeedChanged(qreal)));
|
||||||
connect(observer, SIGNAL(animationPausedChanged(bool)), pauseAnimationsAction, SLOT(setChecked(bool)));
|
connect(inspector, SIGNAL(animationPausedChanged(bool)), pauseAnimationsAction, SLOT(setChecked(bool)));
|
||||||
|
|
||||||
showWarningsWindow = new QAction(tr("Show Warnings"), this);
|
showWarningsWindow = new QAction(tr("Show Warnings"), this);
|
||||||
showWarningsWindow->setCheckable((true));
|
showWarningsWindow->setCheckable((true));
|
||||||
showWarningsWindow->setChecked(loggerWindow->isVisible());
|
showWarningsWindow->setChecked(loggerWindow->isVisible());
|
||||||
connect(showWarningsWindow, SIGNAL(triggered(bool)), this, SLOT(showWarnings(bool)));
|
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->setShortcut(QKeySequence("Ctrl+D"));
|
||||||
designModeBehaviorAction->setCheckable(true);
|
designModeBehaviorAction->setCheckable(true);
|
||||||
designModeBehaviorAction->setChecked(observer->designModeBehavior());
|
designModeBehaviorAction->setChecked(inspector->designModeBehavior());
|
||||||
designModeBehaviorAction->setEnabled(QmlJSDebugger::QDeclarativeObserverService::hasDebuggingClient());
|
designModeBehaviorAction->setEnabled(QmlJSDebugger::QDeclarativeInspectorService::hasDebuggingClient());
|
||||||
connect(designModeBehaviorAction, SIGNAL(triggered(bool)), this, SLOT(setDesignModeBehavior(bool)));
|
connect(designModeBehaviorAction, SIGNAL(triggered(bool)), this, SLOT(setDesignModeBehavior(bool)));
|
||||||
connect(observer, SIGNAL(designModeBehaviorChanged(bool)), designModeBehaviorAction, SLOT(setChecked(bool)));
|
connect(inspector, SIGNAL(designModeBehaviorChanged(bool)), designModeBehaviorAction, SLOT(setChecked(bool)));
|
||||||
connect(QmlJSDebugger::QDeclarativeObserverService::instance(), SIGNAL(debuggingClientChanged(bool)),
|
connect(QmlJSDebugger::QDeclarativeInspectorService::instance(), SIGNAL(debuggingClientChanged(bool)),
|
||||||
designModeBehaviorAction, SLOT(setEnabled(bool)));
|
designModeBehaviorAction, SLOT(setEnabled(bool)));
|
||||||
|
|
||||||
appOnTopAction = new QAction(tr("Keep Window on Top"), this);
|
appOnTopAction = new QAction(tr("Keep Window on Top"), this);
|
||||||
appOnTopAction->setCheckable(true);
|
appOnTopAction->setCheckable(true);
|
||||||
appOnTopAction->setChecked(observer->showAppOnTop());
|
appOnTopAction->setChecked(inspector->showAppOnTop());
|
||||||
|
|
||||||
connect(appOnTopAction, SIGNAL(triggered(bool)), observer, SLOT(setShowAppOnTop(bool)));
|
connect(appOnTopAction, SIGNAL(triggered(bool)), inspector, SLOT(setShowAppOnTop(bool)));
|
||||||
connect(observer, SIGNAL(showAppOnTopChanged(bool)), appOnTopAction, SLOT(setChecked(bool)));
|
connect(inspector, SIGNAL(showAppOnTopChanged(bool)), appOnTopAction, SLOT(setChecked(bool)));
|
||||||
|
|
||||||
QAction *proxyAction = new QAction(tr("HTTP &Proxy..."), this);
|
QAction *proxyAction = new QAction(tr("HTTP &Proxy..."), this);
|
||||||
connect(proxyAction, SIGNAL(triggered()), this, SLOT(showProxySettings()));
|
connect(proxyAction, SIGNAL(triggered()), this, SLOT(showProxySettings()));
|
||||||
@@ -1070,12 +1070,12 @@ void QDeclarativeViewer::toggleRecording()
|
|||||||
|
|
||||||
void QDeclarativeViewer::pauseAnimations()
|
void QDeclarativeViewer::pauseAnimations()
|
||||||
{
|
{
|
||||||
observer->setAnimationPaused(true);
|
inspector->setAnimationPaused(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewer::stepAnimations()
|
void QDeclarativeViewer::stepAnimations()
|
||||||
{
|
{
|
||||||
observer->setAnimationPaused(false);
|
inspector->setAnimationPaused(false);
|
||||||
QTimer::singleShot(m_stepSize, this, SLOT(pauseAnimations()));
|
QTimer::singleShot(m_stepSize, this, SLOT(pauseAnimations()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1090,7 +1090,7 @@ void QDeclarativeViewer::setAnimationStep()
|
|||||||
void QDeclarativeViewer::changeAnimationSpeed()
|
void QDeclarativeViewer::changeAnimationSpeed()
|
||||||
{
|
{
|
||||||
if (QAction *action = qobject_cast<QAction*>(sender()))
|
if (QAction *action = qobject_cast<QAction*>(sender()))
|
||||||
observer->setAnimationSpeed(action->data().toFloat());
|
inspector->setAnimationSpeed(action->data().toFloat());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDeclarativeViewer::addLibraryPath(const QString& lib)
|
void QDeclarativeViewer::addLibraryPath(const QString& lib)
|
||||||
|
@@ -40,7 +40,7 @@
|
|||||||
#include "loggerwidget.h"
|
#include "loggerwidget.h"
|
||||||
|
|
||||||
namespace QmlJSDebugger {
|
namespace QmlJSDebugger {
|
||||||
class QDeclarativeViewObserver;
|
class QDeclarativeViewInspector;
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@@ -156,7 +156,7 @@ private:
|
|||||||
|
|
||||||
LoggerWidget *loggerWindow;
|
LoggerWidget *loggerWindow;
|
||||||
QDeclarativeView *canvas;
|
QDeclarativeView *canvas;
|
||||||
QmlJSDebugger::QDeclarativeViewObserver *observer;
|
QmlJSDebugger::QDeclarativeViewInspector *inspector;
|
||||||
QSize initialSize;
|
QSize initialSize;
|
||||||
QString currentFileOrUrl;
|
QString currentFileOrUrl;
|
||||||
QTimer recordTimer;
|
QTimer recordTimer;
|
||||||
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
@@ -66,7 +66,7 @@ static QToolButton *toolButton(QAction *action)
|
|||||||
QmlInspectorToolBar::QmlInspectorToolBar(QObject *parent) :
|
QmlInspectorToolBar::QmlInspectorToolBar(QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_fromQmlAction(0),
|
m_fromQmlAction(0),
|
||||||
m_observerModeAction(0),
|
m_inspectorModeAction(0),
|
||||||
m_playAction(0),
|
m_playAction(0),
|
||||||
m_selectAction(0),
|
m_selectAction(0),
|
||||||
m_zoomAction(0),
|
m_zoomAction(0),
|
||||||
@@ -88,7 +88,7 @@ void QmlInspectorToolBar::setEnabled(bool value)
|
|||||||
{
|
{
|
||||||
m_fromQmlAction->setEnabled(value);
|
m_fromQmlAction->setEnabled(value);
|
||||||
m_showAppOnTopAction->setEnabled(value);
|
m_showAppOnTopAction->setEnabled(value);
|
||||||
m_observerModeAction->setEnabled(value);
|
m_inspectorModeAction->setEnabled(value);
|
||||||
m_playAction->setEnabled(value);
|
m_playAction->setEnabled(value);
|
||||||
m_selectAction->setEnabled(value);
|
m_selectAction->setEnabled(value);
|
||||||
m_zoomAction->setEnabled(value);
|
m_zoomAction->setEnabled(value);
|
||||||
@@ -101,7 +101,7 @@ void QmlInspectorToolBar::enable()
|
|||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
m_emitSignals = false;
|
m_emitSignals = false;
|
||||||
m_showAppOnTopAction->setChecked(false);
|
m_showAppOnTopAction->setChecked(false);
|
||||||
m_observerModeAction->setChecked(false);
|
m_inspectorModeAction->setChecked(false);
|
||||||
setAnimationSpeed(1.0f);
|
setAnimationSpeed(1.0f);
|
||||||
activateDesignModeOnClick();
|
activateDesignModeOnClick();
|
||||||
m_emitSignals = true;
|
m_emitSignals = true;
|
||||||
@@ -165,7 +165,7 @@ void QmlInspectorToolBar::setAnimationPaused(bool paused)
|
|||||||
void QmlInspectorToolBar::setDesignModeBehavior(bool inDesignMode)
|
void QmlInspectorToolBar::setDesignModeBehavior(bool inDesignMode)
|
||||||
{
|
{
|
||||||
m_emitSignals = false;
|
m_emitSignals = false;
|
||||||
m_observerModeAction->setChecked(inDesignMode);
|
m_inspectorModeAction->setChecked(inDesignMode);
|
||||||
activateDesignModeOnClick();
|
activateDesignModeOnClick();
|
||||||
m_emitSignals = true;
|
m_emitSignals = true;
|
||||||
}
|
}
|
||||||
@@ -188,9 +188,9 @@ void QmlInspectorToolBar::createActions(const Core::Context &context)
|
|||||||
m_showAppOnTopAction =
|
m_showAppOnTopAction =
|
||||||
new QAction(QIcon(QLatin1String(":/qml/images/app-on-top.png")),
|
new QAction(QIcon(QLatin1String(":/qml/images/app-on-top.png")),
|
||||||
tr("Show application on top"), this);
|
tr("Show application on top"), this);
|
||||||
m_observerModeAction =
|
m_inspectorModeAction =
|
||||||
new QAction(QIcon(QLatin1String(":/qml/images/observermode.png")),
|
new QAction(QIcon(QLatin1String(":/qml/images/inspectormode.png")),
|
||||||
tr("Observer Mode"), this);
|
tr("Inspector Mode"), this);
|
||||||
m_playAction =
|
m_playAction =
|
||||||
new QAction(m_pauseIcon, tr("Play/Pause Animations"), this);
|
new QAction(m_pauseIcon, tr("Play/Pause Animations"), this);
|
||||||
m_selectAction =
|
m_selectAction =
|
||||||
@@ -207,13 +207,13 @@ void QmlInspectorToolBar::createActions(const Core::Context &context)
|
|||||||
m_fromQmlAction->setChecked(true);
|
m_fromQmlAction->setChecked(true);
|
||||||
m_showAppOnTopAction->setCheckable(true);
|
m_showAppOnTopAction->setCheckable(true);
|
||||||
m_showAppOnTopAction->setChecked(false);
|
m_showAppOnTopAction->setChecked(false);
|
||||||
m_observerModeAction->setCheckable(true);
|
m_inspectorModeAction->setCheckable(true);
|
||||||
m_observerModeAction->setChecked(false);
|
m_inspectorModeAction->setChecked(false);
|
||||||
m_selectAction->setCheckable(true);
|
m_selectAction->setCheckable(true);
|
||||||
m_zoomAction->setCheckable(true);
|
m_zoomAction->setCheckable(true);
|
||||||
m_colorPickerAction->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);
|
Core::Command *command = am->registerAction(m_playAction, Constants::PLAY_ACTION, context);
|
||||||
command->setAttribute(Core::Command::CA_UpdateIcon);
|
command->setAttribute(Core::Command::CA_UpdateIcon);
|
||||||
am->registerAction(m_selectAction, Constants::SELECT_ACTION, context);
|
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_fromQmlAction, SIGNAL(triggered()), SLOT(activateFromQml()));
|
||||||
connect(m_showAppOnTopAction, SIGNAL(triggered()), SLOT(showAppOnTopClick()));
|
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_playAction, SIGNAL(triggered()), SLOT(activatePlayOnClick()));
|
||||||
connect(m_colorPickerAction, SIGNAL(triggered()), SLOT(activateColorPickerOnClick()));
|
connect(m_colorPickerAction, SIGNAL(triggered()), SLOT(activateColorPickerOnClick()));
|
||||||
connect(m_selectAction, SIGNAL(triggered()), SLOT(activateSelectToolOnClick()));
|
connect(m_selectAction, SIGNAL(triggered()), SLOT(activateSelectToolOnClick()));
|
||||||
@@ -322,7 +322,7 @@ void QmlInspectorToolBar::changeAnimationSpeed()
|
|||||||
|
|
||||||
void QmlInspectorToolBar::activateDesignModeOnClick()
|
void QmlInspectorToolBar::activateDesignModeOnClick()
|
||||||
{
|
{
|
||||||
bool checked = m_observerModeAction->isChecked();
|
bool checked = m_inspectorModeAction->isChecked();
|
||||||
|
|
||||||
m_selectAction->setEnabled(checked);
|
m_selectAction->setEnabled(checked);
|
||||||
m_zoomAction->setEnabled(checked);
|
m_zoomAction->setEnabled(checked);
|
||||||
|
@@ -127,7 +127,7 @@ private:
|
|||||||
QToolButton *m_operateByInstructionButton;
|
QToolButton *m_operateByInstructionButton;
|
||||||
|
|
||||||
QAction *m_fromQmlAction;
|
QAction *m_fromQmlAction;
|
||||||
QAction *m_observerModeAction;
|
QAction *m_inspectorModeAction;
|
||||||
QAction *m_playAction;
|
QAction *m_playAction;
|
||||||
QAction *m_selectAction;
|
QAction *m_selectAction;
|
||||||
QAction *m_zoomAction;
|
QAction *m_zoomAction;
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include "qmljsclientproxy.h"
|
#include "qmljsclientproxy.h"
|
||||||
#include "qmljsprivateapi.h"
|
#include "qmljsprivateapi.h"
|
||||||
#include "qmljsobserverclient.h"
|
#include "qmljsinspectorclient.h"
|
||||||
#include "qmljsinspector.h"
|
#include "qmljsinspector.h"
|
||||||
|
|
||||||
#include <debugger/debuggerplugin.h>
|
#include <debugger/debuggerplugin.h>
|
||||||
@@ -52,7 +52,7 @@ ClientProxy::ClientProxy(Debugger::QmlAdapter *adapter, QObject *parent)
|
|||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_adapter(adapter)
|
, m_adapter(adapter)
|
||||||
, m_engineClient(0)
|
, m_engineClient(0)
|
||||||
, m_observerClient(0)
|
, m_inspectorClient(0)
|
||||||
, m_engineQuery(0)
|
, m_engineQuery(0)
|
||||||
, m_contextQuery(0)
|
, m_contextQuery(0)
|
||||||
, m_isConnected(false)
|
, m_isConnected(false)
|
||||||
@@ -69,33 +69,33 @@ void ClientProxy::connectToServer()
|
|||||||
|
|
||||||
connect(m_engineClient, SIGNAL(newObjects()), this, SLOT(newObjects()));
|
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)));
|
this, SLOT(clientStatusChanged(QDeclarativeDebugClient::Status)));
|
||||||
connect(m_observerClient, SIGNAL(currentObjectsChanged(QList<int>)),
|
connect(m_inspectorClient, SIGNAL(currentObjectsChanged(QList<int>)),
|
||||||
SLOT(onCurrentObjectsChanged(QList<int>)));
|
SLOT(onCurrentObjectsChanged(QList<int>)));
|
||||||
connect(m_observerClient, SIGNAL(colorPickerActivated()),
|
connect(m_inspectorClient, SIGNAL(colorPickerActivated()),
|
||||||
SIGNAL(colorPickerActivated()));
|
SIGNAL(colorPickerActivated()));
|
||||||
connect(m_observerClient, SIGNAL(zoomToolActivated()),
|
connect(m_inspectorClient, SIGNAL(zoomToolActivated()),
|
||||||
SIGNAL(zoomToolActivated()));
|
SIGNAL(zoomToolActivated()));
|
||||||
connect(m_observerClient, SIGNAL(selectToolActivated()),
|
connect(m_inspectorClient, SIGNAL(selectToolActivated()),
|
||||||
SIGNAL(selectToolActivated()));
|
SIGNAL(selectToolActivated()));
|
||||||
connect(m_observerClient, SIGNAL(selectMarqueeToolActivated()),
|
connect(m_inspectorClient, SIGNAL(selectMarqueeToolActivated()),
|
||||||
SIGNAL(selectMarqueeToolActivated()));
|
SIGNAL(selectMarqueeToolActivated()));
|
||||||
connect(m_observerClient, SIGNAL(animationSpeedChanged(qreal)),
|
connect(m_inspectorClient, SIGNAL(animationSpeedChanged(qreal)),
|
||||||
SIGNAL(animationSpeedChanged(qreal)));
|
SIGNAL(animationSpeedChanged(qreal)));
|
||||||
connect(m_observerClient, SIGNAL(animationPausedChanged(bool)),
|
connect(m_inspectorClient, SIGNAL(animationPausedChanged(bool)),
|
||||||
SIGNAL(animationPausedChanged(bool)));
|
SIGNAL(animationPausedChanged(bool)));
|
||||||
connect(m_observerClient, SIGNAL(designModeBehaviorChanged(bool)),
|
connect(m_inspectorClient, SIGNAL(designModeBehaviorChanged(bool)),
|
||||||
SIGNAL(designModeBehaviorChanged(bool)));
|
SIGNAL(designModeBehaviorChanged(bool)));
|
||||||
connect(m_observerClient, SIGNAL(showAppOnTopChanged(bool)),
|
connect(m_inspectorClient, SIGNAL(showAppOnTopChanged(bool)),
|
||||||
SIGNAL(showAppOnTopChanged(bool)));
|
SIGNAL(showAppOnTopChanged(bool)));
|
||||||
connect(m_observerClient, SIGNAL(reloaded()), this,
|
connect(m_inspectorClient, SIGNAL(reloaded()), this,
|
||||||
SIGNAL(serverReloaded()));
|
SIGNAL(serverReloaded()));
|
||||||
connect(m_observerClient, SIGNAL(selectedColorChanged(QColor)),
|
connect(m_inspectorClient, SIGNAL(selectedColorChanged(QColor)),
|
||||||
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)));
|
m_adapter, SLOT(logServiceActivity(QString,QString)));
|
||||||
|
|
||||||
updateConnected();
|
updateConnected();
|
||||||
@@ -150,7 +150,7 @@ void ClientProxy::setSelectedItemsByDebugId(const QList<int> &debugIds)
|
|||||||
if (!isConnected())
|
if (!isConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_observerClient->setCurrentObjects(debugIds);
|
m_inspectorClient->setCurrentObjects(debugIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientProxy::setSelectedItemsByObjectId(const QList<QDeclarativeDebugObjectReference> &objectRefs)
|
void ClientProxy::setSelectedItemsByObjectId(const QList<QDeclarativeDebugObjectReference> &objectRefs)
|
||||||
@@ -162,7 +162,7 @@ void ClientProxy::setSelectedItemsByObjectId(const QList<QDeclarativeDebugObject
|
|||||||
debugIds << ref.debugId();
|
debugIds << ref.debugId();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_observerClient->setCurrentObjects(debugIds);
|
m_inspectorClient->setCurrentObjects(debugIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ QDeclarativeDebugExpressionQuery *ClientProxy::queryExpressionResult(int objectD
|
|||||||
void ClientProxy::clearComponentCache()
|
void ClientProxy::clearComponentCache()
|
||||||
{
|
{
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
m_observerClient->clearComponentCache();
|
m_inspectorClient->clearComponentCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientProxy::addObjectWatch(int objectDebugId)
|
bool ClientProxy::addObjectWatch(int objectDebugId)
|
||||||
@@ -500,10 +500,10 @@ void ClientProxy::objectTreeFetched(QDeclarativeDebugQuery::State state)
|
|||||||
emit objectTreeUpdated();
|
emit objectTreeUpdated();
|
||||||
|
|
||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
if (!m_observerClient->currentObjects().isEmpty())
|
if (!m_inspectorClient->currentObjects().isEmpty())
|
||||||
onCurrentObjectsChanged(m_observerClient->currentObjects(), false);
|
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()
|
void ClientProxy::reloadQmlViewer()
|
||||||
{
|
{
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
m_observerClient->reloadViewer();
|
m_inspectorClient->reloadViewer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientProxy::setDesignModeBehavior(bool inDesignMode)
|
void ClientProxy::setDesignModeBehavior(bool inDesignMode)
|
||||||
{
|
{
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
m_observerClient->setDesignModeBehavior(inDesignMode);
|
m_inspectorClient->setDesignModeBehavior(inDesignMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientProxy::setAnimationSpeed(qreal slowDownFactor)
|
void ClientProxy::setAnimationSpeed(qreal slowDownFactor)
|
||||||
{
|
{
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
m_observerClient->setAnimationSpeed(slowDownFactor);
|
m_inspectorClient->setAnimationSpeed(slowDownFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientProxy::setAnimationPaused(bool paused)
|
void ClientProxy::setAnimationPaused(bool paused)
|
||||||
{
|
{
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
m_observerClient->setAnimationPaused(paused);
|
m_inspectorClient->setAnimationPaused(paused);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientProxy::changeToColorPickerTool()
|
void ClientProxy::changeToColorPickerTool()
|
||||||
{
|
{
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
m_observerClient->changeToColorPickerTool();
|
m_inspectorClient->changeToColorPickerTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientProxy::changeToZoomTool()
|
void ClientProxy::changeToZoomTool()
|
||||||
{
|
{
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
m_observerClient->changeToZoomTool();
|
m_inspectorClient->changeToZoomTool();
|
||||||
}
|
}
|
||||||
void ClientProxy::changeToSelectTool()
|
void ClientProxy::changeToSelectTool()
|
||||||
{
|
{
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
m_observerClient->changeToSelectTool();
|
m_inspectorClient->changeToSelectTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientProxy::changeToSelectMarqueeTool()
|
void ClientProxy::changeToSelectMarqueeTool()
|
||||||
{
|
{
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
m_observerClient->changeToSelectMarqueeTool();
|
m_inspectorClient->changeToSelectMarqueeTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientProxy::showAppOnTop(bool showOnTop)
|
void ClientProxy::showAppOnTop(bool showOnTop)
|
||||||
{
|
{
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
m_observerClient->showAppOnTop(showOnTop);
|
m_inspectorClient->showAppOnTop(showOnTop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientProxy::createQmlObject(const QString &qmlText, int parentDebugId,
|
void ClientProxy::createQmlObject(const QString &qmlText, int parentDebugId,
|
||||||
const QStringList &imports, const QString &filename, int order)
|
const QStringList &imports, const QString &filename, int order)
|
||||||
{
|
{
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
m_observerClient->createQmlObject(qmlText, parentDebugId, imports, filename, order);
|
m_inspectorClient->createQmlObject(qmlText, parentDebugId, imports, filename, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientProxy::destroyQmlObject(int debugId)
|
void ClientProxy::destroyQmlObject(int debugId)
|
||||||
{
|
{
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
m_observerClient->destroyQmlObject(debugId);
|
m_inspectorClient->destroyQmlObject(debugId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientProxy::reparentQmlObject(int debugId, int newParent)
|
void ClientProxy::reparentQmlObject(int debugId, int newParent)
|
||||||
{
|
{
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
m_observerClient->reparentQmlObject(debugId, newParent);
|
m_inspectorClient->reparentQmlObject(debugId, newParent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientProxy::updateConnected()
|
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;
|
&& m_engineClient && m_engineClient->status() == QDeclarativeEngineDebug::Enabled;
|
||||||
|
|
||||||
if (isConnected != m_isConnected) {
|
if (isConnected != m_isConnected) {
|
||||||
|
@@ -50,7 +50,7 @@ typedef QHash<QPair<QString, int>, QHash<QPair<int, int>, QList<int> > > DebugId
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class InspectorPlugin;
|
class InspectorPlugin;
|
||||||
class QmlJSObserverClient;
|
class QmlJSInspectorClient;
|
||||||
|
|
||||||
class ClientProxy : public QObject
|
class ClientProxy : public QObject
|
||||||
{
|
{
|
||||||
@@ -167,7 +167,7 @@ private:
|
|||||||
|
|
||||||
Debugger::QmlAdapter *m_adapter;
|
Debugger::QmlAdapter *m_adapter;
|
||||||
QDeclarativeEngineDebug *m_engineClient;
|
QDeclarativeEngineDebug *m_engineClient;
|
||||||
QmlJSObserverClient *m_observerClient;
|
QmlJSInspectorClient *m_inspectorClient;
|
||||||
|
|
||||||
QDeclarativeDebugEnginesQuery *m_engineQuery;
|
QDeclarativeDebugEnginesQuery *m_engineQuery;
|
||||||
QDeclarativeDebugRootContextQuery *m_contextQuery;
|
QDeclarativeDebugRootContextQuery *m_contextQuery;
|
||||||
|
@@ -338,7 +338,7 @@ void InspectorUi::disconnected()
|
|||||||
m_qmlEngine = 0;
|
m_qmlEngine = 0;
|
||||||
resetViews();
|
resetViews();
|
||||||
|
|
||||||
applyChangesToQmlObserverHelper(false);
|
applyChangesToQmlInspectorHelper(false);
|
||||||
|
|
||||||
QHashIterator<QString, QmlJSLiveTextPreview *> iter(m_textPreviews);
|
QHashIterator<QString, QmlJSLiveTextPreview *> iter(m_textPreviews);
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
@@ -417,7 +417,7 @@ void InspectorUi::initializeDocuments()
|
|||||||
createPreviewForEditor(editor);
|
createPreviewForEditor(editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
applyChangesToQmlObserverHelper(true);
|
applyChangesToQmlInspectorHelper(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectorUi::serverReloaded()
|
void InspectorUi::serverReloaded()
|
||||||
@@ -730,9 +730,9 @@ void InspectorUi::setupDockWidgets()
|
|||||||
|
|
||||||
m_propertyInspector = new QmlJSPropertyInspector;
|
m_propertyInspector = new QmlJSPropertyInspector;
|
||||||
|
|
||||||
QWidget *observerWidget = new QWidget;
|
QWidget *inspectorWidget = new QWidget;
|
||||||
observerWidget->setWindowTitle(tr("QML Observer"));
|
inspectorWidget->setWindowTitle(tr("QML Inspector"));
|
||||||
observerWidget->setObjectName(Debugger::Constants::DOCKWIDGET_QML_INSPECTOR);
|
inspectorWidget->setObjectName(Debugger::Constants::DOCKWIDGET_QML_INSPECTOR);
|
||||||
|
|
||||||
QWidget *pathAndFilterWidget = new StyledBackground;
|
QWidget *pathAndFilterWidget = new StyledBackground;
|
||||||
pathAndFilterWidget->setMaximumHeight(m_crumblePath->height());
|
pathAndFilterWidget->setMaximumHeight(m_crumblePath->height());
|
||||||
@@ -747,14 +747,14 @@ void InspectorUi::setupDockWidgets()
|
|||||||
pathAndFilterLayout->addWidget(m_crumblePath);
|
pathAndFilterLayout->addWidget(m_crumblePath);
|
||||||
pathAndFilterLayout->addWidget(m_filterExp);
|
pathAndFilterLayout->addWidget(m_filterExp);
|
||||||
|
|
||||||
QVBoxLayout *wlay = new QVBoxLayout(observerWidget);
|
QVBoxLayout *wlay = new QVBoxLayout(inspectorWidget);
|
||||||
wlay->setMargin(0);
|
wlay->setMargin(0);
|
||||||
wlay->setSpacing(0);
|
wlay->setSpacing(0);
|
||||||
observerWidget->setLayout(wlay);
|
inspectorWidget->setLayout(wlay);
|
||||||
wlay->addWidget(pathAndFilterWidget);
|
wlay->addWidget(pathAndFilterWidget);
|
||||||
wlay->addWidget(m_propertyInspector);
|
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->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
|
||||||
dock->setTitleBarWidget(new QWidget(dock));
|
dock->setTitleBarWidget(new QWidget(dock));
|
||||||
}
|
}
|
||||||
@@ -793,18 +793,18 @@ QString InspectorUi::findFileInProject(const QString &originalPath) const
|
|||||||
return m_projectFinder.findFile(originalPath);
|
return m_projectFinder.findFile(originalPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectorUi::setApplyChangesToQmlObserver(bool applyChanges)
|
void InspectorUi::setApplyChangesToQmlInspector(bool applyChanges)
|
||||||
{
|
{
|
||||||
emit livePreviewActivated(applyChanges);
|
emit livePreviewActivated(applyChanges);
|
||||||
applyChangesToQmlObserverHelper(applyChanges);
|
applyChangesToQmlInspectorHelper(applyChanges);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectorUi::applyChangesToQmlObserverHelper(bool applyChanges)
|
void InspectorUi::applyChangesToQmlInspectorHelper(bool applyChanges)
|
||||||
{
|
{
|
||||||
QHashIterator<QString, QmlJSLiveTextPreview *> iter(m_textPreviews);
|
QHashIterator<QString, QmlJSLiveTextPreview *> iter(m_textPreviews);
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
iter.next();
|
iter.next();
|
||||||
iter.value()->setApplyChangesToQmlObserver(applyChanges);
|
iter.value()->setApplyChangesToQmlInspector(applyChanges);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -833,7 +833,7 @@ void InspectorUi::updatePendingPreviewDocuments(QmlJS::Document::Ptr doc)
|
|||||||
|
|
||||||
void InspectorUi::disableLivePreview()
|
void InspectorUi::disableLivePreview()
|
||||||
{
|
{
|
||||||
setApplyChangesToQmlObserver(false);
|
setApplyChangesToQmlInspector(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectorUi::connectSignals()
|
void InspectorUi::connectSignals()
|
||||||
@@ -875,7 +875,7 @@ void InspectorUi::connectSignals()
|
|||||||
m_toolBar, SLOT(setAnimationPaused(bool)));
|
m_toolBar, SLOT(setAnimationPaused(bool)));
|
||||||
|
|
||||||
connect(m_toolBar, SIGNAL(applyChangesFromQmlFileTriggered(bool)),
|
connect(m_toolBar, SIGNAL(applyChangesFromQmlFileTriggered(bool)),
|
||||||
this, SLOT(setApplyChangesToQmlObserver(bool)));
|
this, SLOT(setApplyChangesToQmlInspector(bool)));
|
||||||
|
|
||||||
connect(m_toolBar, SIGNAL(designModeSelected(bool)),
|
connect(m_toolBar, SIGNAL(designModeSelected(bool)),
|
||||||
m_clientProxy, SLOT(setDesignModeBehavior(bool)));
|
m_clientProxy, SLOT(setDesignModeBehavior(bool)));
|
||||||
|
@@ -111,7 +111,7 @@ signals:
|
|||||||
public slots:
|
public slots:
|
||||||
void reloadQmlViewer();
|
void reloadQmlViewer();
|
||||||
void serverReloaded();
|
void serverReloaded();
|
||||||
void setApplyChangesToQmlObserver(bool applyChanges);
|
void setApplyChangesToQmlInspector(bool applyChanges);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void enable();
|
void enable();
|
||||||
@@ -141,7 +141,7 @@ private:
|
|||||||
void resetViews();
|
void resetViews();
|
||||||
|
|
||||||
void initializeDocuments();
|
void initializeDocuments();
|
||||||
void applyChangesToQmlObserverHelper(bool applyChanges);
|
void applyChangesToQmlInspectorHelper(bool applyChanges);
|
||||||
void setupDockWidgets();
|
void setupDockWidgets();
|
||||||
QString filenameForShadowBuildFile(const QString &filename) const;
|
QString filenameForShadowBuildFile(const QString &filename) const;
|
||||||
void populateCrumblePath(const QDeclarativeDebugObjectReference &objRef);
|
void populateCrumblePath(const QDeclarativeDebugObjectReference &objRef);
|
||||||
|
@@ -16,7 +16,7 @@ qmljsinspector.h \
|
|||||||
qmlinspectortoolbar.h \
|
qmlinspectortoolbar.h \
|
||||||
qmljslivetextpreview.h \
|
qmljslivetextpreview.h \
|
||||||
qmljstoolbarcolorbox.h \
|
qmljstoolbarcolorbox.h \
|
||||||
qmljsobserverclient.h \
|
qmljsinspectorclient.h \
|
||||||
qmljscontextcrumblepath.h \
|
qmljscontextcrumblepath.h \
|
||||||
qmljsinspectorsettings.h \
|
qmljsinspectorsettings.h \
|
||||||
qmljspropertyinspector.h
|
qmljspropertyinspector.h
|
||||||
@@ -28,7 +28,7 @@ qmljsinspector.cpp \
|
|||||||
qmlinspectortoolbar.cpp \
|
qmlinspectortoolbar.cpp \
|
||||||
qmljslivetextpreview.cpp \
|
qmljslivetextpreview.cpp \
|
||||||
qmljstoolbarcolorbox.cpp \
|
qmljstoolbarcolorbox.cpp \
|
||||||
qmljsobserverclient.cpp \
|
qmljsinspectorclient.cpp \
|
||||||
qmljscontextcrumblepath.cpp \
|
qmljscontextcrumblepath.cpp \
|
||||||
qmljsinspectorsettings.cpp \
|
qmljsinspectorsettings.cpp \
|
||||||
qmljspropertyinspector.cpp
|
qmljspropertyinspector.cpp
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
<file>images/zoom-small.png</file>
|
<file>images/zoom-small.png</file>
|
||||||
<file>images/select-marquee-small.png</file>
|
<file>images/select-marquee-small.png</file>
|
||||||
<file>images/color-picker-small-hicontrast.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>
|
<file>images/app-on-top.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "qmljsobserverclient.h"
|
#include "qmljsinspectorclient.h"
|
||||||
#include "qmljsclientproxy.h"
|
#include "qmljsclientproxy.h"
|
||||||
#include "qmljsinspectorconstants.h"
|
#include "qmljsinspectorconstants.h"
|
||||||
|
|
||||||
@@ -40,27 +40,27 @@ using namespace QmlJSDebugger;
|
|||||||
namespace QmlJSInspector {
|
namespace QmlJSInspector {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
QmlJSObserverClient::QmlJSObserverClient(QDeclarativeDebugConnection *client,
|
QmlJSInspectorClient::QmlJSInspectorClient(QDeclarativeDebugConnection *client,
|
||||||
QObject * /*parent*/)
|
QObject * /*parent*/)
|
||||||
: QDeclarativeDebugClient(QLatin1String("QDeclarativeObserverMode"), client) ,
|
: QDeclarativeDebugClient(QLatin1String("QDeclarativeObserverMode"), client) ,
|
||||||
m_connection(client)
|
m_connection(client)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSObserverClient::statusChanged(Status status)
|
void QmlJSInspectorClient::statusChanged(Status status)
|
||||||
{
|
{
|
||||||
emit connectedStatusChanged(status);
|
emit connectedStatusChanged(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSObserverClient::messageReceived(const QByteArray &message)
|
void QmlJSInspectorClient::messageReceived(const QByteArray &message)
|
||||||
{
|
{
|
||||||
QDataStream ds(message);
|
QDataStream ds(message);
|
||||||
|
|
||||||
ObserverProtocol::Message type;
|
InspectorProtocol::Message type;
|
||||||
ds >> type;
|
ds >> type;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ObserverProtocol::CurrentObjectsChanged: {
|
case InspectorProtocol::CurrentObjectsChanged: {
|
||||||
int objectCount;
|
int objectCount;
|
||||||
ds >> objectCount;
|
ds >> objectCount;
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ void QmlJSObserverClient::messageReceived(const QByteArray &message)
|
|||||||
emit currentObjectsChanged(m_currentDebugIds);
|
emit currentObjectsChanged(m_currentDebugIds);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObserverProtocol::ToolChanged: {
|
case InspectorProtocol::ToolChanged: {
|
||||||
int toolId;
|
int toolId;
|
||||||
ds >> toolId;
|
ds >> toolId;
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ void QmlJSObserverClient::messageReceived(const QByteArray &message)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObserverProtocol::AnimationSpeedChanged: {
|
case InspectorProtocol::AnimationSpeedChanged: {
|
||||||
qreal slowDownFactor;
|
qreal slowDownFactor;
|
||||||
ds >> slowDownFactor;
|
ds >> slowDownFactor;
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ void QmlJSObserverClient::messageReceived(const QByteArray &message)
|
|||||||
emit animationSpeedChanged(slowDownFactor);
|
emit animationSpeedChanged(slowDownFactor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObserverProtocol::AnimationPausedChanged: {
|
case InspectorProtocol::AnimationPausedChanged: {
|
||||||
bool paused;
|
bool paused;
|
||||||
ds >> paused;
|
ds >> paused;
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ void QmlJSObserverClient::messageReceived(const QByteArray &message)
|
|||||||
emit animationPausedChanged(paused);
|
emit animationPausedChanged(paused);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObserverProtocol::SetDesignMode: {
|
case InspectorProtocol::SetDesignMode: {
|
||||||
bool inDesignMode;
|
bool inDesignMode;
|
||||||
ds >> inDesignMode;
|
ds >> inDesignMode;
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ void QmlJSObserverClient::messageReceived(const QByteArray &message)
|
|||||||
emit designModeBehaviorChanged(inDesignMode);
|
emit designModeBehaviorChanged(inDesignMode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObserverProtocol::ShowAppOnTop: {
|
case InspectorProtocol::ShowAppOnTop: {
|
||||||
bool showAppOnTop;
|
bool showAppOnTop;
|
||||||
ds >> showAppOnTop;
|
ds >> showAppOnTop;
|
||||||
|
|
||||||
@@ -131,12 +131,12 @@ void QmlJSObserverClient::messageReceived(const QByteArray &message)
|
|||||||
emit showAppOnTopChanged(showAppOnTop);
|
emit showAppOnTopChanged(showAppOnTop);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObserverProtocol::Reloaded: {
|
case InspectorProtocol::Reloaded: {
|
||||||
log(LogReceive, type);
|
log(LogReceive, type);
|
||||||
emit reloaded();
|
emit reloaded();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ObserverProtocol::ColorChanged: {
|
case InspectorProtocol::ColorChanged: {
|
||||||
QColor col;
|
QColor col;
|
||||||
ds >> 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;
|
return m_currentDebugIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSObserverClient::setCurrentObjects(const QList<int> &debugIds)
|
void QmlJSInspectorClient::setCurrentObjects(const QList<int> &debugIds)
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isConnected())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
@@ -168,7 +168,7 @@ void QmlJSObserverClient::setCurrentObjects(const QList<int> &debugIds)
|
|||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ObserverProtocol::Message cmd = ObserverProtocol::SetCurrentObjects;
|
InspectorProtocol::Message cmd = InspectorProtocol::SetCurrentObjects;
|
||||||
ds << cmd
|
ds << cmd
|
||||||
<< debugIds.length();
|
<< debugIds.length();
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ void recurseObjectIdList(const QDeclarativeDebugObjectReference &ref, QList<int>
|
|||||||
recurseObjectIdList(child, debugIds, objectIds);
|
recurseObjectIdList(child, debugIds, objectIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSObserverClient::setObjectIdList(const QList<QDeclarativeDebugObjectReference> &objectRoots)
|
void QmlJSInspectorClient::setObjectIdList(const QList<QDeclarativeDebugObjectReference> &objectRoots)
|
||||||
{
|
{
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
@@ -200,7 +200,7 @@ void QmlJSObserverClient::setObjectIdList(const QList<QDeclarativeDebugObjectRef
|
|||||||
foreach (const QDeclarativeDebugObjectReference &ref, objectRoots)
|
foreach (const QDeclarativeDebugObjectReference &ref, objectRoots)
|
||||||
recurseObjectIdList(ref, debugIds, objectIds);
|
recurseObjectIdList(ref, debugIds, objectIds);
|
||||||
|
|
||||||
ObserverProtocol::Message cmd = ObserverProtocol::ObjectIdList;
|
InspectorProtocol::Message cmd = InspectorProtocol::ObjectIdList;
|
||||||
ds << cmd
|
ds << cmd
|
||||||
<< debugIds.length();
|
<< debugIds.length();
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ void QmlJSObserverClient::setObjectIdList(const QList<QDeclarativeDebugObjectRef
|
|||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSObserverClient::clearComponentCache()
|
void QmlJSInspectorClient::clearComponentCache()
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isConnected())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
@@ -223,7 +223,7 @@ void QmlJSObserverClient::clearComponentCache()
|
|||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ObserverProtocol::Message cmd = ObserverProtocol::ClearComponentCache;
|
InspectorProtocol::Message cmd = InspectorProtocol::ClearComponentCache;
|
||||||
ds << cmd;
|
ds << cmd;
|
||||||
|
|
||||||
log(LogSend, cmd);
|
log(LogSend, cmd);
|
||||||
@@ -231,7 +231,7 @@ void QmlJSObserverClient::clearComponentCache()
|
|||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSObserverClient::reloadViewer()
|
void QmlJSInspectorClient::reloadViewer()
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isConnected())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
@@ -239,7 +239,7 @@ void QmlJSObserverClient::reloadViewer()
|
|||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ObserverProtocol::Message cmd = ObserverProtocol::Reload;
|
InspectorProtocol::Message cmd = InspectorProtocol::Reload;
|
||||||
ds << cmd;
|
ds << cmd;
|
||||||
|
|
||||||
log(LogSend, cmd);
|
log(LogSend, cmd);
|
||||||
@@ -247,7 +247,7 @@ void QmlJSObserverClient::reloadViewer()
|
|||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSObserverClient::setDesignModeBehavior(bool inDesignMode)
|
void QmlJSInspectorClient::setDesignModeBehavior(bool inDesignMode)
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isConnected())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
@@ -255,7 +255,7 @@ void QmlJSObserverClient::setDesignModeBehavior(bool inDesignMode)
|
|||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ObserverProtocol::Message cmd = ObserverProtocol::SetDesignMode;
|
InspectorProtocol::Message cmd = InspectorProtocol::SetDesignMode;
|
||||||
ds << cmd
|
ds << cmd
|
||||||
<< inDesignMode;
|
<< inDesignMode;
|
||||||
|
|
||||||
@@ -264,7 +264,7 @@ void QmlJSObserverClient::setDesignModeBehavior(bool inDesignMode)
|
|||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSObserverClient::setAnimationSpeed(qreal slowDownFactor)
|
void QmlJSInspectorClient::setAnimationSpeed(qreal slowDownFactor)
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isConnected())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
@@ -272,7 +272,7 @@ void QmlJSObserverClient::setAnimationSpeed(qreal slowDownFactor)
|
|||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ObserverProtocol::Message cmd = ObserverProtocol::SetAnimationSpeed;
|
InspectorProtocol::Message cmd = InspectorProtocol::SetAnimationSpeed;
|
||||||
ds << cmd
|
ds << cmd
|
||||||
<< slowDownFactor;
|
<< slowDownFactor;
|
||||||
|
|
||||||
@@ -282,7 +282,7 @@ void QmlJSObserverClient::setAnimationSpeed(qreal slowDownFactor)
|
|||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSObserverClient::setAnimationPaused(bool paused)
|
void QmlJSInspectorClient::setAnimationPaused(bool paused)
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isConnected())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
@@ -290,7 +290,7 @@ void QmlJSObserverClient::setAnimationPaused(bool paused)
|
|||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ObserverProtocol::Message cmd = ObserverProtocol::SetAnimationPaused;
|
InspectorProtocol::Message cmd = InspectorProtocol::SetAnimationPaused;
|
||||||
ds << cmd
|
ds << cmd
|
||||||
<< paused;
|
<< paused;
|
||||||
|
|
||||||
@@ -299,7 +299,7 @@ void QmlJSObserverClient::setAnimationPaused(bool paused)
|
|||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSObserverClient::changeToColorPickerTool()
|
void QmlJSInspectorClient::changeToColorPickerTool()
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isConnected())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
@@ -307,17 +307,17 @@ void QmlJSObserverClient::changeToColorPickerTool()
|
|||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ObserverProtocol::Message cmd = ObserverProtocol::ChangeTool;
|
InspectorProtocol::Message cmd = InspectorProtocol::ChangeTool;
|
||||||
ObserverProtocol::Tool tool = ObserverProtocol::ColorPickerTool;
|
InspectorProtocol::Tool tool = InspectorProtocol::ColorPickerTool;
|
||||||
ds << cmd
|
ds << cmd
|
||||||
<< tool;
|
<< tool;
|
||||||
|
|
||||||
log(LogSend, cmd, ObserverProtocol::toString(tool));
|
log(LogSend, cmd, InspectorProtocol::toString(tool));
|
||||||
|
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSObserverClient::changeToSelectTool()
|
void QmlJSInspectorClient::changeToSelectTool()
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isConnected())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
@@ -325,17 +325,17 @@ void QmlJSObserverClient::changeToSelectTool()
|
|||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ObserverProtocol::Message cmd = ObserverProtocol::ChangeTool;
|
InspectorProtocol::Message cmd = InspectorProtocol::ChangeTool;
|
||||||
ObserverProtocol::Tool tool = ObserverProtocol::SelectTool;
|
InspectorProtocol::Tool tool = InspectorProtocol::SelectTool;
|
||||||
ds << cmd
|
ds << cmd
|
||||||
<< tool;
|
<< tool;
|
||||||
|
|
||||||
log(LogSend, cmd, ObserverProtocol::toString(tool));
|
log(LogSend, cmd, InspectorProtocol::toString(tool));
|
||||||
|
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSObserverClient::changeToSelectMarqueeTool()
|
void QmlJSInspectorClient::changeToSelectMarqueeTool()
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isConnected())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
@@ -343,17 +343,17 @@ void QmlJSObserverClient::changeToSelectMarqueeTool()
|
|||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ObserverProtocol::Message cmd = ObserverProtocol::ChangeTool;
|
InspectorProtocol::Message cmd = InspectorProtocol::ChangeTool;
|
||||||
ObserverProtocol::Tool tool = ObserverProtocol::SelectMarqueeTool;
|
InspectorProtocol::Tool tool = InspectorProtocol::SelectMarqueeTool;
|
||||||
ds << cmd
|
ds << cmd
|
||||||
<< tool;
|
<< tool;
|
||||||
|
|
||||||
log(LogSend, cmd, ObserverProtocol::toString(tool));
|
log(LogSend, cmd, InspectorProtocol::toString(tool));
|
||||||
|
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSObserverClient::changeToZoomTool()
|
void QmlJSInspectorClient::changeToZoomTool()
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isConnected())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
@@ -361,17 +361,17 @@ void QmlJSObserverClient::changeToZoomTool()
|
|||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ObserverProtocol::Message cmd = ObserverProtocol::ChangeTool;
|
InspectorProtocol::Message cmd = InspectorProtocol::ChangeTool;
|
||||||
ObserverProtocol::Tool tool = ObserverProtocol::ZoomTool;
|
InspectorProtocol::Tool tool = InspectorProtocol::ZoomTool;
|
||||||
ds << cmd
|
ds << cmd
|
||||||
<< tool;
|
<< tool;
|
||||||
|
|
||||||
log(LogSend, cmd, ObserverProtocol::toString(tool));
|
log(LogSend, cmd, InspectorProtocol::toString(tool));
|
||||||
|
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSObserverClient::showAppOnTop(bool showOnTop)
|
void QmlJSInspectorClient::showAppOnTop(bool showOnTop)
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isConnected())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
@@ -379,7 +379,7 @@ void QmlJSObserverClient::showAppOnTop(bool showOnTop)
|
|||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ObserverProtocol::Message cmd = ObserverProtocol::ShowAppOnTop;
|
InspectorProtocol::Message cmd = InspectorProtocol::ShowAppOnTop;
|
||||||
ds << cmd << showOnTop;
|
ds << cmd << showOnTop;
|
||||||
|
|
||||||
log(LogSend, cmd, QLatin1String(showOnTop ? "true" : "false"));
|
log(LogSend, cmd, QLatin1String(showOnTop ? "true" : "false"));
|
||||||
@@ -387,7 +387,7 @@ void QmlJSObserverClient::showAppOnTop(bool showOnTop)
|
|||||||
sendMessage(message);
|
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)
|
const QStringList &imports, const QString &filename, int order)
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isConnected())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
@@ -396,7 +396,7 @@ void QmlJSObserverClient::createQmlObject(const QString &qmlText, int parentDebu
|
|||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ObserverProtocol::Message cmd = ObserverProtocol::CreateObject;
|
InspectorProtocol::Message cmd = InspectorProtocol::CreateObject;
|
||||||
ds << cmd
|
ds << cmd
|
||||||
<< qmlText
|
<< qmlText
|
||||||
<< parentDebugId
|
<< parentDebugId
|
||||||
@@ -410,14 +410,14 @@ void QmlJSObserverClient::createQmlObject(const QString &qmlText, int parentDebu
|
|||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSObserverClient::destroyQmlObject(int debugId)
|
void QmlJSInspectorClient::destroyQmlObject(int debugId)
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isConnected())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ObserverProtocol::Message cmd = ObserverProtocol::DestroyObject;
|
InspectorProtocol::Message cmd = InspectorProtocol::DestroyObject;
|
||||||
ds << cmd << debugId;
|
ds << cmd << debugId;
|
||||||
|
|
||||||
log(LogSend, cmd, QString::number(debugId));
|
log(LogSend, cmd, QString::number(debugId));
|
||||||
@@ -425,14 +425,14 @@ void QmlJSObserverClient::destroyQmlObject(int debugId)
|
|||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSObserverClient::reparentQmlObject(int debugId, int newParent)
|
void QmlJSInspectorClient::reparentQmlObject(int debugId, int newParent)
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isConnected())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
QDataStream ds(&message, QIODevice::WriteOnly);
|
||||||
|
|
||||||
ObserverProtocol::Message cmd = ObserverProtocol::MoveObject;
|
InspectorProtocol::Message cmd = InspectorProtocol::MoveObject;
|
||||||
ds << cmd
|
ds << cmd
|
||||||
<< debugId
|
<< debugId
|
||||||
<< newParent;
|
<< newParent;
|
||||||
@@ -444,7 +444,7 @@ void QmlJSObserverClient::reparentQmlObject(int debugId, int newParent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QmlJSObserverClient::applyChangesToQmlFile()
|
void QmlJSInspectorClient::applyChangesToQmlFile()
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isConnected())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
@@ -452,7 +452,7 @@ void QmlJSObserverClient::applyChangesToQmlFile()
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSObserverClient::applyChangesFromQmlFile()
|
void QmlJSInspectorClient::applyChangesFromQmlFile()
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isConnected())
|
if (!m_connection || !m_connection->isConnected())
|
||||||
return;
|
return;
|
||||||
@@ -460,7 +460,7 @@ void QmlJSObserverClient::applyChangesFromQmlFile()
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSObserverClient::log(LogDirection direction, ObserverProtocol::Message message,
|
void QmlJSInspectorClient::log(LogDirection direction, InspectorProtocol::Message message,
|
||||||
const QString &extra)
|
const QString &extra)
|
||||||
{
|
{
|
||||||
QString msg;
|
QString msg;
|
||||||
@@ -469,7 +469,7 @@ void QmlJSObserverClient::log(LogDirection direction, ObserverProtocol::Message
|
|||||||
else
|
else
|
||||||
msg += QLatin1String(" receiving ");
|
msg += QLatin1String(" receiving ");
|
||||||
|
|
||||||
msg += ObserverProtocol::toString(message);
|
msg += InspectorProtocol::toString(message);
|
||||||
msg += QLatin1Char(' ');
|
msg += QLatin1Char(' ');
|
||||||
msg += extra;
|
msg += extra;
|
||||||
emit logActivity(name(), msg);
|
emit logActivity(name(), msg);
|
@@ -34,16 +34,16 @@
|
|||||||
|
|
||||||
#include "qmljsprivateapi.h"
|
#include "qmljsprivateapi.h"
|
||||||
|
|
||||||
#include <observerprotocol.h>
|
#include <inspectorprotocol.h>
|
||||||
|
|
||||||
namespace QmlJSInspector {
|
namespace QmlJSInspector {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QmlJSObserverClient : public QDeclarativeDebugClient
|
class QmlJSInspectorClient : public QDeclarativeDebugClient
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QmlJSObserverClient(QDeclarativeDebugConnection *client,
|
explicit QmlJSInspectorClient(QDeclarativeDebugConnection *client,
|
||||||
QObject *parent = 0);
|
QObject *parent = 0);
|
||||||
|
|
||||||
void setCurrentObjects(const QList<int> &debugIds);
|
void setCurrentObjects(const QList<int> &debugIds);
|
||||||
@@ -100,7 +100,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void log(LogDirection direction,
|
void log(LogDirection direction,
|
||||||
QmlJSDebugger::ObserverProtocol::Message message,
|
QmlJSDebugger::InspectorProtocol::Message message,
|
||||||
const QString &extra = QString());
|
const QString &extra = QString());
|
||||||
|
|
||||||
QList<int> m_currentDebugIds;
|
QList<int> m_currentDebugIds;
|
@@ -176,7 +176,7 @@ QmlJSLiveTextPreview::QmlJSLiveTextPreview(const QmlJS::Document::Ptr &doc,
|
|||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_previousDoc(doc)
|
, m_previousDoc(doc)
|
||||||
, m_initialDoc(initDoc)
|
, m_initialDoc(initDoc)
|
||||||
, m_applyChangesToQmlObserver(true)
|
, m_applyChangesToQmlInspector(true)
|
||||||
, m_clientProxy(clientProxy)
|
, m_clientProxy(clientProxy)
|
||||||
{
|
{
|
||||||
Q_ASSERT(doc->fileName() == initDoc->fileName());
|
Q_ASSERT(doc->fileName() == initDoc->fileName());
|
||||||
@@ -341,7 +341,7 @@ void QmlJSLiveTextPreview::updateDebugIds()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class UpdateObserver : public Delta {
|
class UpdateInspector : public Delta {
|
||||||
private:
|
private:
|
||||||
static inline QString stripQuotes(const QString &str)
|
static inline QString stripQuotes(const QString &str)
|
||||||
{
|
{
|
||||||
@@ -509,7 +509,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UpdateObserver(ClientProxy *clientProxy)
|
UpdateInspector(ClientProxy *clientProxy)
|
||||||
: appliedChangesToViewer(false)
|
: appliedChangesToViewer(false)
|
||||||
, referenceRefreshRequired(false)
|
, referenceRefreshRequired(false)
|
||||||
, unsyncronizableChanges(QmlJSLiveTextPreview::NoUnsyncronizableChanges)
|
, unsyncronizableChanges(QmlJSLiveTextPreview::NoUnsyncronizableChanges)
|
||||||
@@ -534,13 +534,13 @@ void QmlJSLiveTextPreview::documentChanged(QmlJS::Document::Ptr doc)
|
|||||||
|
|
||||||
bool experimentalWarningShown = false;
|
bool experimentalWarningShown = false;
|
||||||
|
|
||||||
if (m_applyChangesToQmlObserver) {
|
if (m_applyChangesToQmlInspector) {
|
||||||
m_docWithUnappliedChanges.clear();
|
m_docWithUnappliedChanges.clear();
|
||||||
|
|
||||||
if (doc && m_previousDoc && doc->fileName() == m_previousDoc->fileName()
|
if (doc && m_previousDoc && doc->fileName() == m_previousDoc->fileName()
|
||||||
&& doc->qmlProgram() && m_previousDoc->qmlProgram())
|
&& doc->qmlProgram() && m_previousDoc->qmlProgram())
|
||||||
{
|
{
|
||||||
UpdateObserver delta(m_clientProxy.data());
|
UpdateInspector delta(m_clientProxy.data());
|
||||||
m_debugIds = delta(m_previousDoc, doc, m_debugIds);
|
m_debugIds = delta(m_previousDoc, doc, m_debugIds);
|
||||||
|
|
||||||
if (delta.referenceRefreshRequired)
|
if (delta.referenceRefreshRequired)
|
||||||
@@ -622,16 +622,16 @@ void QmlJSLiveTextPreview::disableLivePreview()
|
|||||||
emit disableLivePreviewRequested();
|
emit disableLivePreviewRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSLiveTextPreview::setApplyChangesToQmlObserver(bool applyChanges)
|
void QmlJSLiveTextPreview::setApplyChangesToQmlInspector(bool applyChanges)
|
||||||
{
|
{
|
||||||
if (applyChanges && !m_applyChangesToQmlObserver) {
|
if (applyChanges && !m_applyChangesToQmlInspector) {
|
||||||
if (m_docWithUnappliedChanges) {
|
if (m_docWithUnappliedChanges) {
|
||||||
m_applyChangesToQmlObserver = true;
|
m_applyChangesToQmlInspector = true;
|
||||||
documentChanged(m_docWithUnappliedChanges);
|
documentChanged(m_docWithUnappliedChanges);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_applyChangesToQmlObserver = applyChanges;
|
m_applyChangesToQmlInspector = applyChanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSLiveTextPreview::setClientProxy(ClientProxy *clientProxy)
|
void QmlJSLiveTextPreview::setClientProxy(ClientProxy *clientProxy)
|
||||||
|
@@ -90,7 +90,7 @@ signals:
|
|||||||
void disableLivePreviewRequested();
|
void disableLivePreviewRequested();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setApplyChangesToQmlObserver(bool applyChanges);
|
void setApplyChangesToQmlInspector(bool applyChanges);
|
||||||
void updateDebugIds();
|
void updateDebugIds();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@@ -117,7 +117,7 @@ private:
|
|||||||
|
|
||||||
QList<QWeakPointer<QmlJSEditor::QmlJSTextEditorWidget> > m_editors;
|
QList<QWeakPointer<QmlJSEditor::QmlJSTextEditorWidget> > m_editors;
|
||||||
|
|
||||||
bool m_applyChangesToQmlObserver;
|
bool m_applyChangesToQmlInspector;
|
||||||
QmlJS::Document::Ptr m_docWithUnappliedChanges;
|
QmlJS::Document::Ptr m_docWithUnappliedChanges;
|
||||||
QWeakPointer<ClientProxy> m_clientProxy;
|
QWeakPointer<ClientProxy> m_clientProxy;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user