Commit a1680635 authored by con's avatar con
Browse files

Remove string identifier from setDisplayNameFor and setUserEnvChanges.

parent 382750c8
......@@ -85,7 +85,8 @@ void CMakeBuildEnvironmentWidget::init(const QString &buildConfigurationName)
void CMakeBuildEnvironmentWidget::environmentModelUserChangesUpdated()
{
m_pro->setUserEnvironmentChanges(m_buildConfiguration, m_buildEnvironmentWidget->userChanges());
m_pro->setUserEnvironmentChanges(
m_pro->buildConfiguration(m_buildConfiguration), m_buildEnvironmentWidget->userChanges());
}
void CMakeBuildEnvironmentWidget::clearSystemEnvironmentCheckBoxClicked(bool checked)
......
......@@ -584,14 +584,13 @@ QList<ProjectExplorer::EnvironmentItem> CMakeProject::userEnvironmentChanges(Bui
return EnvironmentItem::fromStringList(configuration->value("userEnvironmentChanges").toStringList());
}
void CMakeProject::setUserEnvironmentChanges(const QString &buildConfig, const QList<ProjectExplorer::EnvironmentItem> &diff)
void CMakeProject::setUserEnvironmentChanges(BuildConfiguration *configuration, const QList<ProjectExplorer::EnvironmentItem> &diff)
{
ProjectExplorer::BuildConfiguration *bc = buildConfiguration(buildConfig);
QStringList list = EnvironmentItem::toStringList(diff);
if (list == bc->value("userEnvironmentChanges"))
if (list == configuration->value("userEnvironmentChanges"))
return;
bc->setValue("userEnvironmentChanges", list);
emit environmentChanged(buildConfig);
configuration->setValue("userEnvironmentChanges", list);
emit environmentChanged(configuration->name());
}
QString CMakeProject::buildDirectory(BuildConfiguration *configuration) const
......
......@@ -101,7 +101,7 @@ public:
//building environment
ProjectExplorer::Environment environment(ProjectExplorer::BuildConfiguration *configuration) const;
ProjectExplorer::Environment baseEnvironment(ProjectExplorer::BuildConfiguration *configuration) const;
void setUserEnvironmentChanges(const QString &buildConfig, const QList<ProjectExplorer::EnvironmentItem> &diff);
void setUserEnvironmentChanges(ProjectExplorer::BuildConfiguration *configuration, const QList<ProjectExplorer::EnvironmentItem> &diff);
QList<ProjectExplorer::EnvironmentItem> userEnvironmentChanges(ProjectExplorer::BuildConfiguration *configuration) const;
bool useSystemEnvironment(ProjectExplorer::BuildConfiguration *configuration) const;
void setUseSystemEnvironment(ProjectExplorer::BuildConfiguration *configuration, bool b);
......
......@@ -323,20 +323,8 @@ void BuildSettingsWidget::cloneConfiguration(const QString &sourceConfiguration)
newBuildConfiguration += QString::number(i);
}
// Check that we don't have a configuration with the same displayName
QStringList displayNames;
foreach (const BuildConfiguration *bc, m_project->buildConfigurations())
displayNames << bc->displayName();
if (displayNames.contains(newDisplayName)) {
int i = 2;
while (displayNames.contains(newDisplayName + QString::number(i)))
++i;
newDisplayName += QString::number(i);
}
m_project->copyBuildConfiguration(sourceConfiguration, newBuildConfiguration);
m_project->setDisplayNameFor(newBuildConfiguration, newDisplayName);
m_project->setDisplayNameFor(m_project->buildConfiguration(newBuildConfiguration), newDisplayName);
m_buildConfiguration = newBuildConfiguration;
updateBuildSettings();
......
......@@ -509,22 +509,22 @@ EditorConfiguration *Project::editorConfiguration() const
return m_editorConfiguration;
}
void Project::setDisplayNameFor(const QString &buildConfigurationName, const QString &displayName)
void Project::setDisplayNameFor(BuildConfiguration *configuration, const QString &displayName)
{
QStringList displayNames;
foreach (BuildConfiguration *bc, m_buildConfigurationValues) {
if (bc->name() != buildConfigurationName)
if (bc != configuration)
displayNames << bc->displayName();
}
if (displayNames.contains(displayName)) {
int i = 2;
while (displayNames.contains(displayName + QString::number(i)))
++i;
buildConfiguration(buildConfigurationName)->setDisplayName(displayName + QString::number(i));
configuration->setDisplayName(displayName + QString::number(i));
} else {
buildConfiguration(buildConfigurationName)->setDisplayName(displayName);
configuration->setDisplayName(displayName);
}
emit buildConfigurationDisplayNameChanged(buildConfigurationName);
emit buildConfigurationDisplayNameChanged(configuration->name());
}
QByteArray Project::predefinedMacros(const QString &) const
......
......@@ -101,7 +101,7 @@ public:
void copyBuildConfiguration(const QString &source, const QString &dest);
BuildConfiguration *buildConfiguration(const QString & name) const;
QList<BuildConfiguration *> buildConfigurations() const;
void setDisplayNameFor(const QString &buildConfiguration, const QString &displayName);
void setDisplayNameFor(BuildConfiguration *configuration, const QString &displayName);
BuildConfiguration *activeBuildConfiguration() const;
void setActiveBuildConfiguration(BuildConfiguration *configuration);
......
......@@ -190,7 +190,8 @@ void Qt4ProjectConfigWidget::init(const QString &buildConfiguration)
void Qt4ProjectConfigWidget::changeConfigName(const QString &newName)
{
m_pro->setDisplayNameFor(m_buildConfiguration, newName);
m_pro->setDisplayNameFor(
m_pro->buildConfiguration(m_buildConfiguration), newName);
}
void Qt4ProjectConfigWidget::setupQtVersionsComboBox()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment