diff options
author | Daniel Teske <daniel.teske@digia.com> | 2012-11-08 17:35:59 +0100 |
---|---|---|
committer | Daniel Teske <daniel.teske@digia.com> | 2012-11-16 14:43:09 +0100 |
commit | b5bbdb38d90e9f0b2049442ad69fc61ad4e74055 (patch) | |
tree | 3f5313b4464eb1c4a6e7a4dbf586ddd800ecc2f5 | |
parent | 8cbafa83b677c5fab089cd68f94828c549d76573 (diff) | |
download | qt-creator-b5bbdb38d90e9f0b2049442ad69fc61ad4e74055.tar.gz |
Remove BuildConfigWidget::init()
It no longer serves a purpose.
Change-Id: Icdcb69c87112e295cefd4975dfa2b3d65818365a
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
18 files changed, 54 insertions, 111 deletions
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp index fe6ec93f70..1e71add966 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp @@ -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) diff --git a/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.cpp b/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.cpp index fa7c262e04..3d106a0614 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.cpp @@ -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()); diff --git a/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.h b/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.h index 6b4c0a3faf..8000d2ae23 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.h +++ b/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.h @@ -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(); diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp index aacada4e38..d35aaf6099 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp @@ -108,7 +108,7 @@ CMakeBuildConfiguration::~CMakeBuildConfiguration() ProjectExplorer::BuildConfigWidget *CMakeBuildConfiguration::createConfigWidget() { - return new CMakeBuildSettingsWidget; + return new CMakeBuildSettingsWidget(this); } QString CMakeBuildConfiguration::buildDirectory() const diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index b5b9452f59..937e534766 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -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()); diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.h b/src/plugins/cmakeprojectmanager/cmakeproject.h index e8a3f118e6..5aaacf99fa 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.h +++ b/src/plugins/cmakeprojectmanager/cmakeproject.h @@ -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(); diff --git a/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp b/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp index e418751e15..cb9cb4bb45 100644 --- a/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp +++ b/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp @@ -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()); diff --git a/src/plugins/genericprojectmanager/genericbuildconfiguration.h b/src/plugins/genericprojectmanager/genericbuildconfiguration.h index f0e4f2ac95..6a22e31b2d 100644 --- a/src/plugins/genericprojectmanager/genericbuildconfiguration.h +++ b/src/plugins/genericprojectmanager/genericbuildconfiguration.h @@ -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(); diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp index 7284d78de9..0beb387943 100644 --- a/src/plugins/projectexplorer/buildconfiguration.cpp +++ b/src/plugins/projectexplorer/buildconfiguration.cpp @@ -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() diff --git a/src/plugins/projectexplorer/buildenvironmentwidget.cpp b/src/plugins/projectexplorer/buildenvironmentwidget.cpp index 002a9ea294..c3631713b3 100644 --- a/src/plugins/projectexplorer/buildenvironmentwidget.cpp +++ b/src/plugins/projectexplorer/buildenvironmentwidget.cpp @@ -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()); diff --git a/src/plugins/projectexplorer/buildenvironmentwidget.h b/src/plugins/projectexplorer/buildenvironmentwidget.h index a8dd0162d3..921dc56cf8 100644 --- a/src/plugins/projectexplorer/buildenvironmentwidget.h +++ b/src/plugins/projectexplorer/buildenvironmentwidget.h @@ -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(); diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp index dc4b2f0a86..87a636d236 100644 --- a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp @@ -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) diff --git a/src/plugins/projectexplorer/buildstep.h b/src/plugins/projectexplorer/buildstep.h index af89e1d065..4d5c9d6d3a 100644 --- a/src/plugins/projectexplorer/buildstep.h +++ b/src/plugins/projectexplorer/buildstep.h @@ -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 &); }; diff --git a/src/plugins/projectexplorer/buildstepspage.cpp b/src/plugins/projectexplorer/buildstepspage.cpp index b4f8de53e3..6c3537b368 100644 --- a/src/plugins/projectexplorer/buildstepspage.cpp +++ b/src/plugins/projectexplorer/buildstepspage.cpp @@ -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)); -} diff --git a/src/plugins/projectexplorer/buildstepspage.h b/src/plugins/projectexplorer/buildstepspage.h index 4719708c69..05d4a546f6 100644 --- a/src/plugins/projectexplorer/buildstepspage.h +++ b/src/plugins/projectexplorer/buildstepspage.h @@ -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; diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp index 1195499a1a..d6191c5767 100644 --- a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp @@ -186,7 +186,7 @@ void Qt4BuildConfiguration::emitBuildDirectoryChanged() BuildConfigWidget *Qt4BuildConfiguration::createConfigWidget() { - return new Qt4ProjectConfigWidget(target()); + return new Qt4ProjectConfigWidget(this); } QString Qt4BuildConfiguration::defaultShadowBuildDirectory() const diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp index f57ffd7961..ad20bd8ed7 100644 --- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp +++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp @@ -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) diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.h b/src/plugins/qt4projectmanager/qt4projectconfigwidget.h index 16d26c13bd..934c10272a 100644 --- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.h +++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.h @@ -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 |