forked from qt-creator/qt-creator
QmlEngine: Cleanup
Merge private class back to public one. Change-Id: I3255036ff60738418e2997dbeba97642afe87558 Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
This commit is contained in:
@@ -143,7 +143,7 @@ void QmlAdapter::debugClientStatusChanged(QmlDebugClient::Status status)
|
|||||||
QmlDebugClient *client = qobject_cast<QmlDebugClient*>(sender());
|
QmlDebugClient *client = qobject_cast<QmlDebugClient*>(sender());
|
||||||
QTC_ASSERT(client, return);
|
QTC_ASSERT(client, return);
|
||||||
|
|
||||||
m_qmlClient = qobject_cast<Internal::BaseQmlDebuggerClient *>(client);
|
m_qmlClient = qobject_cast<BaseQmlDebuggerClient *>(client);
|
||||||
m_qmlClient->startSession();
|
m_qmlClient->startSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,13 +192,13 @@ void QmlAdapter::checkConnectionState()
|
|||||||
|
|
||||||
void QmlAdapter::createDebuggerClients()
|
void QmlAdapter::createDebuggerClients()
|
||||||
{
|
{
|
||||||
Internal::QScriptDebuggerClient *debugClient1 = new Internal::QScriptDebuggerClient(m_conn);
|
QScriptDebuggerClient *debugClient1 = new QScriptDebuggerClient(m_conn);
|
||||||
connect(debugClient1, SIGNAL(newStatus(QmlDebugClient::Status)),
|
connect(debugClient1, SIGNAL(newStatus(QmlDebugClient::Status)),
|
||||||
this, SLOT(clientStatusChanged(QmlDebugClient::Status)));
|
this, SLOT(clientStatusChanged(QmlDebugClient::Status)));
|
||||||
connect(debugClient1, SIGNAL(newStatus(QmlDebugClient::Status)),
|
connect(debugClient1, SIGNAL(newStatus(QmlDebugClient::Status)),
|
||||||
this, SLOT(debugClientStatusChanged(QmlDebugClient::Status)));
|
this, SLOT(debugClientStatusChanged(QmlDebugClient::Status)));
|
||||||
|
|
||||||
Internal::QmlV8DebuggerClient *debugClient2 = new Internal::QmlV8DebuggerClient(m_conn);
|
QmlV8DebuggerClient *debugClient2 = new QmlV8DebuggerClient(m_conn);
|
||||||
connect(debugClient2, SIGNAL(newStatus(QmlDebugClient::Status)),
|
connect(debugClient2, SIGNAL(newStatus(QmlDebugClient::Status)),
|
||||||
this, SLOT(clientStatusChanged(QmlDebugClient::Status)));
|
this, SLOT(clientStatusChanged(QmlDebugClient::Status)));
|
||||||
connect(debugClient2, SIGNAL(newStatus(QmlDebugClient::Status)),
|
connect(debugClient2, SIGNAL(newStatus(QmlDebugClient::Status)),
|
||||||
@@ -207,8 +207,8 @@ void QmlAdapter::createDebuggerClients()
|
|||||||
m_debugClients.insert(debugClient1->name(),debugClient1);
|
m_debugClients.insert(debugClient1->name(),debugClient1);
|
||||||
m_debugClients.insert(debugClient2->name(),debugClient2);
|
m_debugClients.insert(debugClient2->name(),debugClient2);
|
||||||
|
|
||||||
debugClient1->setEngine((Internal::QmlEngine*)(m_engine.data()));
|
debugClient1->setEngine((QmlEngine*)(m_engine.data()));
|
||||||
debugClient2->setEngine((Internal::QmlEngine*)(m_engine.data()));
|
debugClient2->setEngine((QmlEngine*)(m_engine.data()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlAdapter::isConnected() const
|
bool QmlAdapter::isConnected() const
|
||||||
@@ -256,12 +256,12 @@ bool QmlAdapter::disableJsDebugging(bool block)
|
|||||||
return isBlocked;
|
return isBlocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
Internal::BaseQmlDebuggerClient *QmlAdapter::activeDebuggerClient()
|
BaseQmlDebuggerClient *QmlAdapter::activeDebuggerClient() const
|
||||||
{
|
{
|
||||||
return m_qmlClient;
|
return m_qmlClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<QString, Internal::BaseQmlDebuggerClient*> QmlAdapter::debuggerClients()
|
QHash<QString, BaseQmlDebuggerClient*> QmlAdapter::debuggerClients() const
|
||||||
{
|
{
|
||||||
return m_debugClients;
|
return m_debugClients;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,8 +77,8 @@ public:
|
|||||||
|
|
||||||
bool disableJsDebugging(bool block);
|
bool disableJsDebugging(bool block);
|
||||||
|
|
||||||
Internal::BaseQmlDebuggerClient *activeDebuggerClient();
|
BaseQmlDebuggerClient *activeDebuggerClient() const;
|
||||||
QHash<QString, Internal::BaseQmlDebuggerClient*> debuggerClients();
|
QHash<QString, BaseQmlDebuggerClient*> debuggerClients() const;
|
||||||
|
|
||||||
BaseEngineDebugClient *engineDebugClient() const;
|
BaseEngineDebugClient *engineDebugClient() const;
|
||||||
QDebugMessageClient *messageClient() const;
|
QDebugMessageClient *messageClient() const;
|
||||||
|
|||||||
@@ -31,9 +31,6 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "qmlengine.h"
|
#include "qmlengine.h"
|
||||||
#include "qmladapter.h"
|
|
||||||
#include "qmlinspectoradapter.h"
|
|
||||||
#include "interactiveinterpreter.h"
|
|
||||||
#include "baseqmldebuggerclient.h"
|
#include "baseqmldebuggerclient.h"
|
||||||
#include "qmlinspectoragent.h"
|
#include "qmlinspectoragent.h"
|
||||||
|
|
||||||
@@ -58,8 +55,6 @@
|
|||||||
#include "qtmessageloghandler.h"
|
#include "qtmessageloghandler.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <projectexplorer/applicationlauncher.h>
|
|
||||||
#include <qmldebug/qmloutputparser.h>
|
|
||||||
#include <qmldebug/baseenginedebugclient.h>
|
#include <qmldebug/baseenginedebugclient.h>
|
||||||
#include <qmljseditor/qmljseditorconstants.h>
|
#include <qmljseditor/qmljseditorconstants.h>
|
||||||
#include <qmljs/parser/qmljsast_p.h>
|
#include <qmljs/parser/qmljsast_p.h>
|
||||||
@@ -87,7 +82,6 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
#include <QTextDocument>
|
|
||||||
|
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
#include <QHostAddress>
|
#include <QHostAddress>
|
||||||
@@ -100,42 +94,12 @@
|
|||||||
#endif
|
#endif
|
||||||
# define XSDEBUG(s) qDebug() << s
|
# define XSDEBUG(s) qDebug() << s
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
|
||||||
using namespace QmlJS;
|
using namespace QmlJS;
|
||||||
using namespace AST;
|
using namespace AST;
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QmlEnginePrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit QmlEnginePrivate(QmlEngine *q);
|
|
||||||
|
|
||||||
private:
|
|
||||||
friend class QmlEngine;
|
|
||||||
QmlAdapter m_adapter;
|
|
||||||
QmlInspectorAdapter m_inspectorAdapter;
|
|
||||||
ApplicationLauncher m_applicationLauncher;
|
|
||||||
QTimer m_noDebugOutputTimer;
|
|
||||||
QmlOutputParser m_outputParser;
|
|
||||||
QHash<QString, QTextDocument*> m_sourceDocuments;
|
|
||||||
QHash<QString, QWeakPointer<TextEditor::ITextEditor> > m_sourceEditors;
|
|
||||||
InteractiveInterpreter m_interpreter;
|
|
||||||
QHash<QString,BreakpointModelId> pendingBreakpoints;
|
|
||||||
QList<quint32> queryIds;
|
|
||||||
bool m_retryOnConnectFail;
|
|
||||||
bool m_automaticConnect;
|
|
||||||
};
|
|
||||||
|
|
||||||
QmlEnginePrivate::QmlEnginePrivate(QmlEngine *q)
|
|
||||||
: m_adapter(q),
|
|
||||||
m_inspectorAdapter(&m_adapter, q),
|
|
||||||
m_retryOnConnectFail(false),
|
|
||||||
m_automaticConnect(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
class ASTWalker : public Visitor
|
class ASTWalker : public Visitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -307,8 +271,11 @@ public:
|
|||||||
|
|
||||||
QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters,
|
QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters,
|
||||||
DebuggerEngine *masterEngine)
|
DebuggerEngine *masterEngine)
|
||||||
: DebuggerEngine(startParameters, QmlLanguage, masterEngine),
|
: DebuggerEngine(startParameters, QmlLanguage, masterEngine)
|
||||||
d(new QmlEnginePrivate(this))
|
, m_adapter(this)
|
||||||
|
, m_inspectorAdapter(&m_adapter, this)
|
||||||
|
, m_retryOnConnectFail(false)
|
||||||
|
, m_automaticConnect(false)
|
||||||
{
|
{
|
||||||
setObjectName(QLatin1String("QmlEngine"));
|
setObjectName(QLatin1String("QmlEngine"));
|
||||||
|
|
||||||
@@ -316,57 +283,58 @@ QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters,
|
|||||||
ExtensionSystem::PluginManager::instance();
|
ExtensionSystem::PluginManager::instance();
|
||||||
pluginManager->addObject(this);
|
pluginManager->addObject(this);
|
||||||
|
|
||||||
connect(&d->m_adapter, SIGNAL(connectionError(QAbstractSocket::SocketError)),
|
connect(&m_adapter, SIGNAL(connectionError(QAbstractSocket::SocketError)),
|
||||||
SLOT(connectionError(QAbstractSocket::SocketError)));
|
SLOT(connectionError(QAbstractSocket::SocketError)));
|
||||||
connect(&d->m_adapter, SIGNAL(serviceConnectionError(QString)),
|
connect(&m_adapter, SIGNAL(serviceConnectionError(QString)),
|
||||||
SLOT(serviceConnectionError(QString)));
|
SLOT(serviceConnectionError(QString)));
|
||||||
connect(&d->m_adapter, SIGNAL(connected()),
|
connect(&m_adapter, SIGNAL(connected()),
|
||||||
SLOT(connectionEstablished()));
|
SLOT(connectionEstablished()));
|
||||||
connect(&d->m_adapter, SIGNAL(connectionStartupFailed()),
|
connect(&m_adapter, SIGNAL(connectionStartupFailed()),
|
||||||
SLOT(connectionStartupFailed()));
|
SLOT(connectionStartupFailed()));
|
||||||
|
|
||||||
connect(this, SIGNAL(stateChanged(Debugger::DebuggerState)),
|
connect(this, SIGNAL(stateChanged(Debugger::DebuggerState)),
|
||||||
SLOT(updateCurrentContext()));
|
SLOT(updateCurrentContext()));
|
||||||
connect(this->stackHandler(), SIGNAL(currentIndexChanged()),
|
connect(this->stackHandler(), SIGNAL(currentIndexChanged()),
|
||||||
SLOT(updateCurrentContext()));
|
SLOT(updateCurrentContext()));
|
||||||
connect(&d->m_inspectorAdapter, SIGNAL(selectionChanged()),
|
connect(&m_inspectorAdapter, SIGNAL(selectionChanged()),
|
||||||
SLOT(updateCurrentContext()));
|
SLOT(updateCurrentContext()));
|
||||||
connect(d->m_inspectorAdapter.agent(), SIGNAL(
|
connect(m_inspectorAdapter.agent(), SIGNAL(
|
||||||
expressionResult(quint32,QVariant)),
|
expressionResult(quint32,QVariant)),
|
||||||
SLOT(expressionEvaluated(quint32,QVariant)));
|
SLOT(expressionEvaluated(quint32,QVariant)));
|
||||||
connect(d->m_adapter.messageClient(),
|
connect(m_adapter.messageClient(),
|
||||||
SIGNAL(message(QtMsgType,QString,
|
SIGNAL(message(QtMsgType,QString,
|
||||||
QmlDebug::QDebugContextInfo)),
|
QmlDebug::QDebugContextInfo)),
|
||||||
SLOT(appendDebugOutput(QtMsgType,QString,
|
SLOT(appendDebugOutput(QtMsgType,QString,
|
||||||
QmlDebug::QDebugContextInfo)));
|
QmlDebug::QDebugContextInfo)));
|
||||||
|
|
||||||
|
|
||||||
connect(&d->m_applicationLauncher,
|
connect(&m_applicationLauncher,
|
||||||
SIGNAL(processExited(int)),
|
SIGNAL(processExited(int)),
|
||||||
SLOT(disconnected()));
|
SLOT(disconnected()));
|
||||||
connect(&d->m_applicationLauncher,
|
connect(&m_applicationLauncher,
|
||||||
SIGNAL(appendMessage(QString,Utils::OutputFormat)),
|
SIGNAL(appendMessage(QString,Utils::OutputFormat)),
|
||||||
SLOT(appendMessage(QString,Utils::OutputFormat)));
|
SLOT(appendMessage(QString,Utils::OutputFormat)));
|
||||||
connect(&d->m_applicationLauncher,
|
connect(&m_applicationLauncher,
|
||||||
SIGNAL(processStarted()),
|
SIGNAL(processStarted()),
|
||||||
&d->m_noDebugOutputTimer,
|
&m_noDebugOutputTimer,
|
||||||
SLOT(start()));
|
SLOT(start()));
|
||||||
|
|
||||||
d->m_outputParser.setNoOutputText(ApplicationLauncher::msgWinCannotRetrieveDebuggingOutput());
|
m_outputParser.setNoOutputText(ProjectExplorer::ApplicationLauncher
|
||||||
connect(&d->m_outputParser, SIGNAL(waitingForConnectionOnPort(quint16)),
|
::msgWinCannotRetrieveDebuggingOutput());
|
||||||
|
connect(&m_outputParser, SIGNAL(waitingForConnectionOnPort(quint16)),
|
||||||
this, SLOT(beginConnection(quint16)));
|
this, SLOT(beginConnection(quint16)));
|
||||||
connect(&d->m_outputParser, SIGNAL(waitingForConnectionViaOst()),
|
connect(&m_outputParser, SIGNAL(waitingForConnectionViaOst()),
|
||||||
this, SLOT(beginConnection()));
|
this, SLOT(beginConnection()));
|
||||||
connect(&d->m_outputParser, SIGNAL(noOutputMessage()),
|
connect(&m_outputParser, SIGNAL(noOutputMessage()),
|
||||||
this, SLOT(tryToConnect()));
|
this, SLOT(tryToConnect()));
|
||||||
connect(&d->m_outputParser, SIGNAL(errorMessage(QString)),
|
connect(&m_outputParser, SIGNAL(errorMessage(QString)),
|
||||||
this, SLOT(appStartupFailed(QString)));
|
this, SLOT(appStartupFailed(QString)));
|
||||||
|
|
||||||
// Only wait 8 seconds for the 'Waiting for connection' on application ouput, then just try to connect
|
// Only wait 8 seconds for the 'Waiting for connection' on application output,
|
||||||
// (application output might be redirected / blocked)
|
// then just try to connect (application output might be redirected / blocked)
|
||||||
d->m_noDebugOutputTimer.setSingleShot(true);
|
m_noDebugOutputTimer.setSingleShot(true);
|
||||||
d->m_noDebugOutputTimer.setInterval(8000);
|
m_noDebugOutputTimer.setInterval(8000);
|
||||||
connect(&d->m_noDebugOutputTimer, SIGNAL(timeout()), this, SLOT(tryToConnect()));
|
connect(&m_noDebugOutputTimer, SIGNAL(timeout()), this, SLOT(tryToConnect()));
|
||||||
|
|
||||||
qtMessageLogHandler()->setHasEditableRow(true);
|
qtMessageLogHandler()->setHasEditableRow(true);
|
||||||
|
|
||||||
@@ -377,9 +345,9 @@ QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters,
|
|||||||
|
|
||||||
// we won't get any debug output
|
// we won't get any debug output
|
||||||
if (startParameters.useTerminal) {
|
if (startParameters.useTerminal) {
|
||||||
d->m_noDebugOutputTimer.setInterval(0);
|
m_noDebugOutputTimer.setInterval(0);
|
||||||
d->m_retryOnConnectFail = true;
|
m_retryOnConnectFail = true;
|
||||||
d->m_automaticConnect = true;
|
m_automaticConnect = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,14 +363,12 @@ QmlEngine::~QmlEngine()
|
|||||||
QList<Core::IEditor *> editorsToClose;
|
QList<Core::IEditor *> editorsToClose;
|
||||||
|
|
||||||
QHash<QString, QWeakPointer<TextEditor::ITextEditor> >::iterator iter;
|
QHash<QString, QWeakPointer<TextEditor::ITextEditor> >::iterator iter;
|
||||||
for (iter = d->m_sourceEditors.begin(); iter != d->m_sourceEditors.end(); ++iter) {
|
for (iter = m_sourceEditors.begin(); iter != m_sourceEditors.end(); ++iter) {
|
||||||
QWeakPointer<TextEditor::ITextEditor> textEditPtr = iter.value();
|
QWeakPointer<TextEditor::ITextEditor> textEditPtr = iter.value();
|
||||||
if (textEditPtr)
|
if (textEditPtr)
|
||||||
editorsToClose << textEditPtr.data();
|
editorsToClose << textEditPtr.data();
|
||||||
}
|
}
|
||||||
Core::EditorManager::instance()->closeEditors(editorsToClose);
|
Core::EditorManager::instance()->closeEditors(editorsToClose);
|
||||||
|
|
||||||
delete d;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::setupInferior()
|
void QmlEngine::setupInferior()
|
||||||
@@ -411,7 +377,7 @@ void QmlEngine::setupInferior()
|
|||||||
|
|
||||||
notifyInferiorSetupOk();
|
notifyInferiorSetupOk();
|
||||||
|
|
||||||
if (d->m_automaticConnect)
|
if (m_automaticConnect)
|
||||||
beginConnection();
|
beginConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,19 +402,19 @@ void QmlEngine::connectionEstablished()
|
|||||||
void QmlEngine::tryToConnect(quint16 port)
|
void QmlEngine::tryToConnect(quint16 port)
|
||||||
{
|
{
|
||||||
showMessage(QLatin1String("QML Debugger: No application output received in time, trying to connect ..."), LogStatus);
|
showMessage(QLatin1String("QML Debugger: No application output received in time, trying to connect ..."), LogStatus);
|
||||||
d->m_retryOnConnectFail = true;
|
m_retryOnConnectFail = true;
|
||||||
if (state() == EngineRunRequested
|
if (state() == EngineRunRequested
|
||||||
&& !d->m_automaticConnect)
|
&& !m_automaticConnect)
|
||||||
beginConnection(port);
|
beginConnection(port);
|
||||||
else
|
else
|
||||||
d->m_automaticConnect = true;
|
m_automaticConnect = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::beginConnection(quint16 port)
|
void QmlEngine::beginConnection(quint16 port)
|
||||||
{
|
{
|
||||||
d->m_noDebugOutputTimer.stop();
|
m_noDebugOutputTimer.stop();
|
||||||
|
|
||||||
if (state() != EngineRunRequested && d->m_retryOnConnectFail)
|
if (state() != EngineRunRequested && m_retryOnConnectFail)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QTC_ASSERT(state() == EngineRunRequested, return);
|
QTC_ASSERT(state() == EngineRunRequested, return);
|
||||||
@@ -460,24 +426,24 @@ void QmlEngine::beginConnection(quint16 port)
|
|||||||
|| startParameters().connParams.port == port,
|
|| startParameters().connParams.port == port,
|
||||||
qWarning() << "Port " << port << "from application output does not match"
|
qWarning() << "Port " << port << "from application output does not match"
|
||||||
<< startParameters().connParams.port << "from start parameters.");
|
<< startParameters().connParams.port << "from start parameters.");
|
||||||
d->m_adapter.beginConnectionTcp(startParameters().qmlServerAddress, port);
|
m_adapter.beginConnectionTcp(startParameters().qmlServerAddress, port);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (startParameters().communicationChannel
|
if (startParameters().communicationChannel
|
||||||
== DebuggerStartParameters::CommunicationChannelTcpIp) {
|
== DebuggerStartParameters::CommunicationChannelTcpIp) {
|
||||||
// no port from application output, use the one from start parameters ...
|
// no port from application output, use the one from start parameters ...
|
||||||
d->m_adapter.beginConnectionTcp(startParameters().qmlServerAddress,
|
m_adapter.beginConnectionTcp(startParameters().qmlServerAddress,
|
||||||
startParameters().qmlServerPort);
|
startParameters().qmlServerPort);
|
||||||
} else {
|
} else {
|
||||||
QTC_CHECK(startParameters().communicationChannel
|
QTC_CHECK(startParameters().communicationChannel
|
||||||
== DebuggerStartParameters::CommunicationChannelUsb);
|
== DebuggerStartParameters::CommunicationChannelUsb);
|
||||||
d->m_adapter.beginConnectionOst(startParameters().remoteChannel);
|
m_adapter.beginConnectionOst(startParameters().remoteChannel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::connectionStartupFailed()
|
void QmlEngine::connectionStartupFailed()
|
||||||
{
|
{
|
||||||
if (d->m_retryOnConnectFail) {
|
if (m_retryOnConnectFail) {
|
||||||
// retry after 3 seconds ...
|
// retry after 3 seconds ...
|
||||||
QTimer::singleShot(3000, this, SLOT(beginConnection()));
|
QTimer::singleShot(3000, this, SLOT(beginConnection()));
|
||||||
return;
|
return;
|
||||||
@@ -562,7 +528,7 @@ bool QmlEngine::canDisplayTooltip() const
|
|||||||
|
|
||||||
void QmlEngine::filterApplicationMessage(const QString &output, int /*channel*/)
|
void QmlEngine::filterApplicationMessage(const QString &output, int /*channel*/)
|
||||||
{
|
{
|
||||||
d->m_outputParser.processOutput(output);
|
m_outputParser.processOutput(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::showMessage(const QString &msg, int channel, int timeout) const
|
void QmlEngine::showMessage(const QString &msg, int channel, int timeout) const
|
||||||
@@ -579,7 +545,7 @@ void QmlEngine::gotoLocation(const Location &location)
|
|||||||
// TODO: QUrl::isLocalFile() once we depend on Qt 4.8
|
// TODO: QUrl::isLocalFile() once we depend on Qt 4.8
|
||||||
if (QUrl(fileName).scheme().compare(QLatin1String("file"), Qt::CaseInsensitive) == 0) {
|
if (QUrl(fileName).scheme().compare(QLatin1String("file"), Qt::CaseInsensitive) == 0) {
|
||||||
// internal file from source files -> show generated .js
|
// internal file from source files -> show generated .js
|
||||||
QTC_ASSERT(d->m_sourceDocuments.contains(fileName), return);
|
QTC_ASSERT(m_sourceDocuments.contains(fileName), return);
|
||||||
Core::IEditor *editor = 0;
|
Core::IEditor *editor = 0;
|
||||||
|
|
||||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
||||||
@@ -599,7 +565,7 @@ void QmlEngine::gotoLocation(const Location &location)
|
|||||||
editor->setProperty(Constants::OPENED_BY_DEBUGGER, true);
|
editor->setProperty(Constants::OPENED_BY_DEBUGGER, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateEditor(editor, d->m_sourceDocuments.value(fileName));
|
updateEditor(editor, m_sourceDocuments.value(fileName));
|
||||||
}
|
}
|
||||||
editorManager->activateEditor(editor);
|
editorManager->activateEditor(editor);
|
||||||
|
|
||||||
@@ -611,7 +577,7 @@ void QmlEngine::gotoLocation(const Location &location)
|
|||||||
void QmlEngine::closeConnection()
|
void QmlEngine::closeConnection()
|
||||||
{
|
{
|
||||||
disconnect(watchersModel(),SIGNAL(layoutChanged()),this,SLOT(synchronizeWatchers()));
|
disconnect(watchersModel(),SIGNAL(layoutChanged()),this,SLOT(synchronizeWatchers()));
|
||||||
d->m_adapter.closeConnection();
|
m_adapter.closeConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::runEngine()
|
void QmlEngine::runEngine()
|
||||||
@@ -624,19 +590,19 @@ void QmlEngine::runEngine()
|
|||||||
else
|
else
|
||||||
startApplicationLauncher();
|
startApplicationLauncher();
|
||||||
} else {
|
} else {
|
||||||
d->m_noDebugOutputTimer.start();
|
m_noDebugOutputTimer.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::startApplicationLauncher()
|
void QmlEngine::startApplicationLauncher()
|
||||||
{
|
{
|
||||||
if (!d->m_applicationLauncher.isRunning()) {
|
if (!m_applicationLauncher.isRunning()) {
|
||||||
appendMessage(tr("Starting %1 %2").arg(
|
appendMessage(tr("Starting %1 %2").arg(
|
||||||
QDir::toNativeSeparators(startParameters().executable),
|
QDir::toNativeSeparators(startParameters().executable),
|
||||||
startParameters().processArgs)
|
startParameters().processArgs)
|
||||||
+ QLatin1Char('\n')
|
+ QLatin1Char('\n')
|
||||||
, Utils::NormalMessageFormat);
|
, Utils::NormalMessageFormat);
|
||||||
d->m_applicationLauncher.start(ApplicationLauncher::Gui,
|
m_applicationLauncher.start(ProjectExplorer::ApplicationLauncher::Gui,
|
||||||
startParameters().executable,
|
startParameters().executable,
|
||||||
startParameters().processArgs);
|
startParameters().processArgs);
|
||||||
}
|
}
|
||||||
@@ -644,9 +610,10 @@ void QmlEngine::startApplicationLauncher()
|
|||||||
|
|
||||||
void QmlEngine::stopApplicationLauncher()
|
void QmlEngine::stopApplicationLauncher()
|
||||||
{
|
{
|
||||||
if (d->m_applicationLauncher.isRunning()) {
|
if (m_applicationLauncher.isRunning()) {
|
||||||
disconnect(&d->m_applicationLauncher, SIGNAL(processExited(int)), this, SLOT(disconnected()));
|
disconnect(&m_applicationLauncher, SIGNAL(processExited(int)),
|
||||||
d->m_applicationLauncher.stop();
|
this, SLOT(disconnected()));
|
||||||
|
m_applicationLauncher.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -673,10 +640,10 @@ void QmlEngine::handleRemoteSetupFailed(const QString &message)
|
|||||||
|
|
||||||
void QmlEngine::shutdownInferior()
|
void QmlEngine::shutdownInferior()
|
||||||
{
|
{
|
||||||
d->m_noDebugOutputTimer.stop();
|
m_noDebugOutputTimer.stop();
|
||||||
|
|
||||||
if (d->m_adapter.activeDebuggerClient())
|
if (m_adapter.activeDebuggerClient())
|
||||||
d->m_adapter.activeDebuggerClient()->endSession();
|
m_adapter.activeDebuggerClient()->endSession();
|
||||||
|
|
||||||
if (isSlaveEngine()) {
|
if (isSlaveEngine()) {
|
||||||
resetLocation();
|
resetLocation();
|
||||||
@@ -703,11 +670,11 @@ void QmlEngine::setupEngine()
|
|||||||
// we need to get the port first
|
// we need to get the port first
|
||||||
notifyEngineRequestRemoteSetup();
|
notifyEngineRequestRemoteSetup();
|
||||||
} else {
|
} else {
|
||||||
d->m_applicationLauncher.setEnvironment(startParameters().environment);
|
m_applicationLauncher.setEnvironment(startParameters().environment);
|
||||||
d->m_applicationLauncher.setWorkingDirectory(startParameters().workingDirectory);
|
m_applicationLauncher.setWorkingDirectory(startParameters().workingDirectory);
|
||||||
|
|
||||||
// We can't do this in the constructore because runControl() isn't yet defined
|
// We can't do this in the constructore because runControl() isn't yet defined
|
||||||
connect(&d->m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
|
connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
|
||||||
runControl(), SLOT(bringApplicationToForeground(qint64)),
|
runControl(), SLOT(bringApplicationToForeground(qint64)),
|
||||||
Qt::UniqueConnection);
|
Qt::UniqueConnection);
|
||||||
|
|
||||||
@@ -718,8 +685,8 @@ void QmlEngine::setupEngine()
|
|||||||
void QmlEngine::continueInferior()
|
void QmlEngine::continueInferior()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (m_adapter.activeDebuggerClient()) {
|
||||||
d->m_adapter.activeDebuggerClient()->continueInferior();
|
m_adapter.activeDebuggerClient()->continueInferior();
|
||||||
}
|
}
|
||||||
resetLocation();
|
resetLocation();
|
||||||
notifyInferiorRunRequested();
|
notifyInferiorRunRequested();
|
||||||
@@ -728,16 +695,16 @@ void QmlEngine::continueInferior()
|
|||||||
|
|
||||||
void QmlEngine::interruptInferior()
|
void QmlEngine::interruptInferior()
|
||||||
{
|
{
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (m_adapter.activeDebuggerClient()) {
|
||||||
d->m_adapter.activeDebuggerClient()->interruptInferior();
|
m_adapter.activeDebuggerClient()->interruptInferior();
|
||||||
}
|
}
|
||||||
notifyInferiorStopOk();
|
notifyInferiorStopOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::executeStep()
|
void QmlEngine::executeStep()
|
||||||
{
|
{
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (m_adapter.activeDebuggerClient()) {
|
||||||
d->m_adapter.activeDebuggerClient()->executeStep();
|
m_adapter.activeDebuggerClient()->executeStep();
|
||||||
}
|
}
|
||||||
notifyInferiorRunRequested();
|
notifyInferiorRunRequested();
|
||||||
notifyInferiorRunOk();
|
notifyInferiorRunOk();
|
||||||
@@ -745,8 +712,8 @@ void QmlEngine::executeStep()
|
|||||||
|
|
||||||
void QmlEngine::executeStepI()
|
void QmlEngine::executeStepI()
|
||||||
{
|
{
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (m_adapter.activeDebuggerClient()) {
|
||||||
d->m_adapter.activeDebuggerClient()->executeStepI();
|
m_adapter.activeDebuggerClient()->executeStepI();
|
||||||
}
|
}
|
||||||
notifyInferiorRunRequested();
|
notifyInferiorRunRequested();
|
||||||
notifyInferiorRunOk();
|
notifyInferiorRunOk();
|
||||||
@@ -754,8 +721,8 @@ void QmlEngine::executeStepI()
|
|||||||
|
|
||||||
void QmlEngine::executeStepOut()
|
void QmlEngine::executeStepOut()
|
||||||
{
|
{
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (m_adapter.activeDebuggerClient()) {
|
||||||
d->m_adapter.activeDebuggerClient()->executeStepOut();
|
m_adapter.activeDebuggerClient()->executeStepOut();
|
||||||
}
|
}
|
||||||
notifyInferiorRunRequested();
|
notifyInferiorRunRequested();
|
||||||
notifyInferiorRunOk();
|
notifyInferiorRunOk();
|
||||||
@@ -763,8 +730,8 @@ void QmlEngine::executeStepOut()
|
|||||||
|
|
||||||
void QmlEngine::executeNext()
|
void QmlEngine::executeNext()
|
||||||
{
|
{
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (m_adapter.activeDebuggerClient()) {
|
||||||
d->m_adapter.activeDebuggerClient()->executeNext();
|
m_adapter.activeDebuggerClient()->executeNext();
|
||||||
}
|
}
|
||||||
notifyInferiorRunRequested();
|
notifyInferiorRunRequested();
|
||||||
notifyInferiorRunOk();
|
notifyInferiorRunOk();
|
||||||
@@ -786,8 +753,8 @@ void QmlEngine::executeRunToLine(const ContextData &data)
|
|||||||
bool valid;
|
bool valid;
|
||||||
if (adjustBreakpointLineAndColumn(data.fileName, &line, &column, &valid))
|
if (adjustBreakpointLineAndColumn(data.fileName, &line, &column, &valid))
|
||||||
modifiedData.lineNumber = line;
|
modifiedData.lineNumber = line;
|
||||||
if (d->m_adapter.activeDebuggerClient())
|
if (m_adapter.activeDebuggerClient())
|
||||||
d->m_adapter.activeDebuggerClient()->executeRunToLine(modifiedData);
|
m_adapter.activeDebuggerClient()->executeRunToLine(modifiedData);
|
||||||
notifyInferiorRunRequested();
|
notifyInferiorRunRequested();
|
||||||
notifyInferiorRunOk();
|
notifyInferiorRunOk();
|
||||||
}
|
}
|
||||||
@@ -809,8 +776,8 @@ void QmlEngine::activateFrame(int index)
|
|||||||
if (state() != InferiorStopOk && state() != InferiorUnrunnable)
|
if (state() != InferiorStopOk && state() != InferiorUnrunnable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (m_adapter.activeDebuggerClient()) {
|
||||||
d->m_adapter.activeDebuggerClient()->activateFrame(index);
|
m_adapter.activeDebuggerClient()->activateFrame(index);
|
||||||
}
|
}
|
||||||
gotoLocation(stackHandler()->frames().value(index));
|
gotoLocation(stackHandler()->frames().value(index));
|
||||||
}
|
}
|
||||||
@@ -834,17 +801,17 @@ void QmlEngine::insertBreakpoint(BreakpointModelId id)
|
|||||||
bool valid = false;
|
bool valid = false;
|
||||||
if (!adjustBreakpointLineAndColumn(params.fileName, &line, &column,
|
if (!adjustBreakpointLineAndColumn(params.fileName, &line, &column,
|
||||||
&valid)) {
|
&valid)) {
|
||||||
d->pendingBreakpoints.insertMulti(params.fileName, id);
|
pendingBreakpoints.insertMulti(params.fileName, id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!valid)
|
if (!valid)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (m_adapter.activeDebuggerClient()) {
|
||||||
d->m_adapter.activeDebuggerClient()->insertBreakpoint(id, line, column);
|
m_adapter.activeDebuggerClient()->insertBreakpoint(id, line, column);
|
||||||
} else {
|
} else {
|
||||||
foreach (BaseQmlDebuggerClient *client, d->m_adapter.debuggerClients()) {
|
foreach (BaseQmlDebuggerClient *client, m_adapter.debuggerClients()) {
|
||||||
client->insertBreakpoint(id, line, column);
|
client->insertBreakpoint(id, line, column);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -856,12 +823,12 @@ void QmlEngine::removeBreakpoint(BreakpointModelId id)
|
|||||||
|
|
||||||
const BreakpointParameters ¶ms = handler->breakpointData(id);
|
const BreakpointParameters ¶ms = handler->breakpointData(id);
|
||||||
if (params.type == BreakpointByFileAndLine &&
|
if (params.type == BreakpointByFileAndLine &&
|
||||||
d->pendingBreakpoints.contains(params.fileName)) {
|
pendingBreakpoints.contains(params.fileName)) {
|
||||||
QHash<QString, BreakpointModelId>::iterator i =
|
QHash<QString, BreakpointModelId>::iterator i =
|
||||||
d->pendingBreakpoints.find(params.fileName);
|
pendingBreakpoints.find(params.fileName);
|
||||||
while (i != d->pendingBreakpoints.end() && i.key() == params.fileName) {
|
while (i != pendingBreakpoints.end() && i.key() == params.fileName) {
|
||||||
if (i.value() == id) {
|
if (i.value() == id) {
|
||||||
d->pendingBreakpoints.erase(i);
|
pendingBreakpoints.erase(i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
@@ -872,10 +839,10 @@ void QmlEngine::removeBreakpoint(BreakpointModelId id)
|
|||||||
QTC_ASSERT(state == BreakpointRemoveRequested, qDebug() << id << this << state);
|
QTC_ASSERT(state == BreakpointRemoveRequested, qDebug() << id << this << state);
|
||||||
handler->notifyBreakpointRemoveProceeding(id);
|
handler->notifyBreakpointRemoveProceeding(id);
|
||||||
|
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (m_adapter.activeDebuggerClient()) {
|
||||||
d->m_adapter.activeDebuggerClient()->removeBreakpoint(id);
|
m_adapter.activeDebuggerClient()->removeBreakpoint(id);
|
||||||
} else {
|
} else {
|
||||||
foreach (BaseQmlDebuggerClient *client, d->m_adapter.debuggerClients()) {
|
foreach (BaseQmlDebuggerClient *client, m_adapter.debuggerClients()) {
|
||||||
client->removeBreakpoint(id);
|
client->removeBreakpoint(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -892,10 +859,10 @@ void QmlEngine::changeBreakpoint(BreakpointModelId id)
|
|||||||
QTC_ASSERT(state == BreakpointChangeRequested, qDebug() << id << this << state);
|
QTC_ASSERT(state == BreakpointChangeRequested, qDebug() << id << this << state);
|
||||||
handler->notifyBreakpointChangeProceeding(id);
|
handler->notifyBreakpointChangeProceeding(id);
|
||||||
|
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (m_adapter.activeDebuggerClient()) {
|
||||||
d->m_adapter.activeDebuggerClient()->changeBreakpoint(id);
|
m_adapter.activeDebuggerClient()->changeBreakpoint(id);
|
||||||
} else {
|
} else {
|
||||||
foreach (BaseQmlDebuggerClient *client, d->m_adapter.debuggerClients()) {
|
foreach (BaseQmlDebuggerClient *client, m_adapter.debuggerClients()) {
|
||||||
client->changeBreakpoint(id);
|
client->changeBreakpoint(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -948,10 +915,10 @@ void QmlEngine::attemptBreakpointSynchronization()
|
|||||||
|
|
||||||
DebuggerEngine::attemptBreakpointSynchronization();
|
DebuggerEngine::attemptBreakpointSynchronization();
|
||||||
|
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (m_adapter.activeDebuggerClient()) {
|
||||||
d->m_adapter.activeDebuggerClient()->synchronizeBreakpoints();
|
m_adapter.activeDebuggerClient()->synchronizeBreakpoints();
|
||||||
} else {
|
} else {
|
||||||
foreach (BaseQmlDebuggerClient *client, d->m_adapter.debuggerClients()) {
|
foreach (BaseQmlDebuggerClient *client, m_adapter.debuggerClients()) {
|
||||||
client->synchronizeBreakpoints();
|
client->synchronizeBreakpoints();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -967,8 +934,8 @@ bool QmlEngine::acceptsBreakpoint(BreakpointModelId id) const
|
|||||||
//For now, the event breakpoint can be set after the activeDebuggerClient is known
|
//For now, the event breakpoint can be set after the activeDebuggerClient is known
|
||||||
//This is because the older client does not support BreakpointOnQmlSignalHandler
|
//This is because the older client does not support BreakpointOnQmlSignalHandler
|
||||||
bool acceptBreakpoint = false;
|
bool acceptBreakpoint = false;
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (m_adapter.activeDebuggerClient()) {
|
||||||
acceptBreakpoint = d->m_adapter.activeDebuggerClient()->acceptsBreakpoint(id);
|
acceptBreakpoint = m_adapter.activeDebuggerClient()->acceptsBreakpoint(id);
|
||||||
}
|
}
|
||||||
return acceptBreakpoint;
|
return acceptBreakpoint;
|
||||||
}
|
}
|
||||||
@@ -988,8 +955,8 @@ void QmlEngine::reloadModules()
|
|||||||
|
|
||||||
void QmlEngine::reloadSourceFiles()
|
void QmlEngine::reloadSourceFiles()
|
||||||
{
|
{
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (m_adapter.activeDebuggerClient()) {
|
||||||
d->m_adapter.activeDebuggerClient()->getSourceFiles();
|
m_adapter.activeDebuggerClient()->getSourceFiles();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1022,8 +989,8 @@ bool QmlEngine::setToolTipExpression(const QPoint &mousePos,
|
|||||||
void QmlEngine::assignValueInDebugger(const WatchData *data,
|
void QmlEngine::assignValueInDebugger(const WatchData *data,
|
||||||
const QString &expression, const QVariant &valueV)
|
const QString &expression, const QVariant &valueV)
|
||||||
{
|
{
|
||||||
if (!expression.isEmpty() && d->m_adapter.activeDebuggerClient()) {
|
if (!expression.isEmpty() && m_adapter.activeDebuggerClient()) {
|
||||||
d->m_adapter.activeDebuggerClient()->assignValueInDebugger(data,
|
m_adapter.activeDebuggerClient()->assignValueInDebugger(data,
|
||||||
expression,
|
expression,
|
||||||
valueV);
|
valueV);
|
||||||
}
|
}
|
||||||
@@ -1037,15 +1004,15 @@ void QmlEngine::updateWatchData(const WatchData &data,
|
|||||||
//showStatusMessage(tr("Stopped."), 5000);
|
//showStatusMessage(tr("Stopped."), 5000);
|
||||||
|
|
||||||
if (data.iname.startsWith("inspect.")) {
|
if (data.iname.startsWith("inspect.")) {
|
||||||
d->m_inspectorAdapter.agent()->updateWatchData(data);
|
m_inspectorAdapter.agent()->updateWatchData(data);
|
||||||
} else {
|
} else {
|
||||||
if (!data.name.isEmpty() && d->m_adapter.activeDebuggerClient()) {
|
if (!data.name.isEmpty() && m_adapter.activeDebuggerClient()) {
|
||||||
if (data.isValueNeeded()) {
|
if (data.isValueNeeded()) {
|
||||||
d->m_adapter.activeDebuggerClient()->updateWatchData(data);
|
m_adapter.activeDebuggerClient()->updateWatchData(data);
|
||||||
}
|
}
|
||||||
if (data.isChildrenNeeded()
|
if (data.isChildrenNeeded()
|
||||||
&& watchHandler()->isExpandedIName(data.iname)) {
|
&& watchHandler()->isExpandedIName(data.iname)) {
|
||||||
d->m_adapter.activeDebuggerClient()->expandObject(data.iname, data.id);
|
m_adapter.activeDebuggerClient()->expandObject(data.iname, data.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
synchronizeWatchers();
|
synchronizeWatchers();
|
||||||
@@ -1060,18 +1027,18 @@ void QmlEngine::synchronizeWatchers()
|
|||||||
{
|
{
|
||||||
QStringList watchedExpressions = watchHandler()->watchedExpressions();
|
QStringList watchedExpressions = watchHandler()->watchedExpressions();
|
||||||
// send watchers list
|
// send watchers list
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (m_adapter.activeDebuggerClient()) {
|
||||||
d->m_adapter.activeDebuggerClient()->synchronizeWatchers(watchedExpressions);
|
m_adapter.activeDebuggerClient()->synchronizeWatchers(watchedExpressions);
|
||||||
} else {
|
} else {
|
||||||
foreach (BaseQmlDebuggerClient *client, d->m_adapter.debuggerClients())
|
foreach (BaseQmlDebuggerClient *client, m_adapter.debuggerClients())
|
||||||
client->synchronizeWatchers(watchedExpressions);
|
client->synchronizeWatchers(watchedExpressions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::expressionEvaluated(quint32 queryId, const QVariant &result)
|
void QmlEngine::expressionEvaluated(quint32 queryId, const QVariant &result)
|
||||||
{
|
{
|
||||||
if (d->queryIds.contains(queryId)) {
|
if (queryIds.contains(queryId)) {
|
||||||
d->queryIds.removeOne(queryId);
|
queryIds.removeOne(queryId);
|
||||||
QtMessageLogItem *item = constructLogItemTree(qtMessageLogHandler()->root(),
|
QtMessageLogItem *item = constructLogItemTree(qtMessageLogHandler()->root(),
|
||||||
result);
|
result);
|
||||||
if (item)
|
if (item)
|
||||||
@@ -1110,9 +1077,9 @@ void QmlEngine::disconnected()
|
|||||||
void QmlEngine::documentUpdated(QmlJS::Document::Ptr doc)
|
void QmlEngine::documentUpdated(QmlJS::Document::Ptr doc)
|
||||||
{
|
{
|
||||||
QString fileName = doc->fileName();
|
QString fileName = doc->fileName();
|
||||||
if (d->pendingBreakpoints.contains(fileName)) {
|
if (pendingBreakpoints.contains(fileName)) {
|
||||||
QList<BreakpointModelId> ids = d->pendingBreakpoints.values(fileName);
|
QList<BreakpointModelId> ids = pendingBreakpoints.values(fileName);
|
||||||
d->pendingBreakpoints.remove(fileName);
|
pendingBreakpoints.remove(fileName);
|
||||||
foreach (const BreakpointModelId &id, ids)
|
foreach (const BreakpointModelId &id, ids)
|
||||||
insertBreakpoint(id);
|
insertBreakpoint(id);
|
||||||
}
|
}
|
||||||
@@ -1122,7 +1089,7 @@ void QmlEngine::updateCurrentContext()
|
|||||||
{
|
{
|
||||||
const QString context = state() == InferiorStopOk ?
|
const QString context = state() == InferiorStopOk ?
|
||||||
stackHandler()->currentFrame().function :
|
stackHandler()->currentFrame().function :
|
||||||
d->m_inspectorAdapter.currentSelectedDisplayName();
|
m_inspectorAdapter.currentSelectedDisplayName();
|
||||||
showMessage(tr("Context: ").append(context), QtMessageLogStatus);
|
showMessage(tr("Context: ").append(context), QtMessageLogStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1154,8 +1121,8 @@ void QmlEngine::appendDebugOutput(QtMsgType type, const QString &message,
|
|||||||
|
|
||||||
void QmlEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages)
|
void QmlEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages)
|
||||||
{
|
{
|
||||||
if ((languages & QmlLanguage) && d->m_adapter.activeDebuggerClient()) {
|
if ((languages & QmlLanguage) && m_adapter.activeDebuggerClient()) {
|
||||||
d->m_adapter.activeDebuggerClient()->executeDebuggerCommand(command);
|
m_adapter.activeDebuggerClient()->executeDebuggerCommand(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1171,13 +1138,13 @@ bool QmlEngine::evaluateScriptExpression(const QString &expression)
|
|||||||
//is sent to V8DebugService. In all other cases, the
|
//is sent to V8DebugService. In all other cases, the
|
||||||
//expression is evaluated by QDeclarativeEngine.
|
//expression is evaluated by QDeclarativeEngine.
|
||||||
if (state() != InferiorStopOk) {
|
if (state() != InferiorStopOk) {
|
||||||
QmlInspectorAgent *agent = d->m_inspectorAdapter.agent();
|
QmlInspectorAgent *agent = m_inspectorAdapter.agent();
|
||||||
quint32 queryId
|
quint32 queryId
|
||||||
= agent->queryExpressionResult(
|
= agent->queryExpressionResult(
|
||||||
d->m_inspectorAdapter.currentSelectedDebugId(),
|
m_inspectorAdapter.currentSelectedDebugId(),
|
||||||
expression);
|
expression);
|
||||||
if (queryId) {
|
if (queryId) {
|
||||||
d->queryIds << queryId;
|
queryIds << queryId;
|
||||||
} else {
|
} else {
|
||||||
didEvaluate = false;
|
didEvaluate = false;
|
||||||
qtMessageLogHandler()->
|
qtMessageLogHandler()->
|
||||||
@@ -1228,11 +1195,11 @@ void QmlEngine::updateScriptSource(const QString &fileName, int lineOffset, int
|
|||||||
const QString &source)
|
const QString &source)
|
||||||
{
|
{
|
||||||
QTextDocument *document = 0;
|
QTextDocument *document = 0;
|
||||||
if (d->m_sourceDocuments.contains(fileName)) {
|
if (m_sourceDocuments.contains(fileName)) {
|
||||||
document = d->m_sourceDocuments.value(fileName);
|
document = m_sourceDocuments.value(fileName);
|
||||||
} else {
|
} else {
|
||||||
document = new QTextDocument(this);
|
document = new QTextDocument(this);
|
||||||
d->m_sourceDocuments.insert(fileName, document);
|
m_sourceDocuments.insert(fileName, document);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're getting an unordered set of snippets that can even interleave
|
// We're getting an unordered set of snippets that can even interleave
|
||||||
@@ -1294,9 +1261,9 @@ void QmlEngine::updateEditor(Core::IEditor *editor, const QTextDocument *documen
|
|||||||
|
|
||||||
bool QmlEngine::canEvaluateScript(const QString &script)
|
bool QmlEngine::canEvaluateScript(const QString &script)
|
||||||
{
|
{
|
||||||
d->m_interpreter.clearText();
|
m_interpreter.clearText();
|
||||||
d->m_interpreter.appendText(script);
|
m_interpreter.appendText(script);
|
||||||
return d->m_interpreter.canEvaluate();
|
return m_interpreter.canEvaluate();
|
||||||
}
|
}
|
||||||
|
|
||||||
QtMessageLogItem *QmlEngine::constructLogItemTree(
|
QtMessageLogItem *QmlEngine::constructLogItemTree(
|
||||||
@@ -1362,11 +1329,6 @@ bool QmlEngine::adjustBreakpointLineAndColumn(
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlAdapter *QmlEngine::adapter() const
|
|
||||||
{
|
|
||||||
return &d->m_adapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
QmlEngine *createQmlEngine(const DebuggerStartParameters &sp,
|
QmlEngine *createQmlEngine(const DebuggerStartParameters &sp,
|
||||||
DebuggerEngine *masterEngine)
|
DebuggerEngine *masterEngine)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,19 +30,22 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef DEBUGGER_QMLENGINE_H
|
#ifndef QMLENGINE_H
|
||||||
#define DEBUGGER_QMLENGINE_H
|
#define QMLENGINE_H
|
||||||
|
|
||||||
#include "debuggerengine.h"
|
#include "debuggerengine.h"
|
||||||
|
#include "interactiveinterpreter.h"
|
||||||
|
#include "qmladapter.h"
|
||||||
|
#include "qmlinspectoradapter.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/applicationlauncher.h>
|
||||||
#include <qmldebug/qdebugmessageclient.h>
|
#include <qmldebug/qdebugmessageclient.h>
|
||||||
#include <utils/outputformat.h>
|
#include <qmldebug/qmloutputparser.h>
|
||||||
#include <qmljs/qmljsdocument.h>
|
#include <qmljs/qmljsdocument.h>
|
||||||
|
#include <utils/outputformat.h>
|
||||||
|
|
||||||
#include <QAbstractSocket>
|
#include <QAbstractSocket>
|
||||||
|
#include <QTextDocument>
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QTextDocument;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class IEditor;
|
class IEditor;
|
||||||
@@ -51,20 +54,14 @@ class IEditor;
|
|||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QtMessageLogItem;
|
|
||||||
class QmlAdapter;
|
class QmlAdapter;
|
||||||
class QmlEnginePrivate;
|
class QtMessageLogItem;
|
||||||
|
|
||||||
class QmlEngine : public DebuggerEngine
|
class QmlEngine : public DebuggerEngine
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum LogDirection {
|
|
||||||
LogSend,
|
|
||||||
LogReceive
|
|
||||||
};
|
|
||||||
|
|
||||||
QmlEngine(const DebuggerStartParameters &startParameters,
|
QmlEngine(const DebuggerStartParameters &startParameters,
|
||||||
DebuggerEngine *masterEngine);
|
DebuggerEngine *masterEngine);
|
||||||
~QmlEngine();
|
~QmlEngine();
|
||||||
@@ -81,26 +78,45 @@ public:
|
|||||||
void filterApplicationMessage(const QString &msg, int channel);
|
void filterApplicationMessage(const QString &msg, int channel);
|
||||||
void inferiorSpontaneousStop();
|
void inferiorSpontaneousStop();
|
||||||
|
|
||||||
void logMessage(const QString &service, LogDirection direction, const QString &str);
|
enum LogDirection {
|
||||||
|
LogSend,
|
||||||
|
LogReceive
|
||||||
|
};
|
||||||
|
|
||||||
|
void logMessage(const QString &service, LogDirection direction,
|
||||||
|
const QString &str);
|
||||||
|
|
||||||
void setSourceFiles(const QStringList &fileNames);
|
void setSourceFiles(const QStringList &fileNames);
|
||||||
void updateScriptSource(const QString &fileName, int lineOffset, int columnOffset, const QString &source);
|
void updateScriptSource(const QString &fileName, int lineOffset,
|
||||||
|
int columnOffset, const QString &source);
|
||||||
QmlAdapter *adapter() const;
|
|
||||||
|
|
||||||
void insertBreakpoint(BreakpointModelId id);
|
void insertBreakpoint(BreakpointModelId id);
|
||||||
|
|
||||||
public slots:
|
signals:
|
||||||
|
void tooltipRequested(const QPoint &mousePos,
|
||||||
|
TextEditor::ITextEditor *editor, int cursorPos);
|
||||||
|
|
||||||
|
private slots:
|
||||||
void disconnected();
|
void disconnected();
|
||||||
void documentUpdated(QmlJS::Document::Ptr doc);
|
void documentUpdated(QmlJS::Document::Ptr doc);
|
||||||
void expressionEvaluated(quint32 queryId, const QVariant &result);
|
void expressionEvaluated(quint32 queryId, const QVariant &result);
|
||||||
|
|
||||||
private slots:
|
|
||||||
void errorMessageBoxFinished(int result);
|
void errorMessageBoxFinished(int result);
|
||||||
void updateCurrentContext();
|
void updateCurrentContext();
|
||||||
void appendDebugOutput(QtMsgType type, const QString &message,
|
void appendDebugOutput(QtMsgType type, const QString &message,
|
||||||
const QmlDebug::QDebugContextInfo &info);
|
const QmlDebug::QDebugContextInfo &info);
|
||||||
|
|
||||||
|
void tryToConnect(quint16 port = 0);
|
||||||
|
void beginConnection(quint16 port = 0);
|
||||||
|
void connectionEstablished();
|
||||||
|
void connectionStartupFailed();
|
||||||
|
void appStartupFailed(const QString &errorMessage);
|
||||||
|
void connectionError(QAbstractSocket::SocketError error);
|
||||||
|
void serviceConnectionError(const QString &service);
|
||||||
|
void appendMessage(const QString &msg, Utils::OutputFormat);
|
||||||
|
|
||||||
|
void synchronizeWatchers();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// DebuggerEngine implementation.
|
// DebuggerEngine implementation.
|
||||||
bool isSynchronous() const { return false; }
|
bool isSynchronous() const { return false; }
|
||||||
@@ -154,22 +170,6 @@ private:
|
|||||||
|
|
||||||
bool hasCapability(unsigned) const;
|
bool hasCapability(unsigned) const;
|
||||||
|
|
||||||
signals:
|
|
||||||
void tooltipRequested(const QPoint &mousePos,
|
|
||||||
TextEditor::ITextEditor *editor, int cursorPos);
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void tryToConnect(quint16 port = 0);
|
|
||||||
void beginConnection(quint16 port = 0);
|
|
||||||
void connectionEstablished();
|
|
||||||
void connectionStartupFailed();
|
|
||||||
void appStartupFailed(const QString &errorMessage);
|
|
||||||
void connectionError(QAbstractSocket::SocketError error);
|
|
||||||
void serviceConnectionError(const QString &service);
|
|
||||||
void appendMessage(const QString &msg, Utils::OutputFormat);
|
|
||||||
|
|
||||||
void synchronizeWatchers();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void closeConnection();
|
void closeConnection();
|
||||||
void startApplicationLauncher();
|
void startApplicationLauncher();
|
||||||
@@ -189,12 +189,23 @@ private:
|
|||||||
bool adjustBreakpointLineAndColumn(const QString &filePath, quint32 *line,
|
bool adjustBreakpointLineAndColumn(const QString &filePath, quint32 *line,
|
||||||
quint32 *column, bool *valid);
|
quint32 *column, bool *valid);
|
||||||
|
|
||||||
private:
|
QmlAdapter m_adapter;
|
||||||
|
QmlInspectorAdapter m_inspectorAdapter;
|
||||||
|
ProjectExplorer::ApplicationLauncher m_applicationLauncher;
|
||||||
|
QTimer m_noDebugOutputTimer;
|
||||||
|
QmlOutputParser m_outputParser;
|
||||||
|
QHash<QString, QTextDocument*> m_sourceDocuments;
|
||||||
|
QHash<QString, QWeakPointer<TextEditor::ITextEditor> > m_sourceEditors;
|
||||||
|
InteractiveInterpreter m_interpreter;
|
||||||
|
QHash<QString,BreakpointModelId> pendingBreakpoints;
|
||||||
|
QList<quint32> queryIds;
|
||||||
|
bool m_retryOnConnectFail;
|
||||||
|
bool m_automaticConnect;
|
||||||
|
|
||||||
friend class QmlCppEngine;
|
friend class QmlCppEngine;
|
||||||
QmlEnginePrivate *d;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|
||||||
#endif // DEBUGGER_QMLENGINE_H
|
#endif // QMLENGINE_H
|
||||||
|
|||||||
Reference in New Issue
Block a user