forked from qt-creator/qt-creator
QmlDebug: Remove unused code
Remove code related to the nuked 'Apply on Save' functionality, and older cruft. Change-Id: I5e7acf11ded95a46977a1c28ee77c713e94b73c3 GPush-Base: 3606f8b02a65f0080e7e93ff27e79d7c34118c6c Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
@@ -42,34 +42,18 @@ class QMLDEBUG_EXPORT BaseToolsClient : public QmlDebugClient
|
|||||||
public:
|
public:
|
||||||
BaseToolsClient(QmlDebugConnection *client, QLatin1String clientName);
|
BaseToolsClient(QmlDebugConnection *client, QLatin1String clientName);
|
||||||
|
|
||||||
virtual void setCurrentObjects(const QList<int> &debugIds) = 0;
|
|
||||||
virtual void reload(const QHash<QString, QByteArray> &changesHash) = 0;
|
virtual void reload(const QHash<QString, QByteArray> &changesHash) = 0;
|
||||||
virtual bool supportReload() const = 0;
|
virtual bool supportReload() const = 0;
|
||||||
virtual void setDesignModeBehavior(bool inDesignMode) = 0;
|
virtual void setDesignModeBehavior(bool inDesignMode) = 0;
|
||||||
virtual void setAnimationSpeed(qreal slowDownFactor) = 0;
|
|
||||||
virtual void setAnimationPaused(bool paused) = 0;
|
|
||||||
virtual void changeToSelectTool() = 0;
|
virtual void changeToSelectTool() = 0;
|
||||||
virtual void changeToSelectMarqueeTool() = 0;
|
virtual void changeToSelectMarqueeTool() = 0;
|
||||||
virtual void changeToZoomTool() = 0;
|
virtual void changeToZoomTool() = 0;
|
||||||
virtual void showAppOnTop(bool showOnTop) = 0;
|
virtual void showAppOnTop(bool showOnTop) = 0;
|
||||||
|
|
||||||
virtual void createQmlObject(const QString &qmlText, int parentDebugId,
|
|
||||||
const QStringList &imports, const QString &filename,
|
|
||||||
int order) = 0;
|
|
||||||
virtual void destroyQmlObject(int debugId) = 0;
|
|
||||||
virtual void reparentQmlObject(int debugId, int newParent) = 0;
|
|
||||||
|
|
||||||
virtual void applyChangesToQmlFile() = 0;
|
|
||||||
virtual void applyChangesFromQmlFile() = 0;
|
|
||||||
|
|
||||||
virtual QList<int> currentObjects() const = 0;
|
|
||||||
|
|
||||||
// ### Qt 4.8: remove if we can have access to qdeclarativecontextdata or id's
|
// ### Qt 4.8: remove if we can have access to qdeclarativecontextdata or id's
|
||||||
virtual void setObjectIdList(
|
virtual void setObjectIdList(
|
||||||
const QList<ObjectReference> &objectRoots) = 0;
|
const QList<ObjectReference> &objectRoots) = 0;
|
||||||
|
|
||||||
virtual void clearComponentCache() = 0;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void newState(QmlDebug::QmlDebugClient::State status);
|
void newState(QmlDebug::QmlDebugClient::State status);
|
||||||
|
|
||||||
@@ -77,12 +61,8 @@ signals:
|
|||||||
void selectToolActivated();
|
void selectToolActivated();
|
||||||
void selectMarqueeToolActivated();
|
void selectMarqueeToolActivated();
|
||||||
void zoomToolActivated();
|
void zoomToolActivated();
|
||||||
void animationSpeedChanged(qreal slowdownFactor);
|
|
||||||
void animationPausedChanged(bool paused);
|
|
||||||
void designModeBehaviorChanged(bool inDesignMode);
|
void designModeBehaviorChanged(bool inDesignMode);
|
||||||
void showAppOnTopChanged(bool showAppOnTop);
|
|
||||||
void reloaded(); // the server has reloaded the document
|
void reloaded(); // the server has reloaded the document
|
||||||
void destroyedObject(int);
|
|
||||||
|
|
||||||
void logActivity(QString client, QString message);
|
void logActivity(QString client, QString message);
|
||||||
|
|
||||||
|
@@ -55,21 +55,12 @@ class InspectorProtocol : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
enum Message {
|
enum Message {
|
||||||
AnimationSpeedChanged = 0,
|
|
||||||
AnimationPausedChanged = 19, // highest value
|
|
||||||
ChangeTool = 1,
|
ChangeTool = 1,
|
||||||
ClearComponentCache = 2,
|
|
||||||
ColorChanged = 3,
|
ColorChanged = 3,
|
||||||
CreateObject = 5,
|
|
||||||
CurrentObjectsChanged = 6,
|
CurrentObjectsChanged = 6,
|
||||||
DestroyObject = 7,
|
|
||||||
MoveObject = 8,
|
|
||||||
ObjectIdList = 9,
|
ObjectIdList = 9,
|
||||||
Reload = 10,
|
Reload = 10,
|
||||||
Reloaded = 11,
|
Reloaded = 11,
|
||||||
SetAnimationSpeed = 12,
|
|
||||||
SetAnimationPaused = 18,
|
|
||||||
SetCurrentObjects = 14,
|
|
||||||
SetDesignMode = 15,
|
SetDesignMode = 15,
|
||||||
ShowAppOnTop = 16,
|
ShowAppOnTop = 16,
|
||||||
ToolChanged = 17
|
ToolChanged = 17
|
||||||
@@ -156,16 +147,16 @@ void DeclarativeToolsClient::messageReceived(const QByteArray &message)
|
|||||||
|
|
||||||
log(LogReceive, type, QString::fromLatin1("%1 [list of debug ids]").arg(objectCount));
|
log(LogReceive, type, QString::fromLatin1("%1 [list of debug ids]").arg(objectCount));
|
||||||
|
|
||||||
m_currentDebugIds.clear();
|
QList<int> currentDebugIds;
|
||||||
|
|
||||||
for (int i = 0; i < objectCount; ++i) {
|
for (int i = 0; i < objectCount; ++i) {
|
||||||
int debugId;
|
int debugId;
|
||||||
ds >> debugId;
|
ds >> debugId;
|
||||||
if (debugId != -1)
|
if (debugId != -1)
|
||||||
m_currentDebugIds << debugId;
|
currentDebugIds << debugId;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit currentObjectsChanged(m_currentDebugIds);
|
emit currentObjectsChanged(currentDebugIds);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case InspectorProtocol::ToolChanged: {
|
case InspectorProtocol::ToolChanged: {
|
||||||
@@ -182,25 +173,6 @@ void DeclarativeToolsClient::messageReceived(const QByteArray &message)
|
|||||||
emit selectMarqueeToolActivated();
|
emit selectMarqueeToolActivated();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case InspectorProtocol::AnimationSpeedChanged: {
|
|
||||||
qreal slowDownFactor;
|
|
||||||
ds >> slowDownFactor;
|
|
||||||
|
|
||||||
log(LogReceive, type, QString::number(slowDownFactor));
|
|
||||||
|
|
||||||
emit animationSpeedChanged(slowDownFactor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case InspectorProtocol::AnimationPausedChanged: {
|
|
||||||
bool paused;
|
|
||||||
ds >> paused;
|
|
||||||
|
|
||||||
log(LogReceive, type, paused ? QLatin1String("true")
|
|
||||||
: QLatin1String("false"));
|
|
||||||
|
|
||||||
emit animationPausedChanged(paused);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case InspectorProtocol::SetDesignMode: {
|
case InspectorProtocol::SetDesignMode: {
|
||||||
bool inDesignMode;
|
bool inDesignMode;
|
||||||
ds >> inDesignMode;
|
ds >> inDesignMode;
|
||||||
@@ -215,8 +187,6 @@ void DeclarativeToolsClient::messageReceived(const QByteArray &message)
|
|||||||
ds >> showAppOnTop;
|
ds >> showAppOnTop;
|
||||||
|
|
||||||
log(LogReceive, type, QLatin1String(showAppOnTop ? "true" : "false"));
|
log(LogReceive, type, QLatin1String(showAppOnTop ? "true" : "false"));
|
||||||
|
|
||||||
emit showAppOnTopChanged(showAppOnTop);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case InspectorProtocol::Reloaded: {
|
case InspectorProtocol::Reloaded: {
|
||||||
@@ -229,37 +199,6 @@ void DeclarativeToolsClient::messageReceived(const QByteArray &message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<int> DeclarativeToolsClient::currentObjects() const
|
|
||||||
{
|
|
||||||
return m_currentDebugIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarativeToolsClient::setCurrentObjects(const QList<int> &debugIds)
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isOpen())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (debugIds == m_currentDebugIds)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_currentDebugIds = debugIds;
|
|
||||||
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
InspectorProtocol::Message cmd = InspectorProtocol::SetCurrentObjects;
|
|
||||||
ds << cmd
|
|
||||||
<< debugIds.length();
|
|
||||||
|
|
||||||
foreach (int id, debugIds) {
|
|
||||||
ds << id;
|
|
||||||
}
|
|
||||||
|
|
||||||
log(LogSend, cmd, QString::fromLatin1("%1 [list of ids]").arg(debugIds.length()));
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarativeToolsClient::setObjectIdList(
|
void DeclarativeToolsClient::setObjectIdList(
|
||||||
const QList<ObjectReference> &objectRoots)
|
const QList<ObjectReference> &objectRoots)
|
||||||
{
|
{
|
||||||
@@ -288,22 +227,6 @@ void DeclarativeToolsClient::setObjectIdList(
|
|||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeclarativeToolsClient::clearComponentCache()
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isOpen())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
InspectorProtocol::Message cmd = InspectorProtocol::ClearComponentCache;
|
|
||||||
ds << cmd;
|
|
||||||
|
|
||||||
log(LogSend, cmd);
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarativeToolsClient::reload(const QHash<QString,
|
void DeclarativeToolsClient::reload(const QHash<QString,
|
||||||
QByteArray> &changesHash)
|
QByteArray> &changesHash)
|
||||||
{
|
{
|
||||||
@@ -340,41 +263,6 @@ void DeclarativeToolsClient::setDesignModeBehavior(bool inDesignMode)
|
|||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeclarativeToolsClient::setAnimationSpeed(qreal slowDownFactor)
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isOpen())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
InspectorProtocol::Message cmd = InspectorProtocol::SetAnimationSpeed;
|
|
||||||
ds << cmd
|
|
||||||
<< slowDownFactor;
|
|
||||||
|
|
||||||
|
|
||||||
log(LogSend, cmd, QString::number(slowDownFactor));
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarativeToolsClient::setAnimationPaused(bool paused)
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isOpen())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
InspectorProtocol::Message cmd = InspectorProtocol::SetAnimationPaused;
|
|
||||||
ds << cmd
|
|
||||||
<< paused;
|
|
||||||
|
|
||||||
log(LogSend, cmd, paused ? QLatin1String("true") : QLatin1String("false"));
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarativeToolsClient::changeToSelectTool()
|
void DeclarativeToolsClient::changeToSelectTool()
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isOpen())
|
if (!m_connection || !m_connection->isOpen())
|
||||||
@@ -445,82 +333,6 @@ void DeclarativeToolsClient::showAppOnTop(bool showOnTop)
|
|||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeclarativeToolsClient::createQmlObject(const QString &qmlText,
|
|
||||||
int parentDebugId,
|
|
||||||
const QStringList &imports,
|
|
||||||
const QString &filename, int order)
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isOpen())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
InspectorProtocol::Message cmd = InspectorProtocol::CreateObject;
|
|
||||||
ds << cmd
|
|
||||||
<< qmlText
|
|
||||||
<< parentDebugId
|
|
||||||
<< imports
|
|
||||||
<< filename
|
|
||||||
<< order;
|
|
||||||
|
|
||||||
log(LogSend, cmd, QString::fromLatin1("%1 %2 [%3] %4").arg(qmlText,
|
|
||||||
QString::number(parentDebugId),
|
|
||||||
imports.join(QLatin1Char(',')), filename));
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarativeToolsClient::destroyQmlObject(int debugId)
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isOpen())
|
|
||||||
return;
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
InspectorProtocol::Message cmd = InspectorProtocol::DestroyObject;
|
|
||||||
ds << cmd << debugId;
|
|
||||||
|
|
||||||
log(LogSend, cmd, QString::number(debugId));
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarativeToolsClient::reparentQmlObject(int debugId, int newParent)
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isOpen())
|
|
||||||
return;
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
|
|
||||||
InspectorProtocol::Message cmd = InspectorProtocol::MoveObject;
|
|
||||||
ds << cmd
|
|
||||||
<< debugId
|
|
||||||
<< newParent;
|
|
||||||
|
|
||||||
log(LogSend, cmd, QString::fromLatin1("%1 %2").arg(QString::number(debugId),
|
|
||||||
QString::number(newParent)));
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DeclarativeToolsClient::applyChangesToQmlFile()
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isOpen())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarativeToolsClient::applyChangesFromQmlFile()
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isOpen())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeclarativeToolsClient::log(LogDirection direction,
|
void DeclarativeToolsClient::log(LogDirection direction,
|
||||||
int message,
|
int message,
|
||||||
const QString &extra)
|
const QString &extra)
|
||||||
|
@@ -41,33 +41,17 @@ class QMLDEBUG_EXPORT DeclarativeToolsClient : public BaseToolsClient
|
|||||||
public:
|
public:
|
||||||
DeclarativeToolsClient(QmlDebugConnection *client);
|
DeclarativeToolsClient(QmlDebugConnection *client);
|
||||||
|
|
||||||
void setCurrentObjects(const QList<int> &debugIds);
|
|
||||||
void reload(const QHash<QString, QByteArray> &changesHash);
|
void reload(const QHash<QString, QByteArray> &changesHash);
|
||||||
bool supportReload() const { return false; }
|
bool supportReload() const { return false; }
|
||||||
void setDesignModeBehavior(bool inDesignMode);
|
void setDesignModeBehavior(bool inDesignMode);
|
||||||
void setAnimationSpeed(qreal slowDownFactor);
|
|
||||||
void setAnimationPaused(bool paused);
|
|
||||||
void changeToSelectTool();
|
void changeToSelectTool();
|
||||||
void changeToSelectMarqueeTool();
|
void changeToSelectMarqueeTool();
|
||||||
void changeToZoomTool();
|
void changeToZoomTool();
|
||||||
void showAppOnTop(bool showOnTop);
|
void showAppOnTop(bool showOnTop);
|
||||||
|
|
||||||
void createQmlObject(const QString &qmlText, int parentDebugId,
|
|
||||||
const QStringList &imports, const QString &filename,
|
|
||||||
int order);
|
|
||||||
void destroyQmlObject(int debugId);
|
|
||||||
void reparentQmlObject(int debugId, int newParent);
|
|
||||||
|
|
||||||
void applyChangesToQmlFile();
|
|
||||||
void applyChangesFromQmlFile();
|
|
||||||
|
|
||||||
QList<int> currentObjects() const;
|
|
||||||
|
|
||||||
// ### Qt 4.8: remove if we can have access to qdeclarativecontextdata or id's
|
// ### Qt 4.8: remove if we can have access to qdeclarativecontextdata or id's
|
||||||
void setObjectIdList(const QList<ObjectReference> &objectRoots);
|
void setObjectIdList(const QList<ObjectReference> &objectRoots);
|
||||||
|
|
||||||
void clearComponentCache();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void messageReceived(const QByteArray &);
|
void messageReceived(const QByteArray &);
|
||||||
|
|
||||||
@@ -77,7 +61,6 @@ private:
|
|||||||
const QString &extra = QString());
|
const QString &extra = QString());
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<int> m_currentDebugIds;
|
|
||||||
QmlDebugConnection *m_connection;
|
QmlDebugConnection *m_connection;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -34,17 +34,10 @@
|
|||||||
//INSPECTOR SERVICE PROTOCOL
|
//INSPECTOR SERVICE PROTOCOL
|
||||||
// <HEADER><COMMAND><DATA>
|
// <HEADER><COMMAND><DATA>
|
||||||
// <HEADER> : <type{request, response, event}><requestId/eventId>[<response_success_bool>]
|
// <HEADER> : <type{request, response, event}><requestId/eventId>[<response_success_bool>]
|
||||||
// <COMMAND> : {"enable", "disable", "select", "reload", "setAnimationSpeed",
|
// <COMMAND> : {"enable", "disable", "reload", "showAppOnTop"}
|
||||||
// "showAppOnTop", "createObject", "destroyObject", "moveObject",
|
|
||||||
// "clearCache"}
|
|
||||||
// <DATA> : select: <debugIds_int_list>
|
// <DATA> : select: <debugIds_int_list>
|
||||||
// reload: <hash<changed_filename_string, filecontents_bytearray>>
|
// reload: <hash<changed_filename_string, filecontents_bytearray>>
|
||||||
// setAnimationSpeed: <speed_real>
|
|
||||||
// showAppOnTop: <set_bool>
|
// showAppOnTop: <set_bool>
|
||||||
// createObject: <qml_string><parentId_int><imports_string_list><filename_string>
|
|
||||||
// destroyObject: <debugId_int>
|
|
||||||
// moveObject: <debugId_int><newParentId_int>
|
|
||||||
// clearCache: void
|
|
||||||
|
|
||||||
const char REQUEST[] = "request";
|
const char REQUEST[] = "request";
|
||||||
const char RESPONSE[] = "response";
|
const char RESPONSE[] = "response";
|
||||||
@@ -53,12 +46,7 @@ const char ENABLE[] = "enable";
|
|||||||
const char DISABLE[] = "disable";
|
const char DISABLE[] = "disable";
|
||||||
const char SELECT[] = "select";
|
const char SELECT[] = "select";
|
||||||
const char RELOAD[] = "reload";
|
const char RELOAD[] = "reload";
|
||||||
const char SET_ANIMATION_SPEED[] = "setAnimationSpeed";
|
|
||||||
const char SHOW_APP_ON_TOP[] = "showAppOnTop";
|
const char SHOW_APP_ON_TOP[] = "showAppOnTop";
|
||||||
const char CREATE_OBJECT[] = "createObject";
|
|
||||||
const char DESTROY_OBJECT[] = "destroyObject";
|
|
||||||
const char MOVE_OBJECT[] = "moveObject";
|
|
||||||
const char CLEAR_CACHE[] = "clearCache";
|
|
||||||
|
|
||||||
namespace QmlDebug {
|
namespace QmlDebug {
|
||||||
|
|
||||||
@@ -66,9 +54,7 @@ QmlToolsClient::QmlToolsClient(QmlDebugConnection *client)
|
|||||||
: BaseToolsClient(client, QLatin1String("QmlInspector")),
|
: BaseToolsClient(client, QLatin1String("QmlInspector")),
|
||||||
m_connection(client),
|
m_connection(client),
|
||||||
m_requestId(0),
|
m_requestId(0),
|
||||||
m_reloadQueryId(-1),
|
m_reloadQueryId(-1)
|
||||||
m_slowDownFactor(1),
|
|
||||||
m_destroyObjectQueryId(-1)
|
|
||||||
{
|
{
|
||||||
setObjectName(name());
|
setObjectName(name());
|
||||||
}
|
}
|
||||||
@@ -88,85 +74,36 @@ void QmlToolsClient::messageReceived(const QByteArray &message)
|
|||||||
if ((m_reloadQueryId != -1) && (m_reloadQueryId == requestId) && success)
|
if ((m_reloadQueryId != -1) && (m_reloadQueryId == requestId) && success)
|
||||||
emit reloaded();
|
emit reloaded();
|
||||||
|
|
||||||
if ((m_destroyObjectQueryId != -1) && (m_destroyObjectQueryId == requestId)
|
|
||||||
&& success && !ds.atEnd()) {
|
|
||||||
int objectDebugId;
|
|
||||||
ds >> objectDebugId;
|
|
||||||
emit destroyedObject(objectDebugId);
|
|
||||||
}
|
|
||||||
|
|
||||||
log(LogReceive, type, QString::fromLatin1("requestId: %1 success: %2")
|
log(LogReceive, type, QString::fromLatin1("requestId: %1 success: %2")
|
||||||
.arg(QString::number(requestId)).arg(QString::number(success)));
|
.arg(QString::number(requestId)).arg(QString::number(success)));
|
||||||
} else if (type == QByteArray(EVENT)) {
|
} else if (type == QByteArray(EVENT)) {
|
||||||
QByteArray event;
|
QByteArray event;
|
||||||
ds >> event;
|
ds >> event;
|
||||||
if (event == QByteArray(SELECT)) {
|
if (event == QByteArray(SELECT)) {
|
||||||
m_currentDebugIds.clear();
|
|
||||||
QList<int> debugIds;
|
QList<int> debugIds;
|
||||||
ds >> debugIds;
|
ds >> debugIds;
|
||||||
|
|
||||||
|
debugIds.removeAll(-1);
|
||||||
|
|
||||||
QStringList debugIdStrings;
|
QStringList debugIdStrings;
|
||||||
foreach (int debugId, debugIds) {
|
foreach (int debugId, debugIds) {
|
||||||
if (debugId != -1) {
|
|
||||||
m_currentDebugIds << debugId;
|
|
||||||
debugIdStrings << QString::number(debugId);
|
debugIdStrings << QString::number(debugId);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
log(LogReceive, type + ':' + event,
|
log(LogReceive, type + ':' + event,
|
||||||
QString::fromLatin1("[%1]").arg(debugIdStrings.join(QLatin1Char(','))));
|
QString::fromLatin1("[%1]").arg(debugIdStrings.join(QLatin1Char(','))));
|
||||||
emit currentObjectsChanged(m_currentDebugIds);
|
emit currentObjectsChanged(debugIds);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log(LogReceive, type, QLatin1String("Warning: Not handling message"));
|
log(LogReceive, type, QLatin1String("Warning: Not handling message"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<int> QmlToolsClient::currentObjects() const
|
|
||||||
{
|
|
||||||
return m_currentDebugIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlToolsClient::setCurrentObjects(const QList<int> &debugIds)
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isOpen())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (debugIds == m_currentDebugIds)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_currentDebugIds = debugIds;
|
|
||||||
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray(REQUEST) << m_requestId++
|
|
||||||
<< QByteArray(SELECT) << m_currentDebugIds;
|
|
||||||
|
|
||||||
log(LogSend, SELECT, QString::fromLatin1("%1 [list of ids]").arg(debugIds.length()));
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlToolsClient::setObjectIdList(
|
void QmlToolsClient::setObjectIdList(
|
||||||
const QList<ObjectReference> &/*objectRoots*/)
|
const QList<ObjectReference> &/*objectRoots*/)
|
||||||
{
|
{
|
||||||
//NOT IMPLEMENTED
|
//NOT IMPLEMENTED
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlToolsClient::clearComponentCache()
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isOpen())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray(REQUEST) << m_requestId++
|
|
||||||
<< QByteArray(CLEAR_CACHE);
|
|
||||||
|
|
||||||
log(LogSend, CLEAR_CACHE);
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlToolsClient::reload(const QHash<QString, QByteArray> &changesHash)
|
void QmlToolsClient::reload(const QHash<QString, QByteArray> &changesHash)
|
||||||
{
|
{
|
||||||
if (!m_connection || !m_connection->isOpen())
|
if (!m_connection || !m_connection->isOpen())
|
||||||
@@ -202,32 +139,6 @@ void QmlToolsClient::setDesignModeBehavior(bool inDesignMode)
|
|||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlToolsClient::setAnimationSpeed(qreal slowDownFactor)
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isOpen())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray(REQUEST) << m_requestId++
|
|
||||||
<< QByteArray(SET_ANIMATION_SPEED) << slowDownFactor;
|
|
||||||
|
|
||||||
log(LogSend, SET_ANIMATION_SPEED, QString::number(slowDownFactor));
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
//Cache non-zero values
|
|
||||||
if (slowDownFactor)
|
|
||||||
m_slowDownFactor = slowDownFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlToolsClient::setAnimationPaused(bool paused)
|
|
||||||
{
|
|
||||||
if (paused)
|
|
||||||
setAnimationSpeed(0);
|
|
||||||
else
|
|
||||||
setAnimationSpeed(m_slowDownFactor);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlToolsClient::changeToSelectTool()
|
void QmlToolsClient::changeToSelectTool()
|
||||||
{
|
{
|
||||||
// NOT IMPLEMENTED
|
// NOT IMPLEMENTED
|
||||||
@@ -258,78 +169,6 @@ void QmlToolsClient::showAppOnTop(bool showOnTop)
|
|||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlToolsClient::createQmlObject(const QString &qmlText,
|
|
||||||
int parentDebugId,
|
|
||||||
const QStringList &imports,
|
|
||||||
const QString &filename, int order)
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isOpen())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray(REQUEST) << m_requestId++
|
|
||||||
<< QByteArray(CREATE_OBJECT)
|
|
||||||
<< qmlText
|
|
||||||
<< parentDebugId
|
|
||||||
<< imports
|
|
||||||
<< filename
|
|
||||||
<< order;
|
|
||||||
|
|
||||||
log(LogSend, CREATE_OBJECT, QString::fromLatin1("%1 %2 [%3] %4").arg(qmlText,
|
|
||||||
QString::number(parentDebugId),
|
|
||||||
imports.join(QLatin1Char(',')), filename));
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlToolsClient::destroyQmlObject(int debugId)
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isOpen())
|
|
||||||
return;
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
m_destroyObjectQueryId = m_requestId;
|
|
||||||
ds << QByteArray(REQUEST) << m_requestId++
|
|
||||||
<< QByteArray(DESTROY_OBJECT) << debugId;
|
|
||||||
|
|
||||||
log(LogSend, DESTROY_OBJECT, QString::number(debugId));
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlToolsClient::reparentQmlObject(int debugId, int newParent)
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isOpen())
|
|
||||||
return;
|
|
||||||
QByteArray message;
|
|
||||||
QDataStream ds(&message, QIODevice::WriteOnly);
|
|
||||||
ds << QByteArray(REQUEST) << m_requestId++
|
|
||||||
<< QByteArray(MOVE_OBJECT) << debugId << newParent;
|
|
||||||
|
|
||||||
log(LogSend, MOVE_OBJECT, QString::fromLatin1("%1 %2").arg(QString::number(debugId),
|
|
||||||
QString::number(newParent)));
|
|
||||||
|
|
||||||
sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void QmlToolsClient::applyChangesToQmlFile()
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isOpen())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlToolsClient::applyChangesFromQmlFile()
|
|
||||||
{
|
|
||||||
if (!m_connection || !m_connection->isOpen())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlToolsClient::log(LogDirection direction,
|
void QmlToolsClient::log(LogDirection direction,
|
||||||
const QByteArray &message,
|
const QByteArray &message,
|
||||||
const QString &extra)
|
const QString &extra)
|
||||||
|
@@ -41,33 +41,17 @@ class QMLDEBUG_EXPORT QmlToolsClient : public BaseToolsClient
|
|||||||
public:
|
public:
|
||||||
explicit QmlToolsClient(QmlDebugConnection *client);
|
explicit QmlToolsClient(QmlDebugConnection *client);
|
||||||
|
|
||||||
void setCurrentObjects(const QList<int> &debugIds);
|
|
||||||
void reload(const QHash<QString, QByteArray> &changesHash);
|
void reload(const QHash<QString, QByteArray> &changesHash);
|
||||||
bool supportReload() const { return true; }
|
bool supportReload() const { return true; }
|
||||||
void setDesignModeBehavior(bool inDesignMode);
|
void setDesignModeBehavior(bool inDesignMode);
|
||||||
void setAnimationSpeed(qreal slowDownFactor);
|
|
||||||
void setAnimationPaused(bool paused);
|
|
||||||
void changeToSelectTool();
|
void changeToSelectTool();
|
||||||
void changeToSelectMarqueeTool();
|
void changeToSelectMarqueeTool();
|
||||||
void changeToZoomTool();
|
void changeToZoomTool();
|
||||||
void showAppOnTop(bool showOnTop);
|
void showAppOnTop(bool showOnTop);
|
||||||
|
|
||||||
void createQmlObject(const QString &qmlText, int parentDebugId,
|
|
||||||
const QStringList &imports, const QString &filename,
|
|
||||||
int order);
|
|
||||||
void destroyQmlObject(int debugId);
|
|
||||||
void reparentQmlObject(int debugId, int newParent);
|
|
||||||
|
|
||||||
void applyChangesToQmlFile();
|
|
||||||
void applyChangesFromQmlFile();
|
|
||||||
|
|
||||||
QList<int> currentObjects() const;
|
|
||||||
|
|
||||||
// ### Qt 4.8: remove if we can have access to qdeclarativecontextdata or id's
|
// ### Qt 4.8: remove if we can have access to qdeclarativecontextdata or id's
|
||||||
void setObjectIdList(const QList<ObjectReference> &objectRoots);
|
void setObjectIdList(const QList<ObjectReference> &objectRoots);
|
||||||
|
|
||||||
void clearComponentCache();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void messageReceived(const QByteArray &);
|
void messageReceived(const QByteArray &);
|
||||||
|
|
||||||
@@ -77,12 +61,9 @@ private:
|
|||||||
const QString &extra = QString());
|
const QString &extra = QString());
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<int> m_currentDebugIds;
|
|
||||||
QmlDebugConnection *m_connection;
|
QmlDebugConnection *m_connection;
|
||||||
int m_requestId;
|
int m_requestId;
|
||||||
int m_reloadQueryId;
|
int m_reloadQueryId;
|
||||||
qreal m_slowDownFactor;
|
|
||||||
int m_destroyObjectQueryId;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDebug
|
} // namespace QmlDebug
|
||||||
|
Reference in New Issue
Block a user