Commit 30362e10 authored by con's avatar con
Browse files

Remove the build config display name method from Project

parent 21565b99
......@@ -31,6 +31,7 @@
#include "buildstep.h"
#include "buildstepspage.h"
#include "project.h"
#include "buildconfiguration.h"
#include <coreplugin/coreconstants.h>
#include <extensionsystem/pluginmanager.h>
......@@ -188,7 +189,7 @@ void BuildSettingsWidget::buildConfigurationDisplayNameChanged(const QString &bu
{
for (int i=0; i<m_buildConfigurationComboBox->count(); ++i) {
if (m_buildConfigurationComboBox->itemData(i).toString() == buildConfiguration) {
m_buildConfigurationComboBox->setItemText(i, m_project->displayNameFor(buildConfiguration));
m_buildConfigurationComboBox->setItemText(i, m_project->buildConfiguration(buildConfiguration)->displayName());
break;
}
}
......@@ -220,7 +221,7 @@ void BuildSettingsWidget::updateBuildSettings()
// Add tree items
foreach (const QString &buildConfiguration, m_project->buildConfigurations()) {
m_buildConfigurationComboBox->addItem(m_project->displayNameFor(buildConfiguration), buildConfiguration);
m_buildConfigurationComboBox->addItem(m_project->buildConfiguration(buildConfiguration)->displayName(), buildConfiguration);
if (buildConfiguration == m_buildConfiguration)
m_buildConfigurationComboBox->setCurrentIndex(m_buildConfigurationComboBox->count() - 1);
}
......@@ -273,7 +274,7 @@ void BuildSettingsWidget::createConfiguration()
// Check that we don't have a configuration with the same displayName
QStringList displayNames;
foreach (const QString &bc, buildConfigurations)
displayNames << m_project->displayNameFor(bc);
displayNames << m_project->buildConfiguration(bc)->displayName();
if (displayNames.contains(newDisplayName)) {
int i = 2;
......@@ -325,7 +326,7 @@ void BuildSettingsWidget::cloneConfiguration(const QString &sourceConfiguration)
// Check that we don't have a configuration with the same displayName
QStringList displayNames;
foreach (const QString &bc, buildConfigurations)
displayNames << m_project->displayNameFor(bc);
displayNames << m_project->buildConfiguration(bc)->displayName();
if (displayNames.contains(newDisplayName)) {
int i = 2;
......
......@@ -215,7 +215,7 @@ void Project::saveSettingsImpl(PersistentSettingsWriter &writer)
//save buildsettings
foreach (const QString &buildConfigurationName, buildConfigurations()) {
QMap<QString, QVariant> temp =
getBuildConfiguration(buildConfigurationName)->toMap();
buildConfiguration(buildConfigurationName)->toMap();
writer.saveValue("buildConfiguration-" + buildConfigurationName, temp);
}
......@@ -297,7 +297,7 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
addBuildConfiguration(buildConfigurationName);
QMap<QString, QVariant> temp =
reader.restoreValue("buildConfiguration-" + buildConfigurationName).toMap();
getBuildConfiguration(buildConfigurationName)->setValuesFromMap(temp);
buildConfiguration(buildConfigurationName)->setValuesFromMap(temp);
}
const QList<IBuildStepFactory *> buildStepFactories =
......@@ -410,7 +410,7 @@ QVariant Project::value(const QString &name) const
return QVariant();
}
BuildConfiguration *Project::getBuildConfiguration(const QString &name) const
BuildConfiguration *Project::buildConfiguration(const QString &name) const
{
for (int i = 0; i != m_buildConfigurationValues.size(); ++i)
if (m_buildConfigurationValues.at(i)->name() == name)
......@@ -418,16 +418,16 @@ BuildConfiguration *Project::getBuildConfiguration(const QString &name) const
return 0;
}
void Project::setValue(const QString &buildConfiguration, const QString &name, const QVariant &value)
void Project::setValue(const QString &buildConfigurationName, const QString &name, const QVariant &value)
{
BuildConfiguration *bc = getBuildConfiguration(buildConfiguration);
BuildConfiguration *bc = buildConfiguration(buildConfigurationName);
Q_ASSERT(bc);
bc->setValue(name, value);
}
QVariant Project::value(const QString &buildConfiguration, const QString &name) const
QVariant Project::value(const QString &buildConfigurationName, const QString &name) const
{
BuildConfiguration *bc = getBuildConfiguration(buildConfiguration);
BuildConfiguration *bc = buildConfiguration(buildConfigurationName);
if (bc)
return bc->value(name);
else
......@@ -502,27 +502,22 @@ EditorConfiguration *Project::editorConfiguration() const
return m_editorConfiguration;
}
QString Project::displayNameFor(const QString &buildConfiguration)
{
return getBuildConfiguration(buildConfiguration)->displayName();
}
void Project::setDisplayNameFor(const QString &buildConfiguration, const QString &displayName)
void Project::setDisplayNameFor(const QString &buildConfigurationName, const QString &displayName)
{
QStringList displayNames;
foreach (const QString &bc, buildConfigurations()) {
if (bc != buildConfiguration)
displayNames << displayNameFor(bc);
foreach (BuildConfiguration *bc, m_buildConfigurationValues) {
if (bc->name() != buildConfigurationName)
displayNames << bc->displayName();
}
if (displayNames.contains(displayName)) {
int i = 2;
while (displayNames.contains(displayName + QString::number(i)))
++i;
getBuildConfiguration(buildConfiguration)->setDisplayName(displayName + QString::number(i));
buildConfiguration(buildConfigurationName)->setDisplayName(displayName + QString::number(i));
} else {
getBuildConfiguration(buildConfiguration)->setDisplayName(displayName);
buildConfiguration(buildConfigurationName)->setDisplayName(displayName);
}
emit buildConfigurationDisplayNameChanged(buildConfiguration);
emit buildConfigurationDisplayNameChanged(buildConfigurationName);
}
QByteArray Project::predefinedMacros(const QString &) const
......
......@@ -56,10 +56,7 @@ class Environment;
class ProjectNode;
class PersistentSettingsWriter;
class PersistentSettingsReader;
namespace Internal {
class BuildConfiguration;
}
class PROJECTEXPLORER_EXPORT Project
: public QObject
......@@ -101,8 +98,8 @@ public:
void addBuildConfiguration(const QString &name);
void removeBuildConfiguration(const QString &name);
void copyBuildConfiguration(const QString &source, const QString &dest);
BuildConfiguration *buildConfiguration(const QString & name) const;
QStringList buildConfigurations() const;
QString displayNameFor(const QString &buildConfiguration);
void setDisplayNameFor(const QString &buildConfiguration, const QString &displayName);
QString activeBuildConfiguration() const;
......@@ -191,8 +188,6 @@ protected:
virtual bool restoreSettingsImpl(PersistentSettingsReader &reader);
private:
BuildConfiguration *getBuildConfiguration(const QString & name) const;
QList<BuildStep *> m_buildSteps;
QList<BuildStep *> m_cleanSteps;
QStringList m_buildConfigurations;
......
......@@ -62,6 +62,7 @@
#include "projectwelcomepage.h"
#include "projectwelcomepagewidget.h"
#include "corelistenercheckingforrunningbuild.h"
#include "buildconfiguration.h"
#include <coreplugin/basemode.h>
#include <coreplugin/coreconstants.h>
......@@ -1916,7 +1917,7 @@ void ProjectExplorerPlugin::populateBuildConfigurationMenu()
if (Project *pro = d->m_currentProject) {
const QString &activeBuildConfiguration = pro->activeBuildConfiguration();
foreach (const QString &buildConfiguration, pro->buildConfigurations()) {
QString displayName = pro->displayNameFor(buildConfiguration);
QString displayName = pro->buildConfiguration(buildConfiguration)->displayName();
QAction *act = new QAction(displayName, d->m_buildConfigurationActionGroup);
if (debug)
qDebug() << "BuildConfiguration " << buildConfiguration << "active: " << activeBuildConfiguration;
......
......@@ -37,6 +37,7 @@
#include "session.h"
#include "projecttreewidget.h"
#include "runconfiguration.h"
#include "buildconfiguration.h"
#include <coreplugin/minisplitter.h>
#include <coreplugin/fileiconprovider.h>
......@@ -436,7 +437,7 @@ BuildConfigurationComboBox::BuildConfigurationComboBox(Project *p, QWidget *pare
//m_comboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
QStringList buildConfigurations = p->buildConfigurations();
foreach(const QString &buildConfiguration, buildConfigurations)
m_comboBox->addItem(p->displayNameFor(buildConfiguration), buildConfiguration);
m_comboBox->addItem(p->buildConfiguration(buildConfiguration)->displayName(), buildConfiguration);
if (buildConfigurations.count() == 1) {
m_label->setText(m_comboBox->itemText(0));
setCurrentWidget(m_label);
......@@ -468,7 +469,7 @@ void BuildConfigurationComboBox::nameChanged(const QString &buildConfiguration)
int index = nameToIndex(buildConfiguration);
if (index == -1)
return;
const QString &displayName = m_project->displayNameFor(buildConfiguration);
const QString &displayName = m_project->buildConfiguration(buildConfiguration)->displayName();
m_comboBox->setItemText(index, displayName);
if (m_comboBox->count() == 1)
m_label->setText(displayName);
......@@ -495,7 +496,7 @@ void BuildConfigurationComboBox::activeConfigurationChanged()
void BuildConfigurationComboBox::addedBuildConfiguration(ProjectExplorer::Project *,const QString &buildConfiguration)
{
ignoreIndexChange = true;
m_comboBox->addItem(m_project->displayNameFor(buildConfiguration), buildConfiguration);
m_comboBox->addItem(m_project->buildConfiguration(buildConfiguration)->displayName(), buildConfiguration);
if (m_comboBox->count() == 2)
setCurrentWidget(m_comboBox);
......
......@@ -40,6 +40,7 @@
#include <coreplugin/icore.h>
#include <coreplugin/mainwindow.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/buildconfiguration.h>
#include <extensionsystem/pluginmanager.h>
#include <QtGui/QFileDialog>
......@@ -172,7 +173,7 @@ void Qt4ProjectConfigWidget::init(const QString &buildConfiguration)
m_buildConfiguration = buildConfiguration;
m_ui->nameLineEdit->setText(m_pro->displayNameFor(m_buildConfiguration));
m_ui->nameLineEdit->setText(m_pro->buildConfiguration(m_buildConfiguration)->displayName());
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