Commit de0b0706 authored by hjk's avatar hjk

QmakeProjectManager: Code cosmetics

Qt 5 connects, remove no-op function, add a few 'overload', use a few 'auto',
put common code with ugly cast in function, ...

Change-Id: I242aea07356bf535ba9ae11235de4a2a2c1f1d04
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 99b98f28
......@@ -89,8 +89,7 @@ DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *parent, Core:
addExtraAspect(new TerminalAspect(this, QStringLiteral("Qt4ProjectManager.Qt4RunConfiguration.UseTerminal")));
addExtraAspect(new WorkingDirectoryAspect(this,
QStringLiteral("Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory")));
QmakeProject *project = static_cast<QmakeProject *>(parent->project());
QmakeProject *project = qmakeProject();
m_parseSuccess = project->validParse(m_proFilePath);
m_parseInProgress = project->parseInProgress(m_proFilePath);
......@@ -120,7 +119,7 @@ QString DesktopQmakeRunConfiguration::disabledReason() const
.arg(m_proFilePath.fileName());
if (!m_parseSuccess)
return static_cast<QmakeProject *>(target()->project())->disabledReasonForRunConfiguration(m_proFilePath);
return qmakeProject()->disabledReasonForRunConfiguration(m_proFilePath);
return QString();
}
......@@ -138,13 +137,11 @@ void DesktopQmakeRunConfiguration::proFileUpdated(QmakeProFileNode *pro, bool su
if (!parseInProgress) {
emit effectiveTargetInformationChanged();
setDefaultDisplayName(defaultDisplayName());
LocalEnvironmentAspect *aspect = extraAspect<LocalEnvironmentAspect>();
QTC_ASSERT(aspect, return);
aspect->buildEnvironmentHasChanged();
extraAspect<LocalEnvironmentAspect>()->buildEnvironmentHasChanged();
}
TerminalAspect *terminalAspect = extraAspect<TerminalAspect>();
if (terminalAspect && !terminalAspect->isUserSet()) {
auto terminalAspect = extraAspect<TerminalAspect>();
if (!terminalAspect->isUserSet()) {
terminalAspect->setUseTerminal(pro->variableValue(ConfigVar).contains(QLatin1String("console"))
&& !pro->variableValue(QtVar).contains(QLatin1String("testlib")));
}
......@@ -154,16 +151,14 @@ void DesktopQmakeRunConfiguration::proFileEvaluated()
{
// 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
LocalEnvironmentAspect *aspect = extraAspect<LocalEnvironmentAspect>();
QTC_ASSERT(aspect, return);
aspect->buildEnvironmentHasChanged();
return extraAspect<LocalEnvironmentAspect>()->buildEnvironmentHasChanged();
}
void DesktopQmakeRunConfiguration::ctor()
{
setDefaultDisplayName(defaultDisplayName());
QmakeProject *project = static_cast<QmakeProject *>(target()->project());
QmakeProject *project = qmakeProject();
connect(project, &QmakeProject::proFileUpdated,
this, &DesktopQmakeRunConfiguration::proFileUpdated);
connect(project, &QmakeProject::proFilesEvaluated,
......@@ -174,14 +169,13 @@ void DesktopQmakeRunConfiguration::ctor()
/// DesktopQmakeRunConfigurationWidget
/////
DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQmakeRunConfiguration *qmakeRunConfiguration, QWidget *parent)
: QWidget(parent),
m_qmakeRunConfiguration(qmakeRunConfiguration)
DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQmakeRunConfiguration *qmakeRunConfiguration)
: m_qmakeRunConfiguration(qmakeRunConfiguration)
{
QVBoxLayout *vboxTopLayout = new QVBoxLayout(this);
auto vboxTopLayout = new QVBoxLayout(this);
vboxTopLayout->setMargin(0);
QHBoxLayout *hl = new QHBoxLayout();
auto hl = new QHBoxLayout();
hl->addStretch();
m_disabledIcon = new QLabel(this);
m_disabledIcon->setPixmap(Core::Icons::WARNING.pixmap());
......@@ -192,12 +186,12 @@ DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQm
hl->addStretch();
vboxTopLayout->addLayout(hl);
m_detailsContainer = new DetailsWidget(this);
m_detailsContainer->setState(DetailsWidget::NoSummary);
vboxTopLayout->addWidget(m_detailsContainer);
QWidget *detailsWidget = new QWidget(m_detailsContainer);
m_detailsContainer->setWidget(detailsWidget);
QFormLayout *toplayout = new QFormLayout(detailsWidget);
auto detailsContainer = new DetailsWidget(this);
detailsContainer->setState(DetailsWidget::NoSummary);
vboxTopLayout->addWidget(detailsContainer);
auto detailsWidget = new QWidget(detailsContainer);
detailsContainer->setWidget(detailsWidget);
auto toplayout = new QFormLayout(detailsWidget);
toplayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
toplayout->setMargin(0);
......@@ -213,7 +207,7 @@ DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQm
m_useQvfbCheck->setToolTip(tr("Check this option to run the application on a Qt Virtual Framebuffer."));
m_useQvfbCheck->setChecked(m_qmakeRunConfiguration->runMode() == ApplicationLauncher::Console);
m_useQvfbCheck->setVisible(false);
QHBoxLayout *innerBox = new QHBoxLayout();
auto innerBox = new QHBoxLayout();
innerBox->addWidget(m_useQvfbCheck);
innerBox->addStretch();
toplayout->addRow(QString(), innerBox);
......@@ -222,8 +216,8 @@ DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQm
m_usingDyldImageSuffix = new QCheckBox(tr("Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug)"), this);
m_usingDyldImageSuffix->setChecked(m_qmakeRunConfiguration->isUsingDyldImageSuffix());
toplayout->addRow(QString(), m_usingDyldImageSuffix);
connect(m_usingDyldImageSuffix, SIGNAL(toggled(bool)),
this, SLOT(usingDyldImageSuffixToggled(bool)));
connect(m_usingDyldImageSuffix, &QAbstractButton::toggled,
this, &DesktopQmakeRunConfigurationWidget::usingDyldImageSuffixToggled);
}
QString librarySeachPathLabel;
......@@ -249,26 +243,19 @@ DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQm
runConfigurationEnabledChange();
effectiveTargetInformationChanged();
connect(m_useQvfbCheck, SIGNAL(toggled(bool)),
this, SLOT(qvfbToggled(bool)));
connect(qmakeRunConfiguration, SIGNAL(usingDyldImageSuffixChanged(bool)),
this, SLOT(usingDyldImageSuffixChanged(bool)));
connect(qmakeRunConfiguration, &DesktopQmakeRunConfiguration::usingDyldImageSuffixChanged,
this, &DesktopQmakeRunConfigurationWidget::usingDyldImageSuffixChanged);
connect(qmakeRunConfiguration, &DesktopQmakeRunConfiguration::usingLibrarySearchPathChanged,
this, &DesktopQmakeRunConfigurationWidget::usingLibrarySearchPathChanged);
connect(qmakeRunConfiguration, SIGNAL(effectiveTargetInformationChanged()),
this, SLOT(effectiveTargetInformationChanged()), Qt::QueuedConnection);
connect(qmakeRunConfiguration, &DesktopQmakeRunConfiguration::effectiveTargetInformationChanged,
this, &DesktopQmakeRunConfigurationWidget::effectiveTargetInformationChanged, Qt::QueuedConnection);
connect(qmakeRunConfiguration, SIGNAL(enabledChanged()),
this, SLOT(runConfigurationEnabledChange()));
connect(qmakeRunConfiguration, &RunConfiguration::enabledChanged,
this, &DesktopQmakeRunConfigurationWidget::runConfigurationEnabledChange);
Core::VariableChooser::addSupportForChildWidgets(this, m_qmakeRunConfiguration->macroExpander());
}
DesktopQmakeRunConfigurationWidget::~DesktopQmakeRunConfigurationWidget()
{
}
void DesktopQmakeRunConfigurationWidget::runConfigurationEnabledChange()
{
bool enabled = m_qmakeRunConfiguration->isEnabled();
......@@ -277,13 +264,6 @@ void DesktopQmakeRunConfigurationWidget::runConfigurationEnabledChange()
m_disabledReason->setText(m_qmakeRunConfiguration->disabledReason());
}
void DesktopQmakeRunConfigurationWidget::qvfbToggled(bool on)
{
Q_UNUSED(on);
m_ignoreChange = true;
m_ignoreChange = false;
}
void DesktopQmakeRunConfigurationWidget::usingDyldImageSuffixToggled(bool state)
{
m_ignoreChange = true;
......@@ -323,7 +303,7 @@ void DesktopQmakeRunConfigurationWidget::effectiveTargetInformationChanged()
QWidget *DesktopQmakeRunConfiguration::createConfigurationWidget()
{
return new DesktopQmakeRunConfigurationWidget(this, 0);
return new DesktopQmakeRunConfigurationWidget(this);
}
QVariantMap DesktopQmakeRunConfiguration::toMap() const
......@@ -343,16 +323,15 @@ bool DesktopQmakeRunConfiguration::fromMap(const QVariantMap &map)
m_isUsingDyldImageSuffix = map.value(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), false).toBool();
m_isUsingLibrarySearchPath = map.value(QLatin1String(USE_LIBRARY_SEARCH_PATH), true).toBool();
m_parseSuccess = static_cast<QmakeProject *>(target()->project())->validParse(m_proFilePath);
m_parseInProgress = static_cast<QmakeProject *>(target()->project())->parseInProgress(m_proFilePath);
m_parseSuccess = qmakeProject()->validParse(m_proFilePath);
m_parseInProgress = qmakeProject()->parseInProgress(m_proFilePath);
return LocalApplicationRunConfiguration::fromMap(map);
}
QString DesktopQmakeRunConfiguration::executable() const
{
QmakeProject *pro = static_cast<QmakeProject *>(target()->project());
const QmakeProFileNode *node = pro->rootProjectNode()->findProFileFor(m_proFilePath);
const QmakeProFileNode *node = qmakeProject()->rootProjectNode()->findProFileFor(m_proFilePath);
return extractWorkingDirAndExecutable(node).second;
}
......@@ -371,9 +350,7 @@ void DesktopQmakeRunConfiguration::setUsingDyldImageSuffix(bool state)
m_isUsingDyldImageSuffix = state;
emit usingDyldImageSuffixChanged(state);
LocalEnvironmentAspect *aspect = extraAspect<LocalEnvironmentAspect>();
QTC_ASSERT(aspect, return);
aspect->environmentChanged();
return extraAspect<LocalEnvironmentAspect>()->environmentChanged();
}
bool DesktopQmakeRunConfiguration::isUsingLibrarySearchPath() const
......@@ -386,9 +363,7 @@ void DesktopQmakeRunConfiguration::setUsingLibrarySearchPath(bool state)
m_isUsingLibrarySearchPath = state;
emit usingLibrarySearchPathChanged(state);
LocalEnvironmentAspect *aspect = extraAspect<LocalEnvironmentAspect>();
QTC_ASSERT(aspect, return);
aspect->environmentChanged();
return extraAspect<LocalEnvironmentAspect>()->environmentChanged();
}
QString DesktopQmakeRunConfiguration::workingDirectory() const
......@@ -398,8 +373,7 @@ QString DesktopQmakeRunConfiguration::workingDirectory() const
QString DesktopQmakeRunConfiguration::baseWorkingDirectory() const
{
QmakeProject *pro = static_cast<QmakeProject *>(target()->project());
const QmakeProFileNode *node = pro->rootProjectNode()->findProFileFor(m_proFilePath);
const QmakeProFileNode *node = qmakeProject()->rootProjectNode()->findProFileFor(m_proFilePath);
return extractWorkingDirAndExecutable(node).first;
}
......@@ -416,7 +390,7 @@ void DesktopQmakeRunConfiguration::addToBaseEnvironment(Environment &env) const
// The user could be linking to a library found via a -L/some/dir switch
// to find those libraries while actually running we explicitly prepend those
// dirs to the library search path
const QmakeProFileNode *node = static_cast<QmakeProject *>(target()->project())->rootProjectNode()->findProFileFor(m_proFilePath);
const QmakeProFileNode *node = qmakeProject()->rootProjectNode()->findProFileFor(m_proFilePath);
if (m_isUsingLibrarySearchPath && node) {
const QStringList libDirectories = node->variableValue(LibDirectoriesVar);
if (!libDirectories.isEmpty()) {
......@@ -441,10 +415,14 @@ Utils::FileName DesktopQmakeRunConfiguration::proFilePath() const
return m_proFilePath;
}
QmakeProject *DesktopQmakeRunConfiguration::qmakeProject() const
{
return static_cast<QmakeProject *>(target()->project());
}
QString DesktopQmakeRunConfiguration::defaultDisplayName()
{
auto project = static_cast<QmakeProject *>(target()->project());
const QmakeProFileNode *root = project->rootProjectNode();
const QmakeProFileNode *root = qmakeProject()->rootProjectNode();
if (root) {
const QmakeProFileNode *node = root->findProFileFor(m_proFilePath);
if (node) // should always be found
......@@ -512,10 +490,9 @@ QPair<QString, QString> DesktopQmakeRunConfiguration::extractWorkingDirAndExecut
DesktopQmakeRunConfigurationFactory::DesktopQmakeRunConfigurationFactory(QObject *parent) :
QmakeRunConfigurationFactory(parent)
{ setObjectName(QLatin1String("DesktopQmakeRunConfigurationFactory")); }
DesktopQmakeRunConfigurationFactory::~DesktopQmakeRunConfigurationFactory()
{ }
{
setObjectName(QLatin1String("DesktopQmakeRunConfigurationFactory"));
}
bool DesktopQmakeRunConfigurationFactory::canCreate(Target *parent, Core::Id id) const
{
......@@ -527,8 +504,7 @@ bool DesktopQmakeRunConfigurationFactory::canCreate(Target *parent, Core::Id id)
RunConfiguration *DesktopQmakeRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
{
DesktopQmakeRunConfiguration *rc = new DesktopQmakeRunConfiguration(parent, id);
return rc;
return new DesktopQmakeRunConfiguration(parent, id);
}
bool DesktopQmakeRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
......@@ -587,8 +563,8 @@ QList<RunConfiguration *> DesktopQmakeRunConfigurationFactory::runConfigurations
{
QList<RunConfiguration *> result;
foreach (RunConfiguration *rc, t->runConfigurations())
if (DesktopQmakeRunConfiguration *qt4c = qobject_cast<DesktopQmakeRunConfiguration *>(rc))
if (qt4c->proFilePath() == n->filePath())
if (DesktopQmakeRunConfiguration *qmakeRc = qobject_cast<DesktopQmakeRunConfiguration *>(rc))
if (qmakeRc->proFilePath() == n->filePath())
result << rc;
return result;
}
......
......@@ -37,25 +37,18 @@
#include <utils/fileutils.h>
#include <QStringList>
#include <QLabel>
#include <QWidget>
QT_BEGIN_NAMESPACE
class QCheckBox;
class QLabel;
class QLineEdit;
class QRadioButton;
class QComboBox;
QT_END_NAMESPACE
namespace Utils {
class PathChooser;
class DetailsWidget;
}
namespace QmakeProjectManager {
class QmakeProFileNode;
class QmakeProject;
namespace Internal {
class DesktopQmakeRunConfigurationFactory;
......@@ -113,6 +106,7 @@ private:
QPair<QString, QString> extractWorkingDirAndExecutable(const QmakeProFileNode *node) const;
QString baseWorkingDirectory() const;
QString defaultDisplayName();
QmakeProject *qmakeProject() const;
void ctor();
......@@ -131,14 +125,11 @@ class DesktopQmakeRunConfigurationWidget : public QWidget
Q_OBJECT
public:
DesktopQmakeRunConfigurationWidget(DesktopQmakeRunConfiguration *qmakeRunConfiguration, QWidget *parent);
~DesktopQmakeRunConfigurationWidget();
explicit DesktopQmakeRunConfigurationWidget(DesktopQmakeRunConfiguration *qmakeRunConfiguration);
private slots:
private:
void runConfigurationEnabledChange();
void effectiveTargetInformationChanged();
void qvfbToggled(bool);
void usingDyldImageSuffixToggled(bool);
void usingDyldImageSuffixChanged(bool);
void usingLibrarySearchPathToggled(bool state);
......@@ -154,7 +145,6 @@ private:
QCheckBox *m_usingDyldImageSuffix = nullptr;
QCheckBox *m_usingLibrarySearchPath = nullptr;
QLineEdit *m_qmlDebugPort = nullptr;
Utils::DetailsWidget *m_detailsContainer = nullptr;
};
class DesktopQmakeRunConfigurationFactory : public QmakeRunConfigurationFactory
......@@ -163,25 +153,25 @@ class DesktopQmakeRunConfigurationFactory : public QmakeRunConfigurationFactory
public:
explicit DesktopQmakeRunConfigurationFactory(QObject *parent = 0);
~DesktopQmakeRunConfigurationFactory();
bool canCreate(ProjectExplorer::Target *parent, Core::Id id) const;
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source);
bool canCreate(ProjectExplorer::Target *parent, Core::Id id) const override;
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const override;
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const override;
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent,
ProjectExplorer::RunConfiguration *source) override;
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent, CreationMode mode) const;
QString displayNameForId(Core::Id id) const;
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent, CreationMode mode) const override;
QString displayNameForId(Core::Id id) const override;
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
const ProjectExplorer::Node *n);
const ProjectExplorer::Node *n) override;
private:
bool canHandle(ProjectExplorer::Target *t) const;
bool canHandle(ProjectExplorer::Target *t) const override;
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, Core::Id id);
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, Core::Id id) override;
ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
const QVariantMap &map);
const QVariantMap &map) override;
};
} // namespace Internal
......
......@@ -33,10 +33,9 @@
#include <coreplugin/variablechooser.h>
#include <projectexplorer/environmentaspect.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/target.h>
#include <projectexplorer/project.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/target.h>
#include <utils/detailswidget.h>
#include <utils/pathchooser.h>
......@@ -48,26 +47,24 @@
#include <QLineEdit>
using namespace ProjectExplorer;
using namespace Utils;
namespace QtSupport {
namespace Internal {
CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomExecutableRunConfiguration *rc, ApplyMode mode)
: m_ignoreChange(false),
m_runConfiguration(rc),
m_temporaryArgumentsAspect(0),
m_temporaryTerminalAspect(0)
: m_runConfiguration(rc)
{
QFormLayout *layout = new QFormLayout;
auto layout = new QFormLayout;
layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
layout->setMargin(0);
m_executableChooser = new Utils::PathChooser(this);
m_executableChooser = new PathChooser(this);
m_executableChooser->setHistoryCompleter(QLatin1String("Qt.CustomExecutable.History"));
m_executableChooser->setExpectedKind(Utils::PathChooser::Command);
m_executableChooser->setExpectedKind(PathChooser::Command);
layout->addRow(tr("Executable:"), m_executableChooser);
ArgumentsAspect *argumentsAspect = rc->extraAspect<ArgumentsAspect>();
auto argumentsAspect = rc->extraAspect<ArgumentsAspect>();
if (mode == InstantApply) {
argumentsAspect->addToMainConfigurationWidget(this, layout);
} else {
......@@ -77,14 +74,14 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
this, &CustomExecutableConfigurationWidget::validChanged);
}
m_workingDirectory = new Utils::PathChooser(this);
m_workingDirectory = new PathChooser(this);
m_workingDirectory->setHistoryCompleter(QLatin1String("Qt.WorkingDir.History"));
m_workingDirectory->setExpectedKind(Utils::PathChooser::Directory);
m_workingDirectory->setExpectedKind(PathChooser::Directory);
m_workingDirectory->setBaseFileName(rc->target()->project()->projectDirectory());
layout->addRow(tr("Working directory:"), m_workingDirectory);
TerminalAspect *terminalAspect = rc->extraAspect<TerminalAspect>();
auto terminalAspect = rc->extraAspect<TerminalAspect>();
if (mode == InstantApply) {
terminalAspect->addToMainConfigurationWidget(this, layout);
} else {
......@@ -94,42 +91,43 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
this, &CustomExecutableConfigurationWidget::validChanged);
}
QVBoxLayout *vbox = new QVBoxLayout(this);
auto vbox = new QVBoxLayout(this);
vbox->setMargin(0);
m_detailsContainer = new Utils::DetailsWidget(this);
m_detailsContainer->setState(Utils::DetailsWidget::NoSummary);
m_detailsContainer = new DetailsWidget(this);
m_detailsContainer->setState(DetailsWidget::NoSummary);
vbox->addWidget(m_detailsContainer);
QWidget *detailsWidget = new QWidget(m_detailsContainer);
auto detailsWidget = new QWidget(m_detailsContainer);
m_detailsContainer->setWidget(detailsWidget);
detailsWidget->setLayout(layout);
changed();
if (mode == InstantApply) {
connect(m_executableChooser, SIGNAL(rawPathChanged(QString)),
this, SLOT(executableEdited()));
connect(m_workingDirectory, SIGNAL(rawPathChanged(QString)),
this, SLOT(workingDirectoryEdited()));
connect(m_executableChooser, &PathChooser::rawPathChanged,
this, &CustomExecutableConfigurationWidget::executableEdited);
connect(m_workingDirectory, &PathChooser::rawPathChanged,
this, &CustomExecutableConfigurationWidget::workingDirectoryEdited);
} else {
connect(m_executableChooser, SIGNAL(rawPathChanged(QString)),
this, SIGNAL(validChanged()));
connect(m_workingDirectory, SIGNAL(rawPathChanged(QString)),
this, SIGNAL(validChanged()));
connect(m_executableChooser, &PathChooser::rawPathChanged,
this, &CustomExecutableConfigurationWidget::validChanged);
connect(m_workingDirectory, &PathChooser::rawPathChanged,
this, &CustomExecutableConfigurationWidget::validChanged);
}
ProjectExplorer::EnvironmentAspect *aspect = rc->extraAspect<ProjectExplorer::EnvironmentAspect>();
if (aspect) {
connect(aspect, SIGNAL(environmentChanged()), this, SLOT(environmentWasChanged()));
environmentWasChanged();
}
auto enviromentAspect = rc->extraAspect<EnvironmentAspect>();
connect(enviromentAspect, &EnvironmentAspect::environmentChanged,
this, &CustomExecutableConfigurationWidget::environmentWasChanged);
environmentWasChanged();
// If we are in mode InstantApply, we keep us in sync with the rc
// If we are in InstantApply mode, we keep us in sync with the rc
// otherwise we ignore changes to the rc and override them on apply,
// or keep them on cancel
if (mode == InstantApply)
connect(m_runConfiguration, SIGNAL(changed()), this, SLOT(changed()));
if (mode == InstantApply) {
connect(m_runConfiguration, &CustomExecutableRunConfiguration::changed,
this, &CustomExecutableConfigurationWidget::changed);
}
Core::VariableChooser::addSupportForChildWidgets(this, m_runConfiguration->macroExpander());
}
......@@ -142,8 +140,7 @@ CustomExecutableConfigurationWidget::~CustomExecutableConfigurationWidget()
void CustomExecutableConfigurationWidget::environmentWasChanged()
{
ProjectExplorer::EnvironmentAspect *aspect
= m_runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
auto aspect = m_runConfiguration->extraAspect<EnvironmentAspect>();
QTC_ASSERT(aspect, return);
m_workingDirectory->setEnvironment(aspect->environment());
m_executableChooser->setEnvironment(aspect->environment());
......
......@@ -66,26 +66,24 @@ public:
~CustomExecutableConfigurationWidget();
void apply(); // only used for DelayedApply
bool isValid() const;
signals:
void validChanged();
private slots:
private:
void changed();
void executableEdited();
void workingDirectoryEdited();
void environmentWasChanged();
private:
bool m_ignoreChange;
CustomExecutableRunConfiguration *m_runConfiguration;
ProjectExplorer::ArgumentsAspect *m_temporaryArgumentsAspect;
ProjectExplorer::TerminalAspect *m_temporaryTerminalAspect;
Utils::PathChooser *m_executableChooser;
Utils::PathChooser *m_workingDirectory;
Utils::DetailsWidget *m_detailsContainer;
bool m_ignoreChange = false;
CustomExecutableRunConfiguration *m_runConfiguration = 0;
ProjectExplorer::ArgumentsAspect *m_temporaryArgumentsAspect = 0;
ProjectExplorer::TerminalAspect *m_temporaryTerminalAspect = 0;
Utils::PathChooser *m_executableChooser = 0;
Utils::PathChooser *m_workingDirectory = 0;
Utils::DetailsWidget *m_detailsContainer = 0;
};
} // namespace Internal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment