QmlJSInspector: Disable Zoom Tool for QmlDebugger

Zoom Tool and Select Tool are combined for QmlDebugger.
The Zoom Tool is enabled only for backwards compatibility.

Change-Id: Id66eb94ce0535ccac169fa5a80f937370a0f9f6f
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
Aurindam Jana
2012-04-02 10:30:29 +02:00
parent 1074f9a5e1
commit e32f2d7ffd
8 changed files with 32 additions and 7 deletions

View File

@@ -30,12 +30,13 @@
**************************************************************************/ **************************************************************************/
#include "qmldebuggerclient.h" #include "qmldebuggerclient.h"
#include "qmljsdebugclientconstants.h"
namespace QmlJsDebugClient { namespace QmlJsDebugClient {
QmlDebuggerClient::QmlDebuggerClient( QmlDebuggerClient::QmlDebuggerClient(
QDeclarativeDebugConnection *connection) QDeclarativeDebugConnection *connection)
: QmlEngineDebugClient(QLatin1String("QmlDebugger"), connection) : QmlEngineDebugClient(QLatin1String(Constants::QML_DEBUGGER), connection)
{ {
} }

View File

@@ -30,8 +30,7 @@
**************************************************************************/ **************************************************************************/
#include "qmlenginedebugclient.h" #include "qmlenginedebugclient.h"
#include "qmljsdebugclientconstants.h"
const float CURRENT_SUPPORTED_VERSION = 2.0;
namespace QmlJsDebugClient { namespace QmlJsDebugClient {
@@ -80,7 +79,7 @@ void QmlEngineDebugClient::decode(QDataStream &ds,
ds >> data; ds >> data;
int parentId = -1; int parentId = -1;
if (objectName() == QLatin1String("QmlDebugger") && if (objectName() == QLatin1String("QmlDebugger") &&
serviceVersion() >= CURRENT_SUPPORTED_VERSION ) serviceVersion() >= Constants::CURRENT_SUPPORTED_VERSION )
ds >> parentId; ds >> parentId;
o.m_debugId = data.objectId; o.m_debugId = data.objectId;
o.m_className = data.objectType; o.m_className = data.objectType;

View File

@@ -44,6 +44,9 @@ const char STR_IGNORING_DEBUGGER[] = "Ignoring \"-qmljsdebugger=";
const char STR_IGNORING_DEBUGGER2[] = "Ignoring\"-qmljsdebugger="; // There is (was?) a bug in one of the error strings - safest to handle both const char STR_IGNORING_DEBUGGER2[] = "Ignoring\"-qmljsdebugger="; // There is (was?) a bug in one of the error strings - safest to handle both
const char STR_CONNECTION_ESTABLISHED[] = "Connection established"; const char STR_CONNECTION_ESTABLISHED[] = "Connection established";
const char QML_DEBUGGER[] = "QmlDebugger";
const float CURRENT_SUPPORTED_VERSION = 2.0;
} // namespace Constants } // namespace Constants
} // namespace QmlJsDebugClient } // namespace QmlJsDebugClient

View File

@@ -127,6 +127,11 @@ void ClientProxy::clientStatusChanged(QDeclarativeDebugClient::Status status)
updateConnected(); updateConnected();
} }
QDeclarativeDebugClient *ClientProxy::qmlDebugger() const
{
return m_engineClient;
}
void ClientProxy::engineClientStatusChanged(QDeclarativeDebugClient::Status status) void ClientProxy::engineClientStatusChanged(QDeclarativeDebugClient::Status status)
{ {
if (status == QDeclarativeDebugClient::Enabled) { if (status == QDeclarativeDebugClient::Enabled) {

View File

@@ -99,6 +99,8 @@ public:
void fetchContextObjectRecursive(const QmlDebugContextReference &context, bool clear); void fetchContextObjectRecursive(const QmlDebugContextReference &context, bool clear);
void insertObjectInTreeIfNeeded(const QmlDebugObjectReference &object); void insertObjectInTreeIfNeeded(const QmlDebugObjectReference &object);
QDeclarativeDebugClient *qmlDebugger() const;
signals: signals:
void objectTreeUpdated(); void objectTreeUpdated();
void connectionStatusMessage(const QString &text); void connectionStatusMessage(const QString &text);

View File

@@ -50,6 +50,7 @@
#include <debugger/qml/qmlengine.h> #include <debugger/qml/qmlengine.h>
#include <debugger/debuggerstartparameters.h> #include <debugger/debuggerstartparameters.h>
#include <debugger/qml/qmladapter.h> #include <debugger/qml/qmladapter.h>
#include <qmljsdebugclient/qmljsdebugclientconstants.h>
#include <utils/filterlineedit.h> #include <utils/filterlineedit.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -315,7 +316,12 @@ void InspectorUi::connected(ClientProxy *clientProxy)
if (m_clientProxy) if (m_clientProxy)
connect(m_clientProxy, SIGNAL(result(quint32,QVariant)), connect(m_clientProxy, SIGNAL(result(quint32,QVariant)),
SLOT(onResult(quint32,QVariant))); SLOT(onResult(quint32,QVariant)));
using namespace QmlJsDebugClient::Constants;
if (m_clientProxy->qmlDebugger()->objectName() == QML_DEBUGGER &&
m_clientProxy->qmlDebugger()->serviceVersion() >= CURRENT_SUPPORTED_VERSION)
m_toolBar->setZoomToolEnabled(false);
else
m_toolBar->setZoomToolEnabled(true);
QmlJS::Snapshot snapshot = modelManager()->snapshot(); QmlJS::Snapshot snapshot = modelManager()->snapshot();
for (QHash<QString, QmlJSLiveTextPreview *>::const_iterator it = m_textPreviews.constBegin(); for (QHash<QString, QmlJSLiveTextPreview *>::const_iterator it = m_textPreviews.constBegin();
it != m_textPreviews.constEnd(); ++it) { it != m_textPreviews.constEnd(); ++it) {

View File

@@ -79,7 +79,8 @@ QmlJsInspectorToolBar::QmlJsInspectorToolBar(QObject *parent) :
m_animationSpeed(1.0f), m_animationSpeed(1.0f),
m_designModeActive(false), m_designModeActive(false),
m_activeTool(NoTool), m_activeTool(NoTool),
m_barWidget(0) m_barWidget(0),
m_zoomActionEnable(true)
{ {
} }
@@ -89,7 +90,7 @@ void QmlJsInspectorToolBar::setEnabled(bool value)
m_showAppOnTopAction->setEnabled(value); m_showAppOnTopAction->setEnabled(value);
m_playAction->setEnabled(value); m_playAction->setEnabled(value);
m_selectAction->setEnabled(value); m_selectAction->setEnabled(value);
m_zoomAction->setEnabled(value); m_zoomAction->setEnabled(value && m_zoomActionEnable);
} }
void QmlJsInspectorToolBar::enable() void QmlJsInspectorToolBar::enable()
@@ -162,6 +163,12 @@ void QmlJsInspectorToolBar::setShowAppOnTop(bool showAppOnTop)
m_emitSignals = true; m_emitSignals = true;
} }
void QmlJsInspectorToolBar::setZoomToolEnabled(bool enable)
{
m_zoomActionEnable = enable;
m_zoomAction->setEnabled(m_zoomActionEnable);
}
void QmlJsInspectorToolBar::createActions() void QmlJsInspectorToolBar::createActions()
{ {
Core::Context context(Debugger::Constants::C_QMLDEBUGGER); Core::Context context(Debugger::Constants::C_QMLDEBUGGER);

View File

@@ -71,6 +71,7 @@ public:
void createActions(); void createActions();
QWidget *widget() const; QWidget *widget() const;
void readSettings(); void readSettings();
void setZoomToolEnabled(bool enable);
public slots: public slots:
void writeSettings() const; void writeSettings() const;
@@ -137,6 +138,7 @@ private:
DesignTool m_activeTool; DesignTool m_activeTool;
QWidget *m_barWidget; QWidget *m_barWidget;
bool m_zoomActionEnable;
}; };
} // namespace Internal } // namespace Internal