Commit 3904b2ad authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Class name simplification for MakeStep related classes

Was a bit confusing that a MakeStep was constructed by a
MakeBuildStepFactory and configured by a MakeBuildStepConfigWidget.

The MakeStep of the generic project manager was renamed to
GenericMakeStep.
parent 93b3dda6
...@@ -57,7 +57,7 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString * ...@@ -57,7 +57,7 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
CMakeSettingsPage *cmp = new CMakeSettingsPage(); CMakeSettingsPage *cmp = new CMakeSettingsPage();
addAutoReleasedObject(cmp); addAutoReleasedObject(cmp);
addAutoReleasedObject(new CMakeManager(cmp)); addAutoReleasedObject(new CMakeManager(cmp));
addAutoReleasedObject(new MakeBuildStepFactory()); addAutoReleasedObject(new MakeStepFactory());
addAutoReleasedObject(new CMakeRunConfigurationFactory()); addAutoReleasedObject(new CMakeRunConfigurationFactory());
return true; return true;
} }
......
...@@ -30,9 +30,10 @@ ...@@ -30,9 +30,10 @@
#include "makestep.h" #include "makestep.h"
#include "cmakeprojectconstants.h" #include "cmakeprojectconstants.h"
#include "cmakeproject.h" #include "cmakeproject.h"
#include <extensionsystem/pluginmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QtGui/QFormLayout> #include <QtGui/QFormLayout>
#include <QtGui/QGroupBox> #include <QtGui/QGroupBox>
#include <QtGui/QCheckBox> #include <QtGui/QCheckBox>
...@@ -43,7 +44,6 @@ namespace { ...@@ -43,7 +44,6 @@ namespace {
bool debug = false; bool debug = false;
} }
using namespace CMakeProjectManager; using namespace CMakeProjectManager;
using namespace CMakeProjectManager::Internal; using namespace CMakeProjectManager::Internal;
...@@ -122,7 +122,7 @@ QString MakeStep::displayName() ...@@ -122,7 +122,7 @@ QString MakeStep::displayName()
ProjectExplorer::BuildStepConfigWidget *MakeStep::createConfigWidget() ProjectExplorer::BuildStepConfigWidget *MakeStep::createConfigWidget()
{ {
return new MakeBuildStepConfigWidget(this); return new MakeStepConfigWidget(this);
} }
bool MakeStep::immutable() const bool MakeStep::immutable() const
...@@ -233,10 +233,10 @@ void MakeStep::setAdditionalArguments(const QString &buildConfiguration, const Q ...@@ -233,10 +233,10 @@ void MakeStep::setAdditionalArguments(const QString &buildConfiguration, const Q
} }
// //
// CMakeBuildStepConfigWidget // MakeStepConfigWidget
// //
MakeBuildStepConfigWidget::MakeBuildStepConfigWidget(MakeStep *makeStep) MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
: m_makeStep(makeStep) : m_makeStep(makeStep)
{ {
QFormLayout *fl = new QFormLayout(this); QFormLayout *fl = new QFormLayout(this);
...@@ -261,22 +261,22 @@ MakeBuildStepConfigWidget::MakeBuildStepConfigWidget(MakeStep *makeStep) ...@@ -261,22 +261,22 @@ MakeBuildStepConfigWidget::MakeBuildStepConfigWidget(MakeStep *makeStep)
connect(m_targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*))); connect(m_targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
} }
void MakeBuildStepConfigWidget::additionalArgumentsEdited() void MakeStepConfigWidget::additionalArgumentsEdited()
{ {
m_makeStep->setAdditionalArguments(m_buildConfiguration, ProjectExplorer::Environment::parseCombinedArgString(m_additionalArguments->text())); m_makeStep->setAdditionalArguments(m_buildConfiguration, ProjectExplorer::Environment::parseCombinedArgString(m_additionalArguments->text()));
} }
void MakeBuildStepConfigWidget::itemChanged(QListWidgetItem *item) void MakeStepConfigWidget::itemChanged(QListWidgetItem *item)
{ {
m_makeStep->setBuildTarget(m_buildConfiguration, item->text(), item->checkState() & Qt::Checked); m_makeStep->setBuildTarget(m_buildConfiguration, item->text(), item->checkState() & Qt::Checked);
} }
QString MakeBuildStepConfigWidget::displayName() const QString MakeStepConfigWidget::displayName() const
{ {
return "Make"; return "Make";
} }
void MakeBuildStepConfigWidget::init(const QString &buildConfiguration) void MakeStepConfigWidget::init(const QString &buildConfiguration)
{ {
// disconnect to make the changes to the items // disconnect to make the changes to the items
disconnect(m_targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*))); disconnect(m_targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
...@@ -293,15 +293,15 @@ void MakeBuildStepConfigWidget::init(const QString &buildConfiguration) ...@@ -293,15 +293,15 @@ void MakeBuildStepConfigWidget::init(const QString &buildConfiguration)
} }
// //
// MakeBuildStepFactory // MakeStepFactory
// //
bool MakeBuildStepFactory::canCreate(const QString &name) const bool MakeStepFactory::canCreate(const QString &name) const
{ {
return (Constants::MAKESTEP == name); return (Constants::MAKESTEP == name);
} }
ProjectExplorer::BuildStep *MakeBuildStepFactory::create(ProjectExplorer::Project *project, const QString &name) const ProjectExplorer::BuildStep *MakeStepFactory::create(ProjectExplorer::Project *project, const QString &name) const
{ {
Q_ASSERT(name == Constants::MAKESTEP); Q_ASSERT(name == Constants::MAKESTEP);
CMakeProject *pro = qobject_cast<CMakeProject *>(project); CMakeProject *pro = qobject_cast<CMakeProject *>(project);
...@@ -309,12 +309,12 @@ ProjectExplorer::BuildStep *MakeBuildStepFactory::create(ProjectExplorer::Projec ...@@ -309,12 +309,12 @@ ProjectExplorer::BuildStep *MakeBuildStepFactory::create(ProjectExplorer::Projec
return new MakeStep(pro); return new MakeStep(pro);
} }
QStringList MakeBuildStepFactory::canCreateForProject(ProjectExplorer::Project * /* pro */) const QStringList MakeStepFactory::canCreateForProject(ProjectExplorer::Project * /* pro */) const
{ {
return QStringList(); return QStringList();
} }
QString MakeBuildStepFactory::displayNameForName(const QString & /* name */) const QString MakeStepFactory::displayNameForName(const QString & /* name */) const
{ {
return "Make"; return "Make";
} }
......
...@@ -75,11 +75,11 @@ private: ...@@ -75,11 +75,11 @@ private:
QSet<QString> m_openDirectories; QSet<QString> m_openDirectories;
}; };
class MakeBuildStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget class MakeStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
MakeBuildStepConfigWidget(MakeStep *makeStep); MakeStepConfigWidget(MakeStep *makeStep);
virtual QString displayName() const; virtual QString displayName() const;
virtual void init(const QString &buildConfiguration); virtual void init(const QString &buildConfiguration);
private slots: private slots:
...@@ -87,12 +87,12 @@ private slots: ...@@ -87,12 +87,12 @@ private slots:
void additionalArgumentsEdited(); void additionalArgumentsEdited();
private: private:
QString m_buildConfiguration; QString m_buildConfiguration;
MakeStep * m_makeStep; MakeStep *m_makeStep;
QListWidget *m_targetsList; QListWidget *m_targetsList;
QLineEdit *m_additionalArguments; QLineEdit *m_additionalArguments;
}; };
class MakeBuildStepFactory : public ProjectExplorer::IBuildStepFactory class MakeStepFactory : public ProjectExplorer::IBuildStepFactory
{ {
virtual bool canCreate(const QString &name) const; virtual bool canCreate(const QString &name) const;
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro, const QString &name) const; virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro, const QString &name) const;
...@@ -100,7 +100,7 @@ class MakeBuildStepFactory : public ProjectExplorer::IBuildStepFactory ...@@ -100,7 +100,7 @@ class MakeBuildStepFactory : public ProjectExplorer::IBuildStepFactory
virtual QString displayNameForName(const QString &name) const; virtual QString displayNameForName(const QString &name) const;
}; };
} } // namespace Internal
} } // namespace CMakeProjectManager
#endif // MAKESTEP_H #endif // MAKESTEP_H
...@@ -27,12 +27,13 @@ ...@@ -27,12 +27,13 @@
** **
**************************************************************************/ **************************************************************************/
#include "makestep.h" #include "genericmakestep.h"
#include "genericprojectconstants.h" #include "genericprojectconstants.h"
#include "genericproject.h" #include "genericproject.h"
#include <extensionsystem/pluginmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QtGui/QFormLayout> #include <QtGui/QFormLayout>
#include <QtGui/QGroupBox> #include <QtGui/QGroupBox>
#include <QtGui/QCheckBox> #include <QtGui/QCheckBox>
...@@ -43,22 +44,21 @@ namespace { ...@@ -43,22 +44,21 @@ namespace {
bool debug = false; bool debug = false;
} }
using namespace GenericProjectManager; using namespace GenericProjectManager;
using namespace GenericProjectManager::Internal; using namespace GenericProjectManager::Internal;
MakeStep::MakeStep(GenericProject *pro) GenericMakeStep::GenericMakeStep(GenericProject *pro)
: AbstractProcessStep(pro), m_pro(pro), m_buildParser(0) : AbstractProcessStep(pro), m_pro(pro), m_buildParser(0)
{ {
} }
MakeStep::~MakeStep() GenericMakeStep::~GenericMakeStep()
{ {
delete m_buildParser; delete m_buildParser;
m_buildParser = 0; m_buildParser = 0;
} }
bool MakeStep::init(const QString &buildConfiguration) bool GenericMakeStep::init(const QString &buildConfiguration)
{ {
// TODO figure out the correct build parser // TODO figure out the correct build parser
delete m_buildParser; delete m_buildParser;
...@@ -107,46 +107,46 @@ bool MakeStep::init(const QString &buildConfiguration) ...@@ -107,46 +107,46 @@ bool MakeStep::init(const QString &buildConfiguration)
return AbstractProcessStep::init(buildConfiguration); return AbstractProcessStep::init(buildConfiguration);
} }
void MakeStep::run(QFutureInterface<bool> &fi) void GenericMakeStep::run(QFutureInterface<bool> &fi)
{ {
AbstractProcessStep::run(fi); AbstractProcessStep::run(fi);
} }
QString MakeStep::name() QString GenericMakeStep::name()
{ {
return Constants::MAKESTEP; return Constants::MAKESTEP;
} }
QString MakeStep::displayName() QString GenericMakeStep::displayName()
{ {
return "Make"; return "Make";
} }
ProjectExplorer::BuildStepConfigWidget *MakeStep::createConfigWidget() ProjectExplorer::BuildStepConfigWidget *GenericMakeStep::createConfigWidget()
{ {
return new MakeBuildStepConfigWidget(this); return new GenericMakeStepConfigWidget(this);
} }
bool MakeStep::immutable() const bool GenericMakeStep::immutable() const
{ {
return true; return true;
} }
void MakeStep::stdOut(const QString &line) void GenericMakeStep::stdOut(const QString &line)
{ {
if (m_buildParser) if (m_buildParser)
m_buildParser->stdOutput(line); m_buildParser->stdOutput(line);
AbstractProcessStep::stdOut(line); AbstractProcessStep::stdOut(line);
} }
void MakeStep::stdError(const QString &line) void GenericMakeStep::stdError(const QString &line)
{ {
if (m_buildParser) if (m_buildParser)
m_buildParser->stdError(line); m_buildParser->stdError(line);
AbstractProcessStep::stdError(line); AbstractProcessStep::stdError(line);
} }
void MakeStep::slotAddToTaskWindow(const QString & fn, int type, int linenumber, const QString & description) void GenericMakeStep::slotAddToTaskWindow(const QString & fn, int type, int linenumber, const QString & description)
{ {
QString filePath = fn; QString filePath = fn;
if (!filePath.isEmpty() && !QDir::isAbsolutePath(filePath)) { if (!filePath.isEmpty() && !QDir::isAbsolutePath(filePath)) {
...@@ -192,30 +192,30 @@ void MakeStep::slotAddToTaskWindow(const QString & fn, int type, int linenumber, ...@@ -192,30 +192,30 @@ void MakeStep::slotAddToTaskWindow(const QString & fn, int type, int linenumber,
emit addToTaskWindow(filePath, type, linenumber, description); emit addToTaskWindow(filePath, type, linenumber, description);
} }
void MakeStep::addDirectory(const QString &dir) void GenericMakeStep::addDirectory(const QString &dir)
{ {
if (!m_openDirectories.contains(dir)) if (!m_openDirectories.contains(dir))
m_openDirectories.insert(dir); m_openDirectories.insert(dir);
} }
void MakeStep::removeDirectory(const QString &dir) void GenericMakeStep::removeDirectory(const QString &dir)
{ {
if (m_openDirectories.contains(dir)) if (m_openDirectories.contains(dir))
m_openDirectories.remove(dir); m_openDirectories.remove(dir);
} }
GenericProject *MakeStep::project() const GenericProject *GenericMakeStep::project() const
{ {
return m_pro; return m_pro;
} }
bool MakeStep::buildsTarget(const QString &buildConfiguration, const QString &target) const bool GenericMakeStep::buildsTarget(const QString &buildConfiguration, const QString &target) const
{ {
return value(buildConfiguration, "buildTargets").toStringList().contains(target); return value(buildConfiguration, "buildTargets").toStringList().contains(target);
} }
void MakeStep::setBuildTarget(const QString &buildConfiguration, const QString &target, bool on) void GenericMakeStep::setBuildTarget(const QString &buildConfiguration, const QString &target, bool on)
{ {
QStringList old = value(buildConfiguration, "buildTargets").toStringList(); QStringList old = value(buildConfiguration, "buildTargets").toStringList();
if (on && !old.contains(target)) if (on && !old.contains(target))
...@@ -225,9 +225,10 @@ void MakeStep::setBuildTarget(const QString &buildConfiguration, const QString & ...@@ -225,9 +225,10 @@ void MakeStep::setBuildTarget(const QString &buildConfiguration, const QString &
} }
// //
// GenericBuildStepConfigWidget // GenericMakeStepConfigWidget
// //
MakeBuildStepConfigWidget::MakeBuildStepConfigWidget(MakeStep *makeStep)
GenericMakeStepConfigWidget::GenericMakeStepConfigWidget(GenericMakeStep *makeStep)
: m_makeStep(makeStep) : m_makeStep(makeStep)
{ {
QFormLayout *fl = new QFormLayout(this); QFormLayout *fl = new QFormLayout(this);
...@@ -246,17 +247,17 @@ MakeBuildStepConfigWidget::MakeBuildStepConfigWidget(MakeStep *makeStep) ...@@ -246,17 +247,17 @@ MakeBuildStepConfigWidget::MakeBuildStepConfigWidget(MakeStep *makeStep)
connect(m_targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*))); connect(m_targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
} }
void MakeBuildStepConfigWidget::itemChanged(QListWidgetItem *item) void GenericMakeStepConfigWidget::itemChanged(QListWidgetItem *item)
{ {
m_makeStep->setBuildTarget(m_buildConfiguration, item->text(), item->checkState() & Qt::Checked); m_makeStep->setBuildTarget(m_buildConfiguration, item->text(), item->checkState() & Qt::Checked);
} }
QString MakeBuildStepConfigWidget::displayName() const QString GenericMakeStepConfigWidget::displayName() const
{ {
return "Make"; return "Make";
} }
void MakeBuildStepConfigWidget::init(const QString &buildConfiguration) void GenericMakeStepConfigWidget::init(const QString &buildConfiguration)
{ {
// TODO // TODO
...@@ -273,29 +274,28 @@ void MakeBuildStepConfigWidget::init(const QString &buildConfiguration) ...@@ -273,29 +274,28 @@ void MakeBuildStepConfigWidget::init(const QString &buildConfiguration)
} }
// //
// MakeBuildStepFactory // GenericMakeStepFactory
// //
bool MakeBuildStepFactory::canCreate(const QString &name) const bool GenericMakeStepFactory::canCreate(const QString &name) const
{ {
return (Constants::MAKESTEP == name); return (Constants::MAKESTEP == name);
} }
ProjectExplorer::BuildStep *MakeBuildStepFactory::create(ProjectExplorer::Project *project, const QString &name) const ProjectExplorer::BuildStep *GenericMakeStepFactory::create(ProjectExplorer::Project *project, const QString &name) const
{ {
Q_ASSERT(name == Constants::MAKESTEP); Q_ASSERT(name == Constants::MAKESTEP);
GenericProject *pro = qobject_cast<GenericProject *>(project); GenericProject *pro = qobject_cast<GenericProject *>(project);
Q_ASSERT(pro); Q_ASSERT(pro);
return new MakeStep(pro); return new GenericMakeStep(pro);
} }
QStringList MakeBuildStepFactory::canCreateForProject(ProjectExplorer::Project * /* pro */) const QStringList GenericMakeStepFactory::canCreateForProject(ProjectExplorer::Project * /* pro */) const
{ {
return QStringList(); return QStringList();
} }
QString MakeBuildStepFactory::displayNameForName(const QString & /* name */) const QString GenericMakeStepFactory::displayNameForName(const QString & /* name */) const
{ {
return "Make"; return "Make";
} }
...@@ -43,12 +43,12 @@ namespace Internal { ...@@ -43,12 +43,12 @@ namespace Internal {
class GenericProject; class GenericProject;
class MakeStep : public ProjectExplorer::AbstractProcessStep class GenericMakeStep : public ProjectExplorer::AbstractProcessStep
{ {
Q_OBJECT Q_OBJECT
public: public:
MakeStep(GenericProject *pro); GenericMakeStep(GenericProject *pro);
~MakeStep(); ~GenericMakeStep();
virtual bool init(const QString &buildConfiguration); virtual bool init(const QString &buildConfiguration);
virtual void run(QFutureInterface<bool> &fi); virtual void run(QFutureInterface<bool> &fi);
...@@ -73,22 +73,22 @@ private: ...@@ -73,22 +73,22 @@ private:
QSet<QString> m_openDirectories; QSet<QString> m_openDirectories;
}; };
class MakeBuildStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget class GenericMakeStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
MakeBuildStepConfigWidget(MakeStep *makeStep); GenericMakeStepConfigWidget(GenericMakeStep *makeStep);
virtual QString displayName() const; virtual QString displayName() const;
virtual void init(const QString &buildConfiguration); virtual void init(const QString &buildConfiguration);
private slots: private slots:
void itemChanged(QListWidgetItem*); void itemChanged(QListWidgetItem*);
private: private:
QString m_buildConfiguration; QString m_buildConfiguration;
MakeStep * m_makeStep; GenericMakeStep *m_makeStep;
QListWidget *m_targetsList; QListWidget *m_targetsList;
}; };
class MakeBuildStepFactory : public ProjectExplorer::IBuildStepFactory class GenericMakeStepFactory : public ProjectExplorer::IBuildStepFactory
{ {
virtual bool canCreate(const QString &name) const; virtual bool canCreate(const QString &name) const;
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro, const QString &name) const; virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro, const QString &name) const;
......
...@@ -29,17 +29,15 @@ ...@@ -29,17 +29,15 @@
#include "genericproject.h" #include "genericproject.h"
#include "genericprojectconstants.h" #include "genericprojectconstants.h"
#include "genericprojectnodes.h" #include "genericmakestep.h"
#include "makestep.h"