Profile: Use tool chain to make profile name unique

Task-number: QTCREATORBUG-7560

Change-Id: I194ab0084f57c266e1a712ec31873a826a61ae4a
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Tobias Hunger
2012-06-26 12:56:20 +02:00
parent 782dbf1c1c
commit bf4b6d6fc3

View File

@@ -34,6 +34,7 @@
#include "profile.h" #include "profile.h"
#include "profileconfigwidget.h" #include "profileconfigwidget.h"
#include "profileinformation.h"
#include "profilemanagerconfigwidget.h" #include "profilemanagerconfigwidget.h"
#include "project.h" #include "project.h"
@@ -397,7 +398,17 @@ bool ProfileManager::registerProfile(ProjectExplorer::Profile *p)
QStringList names; QStringList names;
foreach (Profile *tmp, profiles()) foreach (Profile *tmp, profiles())
names << tmp->displayName(); names << tmp->displayName();
p->setDisplayName(Project::makeUnique(p->displayName(), names)); QString name = p->displayName();
QString uniqueName = Project::makeUnique(name, names);
if (uniqueName != name) {
ToolChain *tc = ToolChainProfileInformation::toolChain(p);
if (tc) {
const QString tcPostfix = QString::fromLatin1("-%1").arg(tc->displayName());
if (!name.contains(tcPostfix))
uniqueName = Project::makeUnique(name + tcPostfix, names);
}
}
p->setDisplayName(uniqueName);
// make sure we have all the information in our profiles: // make sure we have all the information in our profiles:
foreach (ProfileInformation *pi, d->m_informationList) { foreach (ProfileInformation *pi, d->m_informationList) {