Commit b5bbdb38 authored by Daniel Teske's avatar Daniel Teske
Browse files

Remove BuildConfigWidget::init()



It no longer serves a purpose.

Change-Id: Icdcb69c87112e295cefd4975dfa2b3d65818365a
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 8cbafa83
......@@ -67,7 +67,7 @@ AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(ProjectExplorer::Target
BuildConfigWidget *AutotoolsBuildConfiguration::createConfigWidget()
{
return new AutotoolsBuildSettingsWidget;
return new AutotoolsBuildSettingsWidget(this);
}
AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(ProjectExplorer::Target *parent, const Core::Id id)
......
......@@ -49,7 +49,7 @@ using namespace AutotoolsProjectManager;
using namespace AutotoolsProjectManager::Internal;
using namespace ProjectExplorer;
AutotoolsBuildSettingsWidget::AutotoolsBuildSettingsWidget() :
AutotoolsBuildSettingsWidget::AutotoolsBuildSettingsWidget(AutotoolsBuildConfiguration *bc) :
m_buildConfiguration(0)
{
QFormLayout *fl = new QFormLayout(this);
......@@ -61,6 +61,9 @@ AutotoolsBuildSettingsWidget::AutotoolsBuildSettingsWidget() :
m_pathChooser->setExpectedKind(Utils::PathChooser::Directory);
fl->addRow(tr("Build directory:"), m_pathChooser);
connect(m_pathChooser, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
m_pathChooser->setBaseDirectory(bc->target()->project()->projectDirectory());
m_pathChooser->setPath(m_buildConfiguration->buildDirectory());
}
QString AutotoolsBuildSettingsWidget::displayName() const
......@@ -68,13 +71,6 @@ QString AutotoolsBuildSettingsWidget::displayName() const
return QLatin1String("Autotools Manager");
}
void AutotoolsBuildSettingsWidget::init(BuildConfiguration *bc)
{
m_buildConfiguration = static_cast<AutotoolsBuildConfiguration *>(bc);
m_pathChooser->setBaseDirectory(bc->target()->project()->projectDirectory());
m_pathChooser->setPath(m_buildConfiguration->buildDirectory());
}
void AutotoolsBuildSettingsWidget::buildDirectoryChanged()
{
m_buildConfiguration->setBuildDirectory(m_pathChooser->rawPath());
......
......@@ -57,10 +57,9 @@ class AutotoolsBuildSettingsWidget : public ProjectExplorer::BuildConfigWidget
Q_OBJECT
public:
AutotoolsBuildSettingsWidget();
AutotoolsBuildSettingsWidget(AutotoolsBuildConfiguration *bc);
QString displayName() const;
void init(ProjectExplorer::BuildConfiguration *bc);
private slots:
void buildDirectoryChanged();
......
......@@ -108,7 +108,7 @@ CMakeBuildConfiguration::~CMakeBuildConfiguration()
ProjectExplorer::BuildConfigWidget *CMakeBuildConfiguration::createConfigWidget()
{
return new CMakeBuildSettingsWidget;
return new CMakeBuildSettingsWidget(this);
}
QString CMakeBuildConfiguration::buildDirectory() const
......
......@@ -902,7 +902,7 @@ bool CMakeFile::reload(QString *errorString, ReloadFlag flag, ChangeType type)
return true;
}
CMakeBuildSettingsWidget::CMakeBuildSettingsWidget() : m_buildConfiguration(0)
CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc) : m_buildConfiguration(0)
{
QFormLayout *fl = new QFormLayout(this);
fl->setContentsMargins(20, -1, 0, -1);
......@@ -926,16 +926,8 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget() : m_buildConfiguration(0)
hbox->addWidget(m_changeButton);
fl->addRow(tr("Build directory:"), hbox);
}
QString CMakeBuildSettingsWidget::displayName() const
{
return "CMake";
}
void CMakeBuildSettingsWidget::init(BuildConfiguration *bc)
{
m_buildConfiguration = static_cast<CMakeBuildConfiguration *>(bc);
m_buildConfiguration = bc;
m_pathLineEdit->setText(m_buildConfiguration->buildDirectory());
if (m_buildConfiguration->buildDirectory() == bc->target()->project()->projectDirectory())
m_changeButton->setEnabled(false);
......@@ -943,6 +935,11 @@ void CMakeBuildSettingsWidget::init(BuildConfiguration *bc)
m_changeButton->setEnabled(true);
}
QString CMakeBuildSettingsWidget::displayName() const
{
return "CMake";
}
void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
{
CMakeProject *project = static_cast<CMakeProject *>(m_buildConfiguration->target()->project());
......
......@@ -228,12 +228,9 @@ class CMakeBuildSettingsWidget : public ProjectExplorer::BuildConfigWidget
{
Q_OBJECT
public:
CMakeBuildSettingsWidget();
CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc);
QString displayName() const;
// This is called to set up the config widget before showing it
void init(ProjectExplorer::BuildConfiguration *bc);
private slots:
void openChangeBuildDirectoryDialog();
void runCMake();
......
......@@ -107,7 +107,7 @@ void GenericBuildConfiguration::setBuildDirectory(const QString &buildDirectory)
BuildConfigWidget *GenericBuildConfiguration::createConfigWidget()
{
return new GenericBuildSettingsWidget;
return new GenericBuildSettingsWidget(this);
}
/*!
......@@ -229,7 +229,8 @@ BuildConfiguration::BuildType GenericBuildConfiguration::buildType() const
// GenericBuildSettingsWidget
////////////////////////////////////////////////////////////////////////////////////
GenericBuildSettingsWidget::GenericBuildSettingsWidget() : m_buildConfiguration(0)
GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericBuildConfiguration *bc)
: m_buildConfiguration(0)
{
QFormLayout *fl = new QFormLayout(this);
fl->setContentsMargins(0, -1, 0, -1);
......@@ -240,6 +241,10 @@ GenericBuildSettingsWidget::GenericBuildSettingsWidget() : m_buildConfiguration(
m_pathChooser->setEnabled(true);
fl->addRow(tr("Build directory:"), m_pathChooser);
connect(m_pathChooser, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
m_buildConfiguration = bc;
m_pathChooser->setBaseDirectory(bc->target()->project()->projectDirectory());
m_pathChooser->setPath(m_buildConfiguration->rawBuildDirectory());
}
QString GenericBuildSettingsWidget::displayName() const
......@@ -247,13 +252,6 @@ QString GenericBuildSettingsWidget::displayName() const
return tr("Generic Manager");
}
void GenericBuildSettingsWidget::init(BuildConfiguration *bc)
{
m_buildConfiguration = static_cast<GenericBuildConfiguration *>(bc);
m_pathChooser->setBaseDirectory(bc->target()->project()->projectDirectory());
m_pathChooser->setPath(m_buildConfiguration->rawBuildDirectory());
}
void GenericBuildSettingsWidget::buildDirectoryChanged()
{
m_buildConfiguration->setBuildDirectory(m_pathChooser->rawPath());
......
......@@ -94,12 +94,10 @@ class GenericBuildSettingsWidget : public ProjectExplorer::BuildConfigWidget
Q_OBJECT
public:
GenericBuildSettingsWidget();
GenericBuildSettingsWidget(GenericBuildConfiguration *bc);
QString displayName() const;
void init(ProjectExplorer::BuildConfiguration *bc);
private slots:
void buildDirectoryChanged();
......
......@@ -119,7 +119,7 @@ BuildConfiguration::~BuildConfiguration()
QList<BuildConfigWidget*> BuildConfiguration::createSubConfigWidgets()
{
return QList<BuildConfigWidget *>() << new ProjectExplorer::BuildEnvironmentWidget;
return QList<BuildConfigWidget *>() << new ProjectExplorer::BuildEnvironmentWidget(this);
}
Utils::AbstractMacroExpander *BuildConfiguration::macroExpander()
......
......@@ -40,7 +40,7 @@
using namespace ProjectExplorer;
BuildEnvironmentWidget::BuildEnvironmentWidget()
BuildEnvironmentWidget::BuildEnvironmentWidget(BuildConfiguration *bc)
: m_buildConfiguration(0)
{
QVBoxLayout *vbox = new QVBoxLayout(this);
......@@ -55,21 +55,6 @@ BuildEnvironmentWidget::BuildEnvironmentWidget()
this, SLOT(environmentModelUserChangesChanged()));
connect(m_clearSystemEnvironmentCheckBox, SIGNAL(toggled(bool)),
this, SLOT(clearSystemEnvironmentCheckBoxClicked(bool)));
}
QString BuildEnvironmentWidget::displayName() const
{
return tr("Build Environment");
}
void BuildEnvironmentWidget::init(BuildConfiguration *bc)
{
Q_ASSERT(bc);
if (m_buildConfiguration) {
disconnect(m_buildConfiguration->target(), SIGNAL(environmentChanged()),
this, SLOT(environmentChanged()));
}
m_buildConfiguration = bc;
......@@ -82,6 +67,11 @@ void BuildEnvironmentWidget::init(BuildConfiguration *bc)
m_buildEnvironmentWidget->setUserChanges(m_buildConfiguration->userEnvironmentChanges());
}
QString BuildEnvironmentWidget::displayName() const
{
return tr("Build Environment");
}
void BuildEnvironmentWidget::environmentModelUserChangesChanged()
{
m_buildConfiguration->setUserEnvironmentChanges(m_buildEnvironmentWidget->userChanges());
......
......@@ -46,10 +46,9 @@ class PROJECTEXPLORER_EXPORT BuildEnvironmentWidget : public BuildConfigWidget
Q_OBJECT
public:
BuildEnvironmentWidget();
BuildEnvironmentWidget(BuildConfiguration *bc);
QString displayName() const;
void init(BuildConfiguration *bc);
private slots:
void environmentModelUserChangesChanged();
......
......@@ -242,15 +242,12 @@ void BuildSettingsWidget::updateBuildSettings()
BuildConfigWidget *generalConfigWidget = m_buildConfiguration->createConfigWidget();
addSubWidget(generalConfigWidget);
addSubWidget(new BuildStepsPage(m_target, Core::Id(Constants::BUILDSTEPS_BUILD)));
addSubWidget(new BuildStepsPage(m_target, Core::Id(Constants::BUILDSTEPS_CLEAN)));
addSubWidget(new BuildStepsPage(m_buildConfiguration, Core::Id(Constants::BUILDSTEPS_BUILD)));
addSubWidget(new BuildStepsPage(m_buildConfiguration, Core::Id(Constants::BUILDSTEPS_CLEAN)));
QList<BuildConfigWidget *> subConfigWidgets = m_buildConfiguration->createSubConfigWidgets();
foreach (BuildConfigWidget *subConfigWidget, subConfigWidgets)
addSubWidget(subConfigWidget);
foreach (BuildConfigWidget *widget, subWidgets())
widget->init(m_buildConfiguration);
}
void BuildSettingsWidget::currentIndexChanged(int index)
......
......@@ -129,9 +129,6 @@ public:
virtual QString displayName() const = 0;
// This is called to set up the config widget before showing it
virtual void init(BuildConfiguration *bc) = 0;
signals:
void displayNameChanged(const QString &);
};
......
......@@ -491,16 +491,17 @@ void BuildStepListWidget::updateBuildStepButtonsState()
}
}
BuildStepsPage::BuildStepsPage(Target *target, Core::Id id) :
BuildStepsPage::BuildStepsPage(BuildConfiguration *bc, Core::Id id) :
BuildConfigWidget(),
m_id(id),
m_widget(new BuildStepListWidget(this))
{
Q_UNUSED(target);
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setSpacing(0);
layout->addWidget(m_widget);
m_widget->init(bc->stepList(m_id));
}
BuildStepsPage::~BuildStepsPage()
......@@ -514,8 +515,3 @@ QString BuildStepsPage::displayName() const
return tr("Clean Steps");
return QString();
}
void BuildStepsPage::init(BuildConfiguration *bc)
{
m_widget->init(bc->stepList(m_id));
}
......@@ -156,11 +156,10 @@ class BuildStepsPage : public BuildConfigWidget
Q_OBJECT
public:
BuildStepsPage(Target *target, Core::Id id);
BuildStepsPage(BuildConfiguration *bc, Core::Id id);
virtual ~BuildStepsPage();
QString displayName() const;
void init(BuildConfiguration *bc);
private:
Core::Id m_id;
......
......@@ -186,7 +186,7 @@ void Qt4BuildConfiguration::emitBuildDirectoryChanged()
BuildConfigWidget *Qt4BuildConfiguration::createConfigWidget()
{
return new Qt4ProjectConfigWidget(target());
return new Qt4ProjectConfigWidget(this);
}
QString Qt4BuildConfiguration::defaultShadowBuildDirectory() const
......
......@@ -58,17 +58,13 @@
#include <QPushButton>
#include <utils/detailswidget.h>
namespace {
bool debug = false;
}
using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal;
using namespace ProjectExplorer;
Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(ProjectExplorer::Target *target)
Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4BuildConfiguration *bc)
: BuildConfigWidget(),
m_buildConfiguration(0),
m_buildConfiguration(bc),
m_ignoreChange(false)
{
QVBoxLayout *vbox = new QVBoxLayout(this);
......@@ -95,11 +91,22 @@ Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(ProjectExplorer::Target *target)
connect(m_ui->shadowBuildDirEdit, SIGNAL(changed(QString)),
this, SLOT(shadowBuildEdited()));
Qt4Project *project = static_cast<Qt4Project *>(target->project());
Qt4Project *project = static_cast<Qt4Project *>(bc->target()->project());
connect(project, SIGNAL(environmentChanged()), this, SLOT(environmentChanged()));
connect(project, SIGNAL(buildDirectoryInitialized()), this, SLOT(updateProblemLabel()));
connect(target, SIGNAL(kitChanged()), this, SLOT(updateProblemLabel()));
connect(bc->target(), SIGNAL(kitChanged()), this, SLOT(updateProblemLabel()));
m_ui->shadowBuildDirEdit->setEnvironment(m_buildConfiguration->environment());
connect(m_buildConfiguration, SIGNAL(buildDirectoryChanged()),
this, SLOT(buildDirectoryChanged()));
connect(m_buildConfiguration, SIGNAL(qmakeBuildConfigurationChanged()),
this, SLOT(updateProblemLabel()));
m_ui->shadowBuildDirEdit->setBaseDirectory(m_buildConfiguration->target()->project()->projectDirectory());
buildDirectoryChanged();
}
Qt4ProjectConfigWidget::~Qt4ProjectConfigWidget()
......@@ -131,32 +138,6 @@ QString Qt4ProjectConfigWidget::displayName() const
return tr("General");
}
void Qt4ProjectConfigWidget::init(ProjectExplorer::BuildConfiguration *bc)
{
QTC_ASSERT(bc, return);
if (debug)
qDebug() << "Qt4ProjectConfigWidget::init() for" << bc->displayName();
if (m_buildConfiguration) {
disconnect(m_buildConfiguration, SIGNAL(buildDirectoryChanged()),
this, SLOT(buildDirectoryChanged()));
disconnect(m_buildConfiguration, SIGNAL(qmakeBuildConfigurationChanged()),
this, SLOT(updateProblemLabel()));
}
m_buildConfiguration = static_cast<Qt4BuildConfiguration *>(bc);
m_ui->shadowBuildDirEdit->setEnvironment(m_buildConfiguration->environment());
connect(m_buildConfiguration, SIGNAL(buildDirectoryChanged()),
this, SLOT(buildDirectoryChanged()));
connect(m_buildConfiguration, SIGNAL(qmakeBuildConfigurationChanged()),
this, SLOT(updateProblemLabel()));
m_ui->shadowBuildDirEdit->setBaseDirectory(m_buildConfiguration->target()->project()->projectDirectory());
buildDirectoryChanged();
}
void Qt4ProjectConfigWidget::buildDirectoryChanged()
{
if (m_ignoreChange)
......
......@@ -53,11 +53,10 @@ class Qt4ProjectConfigWidget : public ProjectExplorer::BuildConfigWidget
{
Q_OBJECT
public:
Qt4ProjectConfigWidget(ProjectExplorer::Target *target);
Qt4ProjectConfigWidget(Qt4BuildConfiguration *bc);
~Qt4ProjectConfigWidget();
QString displayName() const;
void init(ProjectExplorer::BuildConfiguration *bc);
private slots:
// User changes in our widgets
......
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