forked from qt-creator/qt-creator
Make sure newly added RunConfigurations have unique names
This commit is contained in:
@@ -164,8 +164,8 @@ void Target::addDeployConfiguration(DeployConfiguration *dc)
|
|||||||
// Check that we don't have a configuration with the same displayName
|
// Check that we don't have a configuration with the same displayName
|
||||||
QString configurationDisplayName = dc->displayName();
|
QString configurationDisplayName = dc->displayName();
|
||||||
QStringList displayNames;
|
QStringList displayNames;
|
||||||
foreach (const DeployConfiguration *bc, m_deployConfigurations)
|
foreach (const DeployConfiguration *current, m_deployConfigurations)
|
||||||
displayNames << bc->displayName();
|
displayNames << current->displayName();
|
||||||
configurationDisplayName = Project::makeUnique(configurationDisplayName, displayNames);
|
configurationDisplayName = Project::makeUnique(configurationDisplayName, displayNames);
|
||||||
dc->setDisplayName(configurationDisplayName);
|
dc->setDisplayName(configurationDisplayName);
|
||||||
|
|
||||||
@@ -229,6 +229,14 @@ void Target::addRunConfiguration(RunConfiguration* runConfiguration)
|
|||||||
QTC_ASSERT(runConfiguration && !m_runConfigurations.contains(runConfiguration), return);
|
QTC_ASSERT(runConfiguration && !m_runConfigurations.contains(runConfiguration), return);
|
||||||
Q_ASSERT(runConfiguration->target() == this);
|
Q_ASSERT(runConfiguration->target() == this);
|
||||||
|
|
||||||
|
// Check that we don't have a configuration with the same displayName
|
||||||
|
QString configurationDisplayName = runConfiguration->displayName();
|
||||||
|
QStringList displayNames;
|
||||||
|
foreach (const RunConfiguration *rc, m_runConfigurations)
|
||||||
|
displayNames << rc->displayName();
|
||||||
|
configurationDisplayName = Project::makeUnique(configurationDisplayName, displayNames);
|
||||||
|
runConfiguration->setDisplayName(configurationDisplayName);
|
||||||
|
|
||||||
m_runConfigurations.push_back(runConfiguration);
|
m_runConfigurations.push_back(runConfiguration);
|
||||||
emit addedRunConfiguration(runConfiguration);
|
emit addedRunConfiguration(runConfiguration);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user