forked from qt-creator/qt-creator
Debugger: Move run parameters from engine to tool runner
The parameters belong to the run control, they should not be triplicated in case of a combined engine. Change-Id: I4dd84220edbd7a44b902cc52627fe01d0568db75 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "qmlcppengine.h"
|
||||
#include "qmlengine.h"
|
||||
|
||||
#include <debugger/debuggercore.h>
|
||||
#include <debugger/debuggerruncontrol.h>
|
||||
#include <debugger/debuggertooltipmanager.h>
|
||||
#include <debugger/debuggerstartparameters.h>
|
||||
@@ -48,13 +49,9 @@ enum { debug = 0 };
|
||||
|
||||
#define CHECK_STATE(s) do { checkState(s, __FILE__, __LINE__); } while (0)
|
||||
|
||||
DebuggerEngine *createQmlCppEngine(const DebuggerRunParameters &sp, QStringList *errors)
|
||||
DebuggerEngine *createQmlCppEngine(DebuggerEngine *cppEngine, bool useTerminal)
|
||||
{
|
||||
QmlCppEngine *newEngine = new QmlCppEngine(sp, errors);
|
||||
if (newEngine->cppEngine())
|
||||
return newEngine;
|
||||
delete newEngine;
|
||||
return 0;
|
||||
return new QmlCppEngine(cppEngine, useTerminal);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,19 +61,12 @@ DebuggerEngine *createQmlCppEngine(const DebuggerRunParameters &sp, QStringList
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
QmlCppEngine::QmlCppEngine(const DebuggerRunParameters &rp, QStringList *errors)
|
||||
: DebuggerEngine(rp)
|
||||
QmlCppEngine::QmlCppEngine(DebuggerEngine *cppEngine, bool useTerminal)
|
||||
{
|
||||
setObjectName(QLatin1String("QmlCppEngine"));
|
||||
m_qmlEngine = new QmlEngine(rp, this);
|
||||
QStringList innerErrors;
|
||||
m_cppEngine = createEngine(rp.cppEngineType, rp, &innerErrors);
|
||||
if (!m_cppEngine) {
|
||||
errors->append(tr("The slave debugging engine required for combined "
|
||||
"QML/C++-Debugging could not be created: %1")
|
||||
.arg(innerErrors.join(QLatin1Char('\n'))));
|
||||
return;
|
||||
}
|
||||
setObjectName("QmlCppEngine");
|
||||
m_qmlEngine = new QmlEngine(useTerminal);
|
||||
m_qmlEngine->setMasterEngine(this);
|
||||
m_cppEngine = cppEngine;
|
||||
m_cppEngine->setMasterEngine(this);
|
||||
setActiveEngine(m_cppEngine);
|
||||
}
|
||||
@@ -770,6 +760,13 @@ DebuggerEngine *QmlCppEngine::qmlEngine() const
|
||||
return m_qmlEngine;
|
||||
}
|
||||
|
||||
void QmlCppEngine::setRunTool(DebuggerRunTool *runTool)
|
||||
{
|
||||
DebuggerEngine::setRunTool(runTool);
|
||||
m_qmlEngine->setRunTool(runTool);
|
||||
m_cppEngine->setRunTool(runTool);
|
||||
}
|
||||
|
||||
void QmlCppEngine::setActiveEngine(DebuggerEngine *engine)
|
||||
{
|
||||
m_activeEngine = engine;
|
||||
|
||||
@@ -37,7 +37,7 @@ class QmlCppEngine : public DebuggerEngine
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QmlCppEngine(const DebuggerRunParameters &sp, QStringList *errors);
|
||||
QmlCppEngine(DebuggerEngine *cppEngine, bool useTerminal);
|
||||
~QmlCppEngine() override;
|
||||
|
||||
bool canDisplayTooltip() const override;
|
||||
@@ -80,6 +80,8 @@ public:
|
||||
|
||||
DebuggerEngine *cppEngine() override { return m_cppEngine; }
|
||||
DebuggerEngine *qmlEngine() const;
|
||||
DebuggerEngine *activeEngine() override { return m_activeEngine; }
|
||||
void setRunTool(DebuggerRunTool *runTool) override;
|
||||
|
||||
void notifyEngineRemoteSetupFinished(const RemoteSetupResult &result) override;
|
||||
void resetLocation() override;
|
||||
|
||||
@@ -257,15 +257,11 @@ static void updateDocument(IDocument *document, const QTextDocument *textDocumen
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
QmlEngine::QmlEngine(const DebuggerRunParameters &startParameters, DebuggerEngine *masterEngine)
|
||||
: DebuggerEngine(startParameters),
|
||||
d(new QmlEnginePrivate(this, new QmlDebugConnection(this)))
|
||||
QmlEngine::QmlEngine(bool useTerminal)
|
||||
: d(new QmlEnginePrivate(this, new QmlDebugConnection(this)))
|
||||
{
|
||||
setObjectName("QmlEngine");
|
||||
|
||||
if (masterEngine)
|
||||
setMasterEngine(masterEngine);
|
||||
|
||||
connect(stackHandler(), &StackHandler::stackChanged,
|
||||
this, &QmlEngine::updateCurrentContext);
|
||||
connect(stackHandler(), &StackHandler::currentIndexChanged,
|
||||
@@ -276,7 +272,7 @@ QmlEngine::QmlEngine(const DebuggerRunParameters &startParameters, DebuggerEngin
|
||||
connect(&d->applicationLauncher, &ApplicationLauncher::processExited,
|
||||
this, &QmlEngine::disconnected);
|
||||
connect(&d->applicationLauncher, &ApplicationLauncher::appendMessage,
|
||||
this, &QmlEngine::appendMessage);
|
||||
this, &QmlEngine::appMessage);
|
||||
connect(&d->applicationLauncher, &ApplicationLauncher::processStarted,
|
||||
this, &QmlEngine::handleLauncherStarted);
|
||||
|
||||
@@ -296,7 +292,7 @@ QmlEngine::QmlEngine(const DebuggerRunParameters &startParameters, DebuggerEngin
|
||||
this, [this] { tryToConnect(); });
|
||||
|
||||
// we won't get any debug output
|
||||
if (startParameters.useTerminal) {
|
||||
if (useTerminal) {
|
||||
d->noDebugOutputTimer.setInterval(0);
|
||||
d->retryOnConnectFail = true;
|
||||
d->automaticConnect = true;
|
||||
@@ -380,7 +376,7 @@ void QmlEngine::handleLauncherStarted()
|
||||
d->noDebugOutputTimer.start();
|
||||
}
|
||||
|
||||
void QmlEngine::appendMessage(const QString &msg, Utils::OutputFormat /* format */)
|
||||
void QmlEngine::appMessage(const QString &msg, Utils::OutputFormat /* format */)
|
||||
{
|
||||
showMessage(msg, AppOutput); // FIXME: Redirect to RunControl
|
||||
}
|
||||
@@ -576,10 +572,10 @@ void QmlEngine::startApplicationLauncher()
|
||||
{
|
||||
if (!d->applicationLauncher.isRunning()) {
|
||||
StandardRunnable runnable = runParameters().inferior;
|
||||
appendMessage(tr("Starting %1 %2").arg(
|
||||
QDir::toNativeSeparators(runnable.executable),
|
||||
runnable.commandLineArguments) + '\n',
|
||||
Utils::NormalMessageFormat);
|
||||
runTool()->appendMessage(tr("Starting %1 %2").arg(
|
||||
QDir::toNativeSeparators(runnable.executable),
|
||||
runnable.commandLineArguments),
|
||||
Utils::NormalMessageFormat);
|
||||
d->applicationLauncher.start(runnable);
|
||||
}
|
||||
}
|
||||
@@ -2579,9 +2575,9 @@ void QmlEnginePrivate::flushSendBuffer()
|
||||
sendBuffer.clear();
|
||||
}
|
||||
|
||||
DebuggerEngine *createQmlEngine(const DebuggerRunParameters &sp)
|
||||
DebuggerEngine *createQmlEngine(bool useTerminal)
|
||||
{
|
||||
return new QmlEngine(sp);
|
||||
return new QmlEngine(useTerminal);
|
||||
}
|
||||
|
||||
} // Internal
|
||||
|
||||
@@ -43,8 +43,7 @@ class QmlEngine : public DebuggerEngine
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QmlEngine(const DebuggerRunParameters &runParameters,
|
||||
DebuggerEngine *masterEngine = nullptr);
|
||||
explicit QmlEngine(bool useTerminal);
|
||||
~QmlEngine() override;
|
||||
|
||||
void setRunTool(DebuggerRunTool *runTool) override;
|
||||
@@ -66,7 +65,7 @@ private:
|
||||
void connectionEstablished();
|
||||
void connectionStartupFailed();
|
||||
void appStartupFailed(const QString &errorMessage);
|
||||
void appendMessage(const QString &msg, Utils::OutputFormat);
|
||||
void appMessage(const QString &msg, Utils::OutputFormat);
|
||||
|
||||
void notifyEngineRemoteServerRunning(const QString &, int pid) override;
|
||||
void notifyEngineRemoteSetupFinished(const RemoteSetupResult &result) override;
|
||||
|
||||
Reference in New Issue
Block a user