From e08b38ffd6947858dcc3bd734655e94e6b4dce9b Mon Sep 17 00:00:00 2001
From: Daniel Teske <daniel.teske@digia.com>
Date: Thu, 8 Nov 2012 16:10:34 +0100
Subject: [PATCH] Move Project::subConfigWidgets to BuildConfiguration

Change-Id: Idf58ebbb02e9cd0ab4ff7e74fbed17250e274693
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
---
 .../autotoolsbuildconfiguration.cpp                      | 7 +++++++
 .../autotoolsbuildconfiguration.h                        | 1 +
 src/plugins/autotoolsprojectmanager/autotoolsproject.cpp | 6 ------
 src/plugins/autotoolsprojectmanager/autotoolsproject.h   | 1 -
 .../cmakeprojectmanager/cmakebuildconfiguration.cpp      | 9 +++++++++
 .../cmakeprojectmanager/cmakebuildconfiguration.h        | 1 +
 src/plugins/cmakeprojectmanager/cmakeproject.cpp         | 8 --------
 src/plugins/cmakeprojectmanager/cmakeproject.h           | 2 --
 .../genericprojectmanager/genericbuildconfiguration.cpp  | 7 +++++++
 .../genericprojectmanager/genericbuildconfiguration.h    | 1 +
 src/plugins/genericprojectmanager/genericproject.cpp     | 8 --------
 src/plugins/genericprojectmanager/genericproject.h       | 2 --
 src/plugins/projectexplorer/buildconfiguration.cpp       | 5 +++++
 src/plugins/projectexplorer/buildconfiguration.h         | 1 +
 .../projectexplorer/buildsettingspropertiespage.cpp      | 2 +-
 src/plugins/projectexplorer/project.cpp                  | 4 ----
 src/plugins/projectexplorer/project.h                    | 2 --
 src/plugins/qmlprojectmanager/qmlproject.cpp             | 5 -----
 src/plugins/qmlprojectmanager/qmlproject.h               | 2 --
 src/plugins/qt4projectmanager/qt4buildconfiguration.cpp  | 8 ++++++++
 src/plugins/qt4projectmanager/qt4buildconfiguration.h    | 1 +
 src/plugins/qt4projectmanager/qt4project.cpp             | 8 --------
 src/plugins/qt4projectmanager/qt4project.h               | 2 --
 23 files changed, 42 insertions(+), 51 deletions(-)

diff --git a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp
index fe6ec93f70e..face86fcdb2 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp
+++ b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp
@@ -38,6 +38,7 @@
 #include "autoreconfstep.h"
 #include "configurestep.h"
 
+#include <projectexplorer/buildenvironmentwidget.h>
 #include <projectexplorer/buildsteplist.h>
 #include <projectexplorer/kitinformation.h>
 #include <projectexplorer/projectexplorerconstants.h>
@@ -70,6 +71,12 @@ BuildConfigWidget *AutotoolsBuildConfiguration::createConfigWidget()
     return new AutotoolsBuildSettingsWidget;
 }
 
+QList<BuildConfigWidget *> AutotoolsBuildConfiguration::subConfigWidgets()
+{
+    return QList<BuildConfigWidget *>() << new ProjectExplorer::BuildEnvironmentWidget;
+}
+
+
 AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(ProjectExplorer::Target *parent, const Core::Id id)
     : BuildConfiguration(parent, id)
 {
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.h b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.h
index 362dec94df6..a98eec649fd 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.h
+++ b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.h
@@ -49,6 +49,7 @@ public:
     explicit AutotoolsBuildConfiguration(ProjectExplorer::Target *parent);
 
     ProjectExplorer::BuildConfigWidget *createConfigWidget();
+    QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
 
     QString buildDirectory() const;
     void setBuildDirectory(const QString &buildDirectory);
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
index b93d405c640..c4662e74596 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
+++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
@@ -40,7 +40,6 @@
 #include "makefileparserthread.h"
 
 #include <projectexplorer/abi.h>
-#include <projectexplorer/buildenvironmentwidget.h>
 #include <projectexplorer/kitmanager.h>
 #include <projectexplorer/kitinformation.h>
 #include <projectexplorer/buildconfiguration.h>
@@ -126,11 +125,6 @@ QString AutotoolsProject::defaultBuildDirectory() const
     return projectDirectory();
 }
 
-QList<BuildConfigWidget *> AutotoolsProject::subConfigWidgets()
-{
-    return QList<BuildConfigWidget *>() << new BuildEnvironmentWidget;
-}
-
 ProjectNode *AutotoolsProject::rootProjectNode() const
 {
     return m_rootNode;
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.h b/src/plugins/autotoolsprojectmanager/autotoolsproject.h
index 1821e5f4583..4800136a722 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsproject.h
+++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.h
@@ -74,7 +74,6 @@ public:
     Core::Id id() const;
     Core::IDocument *document() const;
     ProjectExplorer::IProjectManager *projectManager() const;
-    QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
     ProjectExplorer::ProjectNode *rootProjectNode() const;
     QStringList files(FilesMode fileMode) const;
     QString defaultBuildDirectory() const;
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
index aacada4e38b..88dcdc02fcb 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
@@ -33,6 +33,7 @@
 #include "cmakeproject.h"
 #include "cmakeprojectconstants.h"
 
+#include <projectexplorer/buildenvironmentwidget.h>
 #include <projectexplorer/buildsteplist.h>
 #include <projectexplorer/gnumakeparser.h>
 #include <projectexplorer/ioutputparser.h>
@@ -111,6 +112,14 @@ ProjectExplorer::BuildConfigWidget *CMakeBuildConfiguration::createConfigWidget(
     return new CMakeBuildSettingsWidget;
 }
 
+QList<ProjectExplorer::BuildConfigWidget *> CMakeBuildConfiguration::subConfigWidgets()
+{
+    QList<ProjectExplorer::BuildConfigWidget*> list;
+    list << new ProjectExplorer::BuildEnvironmentWidget;
+    return list;
+}
+
+
 QString CMakeBuildConfiguration::buildDirectory() const
 {
     return m_buildDirectory;
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h
index 973766394c1..7d8cfe38da9 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h
+++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h
@@ -52,6 +52,7 @@ public:
     ~CMakeBuildConfiguration();
 
     ProjectExplorer::BuildConfigWidget *createConfigWidget();
+    QList<ProjectExplorer::BuildConfigWidget *> subConfigWidgets();
     QString buildDirectory() const;
 
     void setBuildDirectory(const QString &buildDirectory);
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index a2f1fc33454..b5b9452f596 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -41,7 +41,6 @@
 #include <projectexplorer/projectexplorerconstants.h>
 #include <projectexplorer/projectexplorer.h>
 #include <projectexplorer/headerpath.h>
-#include <projectexplorer/buildenvironmentwidget.h>
 #include <projectexplorer/buildsteplist.h>
 #include <projectexplorer/buildmanager.h>
 #include <projectexplorer/kitinformation.h>
@@ -512,13 +511,6 @@ CMakeManager *CMakeProject::projectManager() const
     return m_manager;
 }
 
-QList<ProjectExplorer::BuildConfigWidget*> CMakeProject::subConfigWidgets()
-{
-    QList<ProjectExplorer::BuildConfigWidget*> list;
-    list << new BuildEnvironmentWidget;
-    return list;
-}
-
 ProjectExplorer::ProjectNode *CMakeProject::rootProjectNode() const
 {
     return m_rootNode;
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.h b/src/plugins/cmakeprojectmanager/cmakeproject.h
index a68596c170e..e8a3f118e61 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.h
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.h
@@ -85,8 +85,6 @@ public:
     Core::IDocument *document() const;
     CMakeManager *projectManager() const;
 
-    QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
-
     ProjectExplorer::ProjectNode *rootProjectNode() const;
 
     QStringList files(FilesMode fileMode) const;
diff --git a/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp b/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp
index 7083fbf5309..9769271614d 100644
--- a/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp
+++ b/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp
@@ -32,6 +32,7 @@
 #include "genericmakestep.h"
 #include "genericproject.h"
 
+#include <projectexplorer/buildenvironmentwidget.h>
 #include <projectexplorer/buildsteplist.h>
 #include <projectexplorer/kitinformation.h>
 #include <projectexplorer/projectexplorerconstants.h>
@@ -110,6 +111,12 @@ BuildConfigWidget *GenericBuildConfiguration::createConfigWidget()
     return new GenericBuildSettingsWidget;
 }
 
+QList<BuildConfigWidget*> GenericBuildConfiguration::subConfigWidgets()
+{
+    QList<BuildConfigWidget*> list;
+    list << new ProjectExplorer::BuildEnvironmentWidget;
+    return list;
+}
 
 /*!
   \class GenericBuildConfigurationFactory
diff --git a/src/plugins/genericprojectmanager/genericbuildconfiguration.h b/src/plugins/genericprojectmanager/genericbuildconfiguration.h
index f0e4f2ac957..c9774e25bff 100644
--- a/src/plugins/genericprojectmanager/genericbuildconfiguration.h
+++ b/src/plugins/genericprojectmanager/genericbuildconfiguration.h
@@ -50,6 +50,7 @@ public:
     explicit GenericBuildConfiguration(ProjectExplorer::Target *parent);
 
     ProjectExplorer::BuildConfigWidget *createConfigWidget();
+    QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
     QString buildDirectory() const;
 
     QString rawBuildDirectory() const;
diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp
index 8f1020cccd6..9a9dc3c6e15 100644
--- a/src/plugins/genericprojectmanager/genericproject.cpp
+++ b/src/plugins/genericprojectmanager/genericproject.cpp
@@ -39,7 +39,6 @@
 #include <cpptools/ModelManagerInterface.h>
 #include <extensionsystem/pluginmanager.h>
 #include <projectexplorer/abi.h>
-#include <projectexplorer/buildenvironmentwidget.h>
 #include <projectexplorer/buildsteplist.h>
 #include <projectexplorer/headerpath.h>
 #include <projectexplorer/kitinformation.h>
@@ -398,13 +397,6 @@ IProjectManager *GenericProject::projectManager() const
     return m_manager;
 }
 
-QList<BuildConfigWidget*> GenericProject::subConfigWidgets()
-{
-    QList<BuildConfigWidget*> list;
-    list << new BuildEnvironmentWidget;
-    return list;
-}
-
 GenericProjectNode *GenericProject::rootProjectNode() const
 {
     return m_rootNode;
diff --git a/src/plugins/genericprojectmanager/genericproject.h b/src/plugins/genericprojectmanager/genericproject.h
index 192c959a055..b105fdc8e21 100644
--- a/src/plugins/genericprojectmanager/genericproject.h
+++ b/src/plugins/genericprojectmanager/genericproject.h
@@ -64,8 +64,6 @@ public:
     Core::IDocument *document() const;
     ProjectExplorer::IProjectManager *projectManager() const;
 
-    QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
-
     GenericProjectNode *rootProjectNode() const;
     QStringList files(FilesMode fileMode) const;
 
diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp
index 21462fe2060..42cbf9bdbea 100644
--- a/src/plugins/projectexplorer/buildconfiguration.cpp
+++ b/src/plugins/projectexplorer/buildconfiguration.cpp
@@ -116,6 +116,11 @@ BuildConfiguration::~BuildConfiguration()
     delete m_macroExpander;
 }
 
+QList<BuildConfigWidget*> BuildConfiguration::subConfigWidgets()
+{
+    return QList<BuildConfigWidget*>();
+}
+
 Utils::AbstractMacroExpander *BuildConfiguration::macroExpander()
 {
     if (!m_macroExpander)
diff --git a/src/plugins/projectexplorer/buildconfiguration.h b/src/plugins/projectexplorer/buildconfiguration.h
index 78ed6bd93f1..959e18bf8e9 100644
--- a/src/plugins/projectexplorer/buildconfiguration.h
+++ b/src/plugins/projectexplorer/buildconfiguration.h
@@ -61,6 +61,7 @@ public:
     virtual QString buildDirectory() const = 0;
 
     virtual BuildConfigWidget *createConfigWidget() = 0;
+    virtual QList<BuildConfigWidget*> subConfigWidgets();
 
     // Maybe the BuildConfiguration is not the best place for the environment
     Utils::Environment baseEnvironment() const;
diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp
index f0ff0844f7a..10be21edd1d 100644
--- a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp
+++ b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp
@@ -242,7 +242,7 @@ void BuildSettingsWidget::updateBuildSettings()
     addSubWidget(new BuildStepsPage(m_target, Core::Id(Constants::BUILDSTEPS_BUILD)));
     addSubWidget(new BuildStepsPage(m_target, Core::Id(Constants::BUILDSTEPS_CLEAN)));
 
-    QList<BuildConfigWidget *> subConfigWidgets = m_target->project()->subConfigWidgets();
+    QList<BuildConfigWidget *> subConfigWidgets = m_buildConfiguration->subConfigWidgets();
     foreach (BuildConfigWidget *subConfigWidget, subConfigWidgets)
         addSubWidget(subConfigWidget);
 
diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp
index ca42de0f922..261955c03b1 100644
--- a/src/plugins/projectexplorer/project.cpp
+++ b/src/plugins/projectexplorer/project.cpp
@@ -306,10 +306,6 @@ bool Project::restoreSettings()
     return ok;
 }
 
-QList<BuildConfigWidget*> Project::subConfigWidgets()
-{
-    return QList<BuildConfigWidget*>();
-}
 
 /*!
     \brief Serialize all data into a QVariantMap.
diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h
index 0385f28c6eb..56b9a15c540 100644
--- a/src/plugins/projectexplorer/project.h
+++ b/src/plugins/projectexplorer/project.h
@@ -97,8 +97,6 @@ public:
     void saveSettings();
     bool restoreSettings();
 
-    virtual QList<BuildConfigWidget*> subConfigWidgets();
-
     virtual ProjectNode *rootProjectNode() const = 0;
 
     enum FilesMode { AllFiles, ExcludeGeneratedFiles };
diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp
index abd4f2e5a46..e20ab08a6b5 100644
--- a/src/plugins/qmlprojectmanager/qmlproject.cpp
+++ b/src/plugins/qmlprojectmanager/qmlproject.cpp
@@ -301,11 +301,6 @@ bool QmlProject::supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) con
     return version;
 }
 
-QList<ProjectExplorer::BuildConfigWidget*> QmlProject::subConfigWidgets()
-{
-    return QList<ProjectExplorer::BuildConfigWidget*>();
-}
-
 ProjectExplorer::ProjectNode *QmlProject::rootProjectNode() const
 {
     return m_rootNode;
diff --git a/src/plugins/qmlprojectmanager/qmlproject.h b/src/plugins/qmlprojectmanager/qmlproject.h
index 86c2bd23f68..4b642db986f 100644
--- a/src/plugins/qmlprojectmanager/qmlproject.h
+++ b/src/plugins/qmlprojectmanager/qmlproject.h
@@ -68,8 +68,6 @@ public:
 
     bool supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) const;
 
-    QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
-
     ProjectExplorer::ProjectNode *rootProjectNode() const;
     QStringList files(FilesMode fileMode) const;
 
diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
index 1195499a1a6..bf55009c673 100644
--- a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
@@ -39,6 +39,7 @@
 #include <utils/qtcassert.h>
 #include <utils/qtcprocess.h>
 #include <limits>
+#include <projectexplorer/buildenvironmentwidget.h>
 #include <projectexplorer/buildsteplist.h>
 #include <projectexplorer/projectexplorerconstants.h>
 #include <projectexplorer/target.h>
@@ -189,6 +190,13 @@ BuildConfigWidget *Qt4BuildConfiguration::createConfigWidget()
     return new Qt4ProjectConfigWidget(target());
 }
 
+QList<BuildConfigWidget*> Qt4BuildConfiguration::subConfigWidgets()
+{
+    QList<BuildConfigWidget*> subWidgets;
+    subWidgets << new ProjectExplorer::BuildEnvironmentWidget;
+    return subWidgets;
+}
+
 QString Qt4BuildConfiguration::defaultShadowBuildDirectory() const
 {
     // todo displayName isn't ideal
diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.h b/src/plugins/qt4projectmanager/qt4buildconfiguration.h
index b2348b8306d..42efcadb456 100644
--- a/src/plugins/qt4projectmanager/qt4buildconfiguration.h
+++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.h
@@ -56,6 +56,7 @@ public:
     ~Qt4BuildConfiguration();
 
     ProjectExplorer::BuildConfigWidget *createConfigWidget();
+    QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
     QString buildDirectory() const;
     bool shadowBuild() const;
     QString shadowBuildDirectory() const;
diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp
index 27342e7f651..267826dff47 100644
--- a/src/plugins/qt4projectmanager/qt4project.cpp
+++ b/src/plugins/qt4projectmanager/qt4project.cpp
@@ -55,7 +55,6 @@
 #include <projectexplorer/toolchain.h>
 #include <projectexplorer/headerpath.h>
 #include <projectexplorer/target.h>
-#include <projectexplorer/buildenvironmentwidget.h>
 #include <projectexplorer/kitinformation.h>
 #include <projectexplorer/projectexplorer.h>
 #include <projectexplorer/projectexplorerconstants.h>
@@ -1057,13 +1056,6 @@ bool Qt4Project::parseInProgress(const QString &proFilePath) const
     return node && node->parseInProgress();
 }
 
-QList<BuildConfigWidget*> Qt4Project::subConfigWidgets()
-{
-    QList<BuildConfigWidget*> subWidgets;
-    subWidgets << new BuildEnvironmentWidget;
-    return subWidgets;
-}
-
 void Qt4Project::collectAllfProFiles(QList<Qt4ProFileNode *> &list, Qt4ProFileNode *node)
 {
     list.append(node);
diff --git a/src/plugins/qt4projectmanager/qt4project.h b/src/plugins/qt4projectmanager/qt4project.h
index 10767cf90da..58863844d7f 100644
--- a/src/plugins/qt4projectmanager/qt4project.h
+++ b/src/plugins/qt4projectmanager/qt4project.h
@@ -92,8 +92,6 @@ public:
     virtual QStringList files(FilesMode fileMode) const;
     virtual QString generatedUiHeader(const QString &formFile) const;
 
-    QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
-
     QList<Qt4ProFileNode *> allProFiles() const;
     QList<Qt4ProFileNode *> applicationProFiles() const;
     bool hasApplicationProFile(const QString &path) const;
-- 
GitLab