diff options
author | Benjamin Zeller <benjamin.zeller@canonical.com> | 2015-06-11 12:00:20 +0200 |
---|---|---|
committer | Benjamin Zeller <benjamin.zeller@canonical.com> | 2015-06-11 15:49:49 +0000 |
commit | be3c95610d092c10a8197737f449c87fd4406c77 (patch) | |
tree | 8f77a517dc3c30cc88d732ff98b285c45e0cb504 /src/plugins/projectexplorer/localapplicationruncontrol.cpp | |
parent | e3640a4ff8357031885499c6cc158621ada38393 (diff) |
ProjectExplorer: Make the LocalApplicationRunControl more flexible
In order to make it possible to use the LocalApplicationRunControl
without a LocalApplicationRunConfiguration it is required to
add some setter functions to get all the required data which is
not offered by the base RunConfiguration type into the RunControl
object. LocalApplicationRunControl also needs to be exported.
Change-Id: I1c03d924cd69609ee5f23fa69842da98ae86fab8
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
Diffstat (limited to 'src/plugins/projectexplorer/localapplicationruncontrol.cpp')
-rw-r--r-- | src/plugins/projectexplorer/localapplicationruncontrol.cpp | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/src/plugins/projectexplorer/localapplicationruncontrol.cpp b/src/plugins/projectexplorer/localapplicationruncontrol.cpp index defafb82f5..a1596b34b9 100644 --- a/src/plugins/projectexplorer/localapplicationruncontrol.cpp +++ b/src/plugins/projectexplorer/localapplicationruncontrol.cpp @@ -58,26 +58,29 @@ RunControl *LocalApplicationRunControlFactory::create(RunConfiguration *runConfi Q_UNUSED(errorMessage) QTC_ASSERT(canRun(runConfiguration, mode), return 0); LocalApplicationRunConfiguration *localRunConfiguration = qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration); - return new LocalApplicationRunControl(localRunConfiguration, mode); + + QTC_ASSERT(localRunConfiguration, return 0); + LocalApplicationRunControl *runControl = new LocalApplicationRunControl(localRunConfiguration, mode); + runControl->setCommand(localRunConfiguration->executable(), localRunConfiguration->commandLineArguments()); + runControl->setApplicationLauncherMode(localRunConfiguration->runMode()); + runControl->setWorkingDirectory(localRunConfiguration->workingDirectory()); + + return runControl; } +} // namespace Internal + // ApplicationRunControl -LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfiguration *rc, RunMode mode) - : RunControl(rc, mode), m_running(false) +LocalApplicationRunControl::LocalApplicationRunControl(RunConfiguration *rc, RunMode mode) + : RunControl(rc, mode), m_runMode(ApplicationLauncher::Console), m_running(false) { setIcon(QLatin1String(Constants::ICON_RUN_SMALL)); EnvironmentAspect *environment = rc->extraAspect<EnvironmentAspect>(); Utils::Environment env; if (environment) env = environment->environment(); - QString dir = rc->workingDirectory(); m_applicationLauncher.setEnvironment(env); - m_applicationLauncher.setWorkingDirectory(dir); - - m_executable = rc->executable(); - m_runMode = static_cast<ApplicationLauncher::Mode>(rc->runMode()); - m_commandLineArguments = rc->commandLineArguments(); connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,Utils::OutputFormat)), this, SLOT(slotAppendMessage(QString,Utils::OutputFormat))); @@ -123,6 +126,22 @@ bool LocalApplicationRunControl::isRunning() const return m_running; } +void LocalApplicationRunControl::setCommand(const QString &executable, const QString &commandLineArguments) +{ + m_executable = executable; + m_commandLineArguments = commandLineArguments; +} + +void LocalApplicationRunControl::setApplicationLauncherMode(const ApplicationLauncher::Mode mode) +{ + m_runMode = mode; +} + +void LocalApplicationRunControl::setWorkingDirectory(const QString &workingDirectory) +{ + m_applicationLauncher.setWorkingDirectory(workingDirectory); +} + void LocalApplicationRunControl::slotAppendMessage(const QString &err, Utils::OutputFormat format) { @@ -151,5 +170,4 @@ void LocalApplicationRunControl::processExited(int exitCode, QProcess::ExitStatu emit finished(); } -} // namespace Internal } // namespace ProjectExplorer |