ProjectExplorer: Always initialize RunControl's runnable from RunConfig

That's a good first approximation and often enough all that is needed.

Change-Id: If54cdb0e98cda94bc4a4ef24fcc12c78018c4dbe
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2017-04-06 11:26:35 +02:00
parent 1ad6c9465c
commit ff62ef3d92
7 changed files with 5 additions and 28 deletions

View File

@@ -603,6 +603,7 @@ using namespace Internal;
RunControl::RunControl(RunConfiguration *runConfiguration, Core::Id mode) : RunControl::RunControl(RunConfiguration *runConfiguration, Core::Id mode) :
d(new RunControlPrivate(this, runConfiguration, mode)) d(new RunControlPrivate(this, runConfiguration, mode))
{ {
d->runnable = runConfiguration->runnable();
#ifdef WITH_JOURNALD #ifdef WITH_JOURNALD
JournaldWatcher::instance()->subscribe(this, [this](const JournaldWatcher::LogEntry &entry) { JournaldWatcher::instance()->subscribe(this, [this](const JournaldWatcher::LogEntry &entry) {
if (entry.value("_MACHINE_ID") != JournaldWatcher::instance()->machineId()) if (entry.value("_MACHINE_ID") != JournaldWatcher::instance()->machineId())

View File

@@ -142,7 +142,6 @@ RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, Core::Id m
return 0; return 0;
RunControl *runControl = Debugger::createAnalyzerRunControl(runConfig, mode); RunControl *runControl = Debugger::createAnalyzerRunControl(runConfig, mode);
QTC_ASSERT(runControl, return 0); QTC_ASSERT(runControl, return 0);
runControl->setRunnable(runConfig->runnable());
AnalyzerConnection connection; AnalyzerConnection connection;
connection.connParams = device->sshParameters(); connection.connParams = device->sshParameters();
connection.analyzerHost = connection.connParams.host; connection.analyzerHost = connection.connParams.host;

View File

@@ -41,14 +41,7 @@ namespace Internal {
class AbstractRemoteLinuxRunSupportPrivate class AbstractRemoteLinuxRunSupportPrivate
{ {
public: public:
AbstractRemoteLinuxRunSupportPrivate(const RunConfiguration *runConfig) AbstractRemoteLinuxRunSupport::State state = AbstractRemoteLinuxRunSupport::Inactive;
: state(AbstractRemoteLinuxRunSupport::Inactive),
runnable(runConfig->runnable().as<StandardRunnable>())
{
}
AbstractRemoteLinuxRunSupport::State state;
StandardRunnable runnable;
ApplicationLauncher appLauncher; ApplicationLauncher appLauncher;
DeviceUsedPortsGatherer portsGatherer; DeviceUsedPortsGatherer portsGatherer;
ApplicationLauncher fifoCreator; ApplicationLauncher fifoCreator;
@@ -62,7 +55,7 @@ using namespace Internal;
AbstractRemoteLinuxRunSupport::AbstractRemoteLinuxRunSupport(RunControl *runControl) AbstractRemoteLinuxRunSupport::AbstractRemoteLinuxRunSupport(RunControl *runControl)
: ToolRunner(runControl), : ToolRunner(runControl),
d(new AbstractRemoteLinuxRunSupportPrivate(runControl->runConfiguration())) d(new AbstractRemoteLinuxRunSupportPrivate)
{ {
} }
@@ -174,11 +167,6 @@ void AbstractRemoteLinuxRunSupport::createRemoteFifo()
d->fifoCreator.start(r, device()); d->fifoCreator.start(r, device());
} }
const StandardRunnable &AbstractRemoteLinuxRunSupport::runnable() const
{
return d->runnable;
}
void AbstractRemoteLinuxRunSupport::reset() void AbstractRemoteLinuxRunSupport::reset()
{ {
d->portsGatherer.disconnect(this); d->portsGatherer.disconnect(this);

View File

@@ -34,13 +34,6 @@
#include <QObject> #include <QObject>
namespace ProjectExplorer {
class ApplicationLauncher;
class RunConfiguration;
class Runnable;
class StandardRunnable;
}
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { class AbstractRemoteLinuxRunSupportPrivate; } namespace Internal { class AbstractRemoteLinuxRunSupportPrivate; }
@@ -78,8 +71,6 @@ protected:
void createRemoteFifo(); void createRemoteFifo();
QString fifo() const; QString fifo() const;
const ProjectExplorer::StandardRunnable &runnable() const;
void reset(); void reset();
protected: protected:

View File

@@ -152,7 +152,7 @@ void RemoteLinuxAnalyzeSupport::startExecution()
connect(runner, &ApplicationLauncher::reportError, connect(runner, &ApplicationLauncher::reportError,
this, &RemoteLinuxAnalyzeSupport::handleAppRunnerError); this, &RemoteLinuxAnalyzeSupport::handleAppRunnerError);
auto r = runnable(); auto r = runControl()->runnable().as<StandardRunnable>();
if (runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) { if (runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
if (!r.commandLineArguments.isEmpty()) if (!r.commandLineArguments.isEmpty())

View File

@@ -159,7 +159,7 @@ void LinuxDeviceDebugSupport::startExecution()
Runnable LinuxDeviceDebugSupport::realRunnable() const Runnable LinuxDeviceDebugSupport::realRunnable() const
{ {
StandardRunnable r = runnable(); StandardRunnable r = runControl()->runnable().as<StandardRunnable>();
QStringList args = QtcProcess::splitArgs(r.commandLineArguments, OsTypeLinux); QStringList args = QtcProcess::splitArgs(r.commandLineArguments, OsTypeLinux);
QString command; QString command;

View File

@@ -57,8 +57,6 @@ ValgrindRunControl::ValgrindRunControl(RunConfiguration *runConfiguration, Core:
: RunControl(runConfiguration, runMode) : RunControl(runConfiguration, runMode)
{ {
setIcon(ProjectExplorer::Icons::ANALYZER_START_SMALL_TOOLBAR); setIcon(ProjectExplorer::Icons::ANALYZER_START_SMALL_TOOLBAR);
QTC_ASSERT(runConfiguration, return);
setRunnable(runConfiguration->runnable());
if (runConfiguration) if (runConfiguration)
if (IRunConfigurationAspect *aspect = runConfiguration->extraAspect(ANALYZER_VALGRIND_SETTINGS)) if (IRunConfigurationAspect *aspect = runConfiguration->extraAspect(ANALYZER_VALGRIND_SETTINGS))