From 87327515d70f5b66ce5f3f894f9b90ed649b200d Mon Sep 17 00:00:00 2001 From: Aurindam Jana Date: Tue, 24 Apr 2012 09:23:13 +0200 Subject: Debugger: Change name and protocol of QDeclarativeObserverMode Rename QDeclarativeObserverMode to QmlInspector service. This is because the current protocol has been changed completely and just a version change is misleading. Change-Id: I3b72f081f6ab77eac474dcef7a84375ef69e20dc Reviewed-by: Kai Koehne --- .../qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro | 1 - .../qmldbg_qtquick2/qquickviewinspector.cpp | 28 +- .../qmldbg_qtquick2/qquickviewinspector.h | 4 - .../qmltooling/shared/abstractviewinspector.cpp | 377 ++++++++------------- .../qmltooling/shared/abstractviewinspector.h | 49 +-- .../qmltooling/shared/qqmlinspectorprotocol.h | 133 -------- 6 files changed, 149 insertions(+), 443 deletions(-) delete mode 100644 src/plugins/qmltooling/shared/qqmlinspectorprotocol.h (limited to 'src/plugins') diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro b/src/plugins/qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro index f40e3f0b04..b031657b20 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro +++ b/src/plugins/qmltooling/qmldbg_qtquick2/qmldbg_qtquick2.pro @@ -23,7 +23,6 @@ HEADERS += \ qquickviewinspector.h \ ../shared/abstracttool.h \ ../shared/abstractviewinspector.h \ - ../shared/qqmlinspectorprotocol.h \ ../shared/qmlinspectorconstants.h \ inspecttool.h diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp index cc3f3703aa..243a821cc5 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp +++ b/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp @@ -41,7 +41,6 @@ #include "qquickviewinspector.h" -#include "qqmlinspectorprotocol.h" #include "highlight.h" #include "inspecttool.h" @@ -121,8 +120,7 @@ QQuickViewInspector::QQuickViewInspector(QQuickView *view, QObject *parent) : AbstractViewInspector(parent), m_view(view), m_overlay(new QQuickItem), - m_inspectTool(new InspectTool(this, view)), - m_designMode(true) + m_inspectTool(new InspectTool(this, view)) { // Try to make sure the overlay is always on top m_overlay->setZ(FLT_MAX); @@ -131,7 +129,7 @@ QQuickViewInspector::QQuickViewInspector(QQuickView *view, QObject *parent) : m_overlay->setParentItem(root); view->installEventFilter(this); - setCurrentTool(m_inspectTool); + appendTool(m_inspectTool); } void QQuickViewInspector::changeCurrentObjects(const QList &objects) @@ -144,12 +142,6 @@ void QQuickViewInspector::changeCurrentObjects(const QList &objects) syncSelectedItems(items); } -void QQuickViewInspector::reloadView() -{ - // TODO - emit reloadRequested(); -} - void QQuickViewInspector::reparentQmlObject(QObject *object, QObject *newParent) { if (!newParent) @@ -162,22 +154,6 @@ void QQuickViewInspector::reparentQmlObject(QObject *object, QObject *newParent) item->setParentItem(newParentItem); } -void QQuickViewInspector::changeTool(InspectorProtocol::Tool tool) -{ - switch (tool) { - case InspectorProtocol::SelectMarqueeTool: - // TODO - emit marqueeSelectToolActivated(); - break; - case InspectorProtocol::InspectTool: - setCurrentTool(m_inspectTool); - emit inspectToolActivated(); - break; - default: - break; - } -} - QWindow *getMasterWindow(QWindow *w) { QWindow *p = w->parent(); diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.h b/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.h index c523ea2cd0..d6258c5ec1 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.h +++ b/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.h @@ -66,9 +66,7 @@ public: // AbstractViewInspector void changeCurrentObjects(const QList &objects); - void reloadView(); void reparentQmlObject(QObject *object, QObject *newParent); - void changeTool(InspectorProtocol::Tool tool); Qt::WindowFlags windowFlags() const; void setWindowFlags(Qt::WindowFlags flags); QQmlEngine *declarativeEngine() const; @@ -103,8 +101,6 @@ private: QList > m_selectedItems; QHash m_highlightItems; - - bool m_designMode; }; } // namespace QtQuick2 diff --git a/src/plugins/qmltooling/shared/abstractviewinspector.cpp b/src/plugins/qmltooling/shared/abstractviewinspector.cpp index 0dd3012165..5784f64011 100644 --- a/src/plugins/qmltooling/shared/abstractviewinspector.cpp +++ b/src/plugins/qmltooling/shared/abstractviewinspector.cpp @@ -42,8 +42,8 @@ #include "abstractviewinspector.h" #include "abstracttool.h" -#include "qqmlinspectorprotocol.h" +#include #include #include #include @@ -53,17 +53,41 @@ #include #include +//INSPECTOR SERVICE PROTOCOL +//
+//
: [] +// : {"enable", "disable", "select", "setAnimationSpeed", +// "showAppOnTop", "createObject", "destroyObject", "moveObject", +// "clearCache"} +// : select: +// setAnimationSpeed: +// showAppOnTop: +// createObject: +// destroyObject: +// moveObject: +// clearCache: void + +const char REQUEST[] = "request"; +const char RESPONSE[] = "response"; +const char EVENT[] = "event"; +const char ENABLE[] = "enable"; +const char DISABLE[] = "disable"; +const char SELECT[] = "select"; +const char SET_ANIMATION_SPEED[] = "setAnimationSpeed"; +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 QmlJSDebugger { AbstractViewInspector::AbstractViewInspector(QObject *parent) : QObject(parent), - m_currentTool(0), - m_showAppOnTop(false), - m_designModeBehavior(false), - m_animationPaused(false), - m_slowDownFactor(1.0), - m_debugService(QQmlInspectorService::instance()) + m_enabled(false), + m_debugService(QQmlInspectorService::instance()), + m_eventId(0) { } @@ -95,58 +119,20 @@ void AbstractViewInspector::clearComponentCache() declarativeEngine()->clearComponentCache(); } -void AbstractViewInspector::setDesignModeBehavior(bool value) +void AbstractViewInspector::setEnabled(bool value) { - if (m_designModeBehavior == value) + if (m_enabled == value) return; - m_designModeBehavior = value; - m_currentTool->enable(m_designModeBehavior); - emit designModeBehaviorChanged(value); - sendDesignModeBehavior(value); + m_enabled = value; + foreach (AbstractTool *tool, m_tools) + tool->enable(m_enabled); } void AbstractViewInspector::setAnimationSpeed(qreal slowDownFactor) { - Q_ASSERT(slowDownFactor > 0); - if (m_slowDownFactor == slowDownFactor) - return; - - animationSpeedChangeRequested(slowDownFactor); - sendAnimationSpeed(slowDownFactor); -} - -void AbstractViewInspector::setAnimationPaused(bool paused) -{ - if (m_animationPaused == paused) - return; - - animationPausedChangeRequested(paused); - sendAnimationPaused(paused); -} - -void AbstractViewInspector::animationSpeedChangeRequested(qreal factor) -{ - if (m_slowDownFactor != factor) { - m_slowDownFactor = factor; - emit animationSpeedChanged(factor); - } - - const float effectiveFactor = m_animationPaused ? 0 : factor; - QUnifiedTimer::instance()->setSlowModeEnabled(effectiveFactor != 1.0); - QUnifiedTimer::instance()->setSlowdownFactor(effectiveFactor); -} - -void AbstractViewInspector::animationPausedChangeRequested(bool paused) -{ - if (m_animationPaused != paused) { - m_animationPaused = paused; - emit animationPausedChanged(paused); - } - - const float effectiveFactor = paused ? 0 : m_slowDownFactor; - QUnifiedTimer::instance()->setSlowModeEnabled(effectiveFactor != 1.0); - QUnifiedTimer::instance()->setSlowdownFactor(effectiveFactor); + QUnifiedTimer::instance()->setSlowModeEnabled(slowDownFactor != 1.0); + QUnifiedTimer::instance()->setSlowdownFactor(slowDownFactor); } void AbstractViewInspector::setShowAppOnTop(bool appOnTop) @@ -158,26 +144,11 @@ void AbstractViewInspector::setShowAppOnTop(bool appOnTop) flags &= ~Qt::WindowStaysOnTopHint; setWindowFlags(flags); - - m_showAppOnTop = appOnTop; - sendShowAppOnTop(appOnTop); - - emit showAppOnTopChanged(appOnTop); -} - -void AbstractViewInspector::changeToInspectTool() -{ - changeTool(InspectorProtocol::InspectTool); -} - -void AbstractViewInspector::changeToMarqueeSelectTool() -{ - changeTool(InspectorProtocol::SelectMarqueeTool); } bool AbstractViewInspector::eventFilter(QObject *obj, QEvent *event) { - if (!designModeBehavior()) + if (!enabled()) return QObject::eventFilter(obj, event); switch (event->type()) { @@ -228,243 +199,165 @@ bool AbstractViewInspector::eventFilter(QObject *obj, QEvent *event) bool AbstractViewInspector::leaveEvent(QEvent *event) { - m_currentTool->leaveEvent(event); + foreach (AbstractTool *tool, m_tools) + tool->leaveEvent(event); return true; } bool AbstractViewInspector::mousePressEvent(QMouseEvent *event) { - m_currentTool->mousePressEvent(event); + foreach (AbstractTool *tool, m_tools) + tool->mousePressEvent(event); return true; } bool AbstractViewInspector::mouseMoveEvent(QMouseEvent *event) { if (event->buttons()) { - m_currentTool->mouseMoveEvent(event); + foreach (AbstractTool *tool, m_tools) + tool->mouseMoveEvent(event); } else { - m_currentTool->hoverMoveEvent(event); + foreach (AbstractTool *tool, m_tools) + tool->hoverMoveEvent(event); } return true; } bool AbstractViewInspector::mouseReleaseEvent(QMouseEvent *event) { - m_currentTool->mouseReleaseEvent(event); + foreach (AbstractTool *tool, m_tools) + tool->mouseReleaseEvent(event); return true; } bool AbstractViewInspector::keyPressEvent(QKeyEvent *event) { - m_currentTool->keyPressEvent(event); + foreach (AbstractTool *tool, m_tools) + tool->keyPressEvent(event); return true; } bool AbstractViewInspector::keyReleaseEvent(QKeyEvent *event) { - switch (event->key()) { - case Qt::Key_V: - changeTool(InspectorProtocol::InspectTool); - break; -// disabled because multiselection does not do anything useful without design mode -// case Qt::Key_M: -// changeTool(InspectorProtocol::SelectMarqueeTool); -// break; - case Qt::Key_Space: - setAnimationPaused(!animationPaused()); - break; - default: - break; - } - - m_currentTool->keyReleaseEvent(event); + foreach (AbstractTool *tool, m_tools) + tool->keyReleaseEvent(event); return true; } bool AbstractViewInspector::mouseDoubleClickEvent(QMouseEvent *event) { - m_currentTool->mouseDoubleClickEvent(event); + foreach (AbstractTool *tool, m_tools) + tool->mouseDoubleClickEvent(event); return true; } bool AbstractViewInspector::wheelEvent(QWheelEvent *event) { - m_currentTool->wheelEvent(event); + foreach (AbstractTool *tool, m_tools) + tool->wheelEvent(event); return true; } bool AbstractViewInspector::touchEvent(QTouchEvent *event) { - m_currentTool->touchEvent(event); + foreach (AbstractTool *tool, m_tools) + tool->touchEvent(event); return true; } void AbstractViewInspector::handleMessage(const QByteArray &message) { + bool success = true; QDataStream ds(message); - InspectorProtocol::Message type; + QByteArray type; ds >> type; - switch (type) { - case InspectorProtocol::SetCurrentObjects: { - int itemCount = 0; - ds >> itemCount; - - QList selectedObjects; - for (int i = 0; i < itemCount; ++i) { - int debugId = -1; + int requestId = -1; + if (type == REQUEST) { + QByteArray command; + ds >> requestId >> command; + + if (command == ENABLE) { + setEnabled(true); + + } else if (command == DISABLE) { + setEnabled(false); + + } else if (command == SELECT) { + QList debugIds; + ds >> debugIds; + + QList selectedObjects; + foreach (int debugId, debugIds) { + if (QObject *obj = QQmlDebugService::objectForId(debugId)) + selectedObjects << obj; + } + if (m_enabled) + changeCurrentObjects(selectedObjects); + + } else if (command == SET_ANIMATION_SPEED) { + qreal speed; + ds >> speed; + setAnimationSpeed(speed); + + } else if (command == SHOW_APP_ON_TOP) { + bool showOnTop; + ds >> showOnTop; + setShowAppOnTop(showOnTop); + + } else if (command == CREATE_OBJECT) { + QString qml; + int parentId; + QString filename; + QStringList imports; + ds >> qml >> parentId >> imports >> filename; + createQmlObject(qml, QQmlDebugService::objectForId(parentId), + imports, filename); + + } else if (command == DESTROY_OBJECT) { + int debugId; ds >> debugId; if (QObject *obj = QQmlDebugService::objectForId(debugId)) - selectedObjects << obj; - } - if (m_designModeBehavior) - changeCurrentObjects(selectedObjects); - break; - } - case InspectorProtocol::Reload: { - reloadView(); - break; - } - case InspectorProtocol::SetAnimationSpeed: { - qreal speed; - ds >> speed; - animationSpeedChangeRequested(speed); - break; - } - case InspectorProtocol::SetAnimationPaused: { - bool paused; - ds >> paused; - animationPausedChangeRequested(paused); - break; - } - case InspectorProtocol::ChangeTool: { - InspectorProtocol::Tool tool; - ds >> tool; - changeTool(tool); - break; - } - case InspectorProtocol::SetDesignMode: { - bool inDesignMode; - ds >> inDesignMode; - setDesignModeBehavior(inDesignMode); - break; - } - case InspectorProtocol::ShowAppOnTop: { - bool showOnTop; - ds >> showOnTop; - setShowAppOnTop(showOnTop); - break; - } - case InspectorProtocol::CreateObject: { - QString qml; - int parentId; - QString filename; - QStringList imports; - ds >> qml >> parentId >> imports >> filename; - createQmlObject(qml, QQmlDebugService::objectForId(parentId), - imports, filename); - break; - } - case InspectorProtocol::DestroyObject: { - int debugId; - ds >> debugId; - if (QObject *obj = QQmlDebugService::objectForId(debugId)) - obj->deleteLater(); - break; - } - case InspectorProtocol::MoveObject: { - int debugId, newParent; - ds >> debugId >> newParent; - reparentQmlObject(QQmlDebugService::objectForId(debugId), - QQmlDebugService::objectForId(newParent)); - break; - } - case InspectorProtocol::ClearComponentCache: { - clearComponentCache(); - break; - } - default: - qWarning() << "Warning: Not handling message:" << type; - } -} - -void AbstractViewInspector::sendDesignModeBehavior(bool inDesignMode) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + obj->deleteLater(); - ds << InspectorProtocol::SetDesignMode - << inDesignMode; + } else if (command == MOVE_OBJECT) { + int debugId, newParent; + ds >> debugId >> newParent; + reparentQmlObject(QQmlDebugService::objectForId(debugId), + QQmlDebugService::objectForId(newParent)); - m_debugService->sendMessage(message); -} + } else if (command == CLEAR_CACHE) { + clearComponentCache(); -void AbstractViewInspector::sendCurrentObjects(const QList &objects) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); + } else { + qWarning() << "Warning: Not handling command:" << command; + success = false; - ds << InspectorProtocol::CurrentObjectsChanged - << objects.length(); + } + } else { + qWarning() << "Warning: Not handling type:" << type << REQUEST; + success = false; - foreach (QObject *object, objects) { - int id = QQmlDebugService::idForObject(object); - ds << id; } - m_debugService->sendMessage(message); -} - -void AbstractViewInspector::sendCurrentTool(Constants::DesignTool toolId) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::ToolChanged - << toolId; - - m_debugService->sendMessage(message); + QByteArray response; + QDataStream rs(&response, QIODevice::WriteOnly); + rs << QByteArray(RESPONSE) << requestId << success; + m_debugService->sendMessage(response); } -void AbstractViewInspector::sendAnimationSpeed(qreal slowDownFactor) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::AnimationSpeedChanged - << slowDownFactor; - - m_debugService->sendMessage(message); -} - -void AbstractViewInspector::sendAnimationPaused(bool paused) +void AbstractViewInspector::sendCurrentObjects(const QList &objects) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << InspectorProtocol::AnimationPausedChanged - << paused; - - m_debugService->sendMessage(message); -} + ds << QByteArray(EVENT) << m_eventId++ << QByteArray(SELECT); -void AbstractViewInspector::sendReloaded() -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::Reloaded; - - m_debugService->sendMessage(message); -} - -void AbstractViewInspector::sendShowAppOnTop(bool showAppOnTop) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << InspectorProtocol::ShowAppOnTop << showAppOnTop; + QList debugIds; + foreach (QObject *object, objects) + debugIds << QQmlDebugService::idForObject(object); + ds << debugIds; m_debugService->sendMessage(message); } @@ -480,4 +373,14 @@ QString AbstractViewInspector::idStringForObject(QObject *obj) const return QString(); } +void AbstractViewInspector::appendTool(AbstractTool *tool) +{ + m_tools.append(tool); +} + +void AbstractViewInspector::removeTool(AbstractTool *tool) +{ + m_tools.removeOne(tool); +} + } // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/shared/abstractviewinspector.h b/src/plugins/qmltooling/shared/abstractviewinspector.h index bbd3fc8e12..d2dd9557da 100644 --- a/src/plugins/qmltooling/shared/abstractviewinspector.h +++ b/src/plugins/qmltooling/shared/abstractviewinspector.h @@ -46,7 +46,6 @@ #include #include -#include "qqmlinspectorprotocol.h" #include "qmlinspectorconstants.h" QT_BEGIN_NAMESPACE @@ -80,42 +79,22 @@ public: const QString &filename = QString()); void clearComponentCache(); - bool showAppOnTop() const { return m_showAppOnTop; } - bool designModeBehavior() const { return m_designModeBehavior; } - - bool animationPaused() const { return m_animationPaused; } - qreal slowDownFactor() const { return m_slowDownFactor; } + bool enabled() const { return m_enabled; } void sendCurrentObjects(const QList &); - void sendAnimationSpeed(qreal slowDownFactor); - void sendAnimationPaused(bool paused); - void sendCurrentTool(Constants::DesignTool toolId); - void sendReloaded(); - void sendShowAppOnTop(bool showAppOnTop); QString idStringForObject(QObject *obj) const; virtual void changeCurrentObjects(const QList &objects) = 0; - virtual void reloadView() = 0; virtual void reparentQmlObject(QObject *object, QObject *newParent) = 0; - virtual void changeTool(InspectorProtocol::Tool tool) = 0; virtual Qt::WindowFlags windowFlags() const = 0; virtual void setWindowFlags(Qt::WindowFlags flags) = 0; virtual QQmlEngine *declarativeEngine() const = 0; -signals: - void designModeBehaviorChanged(bool inDesignMode); - void showAppOnTopChanged(bool showAppOnTop); - void reloadRequested(); - void marqueeSelectToolActivated(); - void inspectToolActivated(); - - void animationSpeedChanged(qreal factor); - void animationPausedChanged(bool paused); + void appendTool(AbstractTool *tool); + void removeTool(AbstractTool *tool); protected: - AbstractTool *currentTool() const { return m_currentTool; } - void setCurrentTool(AbstractTool *tool) { m_currentTool = tool; } bool eventFilter(QObject *, QEvent *); virtual bool leaveEvent(QEvent *); @@ -129,31 +108,17 @@ protected: virtual bool touchEvent(QTouchEvent *event); private: - void sendDesignModeBehavior(bool inDesignMode); - - void changeToZoomTool(); - void changeToInspectTool(); - void changeToMarqueeSelectTool(); - - virtual void setDesignModeBehavior(bool value); + void setEnabled(bool value); void setShowAppOnTop(bool appOnTop); void setAnimationSpeed(qreal factor); - void setAnimationPaused(bool paused); - - void animationSpeedChangeRequested(qreal factor); - void animationPausedChangeRequested(bool paused); - - AbstractTool *m_currentTool; - - bool m_showAppOnTop; - bool m_designModeBehavior; - bool m_animationPaused; - qreal m_slowDownFactor; + bool m_enabled; QQmlInspectorService *m_debugService; + QList m_tools; + int m_eventId; }; } // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/shared/qqmlinspectorprotocol.h b/src/plugins/qmltooling/shared/qqmlinspectorprotocol.h deleted file mode 100644 index 1614e2e0af..0000000000 --- a/src/plugins/qmltooling/shared/qqmlinspectorprotocol.h +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQMLINSPECTORPROTOCOL_H -#define QQMLINSPECTORPROTOCOL_H - -#include -#include -#include -#include - -namespace QmlJSDebugger { - -class InspectorProtocol : public QObject -{ - Q_OBJECT - Q_ENUMS(Message Tool) - -public: - enum Message { - AnimationSpeedChanged = 0, - AnimationPausedChanged = 19, // highest value - ChangeTool = 1, - ClearComponentCache = 2, - CreateObject = 5, - CurrentObjectsChanged = 6, - DestroyObject = 7, - MoveObject = 8, - Reload = 10, - Reloaded = 11, - SetAnimationSpeed = 12, - SetAnimationPaused = 18, - SetCurrentObjects = 14, - SetDesignMode = 15, - ShowAppOnTop = 16, - ToolChanged = 17 - }; - - enum Tool { - SelectMarqueeTool = 1, - InspectTool - }; - - static inline QString toString(Message message) - { - return QLatin1String(staticMetaObject.enumerator(0).valueToKey(message)); - } - - static inline QString toString(Tool tool) - { - return QLatin1String(staticMetaObject.enumerator(1).valueToKey(tool)); - } -}; - -inline QDataStream & operator<< (QDataStream &stream, InspectorProtocol::Message message) -{ - return stream << static_cast(message); -} - -inline QDataStream & operator>> (QDataStream &stream, InspectorProtocol::Message &message) -{ - quint32 i; - stream >> i; - message = static_cast(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(tool); -} - -inline QDataStream & operator>> (QDataStream &stream, InspectorProtocol::Tool &tool) -{ - quint32 i; - stream >> i; - tool = static_cast(i); - return stream; -} - -inline QDebug operator<< (QDebug dbg, InspectorProtocol::Tool tool) -{ - dbg << InspectorProtocol::toString(tool); - return dbg; -} - -} // namespace QmlJSDebugger - -#endif // QQMLINSPECTORPROTOCOL_H -- cgit v1.2.3