forked from qt-creator/qt-creator
QmlDebug: Unify QPacket and QmlDebugStream and remove unused code
There is no point in having both as they serve the same purpose. Also, most of the packet protocol API was never used or tested, and wrapping each byte to be sent into a QPacket is wasteful and unnecessary. Change-Id: Ia421eae33b644fe86a53bcd04092a84ea3000f0d Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "baseenginedebugclient.h"
|
#include "baseenginedebugclient.h"
|
||||||
#include "qmldebugconstants.h"
|
#include "qmldebugconstants.h"
|
||||||
|
#include "qpacketprotocol.h"
|
||||||
|
|
||||||
namespace QmlDebug {
|
namespace QmlDebug {
|
||||||
|
|
||||||
@@ -182,7 +183,7 @@ void BaseEngineDebugClient::stateChanged(State state)
|
|||||||
|
|
||||||
void BaseEngineDebugClient::messageReceived(const QByteArray &data)
|
void BaseEngineDebugClient::messageReceived(const QByteArray &data)
|
||||||
{
|
{
|
||||||
QmlDebugStream ds(data);
|
QPacket ds(connection()->currentDataStreamVersion(), data);
|
||||||
int queryId;
|
int queryId;
|
||||||
QByteArray type;
|
QByteArray type;
|
||||||
ds >> type >> queryId;
|
ds >> type >> queryId;
|
||||||
@@ -254,11 +255,10 @@ quint32 BaseEngineDebugClient::addWatch(const PropertyReference &property)
|
|||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (state() == Enabled) {
|
if (state() == Enabled) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QPacket ds(connection()->currentDataStreamVersion());
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray("WATCH_PROPERTY") << id << property.m_objectDebugId
|
ds << QByteArray("WATCH_PROPERTY") << id << property.m_objectDebugId
|
||||||
<< property.m_name.toUtf8();
|
<< property.m_name.toUtf8();
|
||||||
sendMessage(message);
|
sendMessage(ds.data());
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -276,10 +276,9 @@ quint32 BaseEngineDebugClient::addWatch(const ObjectReference &object,
|
|||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (state() == Enabled) {
|
if (state() == Enabled) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QPacket ds(connection()->currentDataStreamVersion());
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray("WATCH_EXPR_OBJECT") << id << object.m_debugId << expr;
|
ds << QByteArray("WATCH_EXPR_OBJECT") << id << object.m_debugId << expr;
|
||||||
sendMessage(message);
|
sendMessage(ds.data());
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -289,10 +288,9 @@ quint32 BaseEngineDebugClient::addWatch(int objectDebugId)
|
|||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (state() == Enabled) {
|
if (state() == Enabled) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QPacket ds(connection()->currentDataStreamVersion());
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray("WATCH_OBJECT") << id << objectDebugId;
|
ds << QByteArray("WATCH_OBJECT") << id << objectDebugId;
|
||||||
sendMessage(message);
|
sendMessage(ds.data());
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -306,10 +304,9 @@ quint32 BaseEngineDebugClient::addWatch(const FileReference &/*file*/)
|
|||||||
void BaseEngineDebugClient::removeWatch(quint32 id)
|
void BaseEngineDebugClient::removeWatch(quint32 id)
|
||||||
{
|
{
|
||||||
if (state() == Enabled) {
|
if (state() == Enabled) {
|
||||||
QByteArray message;
|
QPacket ds(connection()->currentDataStreamVersion());
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray("NO_WATCH") << id;
|
ds << QByteArray("NO_WATCH") << id;
|
||||||
sendMessage(message);
|
sendMessage(ds.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,10 +315,9 @@ quint32 BaseEngineDebugClient::queryAvailableEngines()
|
|||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (state() == Enabled) {
|
if (state() == Enabled) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QPacket ds(connection()->currentDataStreamVersion());
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray("LIST_ENGINES") << id;
|
ds << QByteArray("LIST_ENGINES") << id;
|
||||||
sendMessage(message);
|
sendMessage(ds.data());
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -331,10 +327,9 @@ quint32 BaseEngineDebugClient::queryRootContexts(const EngineReference &engine)
|
|||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (state() == Enabled && engine.m_debugId != -1) {
|
if (state() == Enabled && engine.m_debugId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QPacket ds(connection()->currentDataStreamVersion());
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray("LIST_OBJECTS") << id << engine.m_debugId;
|
ds << QByteArray("LIST_OBJECTS") << id << engine.m_debugId;
|
||||||
sendMessage(message);
|
sendMessage(ds.data());
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -344,11 +339,10 @@ quint32 BaseEngineDebugClient::queryObject(int objectId)
|
|||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (state() == Enabled && objectId != -1) {
|
if (state() == Enabled && objectId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QPacket ds(connection()->currentDataStreamVersion());
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray("FETCH_OBJECT") << id << objectId << false <<
|
ds << QByteArray("FETCH_OBJECT") << id << objectId << false <<
|
||||||
true;
|
true;
|
||||||
sendMessage(message);
|
sendMessage(ds.data());
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -358,11 +352,10 @@ quint32 BaseEngineDebugClient::queryObjectRecursive(int objectId)
|
|||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (state() == Enabled && objectId != -1) {
|
if (state() == Enabled && objectId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QPacket ds(connection()->currentDataStreamVersion());
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray("FETCH_OBJECT") << id << objectId << true <<
|
ds << QByteArray("FETCH_OBJECT") << id << objectId << true <<
|
||||||
true;
|
true;
|
||||||
sendMessage(message);
|
sendMessage(ds.data());
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -374,11 +367,10 @@ quint32 BaseEngineDebugClient::queryExpressionResult(int objectDebugId,
|
|||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (state() == Enabled && objectDebugId != -1) {
|
if (state() == Enabled && objectDebugId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QPacket ds(connection()->currentDataStreamVersion());
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray("EVAL_EXPRESSION") << id << objectDebugId << expr
|
ds << QByteArray("EVAL_EXPRESSION") << id << objectDebugId << expr
|
||||||
<< engineId;
|
<< engineId;
|
||||||
sendMessage(message);
|
sendMessage(ds.data());
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -393,11 +385,10 @@ quint32 BaseEngineDebugClient::setBindingForObject(
|
|||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (state() == Enabled && objectDebugId != -1) {
|
if (state() == Enabled && objectDebugId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QPacket ds(connection()->currentDataStreamVersion());
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray("SET_BINDING") << id << objectDebugId << propertyName
|
ds << QByteArray("SET_BINDING") << id << objectDebugId << propertyName
|
||||||
<< bindingExpression << isLiteralValue << source << line;
|
<< bindingExpression << isLiteralValue << source << line;
|
||||||
sendMessage(message);
|
sendMessage(ds.data());
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -409,10 +400,9 @@ quint32 BaseEngineDebugClient::resetBindingForObject(
|
|||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (state() == Enabled && objectDebugId != -1) {
|
if (state() == Enabled && objectDebugId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QPacket ds(connection()->currentDataStreamVersion());
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray("RESET_BINDING") << id << objectDebugId << propertyName;
|
ds << QByteArray("RESET_BINDING") << id << objectDebugId << propertyName;
|
||||||
sendMessage(message);
|
sendMessage(ds.data());
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -424,11 +414,10 @@ quint32 BaseEngineDebugClient::setMethodBody(
|
|||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (state() == Enabled && objectDebugId != -1) {
|
if (state() == Enabled && objectDebugId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QPacket ds(connection()->currentDataStreamVersion());
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray("SET_METHOD_BODY") << id << objectDebugId
|
ds << QByteArray("SET_METHOD_BODY") << id << objectDebugId
|
||||||
<< methodName << methodBody;
|
<< methodName << methodBody;
|
||||||
sendMessage(message);
|
sendMessage(ds.data());
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -439,12 +428,11 @@ quint32 BaseEngineDebugClient::queryObjectsForLocation(
|
|||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (state() == Enabled) {
|
if (state() == Enabled) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QPacket ds(connection()->currentDataStreamVersion());
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray("FETCH_OBJECTS_FOR_LOCATION") << id <<
|
ds << QByteArray("FETCH_OBJECTS_FOR_LOCATION") << id <<
|
||||||
fileName << lineNumber << columnNumber << false <<
|
fileName << lineNumber << columnNumber << false <<
|
||||||
true;
|
true;
|
||||||
sendMessage(message);
|
sendMessage(ds.data());
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "declarativeenginedebugclient.h"
|
#include "declarativeenginedebugclient.h"
|
||||||
#include "qmldebugconstants.h"
|
#include "qmldebugconstants.h"
|
||||||
#include "qmldebugclient.h"
|
#include "qmldebugclient.h"
|
||||||
|
#include "qpacketprotocol.h"
|
||||||
|
|
||||||
namespace QmlDebug {
|
namespace QmlDebug {
|
||||||
|
|
||||||
@@ -50,11 +51,10 @@ quint32 DeclarativeEngineDebugClient::setBindingForObject(
|
|||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (state() == Enabled && objectDebugId != -1) {
|
if (state() == Enabled && objectDebugId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QPacket ds(connection()->currentDataStreamVersion());
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray("SET_BINDING") << objectDebugId << propertyName
|
ds << QByteArray("SET_BINDING") << objectDebugId << propertyName
|
||||||
<< bindingExpression << isLiteralValue << source << line;
|
<< bindingExpression << isLiteralValue << source << line;
|
||||||
sendMessage(message);
|
sendMessage(ds.data());
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -66,10 +66,9 @@ quint32 DeclarativeEngineDebugClient::resetBindingForObject(
|
|||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (state() == Enabled && objectDebugId != -1) {
|
if (state() == Enabled && objectDebugId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QPacket ds(connection()->currentDataStreamVersion());
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray("RESET_BINDING") << objectDebugId << propertyName;
|
ds << QByteArray("RESET_BINDING") << objectDebugId << propertyName;
|
||||||
sendMessage(message);
|
sendMessage(ds.data());
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -81,18 +80,17 @@ quint32 DeclarativeEngineDebugClient::setMethodBody(
|
|||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
if (state() == Enabled && objectDebugId != -1) {
|
if (state() == Enabled && objectDebugId != -1) {
|
||||||
id = getId();
|
id = getId();
|
||||||
QByteArray message;
|
QPacket ds(connection()->currentDataStreamVersion());
|
||||||
QmlDebugStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray("SET_METHOD_BODY") << objectDebugId
|
ds << QByteArray("SET_METHOD_BODY") << objectDebugId
|
||||||
<< methodName << methodBody;
|
<< methodName << methodBody;
|
||||||
sendMessage(message);
|
sendMessage(ds.data());
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeclarativeEngineDebugClient::messageReceived(const QByteArray &data)
|
void DeclarativeEngineDebugClient::messageReceived(const QByteArray &data)
|
||||||
{
|
{
|
||||||
QmlDebugStream ds(data);
|
QPacket ds(connection()->currentDataStreamVersion(), data);
|
||||||
QByteArray type;
|
QByteArray type;
|
||||||
ds >> type;
|
ds >> type;
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,6 @@
|
|||||||
namespace QmlDebug {
|
namespace QmlDebug {
|
||||||
|
|
||||||
const int protocolVersion = 1;
|
const int protocolVersion = 1;
|
||||||
int QmlDebugClient::s_dataStreamVersion = QDataStream::Qt_4_7;
|
|
||||||
|
|
||||||
const QString serverId = QLatin1String("QDeclarativeDebugServer");
|
const QString serverId = QLatin1String("QDeclarativeDebugServer");
|
||||||
const QString clientId = QLatin1String("QDeclarativeDebugClient");
|
const QString clientId = QLatin1String("QDeclarativeDebugClient");
|
||||||
@@ -67,6 +66,9 @@ public:
|
|||||||
QHash <QString, float> serverPlugins;
|
QHash <QString, float> serverPlugins;
|
||||||
QHash<QString, QmlDebugClient *> plugins;
|
QHash<QString, QmlDebugClient *> plugins;
|
||||||
|
|
||||||
|
int currentDataStreamVersion;
|
||||||
|
int maximumDataStreamVersion;
|
||||||
|
|
||||||
void advertisePlugins();
|
void advertisePlugins();
|
||||||
void flush();
|
void flush();
|
||||||
|
|
||||||
@@ -79,7 +81,9 @@ public slots:
|
|||||||
};
|
};
|
||||||
|
|
||||||
QmlDebugConnectionPrivate::QmlDebugConnectionPrivate(QmlDebugConnection *c)
|
QmlDebugConnectionPrivate::QmlDebugConnectionPrivate(QmlDebugConnection *c)
|
||||||
: QObject(c), q(c), protocol(0), device(0), gotHello(false)
|
: QObject(c), q(c), protocol(0), device(0), gotHello(false),
|
||||||
|
currentDataStreamVersion(QDataStream::Qt_4_7),
|
||||||
|
maximumDataStreamVersion(QDataStream::Qt_DefaultCompiledVersion)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,17 +92,17 @@ void QmlDebugConnectionPrivate::advertisePlugins()
|
|||||||
if (!q->isOpen())
|
if (!q->isOpen())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QPacket pack;
|
QPacket pack(currentDataStreamVersion);
|
||||||
pack << serverId << 1 << plugins.keys();
|
pack << serverId << 1 << plugins.keys();
|
||||||
protocol->send(pack);
|
protocol->send(pack.data());
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlDebugConnectionPrivate::connected()
|
void QmlDebugConnectionPrivate::connected()
|
||||||
{
|
{
|
||||||
QPacket pack;
|
QPacket pack(currentDataStreamVersion);
|
||||||
pack << serverId << 0 << protocolVersion << plugins.keys() << QDataStream().version();
|
pack << serverId << 0 << protocolVersion << plugins.keys() << maximumDataStreamVersion;
|
||||||
protocol->send(pack);
|
protocol->send(pack.data());
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +138,7 @@ void QmlDebugConnectionPrivate::error(QAbstractSocket::SocketError socketError)
|
|||||||
void QmlDebugConnectionPrivate::readyRead()
|
void QmlDebugConnectionPrivate::readyRead()
|
||||||
{
|
{
|
||||||
if (!gotHello) {
|
if (!gotHello) {
|
||||||
QPacket pack = protocol->read();
|
QPacket pack(currentDataStreamVersion, protocol->read());
|
||||||
QString name;
|
QString name;
|
||||||
|
|
||||||
pack >> name;
|
pack >> name;
|
||||||
@@ -150,7 +154,7 @@ void QmlDebugConnectionPrivate::readyRead()
|
|||||||
QStringList pluginNames;
|
QStringList pluginNames;
|
||||||
QList<float> pluginVersions;
|
QList<float> pluginVersions;
|
||||||
pack >> pluginNames;
|
pack >> pluginNames;
|
||||||
if (!pack.isEmpty())
|
if (!pack.atEnd())
|
||||||
pack >> pluginVersions;
|
pack >> pluginVersions;
|
||||||
|
|
||||||
const int pluginNamesSize = pluginNames.size();
|
const int pluginNamesSize = pluginNames.size();
|
||||||
@@ -163,9 +167,8 @@ void QmlDebugConnectionPrivate::readyRead()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!pack.atEnd()) {
|
if (!pack.atEnd()) {
|
||||||
pack >> QmlDebugClient::s_dataStreamVersion;
|
pack >> currentDataStreamVersion;
|
||||||
if (QmlDebugClient::s_dataStreamVersion
|
if (currentDataStreamVersion > maximumDataStreamVersion)
|
||||||
> QDataStream().version())
|
|
||||||
qWarning() << "Server returned invalid data stream version!";
|
qWarning() << "Server returned invalid data stream version!";
|
||||||
}
|
}
|
||||||
validHello = true;
|
validHello = true;
|
||||||
@@ -192,7 +195,7 @@ void QmlDebugConnectionPrivate::readyRead()
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (protocol && protocol->packetsAvailable()) {
|
while (protocol && protocol->packetsAvailable()) {
|
||||||
QPacket pack = protocol->read();
|
QPacket pack(currentDataStreamVersion, protocol->read());
|
||||||
QString name;
|
QString name;
|
||||||
pack >> name;
|
pack >> name;
|
||||||
|
|
||||||
@@ -208,7 +211,7 @@ void QmlDebugConnectionPrivate::readyRead()
|
|||||||
QStringList pluginNames;
|
QStringList pluginNames;
|
||||||
QList<float> pluginVersions;
|
QList<float> pluginVersions;
|
||||||
pack >> pluginNames;
|
pack >> pluginNames;
|
||||||
if (!pack.isEmpty())
|
if (!pack.atEnd())
|
||||||
pack >> pluginVersions;
|
pack >> pluginVersions;
|
||||||
|
|
||||||
const int pluginNamesSize = pluginNames.size();
|
const int pluginNamesSize = pluginNames.size();
|
||||||
@@ -334,7 +337,15 @@ void QmlDebugConnection::connectToHost(const QString &hostName, quint16 port)
|
|||||||
socket->connectToHost(hostName, port);
|
socket->connectToHost(hostName, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
int QmlDebugConnection::currentDataStreamVersion() const
|
||||||
|
{
|
||||||
|
return d->currentDataStreamVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmlDebugConnection::setMaximumDataStreamVersion(int maximumVersion)
|
||||||
|
{
|
||||||
|
d->maximumDataStreamVersion = maximumVersion;
|
||||||
|
}
|
||||||
|
|
||||||
QmlDebugClientPrivate::QmlDebugClientPrivate()
|
QmlDebugClientPrivate::QmlDebugClientPrivate()
|
||||||
: connection(0)
|
: connection(0)
|
||||||
@@ -412,9 +423,9 @@ void QmlDebugClient::sendMessage(const QByteArray &message)
|
|||||||
if (state() != Enabled)
|
if (state() != Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QPacket pack;
|
QPacket pack(d->connection->currentDataStreamVersion());
|
||||||
pack << d->name << message;
|
pack << d->name << message;
|
||||||
d->connection->d->protocol->send(pack);
|
d->connection->d->protocol->send(pack.data());
|
||||||
d->connection->d->flush();
|
d->connection->d->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -426,30 +437,6 @@ void QmlDebugClient::messageReceived(const QByteArray &)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlDebugStream::QmlDebugStream()
|
|
||||||
: QDataStream()
|
|
||||||
{
|
|
||||||
setVersion(QmlDebugClient::s_dataStreamVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
QmlDebugStream::QmlDebugStream(QIODevice *d)
|
|
||||||
: QDataStream(d)
|
|
||||||
{
|
|
||||||
setVersion(QmlDebugClient::s_dataStreamVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
QmlDebugStream::QmlDebugStream(QByteArray *ba, QIODevice::OpenMode flags)
|
|
||||||
: QDataStream(ba, flags)
|
|
||||||
{
|
|
||||||
setVersion(QmlDebugClient::s_dataStreamVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
QmlDebugStream::QmlDebugStream(const QByteArray &ba)
|
|
||||||
: QDataStream(ba)
|
|
||||||
{
|
|
||||||
setVersion(QmlDebugClient::s_dataStreamVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace QmlDebug
|
} // namespace QmlDebug
|
||||||
|
|
||||||
#include <qmldebugclient.moc>
|
#include <qmldebugclient.moc>
|
||||||
|
|||||||
@@ -56,6 +56,9 @@ public:
|
|||||||
|
|
||||||
void connectToHost(const QString &hostName, quint16 port);
|
void connectToHost(const QString &hostName, quint16 port);
|
||||||
|
|
||||||
|
int currentDataStreamVersion() const;
|
||||||
|
void setMaximumDataStreamVersion(int maximumVersion);
|
||||||
|
|
||||||
bool isOpen() const;
|
bool isOpen() const;
|
||||||
bool isConnecting() const;
|
bool isConnecting() const;
|
||||||
void close();
|
void close();
|
||||||
@@ -103,17 +106,7 @@ private:
|
|||||||
friend class QmlDebugConnectionPrivate;
|
friend class QmlDebugConnectionPrivate;
|
||||||
QScopedPointer<QmlDebugClientPrivate> d_ptr;
|
QScopedPointer<QmlDebugClientPrivate> d_ptr;
|
||||||
|
|
||||||
public:
|
|
||||||
static int s_dataStreamVersion;
|
|
||||||
};
|
|
||||||
|
|
||||||
class QMLDEBUG_EXPORT QmlDebugStream : public QDataStream
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QmlDebugStream();
|
|
||||||
explicit QmlDebugStream(QIODevice *d);
|
|
||||||
QmlDebugStream(QByteArray *ba, QIODevice::OpenMode flags);
|
|
||||||
QmlDebugStream(const QByteArray &ba);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDebug
|
} // namespace QmlDebug
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "qmlprofilertraceclient.h"
|
#include "qmlprofilertraceclient.h"
|
||||||
#include "qmlenginecontrolclient.h"
|
#include "qmlenginecontrolclient.h"
|
||||||
#include "qdebugmessageclient.h"
|
#include "qdebugmessageclient.h"
|
||||||
|
#include "qpacketprotocol.h"
|
||||||
|
|
||||||
namespace QmlDebug {
|
namespace QmlDebug {
|
||||||
|
|
||||||
@@ -76,12 +77,11 @@ static const int GAP_TIME = 150;
|
|||||||
|
|
||||||
void QmlProfilerTraceClientPrivate::sendRecordingStatus(int engineId)
|
void QmlProfilerTraceClientPrivate::sendRecordingStatus(int engineId)
|
||||||
{
|
{
|
||||||
QByteArray ba;
|
QPacket stream(q->connection()->currentDataStreamVersion());
|
||||||
QmlDebugStream stream(&ba, QIODevice::WriteOnly);
|
|
||||||
stream << recording << engineId; // engineId -1 is OK. It means "all of them"
|
stream << recording << engineId; // engineId -1 is OK. It means "all of them"
|
||||||
if (recording)
|
if (recording)
|
||||||
stream << requestedFeatures << flushInterval;
|
stream << requestedFeatures << flushInterval;
|
||||||
q->sendMessage(ba);
|
q->sendMessage(stream.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlProfilerTraceClient::QmlProfilerTraceClient(QmlDebugConnection *client, quint64 features)
|
QmlProfilerTraceClient::QmlProfilerTraceClient(QmlDebugConnection *client, quint64 features)
|
||||||
@@ -201,8 +201,7 @@ void QmlProfilerTraceClient::stateChanged(State /*status*/)
|
|||||||
|
|
||||||
void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
|
void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
|
||||||
{
|
{
|
||||||
QByteArray rwData = data;
|
QPacket stream(connection()->currentDataStreamVersion(), data);
|
||||||
QmlDebugStream stream(&rwData, QIODevice::ReadOnly);
|
|
||||||
|
|
||||||
qint64 time;
|
qint64 time;
|
||||||
int messageType;
|
int messageType;
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
#include "qpacketprotocol.h"
|
#include "qpacketprotocol.h"
|
||||||
|
|
||||||
#include <qbuffer.h>
|
|
||||||
#include <qelapsedtimer.h>
|
#include <qelapsedtimer.h>
|
||||||
|
|
||||||
namespace QmlDebug {
|
namespace QmlDebug {
|
||||||
@@ -111,8 +110,6 @@ public:
|
|||||||
|
|
||||||
QObject::connect(this, &QPacketProtocolPrivate::readyRead,
|
QObject::connect(this, &QPacketProtocolPrivate::readyRead,
|
||||||
parent, &QPacketProtocol::readyRead);
|
parent, &QPacketProtocol::readyRead);
|
||||||
QObject::connect(this, &QPacketProtocolPrivate::packetWritten,
|
|
||||||
parent, &QPacketProtocol::packetWritten);
|
|
||||||
QObject::connect(this, &QPacketProtocolPrivate::invalidPacket,
|
QObject::connect(this, &QPacketProtocolPrivate::invalidPacket,
|
||||||
parent, &QPacketProtocol::invalidPacket);
|
parent, &QPacketProtocol::invalidPacket);
|
||||||
QObject::connect(dev, &QIODevice::readyRead,
|
QObject::connect(dev, &QIODevice::readyRead,
|
||||||
@@ -125,7 +122,6 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void readyRead();
|
void readyRead();
|
||||||
void packetWritten();
|
|
||||||
void invalidPacket();
|
void invalidPacket();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@@ -147,7 +143,6 @@ public slots:
|
|||||||
} else {
|
} else {
|
||||||
bytes -= sendingPackets.at(0);
|
bytes -= sendingPackets.at(0);
|
||||||
sendingPackets.removeFirst();
|
sendingPackets.removeFirst();
|
||||||
emit packetWritten();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -217,70 +212,22 @@ QPacketProtocol::QPacketProtocol(QIODevice *dev, QObject *parent)
|
|||||||
Q_ASSERT(dev);
|
Q_ASSERT(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Destroys the QPacketProtocol instance.
|
|
||||||
*/
|
|
||||||
QPacketProtocol::~QPacketProtocol()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the maximum packet size allowed. By default this is
|
|
||||||
2,147,483,647 bytes.
|
|
||||||
|
|
||||||
If a packet claiming to be larger than the maximum packet size is received,
|
|
||||||
the QPacketProtocol::invalidPacket() signal is emitted.
|
|
||||||
|
|
||||||
\sa QPacketProtocol::setMaximumPacketSize()
|
|
||||||
*/
|
|
||||||
qint32 QPacketProtocol::maximumPacketSize() const
|
|
||||||
{
|
|
||||||
return d->maxPacketSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Sets the maximum allowable packet size to \a max.
|
|
||||||
|
|
||||||
\sa QPacketProtocol::maximumPacketSize()
|
|
||||||
*/
|
|
||||||
qint32 QPacketProtocol::setMaximumPacketSize(qint32 max)
|
|
||||||
{
|
|
||||||
if (max > (signed)sizeof(qint32))
|
|
||||||
d->maxPacketSize = max;
|
|
||||||
return d->maxPacketSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns a streamable object that is transmitted on destruction. For example
|
|
||||||
|
|
||||||
\code
|
|
||||||
protocol.send() << "Hello world" << 123;
|
|
||||||
\endcode
|
|
||||||
|
|
||||||
will send a packet containing "Hello world" and 123. To construct more
|
|
||||||
complex packets, explicitly construct a QPacket instance.
|
|
||||||
*/
|
|
||||||
QPacketAutoSend QPacketProtocol::send()
|
|
||||||
{
|
|
||||||
return QPacketAutoSend(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Transmits the packet \a p.
|
Transmits the packet \a p.
|
||||||
*/
|
*/
|
||||||
void QPacketProtocol::send(const QPacket & p)
|
void QPacketProtocol::send(const QByteArray &p)
|
||||||
{
|
{
|
||||||
if (p.b.isEmpty())
|
if (p.isEmpty())
|
||||||
return; // We don't send empty packets
|
return; // We don't send empty packets
|
||||||
|
|
||||||
qint64 sendSize = p.b.size() + sizeof(qint32);
|
qint64 sendSize = p.size() + sizeof(qint32);
|
||||||
|
|
||||||
d->sendingPackets.append(sendSize);
|
d->sendingPackets.append(sendSize);
|
||||||
qint32 sendSize32 = sendSize;
|
qint32 sendSize32 = sendSize;
|
||||||
qint64 writeBytes = d->dev->write((char *)&sendSize32, sizeof(qint32));
|
qint64 writeBytes = d->dev->write((char *)&sendSize32, sizeof(qint32));
|
||||||
Q_ASSERT(writeBytes == sizeof(qint32));
|
Q_ASSERT(writeBytes == sizeof(qint32));
|
||||||
writeBytes = d->dev->write(p.b);
|
writeBytes = d->dev->write(p);
|
||||||
Q_ASSERT(writeBytes == p.b.size());
|
Q_ASSERT(writeBytes == p.size());
|
||||||
Q_UNUSED(writeBytes); // For building in release mode.
|
Q_UNUSED(writeBytes); // For building in release mode.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,26 +239,16 @@ qint64 QPacketProtocol::packetsAvailable() const
|
|||||||
return d->packets.count();
|
return d->packets.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Discards any unread packets.
|
|
||||||
*/
|
|
||||||
void QPacketProtocol::clear()
|
|
||||||
{
|
|
||||||
d->packets.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the next unread packet, or an invalid QPacket instance if no packets
|
Returns the next unread packet, or an invalid QPacket instance if no packets
|
||||||
are available. This function does NOT block.
|
are available. This function does NOT block.
|
||||||
*/
|
*/
|
||||||
QPacket QPacketProtocol::read()
|
QByteArray QPacketProtocol::read()
|
||||||
{
|
{
|
||||||
if (0 == d->packets.count())
|
if (0 == d->packets.count())
|
||||||
return QPacket();
|
return QByteArray();
|
||||||
|
|
||||||
QPacket rv(d->packets.at(0));
|
return d->packets.takeFirst();
|
||||||
d->packets.removeFirst();
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -357,14 +294,6 @@ bool QPacketProtocol::waitForReadyRead(int msecs)
|
|||||||
} while (true);
|
} while (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the QIODevice passed to the QPacketProtocol constructor.
|
|
||||||
*/
|
|
||||||
QIODevice *QPacketProtocol::device()
|
|
||||||
{
|
|
||||||
return d->dev;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void QPacketProtocol::readyRead()
|
\fn void QPacketProtocol::readyRead()
|
||||||
|
|
||||||
@@ -380,13 +309,6 @@ QIODevice *QPacketProtocol::device()
|
|||||||
further packets will be received.
|
further packets will be received.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn void QPacketProtocol::packetWritten()
|
|
||||||
|
|
||||||
Emitted each time a packet is completely written to the device. This signal
|
|
||||||
may be used for communications flow control.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class QPacket
|
\class QPacket
|
||||||
\internal
|
\internal
|
||||||
@@ -434,55 +356,22 @@ QIODevice *QPacketProtocol::device()
|
|||||||
/*!
|
/*!
|
||||||
Constructs an empty write-only packet.
|
Constructs an empty write-only packet.
|
||||||
*/
|
*/
|
||||||
QPacket::QPacket()
|
QPacket::QPacket(int version)
|
||||||
: QDataStream(), buf(0)
|
|
||||||
{
|
{
|
||||||
buf = new QBuffer(&b);
|
buf.open(QIODevice::WriteOnly);
|
||||||
buf->open(QIODevice::WriteOnly);
|
setDevice(&buf);
|
||||||
setDevice(buf);
|
setVersion(version);
|
||||||
setVersion(QDataStream::Qt_4_7);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Destroys the QPacket instance.
|
Constructs a read-only packet.
|
||||||
*/
|
|
||||||
QPacket::~QPacket()
|
|
||||||
{
|
|
||||||
if (buf) {
|
|
||||||
delete buf;
|
|
||||||
buf = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Creates a copy of \a other. The initial stream positions are shared, but the
|
|
||||||
two packets are otherwise independent.
|
|
||||||
*/
|
*/
|
||||||
QPacket::QPacket(const QPacket & other)
|
QPacket::QPacket(int version, const QByteArray &data)
|
||||||
: QDataStream(), b(other.b), buf(0)
|
|
||||||
{
|
{
|
||||||
buf = new QBuffer(&b);
|
buf.setData(data);
|
||||||
buf->open(other.buf->openMode());
|
buf.open(QIODevice::ReadOnly);
|
||||||
setDevice(buf);
|
setDevice(&buf);
|
||||||
}
|
setVersion(version);
|
||||||
|
|
||||||
/*!
|
|
||||||
\internal
|
|
||||||
*/
|
|
||||||
QPacket::QPacket(const QByteArray & ba)
|
|
||||||
: QDataStream(), b(ba), buf(0)
|
|
||||||
{
|
|
||||||
buf = new QBuffer(&b);
|
|
||||||
buf->open(QIODevice::ReadOnly);
|
|
||||||
setDevice(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns true if this packet is empty - that is, contains no data.
|
|
||||||
*/
|
|
||||||
bool QPacket::isEmpty() const
|
|
||||||
{
|
|
||||||
return b.isEmpty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -490,48 +379,7 @@ bool QPacket::isEmpty() const
|
|||||||
*/
|
*/
|
||||||
QByteArray QPacket::data() const
|
QByteArray QPacket::data() const
|
||||||
{
|
{
|
||||||
return b;
|
return buf.data();
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Clears data in the packet. This is useful for reusing one writable packet.
|
|
||||||
For example
|
|
||||||
\code
|
|
||||||
QPacketProtocol protocol(...);
|
|
||||||
|
|
||||||
QPacket packet;
|
|
||||||
|
|
||||||
packet << "Hello world!" << 123;
|
|
||||||
protocol.send(packet);
|
|
||||||
|
|
||||||
packet.clear();
|
|
||||||
packet << "Goodbyte world!" << 789;
|
|
||||||
protocol.send(packet);
|
|
||||||
\endcode
|
|
||||||
*/
|
|
||||||
void QPacket::clear()
|
|
||||||
{
|
|
||||||
QBuffer::OpenMode oldMode = buf->openMode();
|
|
||||||
buf->close();
|
|
||||||
b.clear();
|
|
||||||
buf->setBuffer(&b); // reset QBuffer internals with new size of b.
|
|
||||||
buf->open(oldMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\class QPacketAutoSend
|
|
||||||
\internal
|
|
||||||
|
|
||||||
*/
|
|
||||||
QPacketAutoSend::QPacketAutoSend(QPacketProtocol *_p)
|
|
||||||
: QPacket(), p(_p)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QPacketAutoSend::~QPacketAutoSend()
|
|
||||||
{
|
|
||||||
if (!b.isEmpty())
|
|
||||||
p->send(*this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace QmlDebug
|
} // namespace QmlDebug
|
||||||
|
|||||||
@@ -31,81 +31,54 @@
|
|||||||
#ifndef QPACKETPROTOCOL_H
|
#ifndef QPACKETPROTOCOL_H
|
||||||
#define QPACKETPROTOCOL_H
|
#define QPACKETPROTOCOL_H
|
||||||
|
|
||||||
|
#include "qmldebug_global.h"
|
||||||
|
|
||||||
#include <qobject.h>
|
#include <qobject.h>
|
||||||
#include <qdatastream.h>
|
#include <qdatastream.h>
|
||||||
|
#include <qbuffer.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QIODevice;
|
class QIODevice;
|
||||||
class QBuffer;
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace QmlDebug {
|
namespace QmlDebug {
|
||||||
|
|
||||||
class QPacket;
|
|
||||||
class QPacketAutoSend;
|
|
||||||
|
|
||||||
class QPacketProtocolPrivate;
|
class QPacketProtocolPrivate;
|
||||||
|
class QMLDEBUG_EXPORT QPacketProtocol : public QObject
|
||||||
class QPacketProtocol : public QObject
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Q_DECLARE_PRIVATE(QPacketProtocol)
|
||||||
public:
|
public:
|
||||||
explicit QPacketProtocol(QIODevice *dev, QObject *parent = 0);
|
explicit QPacketProtocol(QIODevice *dev, QObject *parent = 0);
|
||||||
virtual ~QPacketProtocol();
|
|
||||||
|
|
||||||
qint32 maximumPacketSize() const;
|
|
||||||
qint32 setMaximumPacketSize(qint32);
|
|
||||||
|
|
||||||
QPacketAutoSend send();
|
|
||||||
void send(const QPacket &);
|
|
||||||
|
|
||||||
|
void send(const QByteArray &data);
|
||||||
qint64 packetsAvailable() const;
|
qint64 packetsAvailable() const;
|
||||||
QPacket read();
|
QByteArray read();
|
||||||
|
|
||||||
bool waitForReadyRead(int msecs = 3000);
|
bool waitForReadyRead(int msecs = 3000);
|
||||||
|
|
||||||
void clear();
|
Q_SIGNALS:
|
||||||
|
|
||||||
QIODevice *device();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void readyRead();
|
void readyRead();
|
||||||
void invalidPacket();
|
void invalidPacket();
|
||||||
void packetWritten();
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void aboutToClose();
|
||||||
|
void bytesWritten(qint64 bytes);
|
||||||
|
void readyToRead();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPacketProtocolPrivate *d;
|
QPacketProtocolPrivate *d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class QMLDEBUG_EXPORT QPacket : public QDataStream
|
||||||
class QPacket : public QDataStream
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QPacket();
|
QPacket(int version);
|
||||||
QPacket(const QPacket &);
|
explicit QPacket(int version, const QByteArray &ba);
|
||||||
virtual ~QPacket();
|
|
||||||
|
|
||||||
void clear();
|
|
||||||
bool isEmpty() const;
|
|
||||||
QByteArray data() const;
|
QByteArray data() const;
|
||||||
|
|
||||||
protected:
|
|
||||||
friend class QPacketProtocol;
|
|
||||||
QPacket(const QByteArray &ba);
|
|
||||||
QByteArray b;
|
|
||||||
QBuffer *buf;
|
|
||||||
};
|
|
||||||
|
|
||||||
class QPacketAutoSend : public QPacket
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual ~QPacketAutoSend();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class QPacketProtocol;
|
void init(QIODevice::OpenMode mode);
|
||||||
QPacketAutoSend(QPacketProtocol *);
|
QBuffer buf;
|
||||||
QPacketProtocol *p;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // QmlDebug
|
} // QmlDebug
|
||||||
|
|||||||
@@ -57,6 +57,7 @@
|
|||||||
#include <qmljseditor/qmljseditorconstants.h>
|
#include <qmljseditor/qmljseditorconstants.h>
|
||||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||||
#include <qmljs/consolemanagerinterface.h>
|
#include <qmljs/consolemanagerinterface.h>
|
||||||
|
#include <qmldebug/qpacketprotocol.h>
|
||||||
|
|
||||||
#include <texteditor/textdocument.h>
|
#include <texteditor/textdocument.h>
|
||||||
#include <texteditor/texteditor.h>
|
#include <texteditor/texteditor.h>
|
||||||
@@ -1504,11 +1505,10 @@ void QmlEnginePrivate::setBreakpoint(const QString type, const QString target,
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
if (type == _(EVENT)) {
|
if (type == _(EVENT)) {
|
||||||
QByteArray params;
|
QPacket rs(connection->currentDataStreamVersion());
|
||||||
QmlDebugStream rs(¶ms, QIODevice::WriteOnly);
|
|
||||||
rs << target.toUtf8() << enabled;
|
rs << target.toUtf8() << enabled;
|
||||||
engine->showMessage(QString(_("%1 %2 %3")).arg(_(BREAKONSIGNAL), target, enabled ? _("enabled") : _("disabled")), LogInput);
|
engine->showMessage(QString(_("%1 %2 %3")).arg(_(BREAKONSIGNAL), target, enabled ? _("enabled") : _("disabled")), LogInput);
|
||||||
runDirectCommand(BREAKONSIGNAL, params);
|
runDirectCommand(BREAKONSIGNAL, rs.data());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
DebuggerCommand cmd(SETBREAKPOINT);
|
DebuggerCommand cmd(SETBREAKPOINT);
|
||||||
@@ -1704,14 +1704,13 @@ void QmlEnginePrivate::runDirectCommand(const QByteArray &type, const QByteArray
|
|||||||
|
|
||||||
engine->showMessage(QString::fromLatin1("%1 %2").arg(_(type), _(msg)), LogInput);
|
engine->showMessage(QString::fromLatin1("%1 %2").arg(_(type), _(msg)), LogInput);
|
||||||
|
|
||||||
QByteArray request;
|
QPacket rs(connection->currentDataStreamVersion());
|
||||||
QmlDebugStream rs(&request, QIODevice::WriteOnly);
|
|
||||||
rs << cmd << type << msg;
|
rs << cmd << type << msg;
|
||||||
|
|
||||||
if (state() == Enabled)
|
if (state() == Enabled)
|
||||||
sendMessage(request);
|
sendMessage(rs.data());
|
||||||
else
|
else
|
||||||
sendBuffer.append(request);
|
sendBuffer.append(rs.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEnginePrivate::memorizeRefs(const QVariant &refs)
|
void QmlEnginePrivate::memorizeRefs(const QVariant &refs)
|
||||||
@@ -1727,7 +1726,7 @@ void QmlEnginePrivate::memorizeRefs(const QVariant &refs)
|
|||||||
|
|
||||||
void QmlEnginePrivate::messageReceived(const QByteArray &data)
|
void QmlEnginePrivate::messageReceived(const QByteArray &data)
|
||||||
{
|
{
|
||||||
QmlDebugStream ds(data);
|
QPacket ds(connection->currentDataStreamVersion(), data);
|
||||||
QByteArray command;
|
QByteArray command;
|
||||||
ds >> command;
|
ds >> command;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user