QmlJSInspector: Renamed Observer to Inspector

Manually redid Qt 4.8 commit 206ebd5af21d94c3f3b49d2cb645105a63e6f5fb,
to make future code synchronization easier.

In order not to have to change the QmlApplicationViewer again, a
compatibility class QDeclarativeViewObserver is retained that subclasses
QDeclarativeViewInspector.

Change-Id: Ief87ae2f8f76b1db0c9d65085e4832424b277603
Reviewed-on: http://codereview.qt.nokia.com/242
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
Thorbjørn Lindeijer
2011-05-30 16:32:25 +02:00
committed by Kai Koehne
parent e0f79761f3
commit 335f6ad0f7
51 changed files with 528 additions and 474 deletions

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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