Commit 92b905a6 authored by con's avatar con
Browse files

Build configuration factory now adds configurations directly.

It's easier this way for the unique naming.
parent fe313a90
......@@ -89,9 +89,9 @@ QString CMakeBuildConfigurationFactory::displayNameForType(const QString &type)
return tr("Create");
}
QList<BuildConfiguration *> CMakeBuildConfigurationFactory::create(const QString &type) const
bool CMakeBuildConfigurationFactory::create(const QString &type) const
{
QTC_ASSERT(type == "Create", return QList<BuildConfiguration*>());
QTC_ASSERT(type == "Create", return false);
//TODO configuration name should be part of the cmakeopenprojectwizard
bool ok;
......@@ -102,11 +102,11 @@ QList<BuildConfiguration *> CMakeBuildConfigurationFactory::create(const QString
QString(),
&ok);
if (!ok || buildConfigurationName.isEmpty())
return QList<BuildConfiguration *>();
return false;
BuildConfiguration *bc = new BuildConfiguration(buildConfigurationName);
m_project->addBuildConfiguration(bc);
// Default to all
//TODO the buildConfigurationName has not been made unique yet
if (m_project->targets().contains("all"))
m_project->makeStep()->setBuildTarget(buildConfigurationName, "all", true);
......@@ -116,17 +116,12 @@ QList<BuildConfiguration *> CMakeBuildConfigurationFactory::create(const QString
m_project->environment(bc));
if (copw.exec() != QDialog::Accepted) {
delete bc;
return QList<BuildConfiguration *>();
return false;
}
bc->setValue("buildDirectory", copw.buildDirectory());
bc->setValue("msvcVersion", copw.msvcVersion());
m_project->parseCMakeLists();
return QList<BuildConfiguration *>() << bc;
}
QList<BuildConfiguration *> CMakeBuildConfigurationFactory::createDefaultConfigurations() const
{
return QList<BuildConfiguration *>() << new BuildConfiguration;
return true;
}
/*!
......
......@@ -73,8 +73,7 @@ public:
QStringList availableCreationTypes() const;
QString displayNameForType(const QString &type) const;
QList<ProjectExplorer::BuildConfiguration *> create(const QString &type) const;
QList<ProjectExplorer::BuildConfiguration *> createDefaultConfigurations() const;
bool create(const QString &type) const;
private:
CMakeProject *m_project;
......
......@@ -130,7 +130,7 @@ QString GenericBuildConfigurationFactory::displayNameForType(const QString &type
return tr("Create");
}
QList<BuildConfiguration *> GenericBuildConfigurationFactory::create(const QString &type) const
bool GenericBuildConfigurationFactory::create(const QString &type) const
{
// bool GenericProject::newBuildConfiguration(const QString &buildConfiguration)
......@@ -138,13 +138,7 @@ QList<BuildConfiguration *> GenericBuildConfigurationFactory::create(const QStri
// makeStep()->setBuildTarget(buildConfiguration, "all", true);
// return true;
// }
return QList<BuildConfiguration *>() << new BuildConfiguration;
}
QList<BuildConfiguration *> GenericBuildConfigurationFactory::createDefaultConfigurations() const
{
return QList<BuildConfiguration *>() << new BuildConfiguration;
return false;
}
////////////////////////////////////////////////////////////////////////////////////
......
......@@ -68,8 +68,7 @@ public:
QStringList availableCreationTypes() const;
QString displayNameForType(const QString &type) const;
QList<ProjectExplorer::BuildConfiguration *> create(const QString &type) const;
QList<ProjectExplorer::BuildConfiguration *> createDefaultConfigurations() const;
bool create(const QString &type) const;
private:
GenericProject *m_project;
......
......@@ -77,10 +77,10 @@ public:
// used to translate the types to names to display to the user
virtual QString displayNameForType(const QString &type) const = 0;
virtual QList<BuildConfiguration *> create(const QString &type) const = 0;
virtual bool create(const QString &type) const = 0;
// restore
// clone
virtual QList<BuildConfiguration *> createDefaultConfigurations() const = 0;
// default?
signals:
void availableCreationTypesChanged();
......
......@@ -271,12 +271,8 @@ void BuildSettingsWidget::createConfiguration()
{
QAction *action = qobject_cast<QAction *>(sender());
const QString &type = action->data().toString();
QList<BuildConfiguration *> configurations = m_project->buildConfigurationFactory()->create(type);
if (!configurations.isEmpty()) {
foreach (BuildConfiguration *configuration, configurations) {
m_project->addBuildConfiguration(configuration);
}
m_buildConfiguration = configurations.first()->name();
if (m_project->buildConfigurationFactory()->create(type)) {
m_buildConfiguration = m_project->buildConfigurations().last()->name();
updateBuildSettings();
}
}
......
......@@ -270,9 +270,9 @@ QString Qt4BuildConfigurationFactory::displayNameForType(const QString &type) co
return QString();
}
QList<BuildConfiguration *> Qt4BuildConfigurationFactory::create(const QString &type) const
bool Qt4BuildConfigurationFactory::create(const QString &type) const
{
QTC_ASSERT(m_versions.contains(type), return QList<BuildConfiguration *>());
QTC_ASSERT(m_versions.contains(type), return false);
const VersionInfo &info = m_versions.value(type);
bool ok;
QString buildConfigurationName = QInputDialog::getText(0,
......@@ -282,15 +282,11 @@ QList<BuildConfiguration *> Qt4BuildConfigurationFactory::create(const QString &
QString(),
&ok);
if (!ok || buildConfigurationName.isEmpty())
return QList<BuildConfiguration *>();
return false;
BuildConfiguration *bc = new BuildConfiguration(buildConfigurationName);
bc->setValue(KEY_QT_VERSION_ID, info.versionId);
return QList<BuildConfiguration *>() << bc;
}
QList<BuildConfiguration *> Qt4BuildConfigurationFactory::createDefaultConfigurations() const
{
return QList<BuildConfiguration *>() << new BuildConfiguration;
m_project->addBuildConfiguration(bc);
return true;
}
/*!
......
......@@ -129,8 +129,7 @@ public:
QStringList availableCreationTypes() const;
QString displayNameForType(const QString &type) const;
QList<ProjectExplorer::BuildConfiguration *> create(const QString &type) const;
QList<ProjectExplorer::BuildConfiguration *> createDefaultConfigurations() const;
bool create(const QString &type) const;
void update();
......
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