forked from qt-creator/qt-creator
Do not allow all WS names in Run-/Deploy-/BuildCOnfigs
Task-number: QTCREATORBUG-2584
This commit is contained in:
@@ -328,6 +328,21 @@ void BuildSettingsWidget::deleteConfiguration()
|
|||||||
deleteConfiguration(m_buildConfiguration);
|
deleteConfiguration(m_buildConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString BuildSettingsWidget::uniqueName(const QString & name)
|
||||||
|
{
|
||||||
|
QString result = name.trimmed();
|
||||||
|
if (!result.isEmpty()) {
|
||||||
|
QStringList bcNames;
|
||||||
|
foreach (BuildConfiguration *bc, m_target->buildConfigurations()) {
|
||||||
|
if (bc == m_buildConfiguration)
|
||||||
|
continue;
|
||||||
|
bcNames.append(bc->displayName());
|
||||||
|
}
|
||||||
|
result = Project::makeUnique(result, bcNames);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void BuildSettingsWidget::renameConfiguration()
|
void BuildSettingsWidget::renameConfiguration()
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
@@ -339,15 +354,10 @@ void BuildSettingsWidget::renameConfiguration()
|
|||||||
if (!ok || !this)
|
if (!ok || !this)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!name.isEmpty()) {
|
name = uniqueName(name);
|
||||||
QStringList bcNames;
|
if (name.isEmpty())
|
||||||
foreach (BuildConfiguration *bc, m_target->buildConfigurations()) {
|
return;
|
||||||
if (bc == m_buildConfiguration)
|
|
||||||
continue;
|
|
||||||
bcNames.append(bc->displayName());
|
|
||||||
}
|
|
||||||
name = Project::makeUnique(name, bcNames);
|
|
||||||
}
|
|
||||||
m_buildConfiguration->setDisplayName(name);
|
m_buildConfiguration->setDisplayName(name);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -359,15 +369,15 @@ void BuildSettingsWidget::cloneConfiguration(BuildConfiguration *sourceConfigura
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//: Title of a the cloned BuildConfiguration window, text of the window
|
//: Title of a the cloned BuildConfiguration window, text of the window
|
||||||
QString newDisplayName(QInputDialog::getText(this, tr("Clone Configuration"), tr("New configuration name:")));
|
QString name = uniqueName(QInputDialog::getText(this, tr("Clone Configuration"), tr("New configuration name:")));
|
||||||
if (newDisplayName.isEmpty())
|
if (name.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BuildConfiguration * bc(m_target->buildConfigurationFactory()->clone(m_target, sourceConfiguration));
|
BuildConfiguration * bc(m_target->buildConfigurationFactory()->clone(m_target, sourceConfiguration));
|
||||||
if (!bc)
|
if (!bc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bc->setDisplayName(newDisplayName);
|
bc->setDisplayName(name);
|
||||||
m_target->addBuildConfiguration(bc);
|
m_target->addBuildConfiguration(bc);
|
||||||
updateBuildSettings();
|
updateBuildSettings();
|
||||||
|
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void cloneConfiguration(BuildConfiguration *toClone);
|
void cloneConfiguration(BuildConfiguration *toClone);
|
||||||
void deleteConfiguration(BuildConfiguration *toDelete);
|
void deleteConfiguration(BuildConfiguration *toDelete);
|
||||||
|
QString uniqueName(const QString & name);
|
||||||
|
|
||||||
Target *m_target;
|
Target *m_target;
|
||||||
BuildConfiguration *m_buildConfiguration;
|
BuildConfiguration *m_buildConfiguration;
|
||||||
|
|||||||
@@ -293,15 +293,10 @@ void RunSettingsWidget::renameRunConfiguration()
|
|||||||
if (!ok || !this)
|
if (!ok || !this)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!name.isEmpty()) {
|
name = uniqueRCName(name);
|
||||||
QStringList rcNames;
|
if (name.isEmpty())
|
||||||
foreach (RunConfiguration *rc, m_target->runConfigurations()) {
|
return;
|
||||||
if (rc == m_target->activeRunConfiguration())
|
|
||||||
continue;
|
|
||||||
rcNames.append(rc->displayName());
|
|
||||||
}
|
|
||||||
name = Project::makeUnique(name, rcNames);
|
|
||||||
}
|
|
||||||
m_target->activeRunConfiguration()->setDisplayName(name);
|
m_target->activeRunConfiguration()->setDisplayName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,15 +388,9 @@ void RunSettingsWidget::renameDeployConfiguration()
|
|||||||
if (!ok || !this)
|
if (!ok || !this)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!name.isEmpty()) {
|
name = uniqueDCName(name);
|
||||||
QStringList dcNames;
|
if (name.isEmpty())
|
||||||
foreach (DeployConfiguration *dc, m_target->deployConfigurations()) {
|
return;
|
||||||
if (dc == m_target->activeDeployConfiguration())
|
|
||||||
continue;
|
|
||||||
dcNames.append(dc->displayName());
|
|
||||||
}
|
|
||||||
name = Project::makeUnique(name, dcNames);
|
|
||||||
}
|
|
||||||
m_target->activeDeployConfiguration()->setDisplayName(name);
|
m_target->activeDeployConfiguration()->setDisplayName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,3 +419,33 @@ void RunSettingsWidget::updateDeployConfiguration(DeployConfiguration *dc)
|
|||||||
m_deploySteps->init(dc->stepList());
|
m_deploySteps->init(dc->stepList());
|
||||||
m_deployLayout->addWidget(m_deploySteps);
|
m_deployLayout->addWidget(m_deploySteps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString RunSettingsWidget::uniqueDCName(const QString &name)
|
||||||
|
{
|
||||||
|
QString result = name.trimmed();
|
||||||
|
if (!result.isEmpty()) {
|
||||||
|
QStringList dcNames;
|
||||||
|
foreach (DeployConfiguration *dc, m_target->deployConfigurations()) {
|
||||||
|
if (dc == m_target->activeDeployConfiguration())
|
||||||
|
continue;
|
||||||
|
dcNames.append(dc->displayName());
|
||||||
|
}
|
||||||
|
result = Project::makeUnique(result, dcNames);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString RunSettingsWidget::uniqueRCName(const QString &name)
|
||||||
|
{
|
||||||
|
QString result = name.trimmed();
|
||||||
|
if (!result.isEmpty()) {
|
||||||
|
QStringList rcNames;
|
||||||
|
foreach (RunConfiguration *rc, m_target->runConfigurations()) {
|
||||||
|
if (rc == m_target->activeRunConfiguration())
|
||||||
|
continue;
|
||||||
|
rcNames.append(rc->displayName());
|
||||||
|
}
|
||||||
|
result = Project::makeUnique(result, rcNames);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|||||||
@@ -104,7 +104,10 @@ private slots:
|
|||||||
void renameDeployConfiguration();
|
void renameDeployConfiguration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QString uniqueDCName(const QString &name);
|
||||||
|
QString uniqueRCName(const QString &name);
|
||||||
void updateDeployConfiguration(DeployConfiguration *);
|
void updateDeployConfiguration(DeployConfiguration *);
|
||||||
|
|
||||||
Target *m_target;
|
Target *m_target;
|
||||||
RunConfigurationModel *m_runConfigurationsModel;
|
RunConfigurationModel *m_runConfigurationsModel;
|
||||||
DeployConfigurationModel *m_deployConfigurationModel;
|
DeployConfigurationModel *m_deployConfigurationModel;
|
||||||
|
|||||||
@@ -710,6 +710,7 @@ BuildConfiguration *Qt4BuildConfigurationFactory::create(ProjectExplorer::Target
|
|||||||
QLineEdit::Normal,
|
QLineEdit::Normal,
|
||||||
version->displayName(),
|
version->displayName(),
|
||||||
&ok);
|
&ok);
|
||||||
|
buildConfigurationName = buildConfigurationName.trimmed();
|
||||||
if (!ok || buildConfigurationName.isEmpty())
|
if (!ok || buildConfigurationName.isEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user