Commit 382750c8 authored by con's avatar con
Browse files

Remove Project::(set)Value(buildconfig, ...) methods.

Instead use the BuildConfiguration class methods directly.
parent acbd4513
......@@ -586,10 +586,11 @@ QList<ProjectExplorer::EnvironmentItem> CMakeProject::userEnvironmentChanges(Bui
void CMakeProject::setUserEnvironmentChanges(const QString &buildConfig, const QList<ProjectExplorer::EnvironmentItem> &diff)
{
ProjectExplorer::BuildConfiguration *bc = buildConfiguration(buildConfig);
QStringList list = EnvironmentItem::toStringList(diff);
if (list == value(buildConfig, "userEnvironmentChanges"))
if (list == bc->value("userEnvironmentChanges"))
return;
setValue(buildConfig, "userEnvironmentChanges", list);
bc->setValue("userEnvironmentChanges", list);
emit environmentChanged(buildConfig);
}
......@@ -613,22 +614,6 @@ QList<ProjectExplorer::BuildConfigWidget*> CMakeProject::subConfigWidgets()
return list;
}
// bool CMakeProject::newBuildConfiguration(const QString &buildConfiguration)
// {
// // Default to all
// if (targets().contains("all"))
// makeStep()->setBuildTarget(buildConfiguration, "all", true);
//
// CMakeOpenProjectWizard copw(projectManager(), sourceDirectory(), buildDirectory(buildConfiguration), environment(buildConfiguration));
// if (copw.exec() == QDialog::Accepted) {
// setValue(buildConfiguration, "buildDirectory", copw.buildDirectory());
// setValue(buildConfiguration, "msvcVersion", copw.msvcVersion());
// parseCMakeLists();
// return true;
// }
// return false;
// }
ProjectExplorer::ProjectNode *CMakeProject::rootProjectNode() const
{
return m_rootNode;
......@@ -678,9 +663,9 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
ProjectExplorer::BuildConfiguration *bc = new ProjectExplorer::BuildConfiguration("all");
addBuildConfiguration(bc);
setValue(bc->name(), "msvcVersion", copw.msvcVersion());
bc->setValue("msvcVersion", copw.msvcVersion());
if (!copw.buildDirectory().isEmpty())
setValue(bc->name(), "buildDirectory", copw.buildDirectory());
bc->setValue("buildDirectory", copw.buildDirectory());
//TODO save arguments somewhere copw.arguments()
MakeStep *cleanMakeStep = new MakeStep(this);
......
......@@ -132,6 +132,13 @@ QString GenericBuildConfigurationFactory::displayNameForType(const QString &type
QList<BuildConfiguration *> GenericBuildConfigurationFactory::create(const QString &type) const
{
// bool GenericProject::newBuildConfiguration(const QString &buildConfiguration)
// {
// makeStep()->setBuildTarget(buildConfiguration, "all", true);
// return true;
// }
return QList<BuildConfiguration *>() << new BuildConfiguration;
}
......@@ -480,12 +487,6 @@ QList<ProjectExplorer::BuildConfigWidget*> GenericProject::subConfigWidgets()
return QList<ProjectExplorer::BuildConfigWidget*>();
}
// bool GenericProject::newBuildConfiguration(const QString &buildConfiguration)
// {
// makeStep()->setBuildTarget(buildConfiguration, "all", true);
// return true;
// }
GenericProjectNode *GenericProject::rootProjectNode() const
{
return m_rootNode;
......@@ -619,7 +620,7 @@ void GenericBuildSettingsWidget::init(const QString &buildConfigurationName)
void GenericBuildSettingsWidget::buildDirectoryChanged()
{
m_project->setValue(m_buildConfiguration, "buildDirectory", m_pathChooser->path());
m_project->buildConfiguration(m_buildConfiguration)->setValue("buildDirectory", m_pathChooser->path());
}
void GenericBuildSettingsWidget::toolChainSelected(int index)
......
......@@ -256,6 +256,7 @@ void BuildSettingsWidget::activeBuildConfigurationChanged()
void BuildSettingsWidget::createConfiguration()
{
// TODO!
// bool ok;
// QString newBuildConfiguration = QInputDialog::getText(this, tr("New configuration"), tr("New Configuration Name:"), QLineEdit::Normal, QString(), &ok);
// if (!ok || newBuildConfiguration.isEmpty())
......
......@@ -442,22 +442,6 @@ BuildConfiguration *Project::buildConfiguration(const QString &name) const
return 0;
}
void Project::setValue(const QString &buildConfigurationName, const QString &name, const QVariant &value)
{
BuildConfiguration *bc = buildConfiguration(buildConfigurationName);
Q_ASSERT(bc);
bc->setValue(name, value);
}
QVariant Project::value(const QString &buildConfigurationName, const QString &name) const
{
BuildConfiguration *bc = buildConfiguration(buildConfigurationName);
if (bc)
return bc->value(name);
else
return QVariant();
}
BuildConfiguration *Project::activeBuildConfiguration() const
{
return buildConfiguration(m_activeBuildConfiguration); //TODO
......
......@@ -104,8 +104,6 @@ public:
void setDisplayNameFor(const QString &buildConfiguration, const QString &displayName);
BuildConfiguration *activeBuildConfiguration() const;
void setActiveBuildConfiguration(BuildConfiguration *configuration);
void setValue(const QString &buildConfiguration, const QString &name, const QVariant &value);
QVariant value(const QString &buildConfiguration, const QString &name) const;
virtual IBuildConfigurationFactory *buildConfigurationFactory() const = 0;
......
......@@ -251,14 +251,15 @@ void QMakeStepConfigWidget::qmakeArgumentsLineEditTextEdited()
void QMakeStepConfigWidget::buildConfigurationChanged()
{
QtVersion::QmakeBuildConfig buildConfiguration = QtVersion::QmakeBuildConfig(m_step->project()->value(m_buildConfiguration, "buildConfiguration").toInt());
ProjectExplorer::BuildConfiguration *bc = m_step->project()->buildConfiguration(m_buildConfiguration);
QtVersion::QmakeBuildConfig buildConfiguration = QtVersion::QmakeBuildConfig(bc->value("buildConfiguration").toInt());
if (m_ui.buildConfigurationComboBox->currentIndex() == 0) {
// debug
buildConfiguration = QtVersion::QmakeBuildConfig(buildConfiguration | QtVersion::DebugBuild);
} else {
buildConfiguration = QtVersion::QmakeBuildConfig(buildConfiguration & ~QtVersion::DebugBuild);
}
m_step->project()->setValue(m_buildConfiguration, "buildConfiguration", int(buildConfiguration));
bc->setValue("buildConfiguration", int(buildConfiguration));
static_cast<Qt4Project *>(m_step->project())->invalidateCachedTargetInformation();
updateTitleLabel();
updateEffectiveQMakeCall();
......@@ -279,7 +280,8 @@ void QMakeStepConfigWidget::init(const QString &buildConfiguration)
m_buildConfiguration = buildConfiguration;
QString qmakeArgs = ProjectExplorer::Environment::joinArgumentList(m_step->value(buildConfiguration, "qmakeArgs").toStringList());
m_ui.qmakeAdditonalArgumentsLineEdit->setText(qmakeArgs);
bool debug = QtVersion::QmakeBuildConfig(m_step->project()->value(buildConfiguration, "buildConfiguration").toInt()) & QtVersion::DebugBuild;
ProjectExplorer::BuildConfiguration *bc = m_step->project()->buildConfiguration(buildConfiguration);
bool debug = QtVersion::QmakeBuildConfig(bc->value("buildConfiguration").toInt()) & QtVersion::DebugBuild;
m_ui.buildConfigurationComboBox->setCurrentIndex(debug? 0 : 1);
updateTitleLabel();
updateEffectiveQMakeCall();
......
......@@ -239,11 +239,12 @@ void Qt4ProjectConfigWidget::shadowBuildCheckBoxClicked(bool checked)
m_ui->shadowBuildDirEdit->setEnabled(checked);
m_browseButton->setEnabled(checked);
bool b = m_ui->shadowBuildCheckBox->isChecked();
m_pro->setValue(m_buildConfiguration, "useShadowBuild", b);
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(m_buildConfiguration);
bc->setValue("useShadowBuild", b);
if (b)
m_pro->setValue(m_buildConfiguration, "buildDirectory", m_ui->shadowBuildDirEdit->path());
bc->setValue("buildDirectory", m_ui->shadowBuildDirEdit->path());
else
m_pro->setValue(m_buildConfiguration, "buildDirectory", QVariant(QString::null));
bc->setValue("buildDirectory", QVariant(QString::null));
updateDetails();
}
......@@ -276,9 +277,10 @@ void Qt4ProjectConfigWidget::updateImportLabel()
void Qt4ProjectConfigWidget::shadowBuildLineEditTextChanged()
{
if (m_pro->value(m_buildConfiguration, "buildDirectory").toString() == m_ui->shadowBuildDirEdit->path())
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(m_buildConfiguration);
if (bc->value("buildDirectory").toString() == m_ui->shadowBuildDirEdit->path())
return;
m_pro->setValue(m_buildConfiguration, "buildDirectory", m_ui->shadowBuildDirEdit->path());
bc->setValue("buildDirectory", m_ui->shadowBuildDirEdit->path());
// if the directory already exists
// check if we have a build in there and
// offer to import it
......
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