forked from qt-creator/qt-creator
AutoTools: Use aspects in build steps
Less code. And there's more room for consolidation. Change-Id: Iccdaf5570155ec2783b7cf6528d3887f6efd5dbb Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -26,22 +26,16 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "autogenstep.h"
|
||||
#include "autotoolsproject.h"
|
||||
#include "autotoolsbuildconfiguration.h"
|
||||
#include "autotoolsprojectconstants.h"
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/gnumakeparser.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <QVariantMap>
|
||||
#include <QDateTime>
|
||||
#include <QLineEdit>
|
||||
#include <QFormLayout>
|
||||
|
||||
using namespace AutotoolsProjectManager;
|
||||
using namespace AutotoolsProjectManager::Internal;
|
||||
@@ -67,6 +61,12 @@ AutogenStepFactory::AutogenStepFactory()
|
||||
AutogenStep::AutogenStep(BuildStepList *bsl) : AbstractProcessStep(bsl, AUTOGEN_STEP_ID)
|
||||
{
|
||||
setDefaultDisplayName(tr("Autogen"));
|
||||
|
||||
m_additionalArgumentsAspect = addAspect<BaseStringAspect>();
|
||||
m_additionalArgumentsAspect->setSettingsKey(AUTOGEN_ADDITIONAL_ARGUMENTS_KEY);
|
||||
m_additionalArgumentsAspect->setLabelText(tr("Arguments:"));
|
||||
m_additionalArgumentsAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay);
|
||||
m_additionalArgumentsAspect->setHistoryCompleter("AutotoolsPM.History.AutogenStepArgs");
|
||||
}
|
||||
|
||||
bool AutogenStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
@@ -79,7 +79,7 @@ bool AutogenStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
||||
pp->setWorkingDirectory(projectDir);
|
||||
pp->setCommand("./autogen.sh");
|
||||
pp->setArguments(additionalArguments());
|
||||
pp->setArguments(m_additionalArgumentsAspect->value());
|
||||
pp->resolveAll();
|
||||
|
||||
return AbstractProcessStep::init(earlierSteps);
|
||||
@@ -113,72 +113,10 @@ void AutogenStep::run(QFutureInterface<bool> &fi)
|
||||
|
||||
BuildStepConfigWidget *AutogenStep::createConfigWidget()
|
||||
{
|
||||
return new AutogenStepConfigWidget(this);
|
||||
}
|
||||
auto widget = AbstractProcessStep::createConfigWidget();
|
||||
|
||||
bool AutogenStep::immutable() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void AutogenStep::setAdditionalArguments(const QString &list)
|
||||
{
|
||||
if (list == m_additionalArguments)
|
||||
return;
|
||||
|
||||
m_additionalArguments = list;
|
||||
m_runAutogen = true;
|
||||
|
||||
emit additionalArgumentsChanged(list);
|
||||
}
|
||||
|
||||
QString AutogenStep::additionalArguments() const
|
||||
{
|
||||
return m_additionalArguments;
|
||||
}
|
||||
|
||||
QVariantMap AutogenStep::toMap() const
|
||||
{
|
||||
QVariantMap map(AbstractProcessStep::toMap());
|
||||
|
||||
map.insert(AUTOGEN_ADDITIONAL_ARGUMENTS_KEY, m_additionalArguments);
|
||||
return map;
|
||||
}
|
||||
|
||||
bool AutogenStep::fromMap(const QVariantMap &map)
|
||||
{
|
||||
m_additionalArguments = map.value(AUTOGEN_ADDITIONAL_ARGUMENTS_KEY).toString();
|
||||
|
||||
return BuildStep::fromMap(map);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
// AutogenStepConfigWidget class
|
||||
//////////////////////////////////
|
||||
AutogenStepConfigWidget::AutogenStepConfigWidget(AutogenStep *autogenStep) :
|
||||
BuildStepConfigWidget(autogenStep),
|
||||
m_autogenStep(autogenStep),
|
||||
m_additionalArguments(new QLineEdit)
|
||||
{
|
||||
QFormLayout *fl = new QFormLayout(this);
|
||||
fl->setMargin(0);
|
||||
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
setLayout(fl);
|
||||
|
||||
fl->addRow(tr("Arguments:"), m_additionalArguments);
|
||||
m_additionalArguments->setText(m_autogenStep->additionalArguments());
|
||||
|
||||
updateDetails();
|
||||
|
||||
connect(m_additionalArguments, &QLineEdit::textChanged,
|
||||
autogenStep, &AutogenStep::setAdditionalArguments);
|
||||
connect(autogenStep, &AutogenStep::additionalArgumentsChanged,
|
||||
this, &AutogenStepConfigWidget::updateDetails);
|
||||
}
|
||||
|
||||
void AutogenStepConfigWidget::updateDetails()
|
||||
{
|
||||
BuildConfiguration *bc = m_autogenStep->buildConfiguration();
|
||||
auto updateDetails = [this, widget] {
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
|
||||
ProcessParameters param;
|
||||
param.setMacroExpander(bc->macroExpander());
|
||||
@@ -186,7 +124,22 @@ void AutogenStepConfigWidget::updateDetails()
|
||||
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
||||
param.setWorkingDirectory(projectDir);
|
||||
param.setCommand("./autogen.sh");
|
||||
param.setArguments(m_autogenStep->additionalArguments());
|
||||
param.setArguments(m_additionalArgumentsAspect->value());
|
||||
|
||||
setSummaryText(param.summary(displayName()));
|
||||
widget->setSummaryText(param.summary(displayName()));
|
||||
};
|
||||
|
||||
updateDetails();
|
||||
|
||||
connect(m_additionalArgumentsAspect, &ProjectConfigurationAspect::changed, this, [=] {
|
||||
updateDetails();
|
||||
m_runAutogen = true;
|
||||
});
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
bool AutogenStep::immutable() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -28,18 +28,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/abstractprocessstep.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLineEdit;
|
||||
QT_END_NAMESPACE
|
||||
#include <projectexplorer/projectconfigurationaspects.h>
|
||||
|
||||
namespace AutotoolsProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class AutotoolsProject;
|
||||
class AutogenStep;
|
||||
class AutogenStepConfigWidget;
|
||||
|
||||
/////////////////////////////
|
||||
// AutogenStepFactory class
|
||||
/////////////////////////////
|
||||
@@ -63,16 +56,12 @@ public:
|
||||
* A autogen step can be configured by selecting the "Projects" button of Qt Creator
|
||||
* (in the left hand side menu) and under "Build Settings".
|
||||
*
|
||||
* It is possible for the user to specify custom arguments. The corresponding
|
||||
* configuration widget is created by AutogenStep::createConfigWidget and is
|
||||
* represented by an instance of the class AutogenStepConfigWidget.
|
||||
* It is possible for the user to specify custom arguments.
|
||||
*/
|
||||
|
||||
class AutogenStep : public ProjectExplorer::AbstractProcessStep
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class AutogenStepFactory;
|
||||
friend class AutogenStepConfigWidget;
|
||||
|
||||
public:
|
||||
explicit AutogenStep(ProjectExplorer::BuildStepList *bsl);
|
||||
@@ -81,42 +70,11 @@ public:
|
||||
void run(QFutureInterface<bool> &fi) override;
|
||||
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
||||
bool immutable() const override;
|
||||
QString additionalArguments() const;
|
||||
QVariantMap toMap() const override;
|
||||
|
||||
void setAdditionalArguments(const QString &list);
|
||||
|
||||
signals:
|
||||
void additionalArgumentsChanged(const QString &);
|
||||
|
||||
private:
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
|
||||
QString m_additionalArguments;
|
||||
ProjectExplorer::BaseStringAspect *m_additionalArgumentsAspect = nullptr;
|
||||
bool m_runAutogen = false;
|
||||
};
|
||||
|
||||
//////////////////////////////////
|
||||
// AutogenStepConfigWidget class
|
||||
//////////////////////////////////
|
||||
/**
|
||||
* @brief Implementation of the ProjectExplorer::BuildStepConfigWidget interface.
|
||||
*
|
||||
* Allows to configure a autogen step in the GUI.
|
||||
*/
|
||||
class AutogenStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AutogenStepConfigWidget(AutogenStep *autogenStep);
|
||||
|
||||
private:
|
||||
void updateDetails();
|
||||
|
||||
AutogenStep *m_autogenStep;
|
||||
QLineEdit *m_additionalArguments;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace AutotoolsProjectManager
|
||||
|
||||
@@ -26,28 +26,20 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "autoreconfstep.h"
|
||||
#include "autotoolsproject.h"
|
||||
#include "autotoolsbuildconfiguration.h"
|
||||
#include "autotoolsprojectconstants.h"
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/gnumakeparser.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QVariantMap>
|
||||
#include <QLineEdit>
|
||||
#include <QFormLayout>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
using namespace AutotoolsProjectManager;
|
||||
using namespace AutotoolsProjectManager::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
const char AUTORECONF_STEP_ID[] = "AutotoolsProjectManager.AutoreconfStep";
|
||||
const char AUTORECONF_ADDITIONAL_ARGUMENTS_KEY[] = "AutotoolsProjectManager.AutoreconfStep.AdditionalArguments";
|
||||
|
||||
|
||||
// AutoreconfStepFactory class
|
||||
@@ -66,6 +58,13 @@ AutoreconfStepFactory::AutoreconfStepFactory()
|
||||
AutoreconfStep::AutoreconfStep(BuildStepList *bsl) : AbstractProcessStep(bsl, AUTORECONF_STEP_ID)
|
||||
{
|
||||
setDefaultDisplayName(tr("Autoreconf"));
|
||||
|
||||
m_additionalArgumentsAspect = addAspect<BaseStringAspect>();
|
||||
m_additionalArgumentsAspect->setSettingsKey("AutotoolsProjectManager.AutoreconfStep.AdditionalArguments");
|
||||
m_additionalArgumentsAspect->setLabelText(tr("Arguments:"));
|
||||
m_additionalArgumentsAspect->setValue("--force --install");
|
||||
m_additionalArgumentsAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay);
|
||||
m_additionalArgumentsAspect->setHistoryCompleter("AutotoolsPM.History.AutoreconfStepArgs");
|
||||
}
|
||||
|
||||
bool AutoreconfStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
@@ -78,7 +77,7 @@ bool AutoreconfStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
||||
pp->setWorkingDirectory(projectDir);
|
||||
pp->setCommand("autoreconf");
|
||||
pp->setArguments(additionalArguments());
|
||||
pp->setArguments(m_additionalArgumentsAspect->value());
|
||||
pp->resolveAll();
|
||||
|
||||
return AbstractProcessStep::init(earlierSteps);
|
||||
@@ -106,72 +105,10 @@ void AutoreconfStep::run(QFutureInterface<bool> &fi)
|
||||
|
||||
BuildStepConfigWidget *AutoreconfStep::createConfigWidget()
|
||||
{
|
||||
return new AutoreconfStepConfigWidget(this);
|
||||
}
|
||||
auto widget = AbstractProcessStep::createConfigWidget();
|
||||
|
||||
bool AutoreconfStep::immutable() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void AutoreconfStep::setAdditionalArguments(const QString &list)
|
||||
{
|
||||
if (list == m_additionalArguments)
|
||||
return;
|
||||
|
||||
m_additionalArguments = list;
|
||||
m_runAutoreconf = true;
|
||||
|
||||
emit additionalArgumentsChanged(list);
|
||||
}
|
||||
|
||||
QString AutoreconfStep::additionalArguments() const
|
||||
{
|
||||
return m_additionalArguments;
|
||||
}
|
||||
|
||||
QVariantMap AutoreconfStep::toMap() const
|
||||
{
|
||||
QVariantMap map = AbstractProcessStep::toMap();
|
||||
|
||||
map.insert(AUTORECONF_ADDITIONAL_ARGUMENTS_KEY, m_additionalArguments);
|
||||
return map;
|
||||
}
|
||||
|
||||
bool AutoreconfStep::fromMap(const QVariantMap &map)
|
||||
{
|
||||
m_additionalArguments = map.value(AUTORECONF_ADDITIONAL_ARGUMENTS_KEY).toString();
|
||||
|
||||
return BuildStep::fromMap(map);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// AutoreconfStepConfigWidget class
|
||||
//////////////////////////////////////
|
||||
AutoreconfStepConfigWidget::AutoreconfStepConfigWidget(AutoreconfStep *autoreconfStep) :
|
||||
BuildStepConfigWidget(autoreconfStep),
|
||||
m_autoreconfStep(autoreconfStep),
|
||||
m_additionalArguments(new QLineEdit(this))
|
||||
{
|
||||
QFormLayout *fl = new QFormLayout(this);
|
||||
fl->setMargin(0);
|
||||
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
setLayout(fl);
|
||||
|
||||
fl->addRow(tr("Arguments:"), m_additionalArguments);
|
||||
m_additionalArguments->setText(m_autoreconfStep->additionalArguments());
|
||||
|
||||
updateDetails();
|
||||
|
||||
connect(m_additionalArguments, &QLineEdit::textChanged,
|
||||
autoreconfStep, &AutoreconfStep::setAdditionalArguments);
|
||||
connect(autoreconfStep, &AutoreconfStep::additionalArgumentsChanged,
|
||||
this, &AutoreconfStepConfigWidget::updateDetails);
|
||||
}
|
||||
|
||||
void AutoreconfStepConfigWidget::updateDetails()
|
||||
{
|
||||
BuildConfiguration *bc = m_autoreconfStep->buildConfiguration();
|
||||
auto updateDetails = [this, widget] {
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
|
||||
ProcessParameters param;
|
||||
param.setMacroExpander(bc->macroExpander());
|
||||
@@ -179,7 +116,22 @@ void AutoreconfStepConfigWidget::updateDetails()
|
||||
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
||||
param.setWorkingDirectory(projectDir);
|
||||
param.setCommand("autoreconf");
|
||||
param.setArguments(m_autoreconfStep->additionalArguments());
|
||||
param.setArguments(m_additionalArgumentsAspect->value());
|
||||
|
||||
setSummaryText(param.summary(displayName()));
|
||||
widget->setSummaryText(param.summary(displayName()));
|
||||
};
|
||||
|
||||
updateDetails();
|
||||
|
||||
connect(m_additionalArgumentsAspect, &ProjectConfigurationAspect::changed, this, [=] {
|
||||
updateDetails();
|
||||
m_runAutoreconf = true;
|
||||
});
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
bool AutoreconfStep::immutable() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -28,17 +28,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/abstractprocessstep.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLineEdit;
|
||||
QT_END_NAMESPACE
|
||||
#include <projectexplorer/projectconfigurationaspects.h>
|
||||
|
||||
namespace AutotoolsProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class AutotoolsProject;
|
||||
class AutoreconfStep;
|
||||
|
||||
////////////////////////////////
|
||||
// AutoreconfStepFactory class
|
||||
////////////////////////////////
|
||||
@@ -62,16 +56,12 @@ public:
|
||||
* A autoreconf step can be configured by selecting the "Projects" button
|
||||
* of Qt Creator (in the left hand side menu) and under "Build Settings".
|
||||
*
|
||||
* It is possible for the user to specify custom arguments. The corresponding
|
||||
* configuration widget is created by AutoreconfStep::createConfigWidget and is
|
||||
* represented by an instance of the class AutoreconfStepConfigWidget.
|
||||
* It is possible for the user to specify custom arguments.
|
||||
*/
|
||||
|
||||
class AutoreconfStep : public ProjectExplorer::AbstractProcessStep
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class AutoreconfStepFactory;
|
||||
friend class AutoreconfStepConfigWidget;
|
||||
|
||||
public:
|
||||
explicit AutoreconfStep(ProjectExplorer::BuildStepList *bsl);
|
||||
@@ -80,42 +70,11 @@ public:
|
||||
void run(QFutureInterface<bool> &fi) override;
|
||||
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
||||
bool immutable() const override;
|
||||
QString additionalArguments() const;
|
||||
QVariantMap toMap() const override;
|
||||
|
||||
void setAdditionalArguments(const QString &list);
|
||||
|
||||
signals:
|
||||
void additionalArgumentsChanged(const QString &);
|
||||
|
||||
private:
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
|
||||
QString m_additionalArguments;
|
||||
ProjectExplorer::BaseStringAspect *m_additionalArgumentsAspect = nullptr;
|
||||
bool m_runAutoreconf = false;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// AutoreconfStepConfigWidget class
|
||||
//////////////////////////////////////
|
||||
/**
|
||||
* @brief Implementation of the ProjectExplorer::BuildStepConfigWidget interface.
|
||||
*
|
||||
* Allows to configure a autoreconf step in the GUI..
|
||||
*/
|
||||
class AutoreconfStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AutoreconfStepConfigWidget(AutoreconfStep *autoreconfStep);
|
||||
|
||||
private:
|
||||
void updateDetails();
|
||||
|
||||
AutoreconfStep *m_autoreconfStep;
|
||||
QLineEdit *m_additionalArguments;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace AutotoolsProjectManager
|
||||
|
||||
@@ -78,7 +78,6 @@ void AutotoolsBuildConfiguration::initialize(const BuildInfo *info)
|
||||
buildSteps->insertStep(0, autogenStep);
|
||||
} else {
|
||||
AutoreconfStep *autoreconfStep = new AutoreconfStep(buildSteps);
|
||||
autoreconfStep->setAdditionalArguments("--force --install");
|
||||
buildSteps->insertStep(0, autoreconfStep);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,12 @@ ConfigureStepFactory::ConfigureStepFactory()
|
||||
ConfigureStep::ConfigureStep(BuildStepList *bsl) : AbstractProcessStep(bsl, CONFIGURE_STEP_ID)
|
||||
{
|
||||
setDefaultDisplayName(tr("Configure"));
|
||||
|
||||
m_additionalArgumentsAspect = addAspect<BaseStringAspect>();
|
||||
m_additionalArgumentsAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay);
|
||||
m_additionalArgumentsAspect->setSettingsKey(CONFIGURE_ADDITIONAL_ARGUMENTS_KEY);
|
||||
m_additionalArgumentsAspect->setLabelText(tr("Arguments:"));
|
||||
m_additionalArgumentsAspect->setHistoryCompleter("AutotoolsPM.History.ConfigureArgs");
|
||||
}
|
||||
|
||||
bool ConfigureStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
@@ -92,7 +98,7 @@ bool ConfigureStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
pp->setEnvironment(bc->environment());
|
||||
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
||||
pp->setCommand(projectDirRelativeToBuildDir(bc) + "configure");
|
||||
pp->setArguments(additionalArguments());
|
||||
pp->setArguments(m_additionalArgumentsAspect->value());
|
||||
pp->resolveAll();
|
||||
|
||||
return AbstractProcessStep::init(earlierSteps);
|
||||
@@ -124,7 +130,16 @@ void ConfigureStep::run(QFutureInterface<bool>& fi)
|
||||
|
||||
BuildStepConfigWidget *ConfigureStep::createConfigWidget()
|
||||
{
|
||||
return new ConfigureStepConfigWidget(this);
|
||||
m_widget = AbstractProcessStep::createConfigWidget();
|
||||
|
||||
updateDetails();
|
||||
|
||||
connect(m_additionalArgumentsAspect, &ProjectConfigurationAspect::changed, this, [this] {
|
||||
m_runConfigure = true;
|
||||
updateDetails();
|
||||
});
|
||||
|
||||
return m_widget.data();
|
||||
}
|
||||
|
||||
bool ConfigureStep::immutable() const
|
||||
@@ -132,78 +147,24 @@ bool ConfigureStep::immutable() const
|
||||
return false;
|
||||
}
|
||||
|
||||
void ConfigureStep::setAdditionalArguments(const QString &list)
|
||||
{
|
||||
if (list == m_additionalArguments)
|
||||
return;
|
||||
|
||||
m_additionalArguments = list;
|
||||
m_runConfigure = true;
|
||||
|
||||
emit additionalArgumentsChanged(list);
|
||||
}
|
||||
|
||||
void ConfigureStep::notifyBuildDirectoryChanged()
|
||||
{
|
||||
emit buildDirectoryChanged();
|
||||
}
|
||||
|
||||
QString ConfigureStep::additionalArguments() const
|
||||
{
|
||||
return m_additionalArguments;
|
||||
}
|
||||
|
||||
QVariantMap ConfigureStep::toMap() const
|
||||
{
|
||||
QVariantMap map = AbstractProcessStep::toMap();
|
||||
|
||||
map.insert(CONFIGURE_ADDITIONAL_ARGUMENTS_KEY, m_additionalArguments);
|
||||
return map;
|
||||
}
|
||||
|
||||
bool ConfigureStep::fromMap(const QVariantMap &map)
|
||||
{
|
||||
m_additionalArguments = map.value(CONFIGURE_ADDITIONAL_ARGUMENTS_KEY).toString();
|
||||
|
||||
return BuildStep::fromMap(map);
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
// ConfigureStepConfigWidget class
|
||||
/////////////////////////////////////
|
||||
ConfigureStepConfigWidget::ConfigureStepConfigWidget(ConfigureStep *configureStep) :
|
||||
BuildStepConfigWidget(configureStep),
|
||||
m_configureStep(configureStep),
|
||||
m_additionalArguments(new QLineEdit)
|
||||
{
|
||||
QFormLayout *fl = new QFormLayout(this);
|
||||
fl->setMargin(0);
|
||||
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
setLayout(fl);
|
||||
|
||||
fl->addRow(tr("Arguments:"), m_additionalArguments);
|
||||
m_additionalArguments->setText(m_configureStep->additionalArguments());
|
||||
|
||||
updateDetails();
|
||||
|
||||
connect(m_additionalArguments, &QLineEdit::textChanged,
|
||||
configureStep, &ConfigureStep::setAdditionalArguments);
|
||||
connect(configureStep, &ConfigureStep::additionalArgumentsChanged,
|
||||
this, &ConfigureStepConfigWidget::updateDetails);
|
||||
connect(configureStep, &ConfigureStep::buildDirectoryChanged,
|
||||
this, &ConfigureStepConfigWidget::updateDetails);
|
||||
}
|
||||
|
||||
void ConfigureStepConfigWidget::updateDetails()
|
||||
void ConfigureStep::updateDetails()
|
||||
{
|
||||
BuildConfiguration *bc = m_configureStep->buildConfiguration();
|
||||
if (!m_widget)
|
||||
return;
|
||||
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
|
||||
ProcessParameters param;
|
||||
param.setMacroExpander(bc->macroExpander());
|
||||
param.setEnvironment(bc->environment());
|
||||
param.setWorkingDirectory(bc->buildDirectory().toString());
|
||||
param.setCommand(projectDirRelativeToBuildDir(bc) + "configure");
|
||||
param.setArguments(m_configureStep->additionalArguments());
|
||||
param.setArguments(m_additionalArgumentsAspect->value());
|
||||
|
||||
setSummaryText(param.summaryInWorkdir(displayName()));
|
||||
m_widget->setSummaryText(param.summaryInWorkdir(displayName()));
|
||||
}
|
||||
|
||||
@@ -28,17 +28,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/abstractprocessstep.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLineEdit;
|
||||
QT_END_NAMESPACE
|
||||
#include <projectexplorer/projectconfigurationaspects.h>
|
||||
|
||||
namespace AutotoolsProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class AutotoolsProject;
|
||||
class ConfigureStepConfigWidget;
|
||||
|
||||
//////////////////////////////////
|
||||
// ConfigureStepFactory Class
|
||||
//////////////////////////////////
|
||||
@@ -69,8 +63,6 @@ public:
|
||||
class ConfigureStep : public ProjectExplorer::AbstractProcessStep
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class ConfigureStepFactory;
|
||||
friend class ConfigureStepConfigWidget;
|
||||
|
||||
public:
|
||||
explicit ConfigureStep(ProjectExplorer::BuildStepList *bsl);
|
||||
@@ -79,43 +71,16 @@ public:
|
||||
void run(QFutureInterface<bool> &fi) override;
|
||||
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
||||
bool immutable() const override;
|
||||
QString additionalArguments() const;
|
||||
QVariantMap toMap() const override;
|
||||
|
||||
void setAdditionalArguments(const QString &list);
|
||||
void notifyBuildDirectoryChanged();
|
||||
|
||||
signals:
|
||||
void additionalArgumentsChanged(const QString &);
|
||||
void buildDirectoryChanged();
|
||||
|
||||
private:
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
|
||||
QString m_additionalArguments;
|
||||
bool m_runConfigure = false;
|
||||
};
|
||||
|
||||
/////////////////////////////////////
|
||||
// ConfigureStepConfigWidget class
|
||||
/////////////////////////////////////
|
||||
/**
|
||||
* @brief Implementation of the ProjectExplorer::BuildStepConfigWidget interface.
|
||||
*
|
||||
* Allows to configure a configure step in the GUI.
|
||||
*/
|
||||
class ConfigureStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConfigureStepConfigWidget(ConfigureStep *configureStep);
|
||||
|
||||
private:
|
||||
void updateDetails();
|
||||
|
||||
ConfigureStep *m_configureStep;
|
||||
QLineEdit *m_additionalArguments;
|
||||
ProjectExplorer::BaseStringAspect *m_additionalArgumentsAspect = nullptr;
|
||||
bool m_runConfigure = false;
|
||||
QPointer<ProjectExplorer::BuildStepConfigWidget> m_widget;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user