From 9c4c7248cc67076e1bd1e68ddbd66c520ba99be0 Mon Sep 17 00:00:00 2001
From: dt <qtc-committer@nokia.com>
Date: Mon, 14 Dec 2009 19:48:55 +0100
Subject: [PATCH] Update on BuildConfiguration::displayNameChanged()

On the project page
---
 .../buildsettingspropertiespage.cpp           | 35 +++++++++++++++++--
 .../buildsettingspropertiespage.h             |  3 ++
 2 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp
index ac03deb6466..70f84584fd0 100644
--- a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp
+++ b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp
@@ -168,6 +168,17 @@ void BuildSettingsWidget::setupUi()
     connect(m_project, SIGNAL(activeBuildConfigurationChanged()),
             this, SLOT(checkMakeActiveLabel()));
 
+    connect(m_project, SIGNAL(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
+            this, SLOT(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
+
+    connect(m_project, SIGNAL(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
+            this, SLOT(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
+
+    foreach (BuildConfiguration *bc, m_project->buildConfigurations()) {
+        connect(bc, SIGNAL(displayNameChanged()),
+                this, SLOT(buildConfigurationDisplayNameChanged()));
+    }
+
     if (m_project->buildConfigurationFactory())
         connect(m_project->buildConfigurationFactory(), SIGNAL(availableCreationIdsChanged()), SLOT(updateAddButtonMenu()));
 
@@ -175,6 +186,27 @@ void BuildSettingsWidget::setupUi()
     updateBuildSettings();
 }
 
+void BuildSettingsWidget::addedBuildConfiguration(BuildConfiguration *bc)
+{
+    connect(bc, SIGNAL(displayNameChanged()),
+            this, SLOT(buildConfigurationDisplayNameChanged()));
+}
+
+void BuildSettingsWidget::removedBuildConfiguration(BuildConfiguration *bc)
+{
+    disconnect(bc, SIGNAL(displayNameChanged()),
+               this, SLOT(buildConfigurationDisplayNameChanged()));
+}
+
+void BuildSettingsWidget::buildConfigurationDisplayNameChanged()
+{
+    for (int i = 0; i < m_buildConfigurationComboBox->count(); ++i) {
+        BuildConfiguration *bc = m_buildConfigurationComboBox->itemData(i).value<BuildConfiguration *>();
+        m_buildConfigurationComboBox->setItemText(i, bc->displayName());
+    }
+    checkMakeActiveLabel();
+}
+
 void BuildSettingsWidget::addSubWidget(const QString &name, QWidget *widget)
 {
     widget->setContentsMargins(m_leftMargin, 10, 0, 0);
@@ -260,9 +292,6 @@ void BuildSettingsWidget::updateBuildSettings()
 
     m_buildConfigurationComboBox->blockSignals(blocked);
 
-    // TODO Restore position, entry from combbox
-    // TODO? select entry from combobox ?
-
     activeBuildConfigurationChanged();
 }
 
diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.h b/src/plugins/projectexplorer/buildsettingspropertiespage.h
index 5a805f3e776..9b1321edccf 100644
--- a/src/plugins/projectexplorer/buildsettingspropertiespage.h
+++ b/src/plugins/projectexplorer/buildsettingspropertiespage.h
@@ -98,6 +98,9 @@ private slots:
 
     void setupUi();
 
+    void addedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
+    void removedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
+    void buildConfigurationDisplayNameChanged();
 private:
     void cloneConfiguration(BuildConfiguration *toClone);
     void deleteConfiguration(BuildConfiguration *toDelete);
-- 
GitLab