Commit 91198532 authored by dt's avatar dt
Browse files

Make setDisplayName easier and break displayName signals

Fix for that will come later
parent 801e9948
......@@ -80,7 +80,10 @@ QString BuildConfiguration::displayName() const
void BuildConfiguration::setDisplayName(const QString &name)
{
if (value("ProjectExplorer.BuildConfiguration.DisplayName").toString() == name)
return;
setValue("ProjectExplorer.BuildConfiguration.DisplayName", name);
emit displayNameChanged();
}
QVariant BuildConfiguration::value(const QString & key) const
......
......@@ -82,6 +82,7 @@ public:
signals:
void environmentChanged();
void buildDirectoryChanged();
void displayNameChanged();
protected:
BuildConfiguration(Project * project);
......
......@@ -200,8 +200,7 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
connect(m_removeButton, SIGNAL(clicked()),
this, SLOT(deleteConfiguration()));
connect(m_project, SIGNAL(buildConfigurationDisplayNameChanged(ProjectExplorer::BuildConfiguration *)),
this, SLOT(buildConfigurationDisplayNameChanged(ProjectExplorer::BuildConfiguration *)));
// TODO update on displayNameChange
connect(m_project, SIGNAL(activeBuildConfigurationChanged()),
this, SLOT(checkMakeActiveLabel()));
......@@ -231,17 +230,6 @@ void BuildSettingsWidget::updateAddButtonMenu()
}
}
void BuildSettingsWidget::buildConfigurationDisplayNameChanged(BuildConfiguration *bc)
{
for (int i=0; i<m_buildConfigurationComboBox->count(); ++i) {
if (m_buildConfigurationComboBox->itemData(i).value<BuildConfiguration *>() == bc) {
m_buildConfigurationComboBox->setItemText(i, bc->displayName());
break;
}
}
}
void BuildSettingsWidget::updateBuildSettings()
{
// TODO save position, entry from combbox
......@@ -350,7 +338,7 @@ void BuildSettingsWidget::cloneConfiguration(BuildConfiguration *sourceConfigura
newDisplayName = Project::makeUnique(newDisplayName, buildConfigurationDisplayNames);
m_buildConfiguration = m_project->buildConfigurationFactory()->clone(sourceConfiguration);
m_project->setDisplayNameFor(m_buildConfiguration, newDisplayName);
m_buildConfiguration->setDisplayName(newDisplayName);
updateBuildSettings();
}
......
......@@ -94,7 +94,6 @@ public:
~BuildSettingsWidget();
private slots:
void buildConfigurationDisplayNameChanged(ProjectExplorer::BuildConfiguration *bc);
void updateBuildSettings();
void currentIndexChanged(int index);
void activeBuildConfigurationChanged();
......
......@@ -49,6 +49,7 @@ BuildStepsPage::BuildStepsPage(Project *project, bool clean) :
BuildConfigWidget(),
m_clean(clean)
{
Q_UNUSED(project)
m_vbox = new QVBoxLayout(this);
m_vbox->setContentsMargins(0, 0, 0, 0);
m_vbox->setSpacing(0);
......
......@@ -463,23 +463,6 @@ EditorConfiguration *Project::editorConfiguration() const
return m_editorConfiguration;
}
void Project::setDisplayNameFor(BuildConfiguration *configuration, const QString &displayName)
{
if (configuration->displayName() == displayName)
return;
QString dn = displayName;
QStringList displayNames;
foreach (BuildConfiguration *bc, m_buildConfigurationValues) {
if (bc != configuration)
displayNames << bc->displayName();
}
dn = makeUnique(displayName, displayNames);
configuration->setDisplayName(displayName);
emit buildConfigurationDisplayNameChanged(configuration);
}
QByteArray Project::predefinedMacros(const QString &) const
{
return QByteArray();
......
......@@ -88,10 +88,6 @@ public:
void removeBuildConfiguration(BuildConfiguration *configuration);
QList<BuildConfiguration *> buildConfigurations() const;
// remove and add "QString uniqueConfigurationDisplayName(const QString &proposedName) const" instead
// move into BuildConfiguration *
void setDisplayNameFor(BuildConfiguration *configuration, const QString &displayName);
BuildConfiguration *activeBuildConfiguration() const;
void setActiveBuildConfiguration(BuildConfiguration *configuration);
......@@ -146,10 +142,6 @@ signals:
void removedBuildConfiguration(ProjectExplorer::Project *p, BuildConfiguration *bc);
void addedBuildConfiguration(ProjectExplorer::Project *p, BuildConfiguration *bc);
// This signal is jut there for updating the tree list in the buildsettings wizard
void buildConfigurationDisplayNameChanged(BuildConfiguration *bc);
protected:
/* This method is called when the project .user file is saved. Simply call
* writer.saveValue() for each value you want to save. Make sure to always
......
......@@ -343,7 +343,7 @@ Qt4BuildConfiguration *Qt4Project::activeQt4BuildConfiguration() const
void Qt4Project::defaultQtVersionChanged()
{
if (static_cast<Qt4BuildConfiguration *>(activeBuildConfiguration())->qtVersionId() == 0)
if (activeQt4BuildConfiguration()->qtVersionId() == 0)
m_rootProjectNode->update();
}
......
......@@ -165,7 +165,7 @@ void Qt4ProjectConfigWidget::init(ProjectExplorer::BuildConfiguration *bc)
void Qt4ProjectConfigWidget::changeConfigName(const QString &newName)
{
m_buildConfiguration->project()->setDisplayNameFor(m_buildConfiguration, newName);
m_buildConfiguration->setDisplayName(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