From 28aa2d54f5e2864faa2f2e535ddaad11977b4496 Mon Sep 17 00:00:00 2001
From: dt <qtc-committer@nokia.com>
Date: Wed, 20 Jan 2010 16:17:26 +0100
Subject: [PATCH] change RunConfiguration::addedRunConfiguration()
 removedRunConfiguration()

To simply transmit the RunConfiguration

Reviewed-By: Tobias Hunger
---
 src/plugins/projectexplorer/project.cpp       |  4 +--
 src/plugins/projectexplorer/project.h         |  4 +--
 src/plugins/projectexplorer/projectwindow.cpp | 30 +++++++------------
 src/plugins/projectexplorer/projectwindow.h   |  5 ++--
 .../runsettingspropertiespage.cpp             |  4 +--
 .../qt-maemo/maemorunconfiguration.cpp        | 18 +++++------
 .../qt-maemo/maemorunconfiguration.h          |  4 +--
 7 files changed, 30 insertions(+), 39 deletions(-)

diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp
index b24280513c2..6110d7aa60a 100644
--- a/src/plugins/projectexplorer/project.cpp
+++ b/src/plugins/projectexplorer/project.cpp
@@ -418,7 +418,7 @@ void Project::addRunConfiguration(RunConfiguration* runConfiguration)
     QTC_ASSERT(runConfiguration && !m_runConfigurations.contains(runConfiguration), return);
 
     m_runConfigurations.push_back(runConfiguration);
-    emit addedRunConfiguration(this, runConfiguration->displayName());
+    emit addedRunConfiguration(runConfiguration);
 }
 
 void Project::removeRunConfiguration(RunConfiguration* runConfiguration)
@@ -438,7 +438,7 @@ void Project::removeRunConfiguration(RunConfiguration* runConfiguration)
     }
 
     m_runConfigurations.removeOne(runConfiguration);
-    emit removedRunConfiguration(this, runConfiguration->displayName());
+    emit removedRunConfiguration(runConfiguration);
     delete runConfiguration;
 }
 
diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h
index 9e348d2c25b..2923289ec75 100644
--- a/src/plugins/projectexplorer/project.h
+++ b/src/plugins/projectexplorer/project.h
@@ -133,8 +133,8 @@ signals:
     void activeRunConfigurationChanged();
     void runConfigurationsEnabledStateChanged();
 
-    void removedRunConfiguration(ProjectExplorer::Project *p, const QString &name);
-    void addedRunConfiguration(ProjectExplorer::Project *p, const QString &name);
+    void removedRunConfiguration(ProjectExplorer::RunConfiguration *rc);
+    void addedRunConfiguration(ProjectExplorer::RunConfiguration *rc);
 
     void removedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
     void addedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp
index 09780c1c8f7..1e81b17bc1b 100644
--- a/src/plugins/projectexplorer/projectwindow.cpp
+++ b/src/plugins/projectexplorer/projectwindow.cpp
@@ -407,15 +407,8 @@ void RunConfigurationComboBox::activeRunConfigurationChanged()
     m_ignoreChange = false;
 }
 
-void RunConfigurationComboBox::addedRunConfiguration(ProjectExplorer::Project *p, const QString &name)
+void RunConfigurationComboBox::addedRunConfiguration(RunConfiguration *runConfiguration)
 {
-    RunConfiguration *runConfiguration = 0;
-    foreach(RunConfiguration *rc, p->runConfigurations()) {
-        if (rc->displayName() == name) {
-            runConfiguration = rc;
-            break;
-        }
-    }
     if (runConfiguration) {
         connect(runConfiguration, SIGNAL(displayNameChanged()),
                 this, SLOT(rebuildTree()));
@@ -423,10 +416,9 @@ void RunConfigurationComboBox::addedRunConfiguration(ProjectExplorer::Project *p
     rebuildTree();
 }
 
-void RunConfigurationComboBox::removedRunConfiguration(ProjectExplorer::Project *p, const QString &name)
+void RunConfigurationComboBox::removedRunConfiguration(RunConfiguration *rc)
 {
-    Q_UNUSED(p)
-    Q_UNUSED(name)
+    Q_UNUSED(rc)
     rebuildTree();
 }
 
@@ -448,20 +440,20 @@ void RunConfigurationComboBox::connectToProject(ProjectExplorer::Project *p)
 {
     connect(p, SIGNAL(activeRunConfigurationChanged()),
             this, SLOT(activeRunConfigurationChanged()));
-    connect(p, SIGNAL(addedRunConfiguration(ProjectExplorer::Project *, QString)),
-            this, SLOT(addedRunConfiguration(ProjectExplorer::Project *, QString)));
-    connect(p, SIGNAL(removedRunConfiguration(ProjectExplorer::Project *, QString)),
-            this, SLOT(removedRunConfiguration(ProjectExplorer::Project *, QString)));
+    connect(p, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration *)),
+            this, SLOT(addedRunConfiguration(ProjectExplorer::RunConfiguration *)));
+    connect(p, SIGNAL(removedRunConfiguration(ProjectExplorer::RunConfiguration *)),
+            this, SLOT(removedRunConfiguration(ProjectExplorer::RunConfiguration *)));
 }
 
 void RunConfigurationComboBox::disconnectFromProject(ProjectExplorer::Project *p)
 {
     disconnect(p, SIGNAL(activeRunConfigurationChanged()),
             this, SLOT(activeRunConfigurationChanged()));
-    disconnect(p, SIGNAL(addedRunConfiguration(ProjectExplorer::Project *, QString)),
-            this, SLOT(addedRunConfiguration(ProjectExplorer::Project *, QString)));
-    disconnect(p, SIGNAL(removedRunConfiguration(ProjectExplorer::Project *, QString)),
-            this, SLOT(removedRunConfiguration(ProjectExplorer::Project *, QString)));
+    disconnect(p, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration *)),
+            this, SLOT(addedRunConfiguration(ProjectExplorer::RunConfiguration *)));
+    disconnect(p, SIGNAL(removedRunConfiguration(ProjectExplorer::RunConfiguration *)),
+            this, SLOT(removedRunConfiguration(ProjectExplorer::RunConfiguration *)));
 }
 
 void RunConfigurationComboBox::rebuildTree()
diff --git a/src/plugins/projectexplorer/projectwindow.h b/src/plugins/projectexplorer/projectwindow.h
index 42532a65a17..cd930339510 100644
--- a/src/plugins/projectexplorer/projectwindow.h
+++ b/src/plugins/projectexplorer/projectwindow.h
@@ -50,6 +50,7 @@ namespace ProjectExplorer {
 class IPropertiesPanel;
 class Project;
 class BuildConfiguration;
+class RunConfiguration;
 
 namespace Internal {
 
@@ -130,8 +131,8 @@ public:
 private slots:
     void activeRunConfigurationChanged();
     void activeItemChanged(int);
-    void addedRunConfiguration(ProjectExplorer::Project *p, const QString &);
-    void removedRunConfiguration(ProjectExplorer::Project *p, const QString &);
+    void addedRunConfiguration(ProjectExplorer::RunConfiguration *);
+    void removedRunConfiguration(ProjectExplorer::RunConfiguration *);
     void projectAdded(ProjectExplorer::Project*);
     void projectRemoved(ProjectExplorer::Project*);
     void rebuildTree();
diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.cpp b/src/plugins/projectexplorer/runsettingspropertiespage.cpp
index db8cd24809d..fe4cb60edb5 100644
--- a/src/plugins/projectexplorer/runsettingspropertiespage.cpp
+++ b/src/plugins/projectexplorer/runsettingspropertiespage.cpp
@@ -200,9 +200,9 @@ RunSettingsWidget::RunSettingsWidget(Project *project)
     connect(m_ui->removeToolButton, SIGNAL(clicked(bool)),
             this, SLOT(removeRunConfiguration()));
 
-    connect(m_project, SIGNAL(removedRunConfiguration(ProjectExplorer::Project *, QString)),
+    connect(m_project, SIGNAL(removedRunConfiguration(ProjectExplorer::RunConfiguration *)),
             this, SLOT(initRunConfigurationComboBox()));
-    connect(m_project, SIGNAL(addedRunConfiguration(ProjectExplorer::Project *, QString)),
+    connect(m_project, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration *)),
             this, SLOT(initRunConfigurationComboBox()));
 
     connect(m_project, SIGNAL(activeRunConfigurationChanged()),
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp
index c0739891a85..1288bde22d4 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp
@@ -589,10 +589,10 @@ RunConfiguration *MaemoRunConfigurationFactory::create(Project *project,
     Qt4Project *qt4project = qobject_cast<Qt4Project *>(project);
     Q_ASSERT(qt4project);
 
-    connect(project, SIGNAL(addedRunConfiguration(ProjectExplorer::Project*,
-        QString)), this, SLOT(addedRunConfiguration(ProjectExplorer::Project*)));
-    connect(project, SIGNAL(removedRunConfiguration(ProjectExplorer::Project*,
-        QString)), this, SLOT(removedRunConfiguration(ProjectExplorer::Project*)));
+    connect(project, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration *)),
+            this, SLOT(addedRunConfiguration(ProjectExplorer::RunConfiguration *)));
+    connect(project, SIGNAL(removedRunConfiguration(RunConfiguration *)),
+            this, SLOT(removedRunConfiguration(ProjectExplorer::RunConfiguration *)));
 
     RunConfiguration *rc = 0;
     const QLatin1String prefix("MaemoRunConfiguration.");
@@ -635,17 +635,15 @@ bool hasMaemoRunConfig(ProjectExplorer::Project* project)
     return false;
 }
 
-void MaemoRunConfigurationFactory::addedRunConfiguration(
-    ProjectExplorer::Project *project)
+void MaemoRunConfigurationFactory::addedRunConfiguration(ProjectExplorer::RunConfiguration *rc)
 {
-    if (hasMaemoRunConfig(project))
+    if (hasMaemoRunConfig(rc->project()))
         MaemoManager::instance()->addQemuSimulatorStarter(project);
 }
 
-void MaemoRunConfigurationFactory::removedRunConfiguration(
-    ProjectExplorer::Project *project)
+void MaemoRunConfigurationFactory::removedRunConfiguration(ProjectExplorer::RunConfiguration *rc)
 {
-    if (!hasMaemoRunConfig(project))
+    if (!hasMaemoRunConfig(rc->project()))
         MaemoManager::instance()->removeQemuSimulatorStarter(project);
 }
 
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h
index f9d39af0395..c12f2671ffe 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h
@@ -186,8 +186,8 @@ public:
     ProjectExplorer::RunConfiguration *create(ProjectExplorer::Project *project, const QString &id);
 
 private slots:
-    void addedRunConfiguration(ProjectExplorer::Project *project);
-    void removedRunConfiguration(ProjectExplorer::Project *project);
+    void addedRunConfiguration(ProjectExplorer::RunConfiguration *rc);
+    void removedRunConfiguration(ProjectExplorer::RunConfiguration *rc);
 
     void projectAdded(ProjectExplorer::Project *project);
     void projectRemoved(ProjectExplorer::Project *project);
-- 
GitLab