From 91198532830ca70d1af2c4b83bdd14b4e884d4e0 Mon Sep 17 00:00:00 2001 From: dt <qtc-committer@nokia.com> Date: Thu, 26 Nov 2009 15:53:38 +0100 Subject: [PATCH] Make setDisplayName easier and break displayName signals Fix for that will come later --- .../projectexplorer/buildconfiguration.cpp | 3 +++ .../projectexplorer/buildconfiguration.h | 1 + .../buildsettingspropertiespage.cpp | 16 ++-------------- .../buildsettingspropertiespage.h | 1 - src/plugins/projectexplorer/buildstepspage.cpp | 1 + src/plugins/projectexplorer/project.cpp | 17 ----------------- src/plugins/projectexplorer/project.h | 8 -------- src/plugins/qt4projectmanager/qt4project.cpp | 2 +- .../qt4projectconfigwidget.cpp | 2 +- 9 files changed, 9 insertions(+), 42 deletions(-) diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp index ed279970d50..c2b2cb7d94c 100644 --- a/src/plugins/projectexplorer/buildconfiguration.cpp +++ b/src/plugins/projectexplorer/buildconfiguration.cpp @@ -80,7 +80,10 @@ QString BuildConfiguration::displayName() const void BuildConfiguration::setDisplayName(const QString &name) { + if (value("ProjectExplorer.BuildConfiguration.DisplayName").toString() == name) + return; setValue("ProjectExplorer.BuildConfiguration.DisplayName", name); + emit displayNameChanged(); } QVariant BuildConfiguration::value(const QString & key) const diff --git a/src/plugins/projectexplorer/buildconfiguration.h b/src/plugins/projectexplorer/buildconfiguration.h index 09950668b2d..a54e7a6705b 100644 --- a/src/plugins/projectexplorer/buildconfiguration.h +++ b/src/plugins/projectexplorer/buildconfiguration.h @@ -82,6 +82,7 @@ public: signals: void environmentChanged(); void buildDirectoryChanged(); + void displayNameChanged(); protected: BuildConfiguration(Project * project); diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp index d73e2c97904..45d939d5b03 100644 --- a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp @@ -200,8 +200,7 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project) connect(m_removeButton, SIGNAL(clicked()), this, SLOT(deleteConfiguration())); - connect(m_project, SIGNAL(buildConfigurationDisplayNameChanged(ProjectExplorer::BuildConfiguration *)), - this, SLOT(buildConfigurationDisplayNameChanged(ProjectExplorer::BuildConfiguration *))); + // TODO update on displayNameChange connect(m_project, SIGNAL(activeBuildConfigurationChanged()), this, SLOT(checkMakeActiveLabel())); @@ -231,17 +230,6 @@ void BuildSettingsWidget::updateAddButtonMenu() } } -void BuildSettingsWidget::buildConfigurationDisplayNameChanged(BuildConfiguration *bc) -{ - for (int i=0; i<m_buildConfigurationComboBox->count(); ++i) { - if (m_buildConfigurationComboBox->itemData(i).value<BuildConfiguration *>() == bc) { - m_buildConfigurationComboBox->setItemText(i, bc->displayName()); - break; - } - } -} - - void BuildSettingsWidget::updateBuildSettings() { // TODO save position, entry from combbox @@ -350,7 +338,7 @@ void BuildSettingsWidget::cloneConfiguration(BuildConfiguration *sourceConfigura newDisplayName = Project::makeUnique(newDisplayName, buildConfigurationDisplayNames); m_buildConfiguration = m_project->buildConfigurationFactory()->clone(sourceConfiguration); - m_project->setDisplayNameFor(m_buildConfiguration, newDisplayName); + m_buildConfiguration->setDisplayName(newDisplayName); updateBuildSettings(); } diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.h b/src/plugins/projectexplorer/buildsettingspropertiespage.h index 0026553b77e..652f91e116f 100644 --- a/src/plugins/projectexplorer/buildsettingspropertiespage.h +++ b/src/plugins/projectexplorer/buildsettingspropertiespage.h @@ -94,7 +94,6 @@ public: ~BuildSettingsWidget(); private slots: - void buildConfigurationDisplayNameChanged(ProjectExplorer::BuildConfiguration *bc); void updateBuildSettings(); void currentIndexChanged(int index); void activeBuildConfigurationChanged(); diff --git a/src/plugins/projectexplorer/buildstepspage.cpp b/src/plugins/projectexplorer/buildstepspage.cpp index 2804ec414f9..0930901be9e 100644 --- a/src/plugins/projectexplorer/buildstepspage.cpp +++ b/src/plugins/projectexplorer/buildstepspage.cpp @@ -49,6 +49,7 @@ BuildStepsPage::BuildStepsPage(Project *project, bool clean) : BuildConfigWidget(), m_clean(clean) { + Q_UNUSED(project) m_vbox = new QVBoxLayout(this); m_vbox->setContentsMargins(0, 0, 0, 0); m_vbox->setSpacing(0); diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index 6a05b9264dd..5d5bd9a3f71 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -463,23 +463,6 @@ EditorConfiguration *Project::editorConfiguration() const return m_editorConfiguration; } -void Project::setDisplayNameFor(BuildConfiguration *configuration, const QString &displayName) -{ - if (configuration->displayName() == displayName) - return; - QString dn = displayName; - QStringList displayNames; - foreach (BuildConfiguration *bc, m_buildConfigurationValues) { - if (bc != configuration) - displayNames << bc->displayName(); - } - dn = makeUnique(displayName, displayNames); - - configuration->setDisplayName(displayName); - - emit buildConfigurationDisplayNameChanged(configuration); -} - QByteArray Project::predefinedMacros(const QString &) const { return QByteArray(); diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h index 4c543169ec5..3885725120e 100644 --- a/src/plugins/projectexplorer/project.h +++ b/src/plugins/projectexplorer/project.h @@ -88,10 +88,6 @@ public: void removeBuildConfiguration(BuildConfiguration *configuration); QList<BuildConfiguration *> buildConfigurations() const; - - // remove and add "QString uniqueConfigurationDisplayName(const QString &proposedName) const" instead - // move into BuildConfiguration * - void setDisplayNameFor(BuildConfiguration *configuration, const QString &displayName); BuildConfiguration *activeBuildConfiguration() const; void setActiveBuildConfiguration(BuildConfiguration *configuration); @@ -146,10 +142,6 @@ signals: void removedBuildConfiguration(ProjectExplorer::Project *p, BuildConfiguration *bc); void addedBuildConfiguration(ProjectExplorer::Project *p, BuildConfiguration *bc); - // This signal is jut there for updating the tree list in the buildsettings wizard - void buildConfigurationDisplayNameChanged(BuildConfiguration *bc); - - protected: /* This method is called when the project .user file is saved. Simply call * writer.saveValue() for each value you want to save. Make sure to always diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index d3cb0ac77f7..3aff94f2a59 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -343,7 +343,7 @@ Qt4BuildConfiguration *Qt4Project::activeQt4BuildConfiguration() const void Qt4Project::defaultQtVersionChanged() { - if (static_cast<Qt4BuildConfiguration *>(activeBuildConfiguration())->qtVersionId() == 0) + if (activeQt4BuildConfiguration()->qtVersionId() == 0) m_rootProjectNode->update(); } diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp index b155944af6a..768e0c735a9 100644 --- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp +++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp @@ -165,7 +165,7 @@ void Qt4ProjectConfigWidget::init(ProjectExplorer::BuildConfiguration *bc) void Qt4ProjectConfigWidget::changeConfigName(const QString &newName) { - m_buildConfiguration->project()->setDisplayNameFor(m_buildConfiguration, newName); + m_buildConfiguration->setDisplayName(newName); } void Qt4ProjectConfigWidget::setupQtVersionsComboBox() -- GitLab