Commit 81479739 authored by Kai Koehne's avatar Kai Koehne

BuildConfiguration: Adapt name if Qt version changes

Change-Id: I1a34cb51f73af9779d6bdb07324d5dadcb5585b3
parent 28e08047
...@@ -75,7 +75,11 @@ void ProjectConfiguration::setDisplayName(const QString &name) ...@@ -75,7 +75,11 @@ void ProjectConfiguration::setDisplayName(const QString &name)
{ {
if (displayName() == name) if (displayName() == name)
return; return;
if (name == m_defaultDisplayName) {
m_displayName.clear();
} else {
m_displayName = name; m_displayName = name;
}
emit displayNameChanged(); emit displayNameChanged();
} }
...@@ -89,6 +93,11 @@ void ProjectConfiguration::setDefaultDisplayName(const QString &name) ...@@ -89,6 +93,11 @@ void ProjectConfiguration::setDefaultDisplayName(const QString &name)
emit displayNameChanged(); emit displayNameChanged();
} }
bool ProjectConfiguration::usesDefaultDisplayName() const
{
return m_displayName.isEmpty();
}
QVariantMap ProjectConfiguration::toMap() const QVariantMap ProjectConfiguration::toMap() const
{ {
QVariantMap map; QVariantMap map;
......
...@@ -53,6 +53,8 @@ public: ...@@ -53,6 +53,8 @@ public:
QString id() const; QString id() const;
QString displayName() const; QString displayName() const;
bool usesDefaultDisplayName() const;
void setDisplayName(const QString &name); void setDisplayName(const QString &name);
void setDefaultDisplayName(const QString &name); void setDefaultDisplayName(const QString &name);
......
...@@ -144,7 +144,13 @@ void Target::addBuildConfiguration(BuildConfiguration *configuration) ...@@ -144,7 +144,13 @@ void Target::addBuildConfiguration(BuildConfiguration *configuration)
foreach (const BuildConfiguration *bc, d->m_buildConfigurations) foreach (const BuildConfiguration *bc, d->m_buildConfigurations)
displayNames << bc->displayName(); displayNames << bc->displayName();
configurationDisplayName = Project::makeUnique(configurationDisplayName, displayNames); configurationDisplayName = Project::makeUnique(configurationDisplayName, displayNames);
if (configurationDisplayName != configuration->displayName()) {
if (configuration->usesDefaultDisplayName()) {
configuration->setDefaultDisplayName(configurationDisplayName);
} else {
configuration->setDisplayName(configurationDisplayName); configuration->setDisplayName(configurationDisplayName);
}
}
// Make sure we have a sane tool chain if at all possible // Make sure we have a sane tool chain if at all possible
if (!configuration->toolChain() if (!configuration->toolChain()
......
...@@ -177,7 +177,7 @@ ProjectExplorer::Target *Qt4DesktopTargetFactory::create(ProjectExplorer::Projec ...@@ -177,7 +177,7 @@ ProjectExplorer::Target *Qt4DesktopTargetFactory::create(ProjectExplorer::Projec
Qt4DesktopTarget *t = new Qt4DesktopTarget(static_cast<Qt4Project *>(parent), id); Qt4DesktopTarget *t = new Qt4DesktopTarget(static_cast<Qt4Project *>(parent), id);
foreach (const BuildConfigurationInfo &info, infos) foreach (const BuildConfigurationInfo &info, infos)
t->addQt4BuildConfiguration(msgBuildConfigurationName(info), t->addQt4BuildConfiguration(msgBuildConfigurationName(info), QString(),
info.version, info.buildConfig, info.version, info.buildConfig,
info.additionalArguments, info.directory); info.additionalArguments, info.directory);
......
...@@ -162,7 +162,7 @@ ProjectExplorer::Target *Qt4SimulatorTargetFactory::create(ProjectExplorer::Proj ...@@ -162,7 +162,7 @@ ProjectExplorer::Target *Qt4SimulatorTargetFactory::create(ProjectExplorer::Proj
Qt4SimulatorTarget *t = new Qt4SimulatorTarget(static_cast<Qt4Project *>(parent), id); Qt4SimulatorTarget *t = new Qt4SimulatorTarget(static_cast<Qt4Project *>(parent), id);
foreach (const BuildConfigurationInfo &info, infos) foreach (const BuildConfigurationInfo &info, infos)
t->addQt4BuildConfiguration(msgBuildConfigurationName(info), info.version, info.buildConfig, t->addQt4BuildConfiguration(msgBuildConfigurationName(info), QString(), info.version, info.buildConfig,
info.additionalArguments, info.directory); info.additionalArguments, info.directory);
t->addDeployConfiguration(t->createDeployConfiguration(ProjectExplorer::Constants::DEFAULT_DEPLOYCONFIGURATION_ID)); t->addDeployConfiguration(t->createDeployConfiguration(ProjectExplorer::Constants::DEFAULT_DEPLOYCONFIGURATION_ID));
......
...@@ -212,7 +212,7 @@ ProjectExplorer::Target *Qt4MaemoTargetFactory::create(ProjectExplorer::Project ...@@ -212,7 +212,7 @@ ProjectExplorer::Target *Qt4MaemoTargetFactory::create(ProjectExplorer::Project
Q_ASSERT(target); Q_ASSERT(target);
foreach (const BuildConfigurationInfo &info, infos) foreach (const BuildConfigurationInfo &info, infos)
target->addQt4BuildConfiguration(msgBuildConfigurationName(info), target->addQt4BuildConfiguration(msgBuildConfigurationName(info), QString(),
info.version, info.buildConfig, info.version, info.buildConfig,
info.additionalArguments, info.directory); info.additionalArguments, info.directory);
......
...@@ -219,7 +219,7 @@ ProjectExplorer::Target *Qt4SymbianTargetFactory::create(ProjectExplorer::Projec ...@@ -219,7 +219,7 @@ ProjectExplorer::Target *Qt4SymbianTargetFactory::create(ProjectExplorer::Projec
return 0; return 0;
Qt4SymbianTarget *t = new Qt4SymbianTarget(static_cast<Qt4Project *>(parent), id); Qt4SymbianTarget *t = new Qt4SymbianTarget(static_cast<Qt4Project *>(parent), id);
foreach (const BuildConfigurationInfo &info, infos) foreach (const BuildConfigurationInfo &info, infos)
t->addQt4BuildConfiguration(msgBuildConfigurationName(info), t->addQt4BuildConfiguration(msgBuildConfigurationName(info), QString(),
info.version, info.buildConfig, info.version, info.buildConfig,
info.additionalArguments, info.directory); info.additionalArguments, info.directory);
......
...@@ -734,14 +734,24 @@ BuildConfiguration *Qt4BuildConfigurationFactory::create(ProjectExplorer::Target ...@@ -734,14 +734,24 @@ BuildConfiguration *Qt4BuildConfigurationFactory::create(ProjectExplorer::Target
return 0; return 0;
//: Debug build configuration. We recommend not translating it. //: Debug build configuration. We recommend not translating it.
BuildConfiguration *bc = qt4Target->addQt4BuildConfiguration(tr("%1 Debug").arg(buildConfigurationName), QString defaultDebugName = tr("%1 Debug").arg(version->displayName());
QString customDebugName;
if (buildConfigurationName != version->displayName())
customDebugName = tr("%1 Debug").arg(buildConfigurationName);
BuildConfiguration *bc = qt4Target->addQt4BuildConfiguration(defaultDebugName, customDebugName,
version, version,
(version->defaultBuildConfig() | QtSupport::BaseQtVersion::DebugBuild), (version->defaultBuildConfig() | QtSupport::BaseQtVersion::DebugBuild),
QString(), QString()); QString(), QString());
if (qt4Target->id() != Constants::S60_EMULATOR_TARGET_ID) { if (qt4Target->id() != Constants::S60_EMULATOR_TARGET_ID) {
//: Release build configuration. We recommend not translating it. //: Release build configuration. We recommend not translating it.
bc = qt4Target->addQt4BuildConfiguration(tr("%1 Release").arg(buildConfigurationName), QString defaultReleaseName = tr("%1 Release").arg(version->displayName());
QString customReleaseName;
if (buildConfigurationName != version->displayName())
customReleaseName = tr("%1 Release").arg(buildConfigurationName);
bc = qt4Target->addQt4BuildConfiguration(defaultReleaseName, customReleaseName,
version, version,
(version->defaultBuildConfig() & ~QtSupport::BaseQtVersion::DebugBuild), (version->defaultBuildConfig() & ~QtSupport::BaseQtVersion::DebugBuild),
QString(), QString()); QString(), QString());
......
...@@ -473,9 +473,29 @@ void Qt4ProjectConfigWidget::qtVersionSelected(const QString &) ...@@ -473,9 +473,29 @@ void Qt4ProjectConfigWidget::qtVersionSelected(const QString &)
QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance(); QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
QtSupport::BaseQtVersion *newQtVersion = vm->version(newQtVersionId); QtSupport::BaseQtVersion *newQtVersion = vm->version(newQtVersionId);
if (newQtVersion) {
const QString qtVersionName = newQtVersion->displayName();
QString defaultConfigName = (m_buildConfiguration->buildType() & BuildConfiguration::Debug) ?
//: Name of a debug build configuration to created by a project wizard, %1 being the Qt version name. We recommend not translating it.
tr("%1 Debug").arg(qtVersionName) :
//: Name of a release build configuration to created by a project wizard, %1 being the Qt version name. We recommend not translating it.
tr("%1 Release").arg(qtVersionName);
// make name unique
QStringList displayNames;
foreach (const BuildConfiguration *bc, m_buildConfiguration->target()->buildConfigurations()) {
if (bc != m_buildConfiguration)
displayNames << bc->displayName();
}
defaultConfigName = Project::makeUnique(defaultConfigName, displayNames);
m_buildConfiguration->setDefaultDisplayName(defaultConfigName);
}
m_ignoreChange = true; m_ignoreChange = true;
m_buildConfiguration->setQtVersion(newQtVersion); m_buildConfiguration->setQtVersion(newQtVersion);
m_ignoreChange = false; m_ignoreChange = false;
m_ui->qtVersionComboBox->setToolTip(newQtVersion ? newQtVersion->toHtml(false) : QString()); m_ui->qtVersionComboBox->setToolTip(newQtVersion ? newQtVersion->toHtml(false) : QString());
updateShadowBuildUi(); updateShadowBuildUi();
......
...@@ -277,7 +277,8 @@ void Qt4BaseTarget::removeUnconfiguredCustomExectutableRunConfigurations() ...@@ -277,7 +277,8 @@ void Qt4BaseTarget::removeUnconfiguredCustomExectutableRunConfigurations()
} }
} }
Qt4BuildConfiguration *Qt4BaseTarget::addQt4BuildConfiguration(QString displayName, QtSupport::BaseQtVersion *qtversion, Qt4BuildConfiguration *Qt4BaseTarget::addQt4BuildConfiguration(QString defaultDisplayName,
QString displayName, QtSupport::BaseQtVersion *qtversion,
QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfiguration, QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
QString additionalArguments, QString additionalArguments,
QString directory) QString directory)
...@@ -287,7 +288,8 @@ Qt4BuildConfiguration *Qt4BaseTarget::addQt4BuildConfiguration(QString displayNa ...@@ -287,7 +288,8 @@ Qt4BuildConfiguration *Qt4BaseTarget::addQt4BuildConfiguration(QString displayNa
// Add the buildconfiguration // Add the buildconfiguration
Qt4BuildConfiguration *bc = new Qt4BuildConfiguration(this); Qt4BuildConfiguration *bc = new Qt4BuildConfiguration(this);
bc->setDefaultDisplayName(displayName); bc->setDefaultDisplayName(defaultDisplayName);
bc->setDisplayName(displayName);
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN); ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
......
...@@ -77,9 +77,16 @@ public: ...@@ -77,9 +77,16 @@ public:
// This is the same for almost all Qt4Targets // This is the same for almost all Qt4Targets
// so for now offer a convience function // so for now offer a convience function
<<<<<<< HEAD
Qt4BuildConfiguration *addQt4BuildConfiguration(QString displayName, Qt4BuildConfiguration *addQt4BuildConfiguration(QString displayName,
QtSupport::BaseQtVersion *qtversion, QtSupport::BaseQtVersion *qtversion,
QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfiguration, QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
=======
Qt4BuildConfiguration *addQt4BuildConfiguration(QString defaultDisplayName,
QString displayName,
BaseQtVersion *qtversion,
BaseQtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
>>>>>>> BuildConfiguration: Adapt name if Qt version changes
QString additionalArguments, QString additionalArguments,
QString directory); QString directory);
......
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