Debugger: Remove DebuggerRunControl

Use plain RunControl + DebuggerRunTool combo instead.

Change-Id: Ib71b5eab50da667b9d71dcc6689d2643ad8ecdee
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2017-04-27 09:53:07 +02:00
parent 6e2756244d
commit 6e990f96c6
27 changed files with 136 additions and 229 deletions

View File

@@ -138,28 +138,30 @@ RunControl *AndroidDebugSupport::createDebugRunControl(RunConfiguration *runConf
}
}
RunControl *runControl = createDebuggerRunControl(params, runConfig, errorMessage);
new AndroidDebugSupport(runControl);
auto runControl = new ProjectExplorer::RunControl(runConfig, ProjectExplorer::Constants::DEBUG_RUN_MODE);
(void) new AndroidDebugSupport(runControl, params, errorMessage);
return runControl;
}
AndroidDebugSupport::AndroidDebugSupport(RunControl *runControl)
: ToolRunner(runControl),
AndroidDebugSupport::AndroidDebugSupport(RunControl *runControl,
const Debugger::DebuggerStartParameters &sp,
QString *errorMessage)
: DebuggerRunTool(runControl, sp, errorMessage),
m_runner(new AndroidRunner(this, runControl->runConfiguration(), runControl->runMode()))
{
connect(runControl, &RunControl::finished,
m_runner, &AndroidRunner::stop);
connect(this->runControl()->toolRunner(), &DebuggerRunTool::requestRemoteSetup,
connect(this, &DebuggerRunTool::requestRemoteSetup,
m_runner, &AndroidRunner::start);
// FIXME: Move signal to base class and generalize handling.
connect(this->runControl()->toolRunner(), &DebuggerRunTool::aboutToNotifyInferiorSetupOk,
connect(this, &DebuggerRunTool::aboutToNotifyInferiorSetupOk,
m_runner, &AndroidRunner::remoteDebuggerRunning);
connect(m_runner, &AndroidRunner::remoteServerRunning,
[this](const QByteArray &serverChannel, int pid) {
this->runControl()->toolRunner()->notifyEngineRemoteServerRunning(serverChannel, pid);
notifyEngineRemoteServerRunning(serverChannel, pid);
});
connect(m_runner, &AndroidRunner::remoteProcessStarted,
@@ -173,12 +175,12 @@ AndroidDebugSupport::AndroidDebugSupport(RunControl *runControl)
connect(m_runner, &AndroidRunner::remoteErrorOutput,
[this](const QString &output) {
this->runControl()->toolRunner()->showMessage(output, AppError);
showMessage(output, AppError);
});
connect(m_runner, &AndroidRunner::remoteOutput,
[this](const QString &output) {
this->runControl()->toolRunner()->showMessage(output, AppOutput);
showMessage(output, AppOutput);
});
QTC_ASSERT(runControl, return);
@@ -200,12 +202,7 @@ void AndroidDebugSupport::handleRemoteProcessStarted(Utils::Port gdbServerPort,
result.success = true;
result.gdbServerPort = gdbServerPort;
result.qmlServerPort = qmlPort;
runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result);
}
DebuggerRunControl *AndroidDebugSupport::runControl()
{
return qobject_cast<DebuggerRunControl *>(ToolRunner::runControl());
notifyEngineRemoteSetupFinished(result);
}
} // namespace Internal

View File

@@ -25,30 +25,29 @@
#pragma once
#include <projectexplorer/runconfiguration.h>
#include <debugger/debuggerruncontrol.h>
#include "androidrunconfiguration.h"
namespace Debugger { class DebuggerRunControl; }
namespace Android {
namespace Internal {
class AndroidRunner;
class AndroidDebugSupport : public ProjectExplorer::ToolRunner
class AndroidDebugSupport : public Debugger::DebuggerRunTool
{
Q_OBJECT
public:
explicit AndroidDebugSupport(ProjectExplorer::RunControl *runControl);
AndroidDebugSupport(ProjectExplorer::RunControl *runControl,
const Debugger::DebuggerStartParameters &sp,
QString *errorMessage);
static ProjectExplorer::RunControl *createDebugRunControl(ProjectExplorer::RunConfiguration *runConfig,
QString *errorMessage);
private:
void handleRemoteProcessStarted(Utils::Port gdbServerPort, Utils::Port qmlPort);
Debugger::DebuggerRunControl *runControl();
AndroidRunner * const m_runner;
};