Commit a7a7e4d0 authored by dt's avatar dt
Browse files

Change IBuildStepFactory::canCreate to take a BuildConfiguration

instead of a Project. Since BuildSteps "should" only care about the
BuildConfiguration not the Project. (Not 100% doable, but still.)
parent a3122063
......@@ -284,7 +284,7 @@ BuildStep *MakeStepFactory::clone(BuildStep *bs, BuildConfiguration *bc) const
return new MakeStep(static_cast<MakeStep *>(bs), bc);
}
QStringList MakeStepFactory::canCreateForProject(Project * /* pro */) const
QStringList MakeStepFactory::canCreateForProject(BuildConfiguration * /* pro */) const
{
return QStringList();
}
......
......@@ -107,7 +107,7 @@ class MakeStepFactory : public ProjectExplorer::IBuildStepFactory
virtual bool canCreate(const QString &name) const;
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::BuildConfiguration *bc, const QString &name) const;
virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs, ProjectExplorer::BuildConfiguration *bc) const;
virtual QStringList canCreateForProject(ProjectExplorer::Project *pro) const;
virtual QStringList canCreateForProject(ProjectExplorer::BuildConfiguration *bc) const;
virtual QString displayNameForName(const QString &name) const;
};
......
......@@ -292,7 +292,7 @@ ProjectExplorer::BuildStep *GenericMakeStepFactory::clone(ProjectExplorer::Build
return new GenericMakeStep(static_cast<GenericMakeStep*>(bs), bc);
}
QStringList GenericMakeStepFactory::canCreateForProject(ProjectExplorer::Project * /* pro */) const
QStringList GenericMakeStepFactory::canCreateForProject(ProjectExplorer::BuildConfiguration * /* pro */) const
{
return QStringList();
}
......
......@@ -107,7 +107,7 @@ class GenericMakeStepFactory : public ProjectExplorer::IBuildStepFactory
const QString &name) const;
virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs,
ProjectExplorer::BuildConfiguration *bc) const;
virtual QStringList canCreateForProject(ProjectExplorer::Project *pro) const;
virtual QStringList canCreateForProject(ProjectExplorer::BuildConfiguration *bc) const;
virtual QString displayNameForName(const QString &name) const;
};
......
......@@ -37,8 +37,6 @@
#include <QtCore/QFutureInterface>
namespace ProjectExplorer {
// TODO remove this
class Project;
class BuildConfiguration;
/*
......@@ -135,7 +133,7 @@ public:
virtual BuildStep *create(BuildConfiguration *bc, const QString &name) const = 0;
/// Called by the add BuildStep action to check which BuildSteps could be added
/// to the project by this factory, should return a list of names
virtual QStringList canCreateForProject(Project *pro) const = 0;
virtual QStringList canCreateForProject(BuildConfiguration *bc) const = 0;
/// Called to convert an internal name to a displayName
/// Called to clone a BuildStep
......
......@@ -47,7 +47,6 @@ using namespace ProjectExplorer::Internal;
BuildStepsPage::BuildStepsPage(Project *project, bool clean) :
BuildConfigWidget(),
m_pro(project),
m_clean(clean)
{
m_vbox = new QVBoxLayout(this);
......@@ -144,7 +143,7 @@ void BuildStepsPage::updateAddBuildStepMenu()
//Build up a list of possible steps and save map the display names to the (internal) name and factories.
QList<IBuildStepFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<IBuildStepFactory>();
foreach (IBuildStepFactory * factory, factories) {
QStringList names = factory->canCreateForProject(m_pro);
QStringList names = factory->canCreateForProject(m_configuration);
foreach (const QString &name, names) {
map.insert(factory->displayNameForName(name), QPair<QString, IBuildStepFactory *>(name, factory));
}
......
......@@ -87,7 +87,6 @@ private:
void updateBuildStepButtonsState();
void addBuildStepWidget(int pos, BuildStep *step);
Project *m_pro;
BuildConfiguration *m_configuration;
QHash<QAction *, QPair<QString, ProjectExplorer::IBuildStepFactory *> > m_addBuildStepHash;
bool m_clean;
......
......@@ -212,9 +212,9 @@ BuildStep *ProcessStepFactory::clone(BuildStep *bs, BuildConfiguration *bc) cons
return new ProcessStep(static_cast<ProcessStep *>(bs), bc);
}
QStringList ProcessStepFactory::canCreateForProject(Project *pro) const
QStringList ProcessStepFactory::canCreateForProject(BuildConfiguration *bc) const
{
Q_UNUSED(pro)
Q_UNUSED(bc)
return QStringList()<<"projectexplorer.processstep";
}
QString ProcessStepFactory::displayNameForName(const QString &name) const
......
......@@ -47,7 +47,7 @@ public:
virtual bool canCreate(const QString &name) const;
virtual BuildStep *create(BuildConfiguration *bc, const QString &name) const;
virtual BuildStep *clone(BuildStep *bs, BuildConfiguration *bc) const;
virtual QStringList canCreateForProject(Project *pro) const;
virtual QStringList canCreateForProject(BuildConfiguration *pro) const;
virtual QString displayNameForName(const QString &name) const;
};
......
......@@ -335,9 +335,9 @@ ProjectExplorer::BuildStep *MakeStepFactory::clone(ProjectExplorer::BuildStep *b
return new MakeStep(static_cast<MakeStep *>(bs), bc);
}
QStringList MakeStepFactory::canCreateForProject(ProjectExplorer::Project *pro) const
QStringList MakeStepFactory::canCreateForProject(ProjectExplorer::BuildConfiguration *pro) const
{
if (qobject_cast<Qt4Project *>(pro))
if (qobject_cast<Qt4BuildConfiguration *>(pro))
return QStringList() << Constants::MAKESTEP;
else
return QStringList();
......
......@@ -54,7 +54,7 @@ public:
bool canCreate(const QString & name) const;
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildConfiguration *bc, const QString & name) const;
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs, ProjectExplorer::BuildConfiguration *bc) const;
QStringList canCreateForProject(ProjectExplorer::Project *pro) const;
QStringList canCreateForProject(ProjectExplorer::BuildConfiguration *bc) const;
QString displayNameForName(const QString &name) const;
};
}
......
......@@ -377,9 +377,11 @@ ProjectExplorer::BuildStep *QMakeStepFactory::clone(ProjectExplorer::BuildStep *
return new QMakeStep(static_cast<QMakeStep *>(bs), bc);
}
QStringList QMakeStepFactory::canCreateForProject(ProjectExplorer::Project *) const
QStringList QMakeStepFactory::canCreateForProject(ProjectExplorer::BuildConfiguration *bc) const
{
return QStringList() << Constants::QMAKESTEP;
if (qobject_cast<Qt4BuildConfiguration *>(bc))
return QStringList() << Constants::QMAKESTEP;
return QStringList();
}
QString QMakeStepFactory::displayNameForName(const QString &name) const
......
......@@ -54,7 +54,7 @@ public:
bool canCreate(const QString & name) const;
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildConfiguration *bc, const QString & name) const;
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs, ProjectExplorer::BuildConfiguration *bc) const;
QStringList canCreateForProject(ProjectExplorer::Project *pro) const;
QStringList canCreateForProject(ProjectExplorer::BuildConfiguration *bc) const;
QString displayNameForName(const QString &name) const;
};
}
......
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