forked from qt-creator/qt-creator
Use EnvironmentAspect to retrieve the environment
Change-Id: If878e22cc2715d05bb3e65ad908cd4fb5e21b03b Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/helpmanager.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <projectexplorer/environmentaspect.h>
|
||||
#include <projectexplorer/environmentwidget.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
@@ -124,8 +125,10 @@ void CMakeRunConfiguration::setRunMode(RunMode runMode)
|
||||
|
||||
QString CMakeRunConfiguration::workingDirectory() const
|
||||
{
|
||||
return QDir::cleanPath(environment().expandVariables(
|
||||
Utils::expandMacros(baseWorkingDirectory(), macroExpander())));
|
||||
ProjectExplorer::EnvironmentAspect *aspect = extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
QTC_ASSERT(aspect, return QString());
|
||||
return QDir::cleanPath(aspect->environment().expandVariables(
|
||||
Utils::expandMacros(baseWorkingDirectory(), macroExpander())));
|
||||
}
|
||||
|
||||
QString CMakeRunConfiguration::baseWorkingDirectory() const
|
||||
@@ -321,6 +324,12 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
|
||||
m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory);
|
||||
m_workingDirectoryEdit->setBaseDirectory(m_cmakeRunConfiguration->target()->project()->projectDirectory());
|
||||
m_workingDirectoryEdit->setPath(m_cmakeRunConfiguration->baseWorkingDirectory());
|
||||
ProjectExplorer::EnvironmentAspect *aspect
|
||||
= m_cmakeRunConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
if (aspect) {
|
||||
connect(aspect, SIGNAL(environmentChanged()), this, SLOT(environmentWasChanged()));
|
||||
environmentWasChanged();
|
||||
}
|
||||
m_workingDirectoryEdit->setPromptDialogTitle(tr("Select Working Directory"));
|
||||
|
||||
QToolButton *resetButton = new QToolButton();
|
||||
@@ -431,6 +440,14 @@ void CMakeRunConfigurationWidget::runInTerminalToggled(bool toggled)
|
||||
: ProjectExplorer::LocalApplicationRunConfiguration::Gui);
|
||||
}
|
||||
|
||||
void CMakeRunConfigurationWidget::environmentWasChanged()
|
||||
{
|
||||
ProjectExplorer::EnvironmentAspect *aspect
|
||||
= m_cmakeRunConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
QTC_ASSERT(aspect, return);
|
||||
m_workingDirectoryEdit->setEnvironment(aspect->environment());
|
||||
}
|
||||
|
||||
void CMakeRunConfigurationWidget::userChangesChanged()
|
||||
{
|
||||
m_cmakeRunConfiguration->setUserEnvironmentChanges(m_environmentWidget->userChanges());
|
||||
|
@@ -139,6 +139,7 @@ private slots:
|
||||
void setWorkingDirectory();
|
||||
void resetWorkingDirectory();
|
||||
void runInTerminalToggled(bool toggled);
|
||||
void environmentWasChanged();
|
||||
|
||||
void baseEnvironmentComboBoxChanged(int index);
|
||||
void workingDirectoryChanged(const QString &workingDirectory);
|
||||
|
@@ -47,6 +47,7 @@
|
||||
#endif
|
||||
|
||||
#include <projectexplorer/localapplicationrunconfiguration.h> // For LocalApplication*
|
||||
#include <projectexplorer/environmentaspect.h> // For the environment
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
@@ -337,6 +338,8 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
|
||||
LocalApplicationRunConfiguration *rc =
|
||||
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
|
||||
QTC_ASSERT(rc, return sp);
|
||||
EnvironmentAspect *environment = rc->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
QTC_ASSERT(environment, return sp);
|
||||
if (!rc->ensureConfigured(errorMessage))
|
||||
return sp;
|
||||
|
||||
@@ -344,7 +347,7 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
|
||||
Kit *kit = target ? target->kit() : KitManager::instance()->defaultKit();
|
||||
if (!fillParameters(&sp, kit, errorMessage))
|
||||
return sp;
|
||||
sp.environment = rc->environment();
|
||||
sp.environment = environment->environment();
|
||||
sp.workingDirectory = rc->workingDirectory();
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
@@ -370,14 +373,14 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
|
||||
}
|
||||
}
|
||||
|
||||
DebuggerRunConfigurationAspect *aspect
|
||||
DebuggerRunConfigurationAspect *debugger
|
||||
= runConfiguration->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
|
||||
sp.multiProcess = aspect->useMultiProcess();
|
||||
sp.multiProcess = debugger->useMultiProcess();
|
||||
|
||||
if (aspect->useCppDebugger())
|
||||
if (debugger->useCppDebugger())
|
||||
sp.languages |= CppLanguage;
|
||||
|
||||
if (aspect->useQmlDebugger()) {
|
||||
if (debugger->useQmlDebugger()) {
|
||||
const ProjectExplorer::IDevice::ConstPtr device =
|
||||
DeviceKitInformation::device(runConfiguration->target()->kit());
|
||||
sp.qmlServerAddress = _("127.0.0.1");
|
||||
|
@@ -41,7 +41,9 @@
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <remotelinux/remotelinuxenvironmentaspect.h>
|
||||
#include <utils/portlist.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <ssh/sshconnection.h>
|
||||
|
||||
#include <QDir>
|
||||
@@ -123,7 +125,9 @@ QString MaemoRunConfiguration::commandPrefix() const
|
||||
|
||||
const QString prefix = environmentPreparationCommand() + QLatin1Char(';');
|
||||
|
||||
return QString::fromLatin1("%1 %2").arg(prefix, userEnvironmentChangesAsString());
|
||||
RemoteLinuxEnvironmentAspect *aspect = extraAspect<RemoteLinuxEnvironmentAspect>();
|
||||
QTC_ASSERT(aspect, return QString());
|
||||
return QString::fromLatin1("%1 %2").arg(prefix, aspect->userEnvironmentChangesAsString());
|
||||
}
|
||||
|
||||
Utils::PortList MaemoRunConfiguration::freePorts() const
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "localapplicationruncontrol.h"
|
||||
#include "localapplicationrunconfiguration.h"
|
||||
|
||||
#include <projectexplorer/environmentaspect.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/environment.h>
|
||||
|
||||
@@ -72,7 +73,10 @@ RunControl *LocalApplicationRunControlFactory::create(RunConfiguration *runConfi
|
||||
LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfiguration *rc, RunMode mode)
|
||||
: RunControl(rc, mode), m_running(false)
|
||||
{
|
||||
Utils::Environment env = rc->environment();
|
||||
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);
|
||||
|
@@ -39,6 +39,7 @@
|
||||
#include <coreplugin/helpmanager.h>
|
||||
#include <qmlprojectmanager/qmlprojectrunconfiguration.h>
|
||||
#include <qmlprojectmanager/qmlprojectplugin.h>
|
||||
#include <projectexplorer/environmentaspect.h>
|
||||
#include <projectexplorer/localapplicationruncontrol.h>
|
||||
#include <projectexplorer/localapplicationrunconfiguration.h>
|
||||
#include <qmldebug/qmloutputparser.h>
|
||||
@@ -84,8 +85,12 @@ QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunCo
|
||||
AbstractQmlProfilerRunner *runner = 0;
|
||||
if (!runConfiguration) // attaching
|
||||
return 0;
|
||||
Debugger::DebuggerRunConfigurationAspect *aspect
|
||||
Debugger::DebuggerRunConfigurationAspect *debugger
|
||||
= runConfiguration->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
|
||||
QTC_ASSERT(debugger, return 0);
|
||||
ProjectExplorer::EnvironmentAspect *environment
|
||||
= runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
QTC_ASSERT(environment, return 0);
|
||||
if (QmlProjectManager::QmlProjectRunConfiguration *rc1 =
|
||||
qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration)) {
|
||||
// This is a "plain" .qmlproject.
|
||||
@@ -93,8 +98,8 @@ QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunCo
|
||||
conf.executable = rc1->observerPath();
|
||||
conf.executableArguments = rc1->viewerArguments();
|
||||
conf.workingDirectory = rc1->workingDirectory();
|
||||
conf.environment = rc1->environment();
|
||||
conf.port = aspect->qmlDebugServerPort();
|
||||
conf.environment = environment->environment();
|
||||
conf.port = debugger->qmlDebugServerPort();
|
||||
runner = new LocalQmlProfilerRunner(conf, parent);
|
||||
} else if (LocalApplicationRunConfiguration *rc2 =
|
||||
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
|
||||
@@ -103,8 +108,8 @@ QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunCo
|
||||
conf.executable = rc2->executable();
|
||||
conf.executableArguments = rc2->commandLineArguments();
|
||||
conf.workingDirectory = rc2->workingDirectory();
|
||||
conf.environment = rc2->environment();
|
||||
conf.port = aspect->qmlDebugServerPort();
|
||||
conf.environment = environment->environment();
|
||||
conf.port = debugger->qmlDebugServerPort();
|
||||
runner = new LocalQmlProfilerRunner(conf, parent);
|
||||
} else if (RemoteLinux::RemoteLinuxRunConfiguration *rmConfig =
|
||||
qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
|
||||
|
@@ -48,6 +48,7 @@
|
||||
#include <utils/fancymainwindow.h>
|
||||
#include <utils/fileinprojectfinder.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <projectexplorer/environmentaspect.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/target.h>
|
||||
@@ -299,31 +300,35 @@ AnalyzerStartParameters QmlProfilerTool::createStartParameters(RunConfiguration
|
||||
Q_UNUSED(mode);
|
||||
|
||||
AnalyzerStartParameters sp;
|
||||
sp.startMode = StartQml; // FIXME: The parameter struct is not needed/not used.
|
||||
|
||||
Debugger::DebuggerRunConfigurationAspect *aspect
|
||||
ProjectExplorer::EnvironmentAspect *environment
|
||||
= runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
Debugger::DebuggerRunConfigurationAspect *debugger
|
||||
= runConfiguration->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
|
||||
QTC_ASSERT(debugger, return sp);
|
||||
sp.startMode = StartQml; // FIXME: The parameter struct is not needed/not used.
|
||||
|
||||
// FIXME: This is only used to communicate the connParams settings.
|
||||
if (QmlProjectRunConfiguration *rc1 =
|
||||
qobject_cast<QmlProjectRunConfiguration *>(runConfiguration)) {
|
||||
// This is a "plain" .qmlproject.
|
||||
sp.environment = rc1->environment();
|
||||
if (environment)
|
||||
sp.environment = environment->environment();
|
||||
sp.workingDirectory = rc1->workingDirectory();
|
||||
sp.debuggee = rc1->observerPath();
|
||||
sp.debuggeeArgs = rc1->viewerArguments();
|
||||
sp.displayName = rc1->displayName();
|
||||
sp.connParams.host = QLatin1String("localhost");
|
||||
sp.connParams.port = aspect->qmlDebugServerPort();
|
||||
sp.connParams.port = debugger->qmlDebugServerPort();
|
||||
} else if (LocalApplicationRunConfiguration *rc2 =
|
||||
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
|
||||
sp.environment = rc2->environment();
|
||||
if (environment)
|
||||
sp.environment = environment->environment();
|
||||
sp.workingDirectory = rc2->workingDirectory();
|
||||
sp.debuggee = rc2->executable();
|
||||
sp.debuggeeArgs = rc2->commandLineArguments();
|
||||
sp.displayName = rc2->displayName();
|
||||
sp.connParams.host = QLatin1String("localhost");
|
||||
sp.connParams.port = aspect->qmlDebugServerPort();
|
||||
sp.connParams.port = debugger->qmlDebugServerPort();
|
||||
} else if (RemoteLinux::RemoteLinuxRunConfiguration *rc3 =
|
||||
qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
|
||||
sp.debuggee = rc3->remoteExecutableFilePath();
|
||||
|
@@ -30,6 +30,8 @@
|
||||
#include "qmlprojectruncontrol.h"
|
||||
#include "qmlprojectrunconfiguration.h"
|
||||
#include <debugger/debuggerrunconfigurationaspect.h>
|
||||
#include <projectexplorer/environmentaspect.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/project.h>
|
||||
@@ -54,7 +56,9 @@ namespace Internal {
|
||||
QmlProjectRunControl::QmlProjectRunControl(QmlProjectRunConfiguration *runConfiguration, RunMode mode)
|
||||
: RunControl(runConfiguration, mode)
|
||||
{
|
||||
m_applicationLauncher.setEnvironment(runConfiguration->environment());
|
||||
EnvironmentAspect *environment = runConfiguration->extraAspect<EnvironmentAspect>();
|
||||
if (environment)
|
||||
m_applicationLauncher.setEnvironment(environment->environment());
|
||||
m_applicationLauncher.setWorkingDirectory(runConfiguration->workingDirectory());
|
||||
|
||||
if (mode == NormalRunMode)
|
||||
@@ -195,17 +199,22 @@ QString QmlProjectRunControlFactory::displayName() const
|
||||
RunControl *QmlProjectRunControlFactory::createDebugRunControl(QmlProjectRunConfiguration *runConfig, QString *errorMessage)
|
||||
{
|
||||
Debugger::DebuggerStartParameters params;
|
||||
Debugger::DebuggerRunConfigurationAspect *aspect
|
||||
|
||||
Debugger::DebuggerRunConfigurationAspect *debugger
|
||||
= runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
|
||||
QTC_ASSERT(debugger, return 0);
|
||||
EnvironmentAspect *environment = runConfig->extraAspect<EnvironmentAspect>();
|
||||
|
||||
params.startMode = Debugger::StartInternal;
|
||||
params.executable = runConfig->observerPath();
|
||||
params.processArgs = runConfig->viewerArguments();
|
||||
params.workingDirectory = runConfig->workingDirectory();
|
||||
params.environment = runConfig->environment();
|
||||
if (environment)
|
||||
params.environment = environment->environment();
|
||||
params.displayName = runConfig->displayName();
|
||||
params.projectSourceDirectory = runConfig->target()->project()->projectDirectory();
|
||||
params.projectSourceFiles = runConfig->target()->project()->files(Project::ExcludeGeneratedFiles);
|
||||
if (aspect->useQmlDebugger()) {
|
||||
if (debugger->useQmlDebugger()) {
|
||||
const ProjectExplorer::IDevice::ConstPtr device =
|
||||
DeviceKitInformation::device(runConfig->target()->kit());
|
||||
params.qmlServerAddress = QLatin1String("127.0.0.1");
|
||||
@@ -233,7 +242,7 @@ RunControl *QmlProjectRunControlFactory::createDebugRunControl(QmlProjectRunConf
|
||||
QString::fromLatin1("-qmljsdebugger=port:%1,block").arg(
|
||||
params.qmlServerPort));
|
||||
}
|
||||
if (aspect->useCppDebugger())
|
||||
if (debugger->useCppDebugger())
|
||||
params.languages |= Debugger::CppLanguage;
|
||||
|
||||
if (params.executable.isEmpty()) {
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include "../qt4buildconfiguration.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <projectexplorer/localenvironmentaspect.h>
|
||||
#include <projectexplorer/environmentwidget.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
@@ -134,11 +135,15 @@ QString Qt4RunConfiguration::disabledReason() const
|
||||
|
||||
void Qt4RunConfiguration::proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress)
|
||||
{
|
||||
ProjectExplorer::LocalEnvironmentAspect *aspect
|
||||
= extraAspect<ProjectExplorer::LocalEnvironmentAspect>();
|
||||
QTC_ASSERT(aspect, return);
|
||||
|
||||
if (m_proFilePath != pro->path()) {
|
||||
if (!parseInProgress) {
|
||||
// We depend on all .pro files for the LD_LIBRARY_PATH so we emit a signal for all .pro files
|
||||
// This can be optimized by checking whether LD_LIBRARY_PATH changed
|
||||
emit baseEnvironmentChanged();
|
||||
aspect->buildEnvironmentHasChanged();
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -152,7 +157,7 @@ void Qt4RunConfiguration::proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *pro,
|
||||
|
||||
if (!parseInProgress) {
|
||||
emit effectiveTargetInformationChanged();
|
||||
emit baseEnvironmentChanged();
|
||||
aspect->buildEnvironmentHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,7 +230,12 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
|
||||
m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory);
|
||||
m_workingDirectoryEdit->setPath(m_qt4RunConfiguration->baseWorkingDirectory());
|
||||
m_workingDirectoryEdit->setBaseDirectory(m_qt4RunConfiguration->target()->project()->projectDirectory());
|
||||
m_workingDirectoryEdit->setEnvironment(m_qt4RunConfiguration->environment());
|
||||
ProjectExplorer::EnvironmentAspect *aspect
|
||||
= qt4RunConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
if (aspect) {
|
||||
connect(aspect, SIGNAL(environmentChanged()), this, SLOT(environmenWasChanged()));
|
||||
environmentWasChanged();
|
||||
}
|
||||
m_workingDirectoryEdit->setPromptDialogTitle(tr("Select Working Directory"));
|
||||
|
||||
QToolButton *resetButton = new QToolButton(this);
|
||||
@@ -369,6 +379,14 @@ void Qt4RunConfigurationWidget::userChangesEdited()
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
|
||||
void Qt4RunConfigurationWidget::environmentWasChanged()
|
||||
{
|
||||
ProjectExplorer::EnvironmentAspect *aspect
|
||||
= m_qt4RunConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
QTC_ASSERT(aspect, return);
|
||||
m_workingDirectoryEdit->setEnvironment(aspect->environment());
|
||||
}
|
||||
|
||||
void Qt4RunConfigurationWidget::runConfigurationEnabledChange()
|
||||
{
|
||||
bool enabled = m_qt4RunConfiguration->isEnabled();
|
||||
@@ -546,7 +564,10 @@ void Qt4RunConfiguration::setUsingDyldImageSuffix(bool state)
|
||||
|
||||
QString Qt4RunConfiguration::workingDirectory() const
|
||||
{
|
||||
return QDir::cleanPath(environment().expandVariables(
|
||||
ProjectExplorer::EnvironmentAspect *aspect
|
||||
= extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
QTC_ASSERT(aspect, baseWorkingDirectory());
|
||||
return QDir::cleanPath(aspect->environment().expandVariables(
|
||||
Utils::expandMacros(baseWorkingDirectory(), macroExpander())));
|
||||
}
|
||||
|
||||
|
@@ -174,6 +174,7 @@ private slots:
|
||||
void workingDirectoryReseted();
|
||||
void argumentsEdited(const QString &arguments);
|
||||
void userChangesEdited();
|
||||
void environmentWasChanged();
|
||||
|
||||
void workingDirectoryChanged(const QString &workingDirectory);
|
||||
void commandLineArgumentsChanged(const QString &args);
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "customexecutableconfigurationwidget.h"
|
||||
#include "customexecutablerunconfiguration.h"
|
||||
|
||||
#include <projectexplorer/environmentaspect.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/environmentwidget.h>
|
||||
@@ -56,7 +57,6 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
|
||||
|
||||
m_executableChooser = new Utils::PathChooser(this);
|
||||
m_executableChooser->setExpectedKind(Utils::PathChooser::Command);
|
||||
m_executableChooser->setEnvironment(rc->environment());
|
||||
layout->addRow(tr("Command:"), m_executableChooser);
|
||||
|
||||
m_commandLineArgumentsLineEdit = new QLineEdit(this);
|
||||
@@ -66,7 +66,7 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
|
||||
m_workingDirectory = new Utils::PathChooser(this);
|
||||
m_workingDirectory->setExpectedKind(Utils::PathChooser::Directory);
|
||||
m_workingDirectory->setBaseDirectory(rc->target()->project()->projectDirectory());
|
||||
m_workingDirectory->setEnvironment(rc->environment());
|
||||
|
||||
layout->addRow(tr("Working directory:"), m_workingDirectory);
|
||||
|
||||
m_useTerminalCheck = new QCheckBox(tr("Run in &terminal"), this);
|
||||
@@ -124,6 +124,12 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
|
||||
connect(m_useTerminalCheck, SIGNAL(toggled(bool)),
|
||||
this, SLOT(termToggled(bool)));
|
||||
|
||||
ProjectExplorer::EnvironmentAspect *aspect = rc->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
if (aspect) {
|
||||
connect(aspect, SIGNAL(environmentChanged()), this, SLOT(environmentWasChanged()));
|
||||
environmentWasChanged();
|
||||
}
|
||||
|
||||
connect(m_runConfiguration, SIGNAL(changed()), this, SLOT(changed()));
|
||||
|
||||
connect(m_environmentWidget, SIGNAL(userChangesChanged()),
|
||||
@@ -150,6 +156,15 @@ void CustomExecutableConfigurationWidget::baseEnvironmentSelected(int index)
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::environmentWasChanged()
|
||||
{
|
||||
ProjectExplorer::EnvironmentAspect *aspect
|
||||
= m_runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
QTC_ASSERT(aspect, return);
|
||||
m_workingDirectory->setEnvironment(aspect->environment());
|
||||
m_executableChooser->setEnvironment(aspect->environment());
|
||||
}
|
||||
|
||||
void CustomExecutableConfigurationWidget::baseEnvironmentChanged()
|
||||
{
|
||||
if (m_ignoreChange)
|
||||
|
@@ -70,6 +70,7 @@ private slots:
|
||||
void baseEnvironmentChanged();
|
||||
void userEnvironmentChangesChanged();
|
||||
void baseEnvironmentSelected(int index);
|
||||
void environmentWasChanged();
|
||||
|
||||
private:
|
||||
bool m_ignoreChange;
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include "qtkitinformation.h"
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/environmentaspect.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/abi.h>
|
||||
@@ -179,7 +180,10 @@ bool CustomExecutableRunConfiguration::validateExecutable(QString *executable, Q
|
||||
*errorMessage = tr("No executable.");
|
||||
return false;
|
||||
}
|
||||
const Utils::Environment env = environment();
|
||||
Utils::Environment env;
|
||||
ProjectExplorer::EnvironmentAspect *aspect = extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
if (aspect)
|
||||
env = aspect->environment();
|
||||
const QString exec = env.searchInPath(Utils::expandMacros(m_executable, macroExpander()),
|
||||
QStringList(workingDirectory()));
|
||||
if (exec.isEmpty()) {
|
||||
@@ -217,7 +221,9 @@ ProjectExplorer::LocalApplicationRunConfiguration::RunMode CustomExecutableRunCo
|
||||
|
||||
QString CustomExecutableRunConfiguration::workingDirectory() const
|
||||
{
|
||||
return QDir::cleanPath(environment().expandVariables(
|
||||
ProjectExplorer::EnvironmentAspect *aspect = extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
QTC_ASSERT(aspect, return baseWorkingDirectory());
|
||||
return QDir::cleanPath(aspect->environment().expandVariables(
|
||||
Utils::expandMacros(baseWorkingDirectory(), macroExpander())));
|
||||
}
|
||||
|
||||
|
@@ -221,8 +221,10 @@ QString RemoteLinuxRunConfiguration::environmentPreparationCommand() const
|
||||
|
||||
QString RemoteLinuxRunConfiguration::commandPrefix() const
|
||||
{
|
||||
RemoteLinuxEnvironmentAspect *aspect = extraAspect<RemoteLinuxEnvironmentAspect>();
|
||||
QTC_ASSERT(aspect, return QString());
|
||||
return QString::fromLatin1("%1; DISPLAY=:0.0 %2")
|
||||
.arg(environmentPreparationCommand(), userEnvironmentChangesAsString());
|
||||
.arg(environmentPreparationCommand(), aspect->userEnvironmentChangesAsString());
|
||||
}
|
||||
|
||||
QString RemoteLinuxRunConfiguration::localExecutableFilePath() const
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include <remotelinux/remotelinuxrunconfiguration.h>
|
||||
|
||||
#include <debugger/debuggerrunconfigurationaspect.h>
|
||||
#include <projectexplorer/environmentaspect.h>
|
||||
#include <projectexplorer/localapplicationrunconfiguration.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
@@ -62,8 +63,11 @@ Analyzer::AnalyzerStartParameters ValgrindTool::createStartParameters(
|
||||
sp.displayName = runConfiguration->displayName();
|
||||
if (LocalApplicationRunConfiguration *rc1 =
|
||||
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
|
||||
ProjectExplorer::EnvironmentAspect *aspect
|
||||
= runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
sp.startMode = Analyzer::StartLocal;
|
||||
sp.environment = rc1->environment();
|
||||
if (aspect)
|
||||
sp.environment = aspect->environment();
|
||||
sp.workingDirectory = rc1->workingDirectory();
|
||||
sp.debuggee = rc1->executable();
|
||||
sp.debuggeeArgs = rc1->commandLineArguments();
|
||||
|
Reference in New Issue
Block a user