forked from qt-creator/qt-creator
QmlDebug: Remove outdated clients
The declarative* clients are only used with Qt Quick 1. We don't need them anymore. Change-Id: I102fe93b3acd4b23cc01aff5eb9f12540625fe5e Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -71,11 +71,8 @@ void BaseEngineDebugClient::decode(QDataStream &ds,
|
|||||||
bool simple)
|
bool simple)
|
||||||
{
|
{
|
||||||
QmlObjectData data;
|
QmlObjectData data;
|
||||||
ds >> data;
|
|
||||||
int parentId = -1;
|
int parentId = -1;
|
||||||
// qt > 4.8.3
|
ds >> data >> parentId;
|
||||||
if (objectName() != QLatin1String(Constants::QDECLARATIVE_ENGINE))
|
|
||||||
ds >> parentId;
|
|
||||||
o.m_debugId = data.objectId;
|
o.m_debugId = data.objectId;
|
||||||
o.m_className = data.objectType;
|
o.m_className = data.objectType;
|
||||||
o.m_idString = data.idString;
|
o.m_idString = data.idString;
|
||||||
|
|||||||
@@ -1,102 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "declarativeenginedebugclient.h"
|
|
||||||
#include "qmldebugconstants.h"
|
|
||||||
#include "qmldebugclient.h"
|
|
||||||
#include "qpacketprotocol.h"
|
|
||||||
|
|
||||||
namespace QmlDebug {
|
|
||||||
|
|
||||||
DeclarativeEngineDebugClient::DeclarativeEngineDebugClient(
|
|
||||||
QmlDebugConnection *connection)
|
|
||||||
: BaseEngineDebugClient(QLatin1String(Constants::QDECLARATIVE_ENGINE), connection)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
quint32 DeclarativeEngineDebugClient::setBindingForObject(
|
|
||||||
int objectDebugId,
|
|
||||||
const QString &propertyName,
|
|
||||||
const QVariant &bindingExpression,
|
|
||||||
bool isLiteralValue,
|
|
||||||
QString source, int line)
|
|
||||||
{
|
|
||||||
quint32 id = 0;
|
|
||||||
if (state() == Enabled && objectDebugId != -1) {
|
|
||||||
id = getId();
|
|
||||||
QPacket ds(dataStreamVersion());
|
|
||||||
ds << QByteArray("SET_BINDING") << objectDebugId << propertyName
|
|
||||||
<< bindingExpression << isLiteralValue << source << line;
|
|
||||||
sendMessage(ds.data());
|
|
||||||
}
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
quint32 DeclarativeEngineDebugClient::resetBindingForObject(
|
|
||||||
int objectDebugId,
|
|
||||||
const QString &propertyName)
|
|
||||||
{
|
|
||||||
quint32 id = 0;
|
|
||||||
if (state() == Enabled && objectDebugId != -1) {
|
|
||||||
id = getId();
|
|
||||||
QPacket ds(dataStreamVersion());
|
|
||||||
ds << QByteArray("RESET_BINDING") << objectDebugId << propertyName;
|
|
||||||
sendMessage(ds.data());
|
|
||||||
}
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
quint32 DeclarativeEngineDebugClient::setMethodBody(
|
|
||||||
int objectDebugId, const QString &methodName,
|
|
||||||
const QString &methodBody)
|
|
||||||
{
|
|
||||||
quint32 id = 0;
|
|
||||||
if (state() == Enabled && objectDebugId != -1) {
|
|
||||||
id = getId();
|
|
||||||
QPacket ds(dataStreamVersion());
|
|
||||||
ds << QByteArray("SET_METHOD_BODY") << objectDebugId
|
|
||||||
<< methodName << methodBody;
|
|
||||||
sendMessage(ds.data());
|
|
||||||
}
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarativeEngineDebugClient::messageReceived(const QByteArray &data)
|
|
||||||
{
|
|
||||||
QPacket ds(dataStreamVersion(), data);
|
|
||||||
QByteArray type;
|
|
||||||
ds >> type;
|
|
||||||
|
|
||||||
if (type == "OBJECT_CREATED") {
|
|
||||||
int engineId;
|
|
||||||
int objectId;
|
|
||||||
ds >> engineId >> objectId;
|
|
||||||
emit newObject(engineId, objectId, -1);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
BaseEngineDebugClient::messageReceived(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // namespace QmlDebug
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "baseenginedebugclient.h"
|
|
||||||
|
|
||||||
namespace QmlDebug {
|
|
||||||
|
|
||||||
class QmlDebugConnection;
|
|
||||||
|
|
||||||
class QMLDEBUG_EXPORT DeclarativeEngineDebugClient : public BaseEngineDebugClient
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit DeclarativeEngineDebugClient(QmlDebugConnection *conn);
|
|
||||||
|
|
||||||
quint32 setBindingForObject(int objectDebugId, const QString &propertyName,
|
|
||||||
const QVariant &bindingExpression,
|
|
||||||
bool isLiteralValue,
|
|
||||||
QString source, int line) override;
|
|
||||||
quint32 resetBindingForObject(int objectDebugId, const QString &propertyName) override;
|
|
||||||
quint32 setMethodBody(int objectDebugId, const QString &methodName,
|
|
||||||
const QString &methodBody) override;
|
|
||||||
|
|
||||||
void messageReceived(const QByteArray &data) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace QmlDebug
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "baseenginedebugclient.h"
|
|
||||||
|
|
||||||
namespace QmlDebug {
|
|
||||||
|
|
||||||
class QmlDebugConnection;
|
|
||||||
|
|
||||||
class QMLDEBUG_EXPORT DeclarativeEngineDebugClientV2 : public BaseEngineDebugClient
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit DeclarativeEngineDebugClientV2(QmlDebugConnection *conn)
|
|
||||||
: BaseEngineDebugClient(QLatin1String("DeclarativeDebugger"), conn)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace QmlDebug
|
|
||||||
@@ -1,333 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "declarativetoolsclient.h"
|
|
||||||
#include "qmldebugconnection.h"
|
|
||||||
#include <QMetaEnum>
|
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
namespace QmlDebug {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
namespace Constants {
|
|
||||||
|
|
||||||
enum DesignTool {
|
|
||||||
NoTool = 0,
|
|
||||||
SelectionToolMode = 1,
|
|
||||||
MarqueeSelectionToolMode = 2,
|
|
||||||
MoveToolMode = 3,
|
|
||||||
ResizeToolMode = 4,
|
|
||||||
ZoomMode = 6
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class InspectorProtocol : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_ENUMS(Message Tool)
|
|
||||||
|
|
||||||
public:
|
|
||||||
enum Message {
|
|
||||||
ChangeTool = 1,
|
|
||||||
ColorChanged = 3,
|
|
||||||
CurrentObjectsChanged = 6,
|
|
||||||
ObjectIdList = 9,
|
|
||||||
Reload = 10,
|
|
||||||
Reloaded = 11,
|
|
||||||
SetDesignMode = 15,
|
|
||||||
ShowAppOnTop = 16,
|
|
||||||
ToolChanged = 17
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Tool {
|
|
||||||
ColorPickerTool,
|
|
||||||
SelectMarqueeTool,
|
|
||||||
SelectTool,
|
|
||||||
ZoomTool
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline QString toString(Message message)
|
|
||||||
{
|
|
||||||
return QString::fromUtf8(staticMetaObject.enumerator(0).valueToKey(message));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline QString toString(Tool tool)
|
|
||||||
{
|
|
||||||
return QString::fromUtf8(staticMetaObject.enumerator(1).valueToKey(tool));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
inline QDataStream & operator<< (QDataStream &stream, InspectorProtocol::Message message)
|
|
||||||
{
|
|
||||||
return stream << static_cast<quint32>(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QDataStream & operator>> (QDataStream &stream, InspectorProtocol::Message &message)
|
|
||||||
{
|
|
||||||
quint32 i;
|
|
||||||
stream >> i;
|
|
||||||
message = static_cast<InspectorProtocol::Message>(i);
|
|
||||||
return stream;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QDebug operator<< (QDebug dbg, InspectorProtocol::Message message)
|
|
||||||
{
|
|
||||||
dbg << InspectorProtocol::toString(message);
|
|
||||||
return dbg;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QDataStream & operator<< (QDataStream &stream, InspectorProtocol::Tool tool)
|
|
||||||
{
|
|
||||||
return stream << static_cast<quint32>(tool);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QDataStream & operator>> (QDataStream &stream, InspectorProtocol::Tool &tool)
|
|
||||||
{
|
|
||||||
quint32 i;
|
|
||||||
stream >> i;
|
|
||||||
tool = static_cast<InspectorProtocol::Tool>(i);
|
|
||||||
return stream;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QDebug operator<< (QDebug dbg, InspectorProtocol::Tool tool)
|
|
||||||
{
|
|
||||||
dbg << InspectorProtocol::toString(tool);
|
|
||||||
return dbg;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // internal
|
|
||||||
|
|
||||||
using namespace Internal;
|
|
||||||
|
|
||||||
DeclarativeToolsClient::DeclarativeToolsClient(QmlDebugConnection *client)
|
|
||||||
: BaseToolsClient(client,QLatin1String("QDeclarativeObserverMode")),
|
|
||||||
m_connection(client)
|
|
||||||
{
|
|
||||||
setObjectName(name());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarativeToolsClient::messageReceived(const QByteArray &message)
|
|
||||||
{
|
|
||||||
QDataStream ds(message);
|
|
||||||
|
|
||||||
InspectorProtocol::Message type;
|
|
||||||
ds >> type;
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case InspectorProtocol::CurrentObjectsChanged: {
|
|
||||||
int objectCount;
|
|
||||||
ds >> objectCount;
|
|
||||||
|
|
||||||
log(LogReceive, type, QString::fromLatin1("%1 [list of debug ids]").arg(objectCount));
|
|
||||||
|
|
||||||
QList<int> currentDebugIds;
|
|
||||||
|
|
||||||
for (int i = 0; i < objectCount; ++i) {
|
|
||||||
int debugId;
|
|
||||||
ds >> debugId;
|
|
||||||
if (debugId != -1)
|
|
||||||
currentDebugIds << debugId;
|
|
||||||
}
|
|
||||||
|
|
||||||
emit currentObjectsChanged(currentDebugIds);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case InspectorProtocol::ToolChanged: {
|
|
||||||
int toolId;
|
|
||||||
ds >> toolId;
|
|
||||||
|
|
||||||
log(LogReceive, type, QString::number(toolId));
|
|
||||||
|
|
||||||
if (toolId == Constants::ZoomMode)
|
|
||||||
emit zoomToolActivated();
|
|
||||||
else if (toolId == Constants::SelectionToolMode)
|
|
||||||
emit selectToolActivated();
|
|
||||||
else if (toolId == Constants::MarqueeSelectionToolMode)
|
|
||||||
emit selectMarqueeToolActivated();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case InspectorProtocol::SetDesignMode: {
|
|
||||||
bool inDesignMode;
|
|
||||||
ds >> inDesignMode;
|
|
||||||
|
|
||||||
log(LogReceive, type, QLatin1String(inDesignMode ? "true" : "false"));
|
|
||||||
|
|
||||||
emit designModeBehaviorChanged(inDesignMode);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case InspectorProtocol::ShowAppOnTop: {
|
|
||||||
bool showAppOnTop;
|
|
||||||
ds >> showAppOnTop;
|
|
||||||
|
|
||||||
log(LogReceive, type, QLatin1String(showAppOnTop ? "true" : "false"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case InspectorProtocol::Reloaded: {
|
|
||||||
log(LogReceive, type);
|
|
||||||
emit reloaded();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
log(LogReceive, type, QLatin1String("Warning: Not handling message"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarativeToolsClient::setObjectIdList(
|
|
||||||
const QList<ObjectReference> &objectRoots)
|
|
||||||
{
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
QList<int> debugIds;
|
|
||||||
QList<QString> objectIds;
|
|
||||||
|
|
||||||
foreach (const ObjectReference &ref, objectRoots)
|
|
||||||
recurseObjectIdList(ref, debugIds, objectIds);
|
|
||||||
|
|
||||||
InspectorProtocol::Message cmd = InspectorProtocol::ObjectIdList;
|
|
||||||
ds << cmd
|
|
||||||
<< debugIds.length();
|
|
||||||
|
|
||||||
Q_ASSERT(debugIds.length() == objectIds.length());
|
|
||||||
|
|
||||||
for (int i = 0; i < debugIds.length(); ++i) {
|
|
||||||
ds << debugIds[i] << objectIds[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
log(LogSend, cmd,
|
|
||||||
QString::fromLatin1("%1 %2 [list of debug / object ids]").arg(debugIds.length()));
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarativeToolsClient::setDesignModeBehavior(bool inDesignMode)
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isConnected())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
InspectorProtocol::Message cmd = InspectorProtocol::SetDesignMode;
|
|
||||||
ds << cmd
|
|
||||||
<< inDesignMode;
|
|
||||||
|
|
||||||
log(LogSend, cmd, QLatin1String(inDesignMode ? "true" : "false"));
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarativeToolsClient::changeToSelectTool()
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isConnected())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
InspectorProtocol::Message cmd = InspectorProtocol::ChangeTool;
|
|
||||||
InspectorProtocol::Tool tool = InspectorProtocol::SelectTool;
|
|
||||||
ds << cmd
|
|
||||||
<< tool;
|
|
||||||
|
|
||||||
log(LogSend, cmd, InspectorProtocol::toString(tool));
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarativeToolsClient::changeToSelectMarqueeTool()
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isConnected())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
InspectorProtocol::Message cmd = InspectorProtocol::ChangeTool;
|
|
||||||
InspectorProtocol::Tool tool = InspectorProtocol::SelectMarqueeTool;
|
|
||||||
ds << cmd
|
|
||||||
<< tool;
|
|
||||||
|
|
||||||
log(LogSend, cmd, InspectorProtocol::toString(tool));
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarativeToolsClient::changeToZoomTool()
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isConnected())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
InspectorProtocol::Message cmd = InspectorProtocol::ChangeTool;
|
|
||||||
InspectorProtocol::Tool tool = InspectorProtocol::ZoomTool;
|
|
||||||
ds << cmd
|
|
||||||
<< tool;
|
|
||||||
|
|
||||||
log(LogSend, cmd, InspectorProtocol::toString(tool));
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarativeToolsClient::showAppOnTop(bool showOnTop)
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isConnected())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
InspectorProtocol::Message cmd = InspectorProtocol::ShowAppOnTop;
|
|
||||||
ds << cmd << showOnTop;
|
|
||||||
|
|
||||||
log(LogSend, cmd, QLatin1String(showOnTop ? "true" : "false"));
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarativeToolsClient::log(LogDirection direction,
|
|
||||||
int message,
|
|
||||||
const QString &extra)
|
|
||||||
{
|
|
||||||
QString msg;
|
|
||||||
if (direction == LogSend)
|
|
||||||
msg += QLatin1String("sending ");
|
|
||||||
else
|
|
||||||
msg += QLatin1String("receiving ");
|
|
||||||
|
|
||||||
InspectorProtocol::Message msgType
|
|
||||||
= static_cast<InspectorProtocol::Message>(message);
|
|
||||||
msg += InspectorProtocol::toString(msgType);
|
|
||||||
msg += QLatin1Char(' ');
|
|
||||||
msg += extra;
|
|
||||||
emit logActivity(name(), msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace QmlDebug
|
|
||||||
|
|
||||||
#include "declarativetoolsclient.moc"
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "basetoolsclient.h"
|
|
||||||
|
|
||||||
namespace QmlDebug {
|
|
||||||
|
|
||||||
class QMLDEBUG_EXPORT DeclarativeToolsClient : public BaseToolsClient
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
DeclarativeToolsClient(QmlDebugConnection *client);
|
|
||||||
|
|
||||||
void setDesignModeBehavior(bool inDesignMode) override;
|
|
||||||
void changeToSelectTool() override;
|
|
||||||
void changeToSelectMarqueeTool() override;
|
|
||||||
void changeToZoomTool() override;
|
|
||||||
void showAppOnTop(bool showOnTop) override;
|
|
||||||
|
|
||||||
// ### Qt 4.8: remove if we can have access to qdeclarativecontextdata or id's
|
|
||||||
void setObjectIdList(const QList<ObjectReference> &objectRoots) override;
|
|
||||||
|
|
||||||
void messageReceived(const QByteArray &) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void log(LogDirection direction,
|
|
||||||
int message,
|
|
||||||
const QString &extra = QString());
|
|
||||||
|
|
||||||
private:
|
|
||||||
QmlDebugConnection *m_connection;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace QmlDebug
|
|
||||||
@@ -7,8 +7,6 @@ shared {
|
|||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/qmldebugclient.h \
|
$$PWD/qmldebugclient.h \
|
||||||
$$PWD/baseenginedebugclient.h \
|
$$PWD/baseenginedebugclient.h \
|
||||||
$$PWD/declarativeenginedebugclient.h \
|
|
||||||
$$PWD/declarativeenginedebugclientv2.h \
|
|
||||||
$$PWD/qmloutputparser.h \
|
$$PWD/qmloutputparser.h \
|
||||||
$$PWD/qmldebug_global.h \
|
$$PWD/qmldebug_global.h \
|
||||||
$$PWD/qpacketprotocol.h \
|
$$PWD/qpacketprotocol.h \
|
||||||
@@ -16,7 +14,6 @@ HEADERS += \
|
|||||||
$$PWD/qdebugmessageclient.h \
|
$$PWD/qdebugmessageclient.h \
|
||||||
$$PWD/qmlenginedebugclient.h \
|
$$PWD/qmlenginedebugclient.h \
|
||||||
$$PWD/basetoolsclient.h \
|
$$PWD/basetoolsclient.h \
|
||||||
$$PWD/declarativetoolsclient.h \
|
|
||||||
$$PWD/qmltoolsclient.h \
|
$$PWD/qmltoolsclient.h \
|
||||||
$$PWD/qmlenginecontrolclient.h \
|
$$PWD/qmlenginecontrolclient.h \
|
||||||
$$PWD/qmldebugcommandlinearguments.h \
|
$$PWD/qmldebugcommandlinearguments.h \
|
||||||
@@ -30,9 +27,7 @@ SOURCES += \
|
|||||||
$$PWD/qpacketprotocol.cpp \
|
$$PWD/qpacketprotocol.cpp \
|
||||||
$$PWD/qdebugmessageclient.cpp \
|
$$PWD/qdebugmessageclient.cpp \
|
||||||
$$PWD/basetoolsclient.cpp \
|
$$PWD/basetoolsclient.cpp \
|
||||||
$$PWD/declarativetoolsclient.cpp \
|
|
||||||
$$PWD/qmltoolsclient.cpp \
|
$$PWD/qmltoolsclient.cpp \
|
||||||
$$PWD/declarativeenginedebugclient.cpp \
|
|
||||||
$$PWD/qmlenginecontrolclient.cpp \
|
$$PWD/qmlenginecontrolclient.cpp \
|
||||||
$$PWD/qmldebugconnection.cpp \
|
$$PWD/qmldebugconnection.cpp \
|
||||||
$$PWD/qmldebugconnectionmanager.cpp
|
$$PWD/qmldebugconnectionmanager.cpp
|
||||||
|
|||||||
@@ -16,11 +16,6 @@ Project {
|
|||||||
"baseenginedebugclient.h",
|
"baseenginedebugclient.h",
|
||||||
"basetoolsclient.cpp",
|
"basetoolsclient.cpp",
|
||||||
"basetoolsclient.h",
|
"basetoolsclient.h",
|
||||||
"declarativeenginedebugclient.cpp",
|
|
||||||
"declarativeenginedebugclient.h",
|
|
||||||
"declarativeenginedebugclientv2.h",
|
|
||||||
"declarativetoolsclient.cpp",
|
|
||||||
"declarativetoolsclient.h",
|
|
||||||
"qdebugmessageclient.cpp",
|
"qdebugmessageclient.cpp",
|
||||||
"qdebugmessageclient.h",
|
"qdebugmessageclient.h",
|
||||||
"qmldebug_global.h",
|
"qmldebug_global.h",
|
||||||
|
|||||||
@@ -35,7 +35,5 @@ const char STR_IGNORING_DEBUGGER[] = "Ignoring \"-qmljsdebugger=";
|
|||||||
const char STR_CONNECTION_ESTABLISHED[] = "Connection established";
|
const char STR_CONNECTION_ESTABLISHED[] = "Connection established";
|
||||||
const char STR_CONNECTING_TO_SOCKET[] = "Connecting to socket";
|
const char STR_CONNECTING_TO_SOCKET[] = "Connecting to socket";
|
||||||
|
|
||||||
const char QDECLARATIVE_ENGINE[] = "QDeclarativeEngine";
|
|
||||||
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
} // namespace QmlDebug
|
} // namespace QmlDebug
|
||||||
|
|||||||
@@ -38,9 +38,6 @@
|
|||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/editormanager/documentmodel.h>
|
#include <coreplugin/editormanager/documentmodel.h>
|
||||||
|
|
||||||
#include <qmldebug/declarativeenginedebugclient.h>
|
|
||||||
#include <qmldebug/declarativeenginedebugclientv2.h>
|
|
||||||
#include <qmldebug/declarativetoolsclient.h>
|
|
||||||
#include <qmldebug/qmldebugconstants.h>
|
#include <qmldebug/qmldebugconstants.h>
|
||||||
#include <qmldebug/qmlenginedebugclient.h>
|
#include <qmldebug/qmlenginedebugclient.h>
|
||||||
#include <qmldebug/qmltoolsclient.h>
|
#include <qmldebug/qmltoolsclient.h>
|
||||||
@@ -86,40 +83,15 @@ QmlInspectorAgent::QmlInspectorAgent(QmlEngine *engine, QmlDebugConnection *conn
|
|||||||
connect(&m_delayQueryTimer, &QTimer::timeout,
|
connect(&m_delayQueryTimer, &QTimer::timeout,
|
||||||
this, &QmlInspectorAgent::queryEngineContext);
|
this, &QmlInspectorAgent::queryEngineContext);
|
||||||
|
|
||||||
auto engineClient1 = new DeclarativeEngineDebugClient(connection);
|
|
||||||
connect(engineClient1, &BaseEngineDebugClient::newState,
|
|
||||||
this, &QmlInspectorAgent::clientStateChanged);
|
|
||||||
connect(engineClient1, &BaseEngineDebugClient::newState,
|
|
||||||
this, &QmlInspectorAgent::engineClientStateChanged);
|
|
||||||
|
|
||||||
auto engineClient2 = new QmlEngineDebugClient(connection);
|
auto engineClient2 = new QmlEngineDebugClient(connection);
|
||||||
connect(engineClient2, &BaseEngineDebugClient::newState,
|
connect(engineClient2, &BaseEngineDebugClient::newState,
|
||||||
this, &QmlInspectorAgent::clientStateChanged);
|
this, &QmlInspectorAgent::clientStateChanged);
|
||||||
connect(engineClient2, &BaseEngineDebugClient::newState,
|
connect(engineClient2, &BaseEngineDebugClient::newState,
|
||||||
this, &QmlInspectorAgent::engineClientStateChanged);
|
this, &QmlInspectorAgent::engineClientStateChanged);
|
||||||
|
|
||||||
auto engineClient3 = new DeclarativeEngineDebugClientV2(connection);
|
|
||||||
connect(engineClient3, &BaseEngineDebugClient::newState,
|
|
||||||
this, &QmlInspectorAgent::clientStateChanged);
|
|
||||||
connect(engineClient3, &BaseEngineDebugClient::newState,
|
|
||||||
this, &QmlInspectorAgent::engineClientStateChanged);
|
|
||||||
|
|
||||||
m_engineClients.insert(engineClient1->name(), engineClient1);
|
|
||||||
m_engineClients.insert(engineClient2->name(), engineClient2);
|
m_engineClients.insert(engineClient2->name(), engineClient2);
|
||||||
m_engineClients.insert(engineClient3->name(), engineClient3);
|
|
||||||
|
|
||||||
if (engineClient1->state() == QmlDebugClient::Enabled)
|
|
||||||
setActiveEngineClient(engineClient1);
|
|
||||||
if (engineClient2->state() == QmlDebugClient::Enabled)
|
if (engineClient2->state() == QmlDebugClient::Enabled)
|
||||||
setActiveEngineClient(engineClient2);
|
setActiveEngineClient(engineClient2);
|
||||||
if (engineClient3->state() == QmlDebugClient::Enabled)
|
|
||||||
setActiveEngineClient(engineClient3);
|
|
||||||
|
|
||||||
auto toolsClient1 = new DeclarativeToolsClient(connection);
|
|
||||||
connect(toolsClient1, &BaseToolsClient::newState,
|
|
||||||
this, &QmlInspectorAgent::clientStateChanged);
|
|
||||||
connect(toolsClient1, &BaseToolsClient::newState,
|
|
||||||
this, &QmlInspectorAgent::toolsClientStateChanged);
|
|
||||||
|
|
||||||
auto toolsClient2 = new QmlToolsClient(connection);
|
auto toolsClient2 = new QmlToolsClient(connection);
|
||||||
connect(toolsClient2, &BaseToolsClient::newState,
|
connect(toolsClient2, &BaseToolsClient::newState,
|
||||||
@@ -223,13 +195,7 @@ bool QmlInspectorAgent::selectObjectInTree(int debugId)
|
|||||||
// we may have to fetch it
|
// we may have to fetch it
|
||||||
m_objectToSelect = debugId;
|
m_objectToSelect = debugId;
|
||||||
using namespace QmlDebug::Constants;
|
using namespace QmlDebug::Constants;
|
||||||
if (m_engineClient->objectName() == QDECLARATIVE_ENGINE) {
|
|
||||||
// reset current Selection
|
|
||||||
QString root = m_qmlEngine->watchHandler()->watchItem(QModelIndex())->iname;
|
|
||||||
m_qmlEngine->watchHandler()->setCurrentItem(root);
|
|
||||||
} else {
|
|
||||||
fetchObject(debugId);
|
fetchObject(debugId);
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user