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

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 *
CMakeSettingsPage *cmp = new CMakeSettingsPage();
addAutoReleasedObject(cmp);
addAutoReleasedObject(new CMakeManager(cmp));
addAutoReleasedObject(new MakeBuildStepFactory());
addAutoReleasedObject(new MakeStepFactory());
addAutoReleasedObject(new CMakeRunConfigurationFactory());
return true;
}
......
......@@ -30,9 +30,10 @@
#include "makestep.h"
#include "cmakeprojectconstants.h"
#include "cmakeproject.h"
#include <extensionsystem/pluginmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
#include <QtGui/QFormLayout>
#include <QtGui/QGroupBox>
#include <QtGui/QCheckBox>
......@@ -43,7 +44,6 @@ namespace {
bool debug = false;
}
using namespace CMakeProjectManager;
using namespace CMakeProjectManager::Internal;
......@@ -122,7 +122,7 @@ QString MakeStep::displayName()
ProjectExplorer::BuildStepConfigWidget *MakeStep::createConfigWidget()
{
return new MakeBuildStepConfigWidget(this);
return new MakeStepConfigWidget(this);
}
bool MakeStep::immutable() const
......@@ -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)
{
QFormLayout *fl = new QFormLayout(this);
......@@ -261,22 +261,22 @@ MakeBuildStepConfigWidget::MakeBuildStepConfigWidget(MakeStep *makeStep)
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()));
}
void MakeBuildStepConfigWidget::itemChanged(QListWidgetItem *item)
void MakeStepConfigWidget::itemChanged(QListWidgetItem *item)
{
m_makeStep->setBuildTarget(m_buildConfiguration, item->text(), item->checkState() & Qt::Checked);
}
QString MakeBuildStepConfigWidget::displayName() const
QString MakeStepConfigWidget::displayName() const
{
return "Make";
}
void MakeBuildStepConfigWidget::init(const QString &buildConfiguration)
void MakeStepConfigWidget::init(const QString &buildConfiguration)
{
// disconnect to make the changes to the items
disconnect(m_targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
......@@ -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);
}
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);
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
......@@ -309,12 +309,12 @@ ProjectExplorer::BuildStep *MakeBuildStepFactory::create(ProjectExplorer::Projec
return new MakeStep(pro);
}
QStringList MakeBuildStepFactory::canCreateForProject(ProjectExplorer::Project * /* pro */) const
QStringList MakeStepFactory::canCreateForProject(ProjectExplorer::Project * /* pro */) const
{
return QStringList();
}
QString MakeBuildStepFactory::displayNameForName(const QString & /* name */) const
QString MakeStepFactory::displayNameForName(const QString & /* name */) const
{
return "Make";
}
......
......@@ -75,11 +75,11 @@ private:
QSet<QString> m_openDirectories;
};
class MakeBuildStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget
class MakeStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget
{
Q_OBJECT
public:
MakeBuildStepConfigWidget(MakeStep *makeStep);
MakeStepConfigWidget(MakeStep *makeStep);
virtual QString displayName() const;
virtual void init(const QString &buildConfiguration);
private slots:
......@@ -87,12 +87,12 @@ private slots:
void additionalArgumentsEdited();
private:
QString m_buildConfiguration;
MakeStep * m_makeStep;
MakeStep *m_makeStep;
QListWidget *m_targetsList;
QLineEdit *m_additionalArguments;
};
class MakeBuildStepFactory : public ProjectExplorer::IBuildStepFactory
class MakeStepFactory : public ProjectExplorer::IBuildStepFactory
{
virtual bool canCreate(const QString &name) const;
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro, const QString &name) const;
......@@ -100,7 +100,7 @@ class MakeBuildStepFactory : public ProjectExplorer::IBuildStepFactory
virtual QString displayNameForName(const QString &name) const;
};
}
}
} // namespace Internal
} // namespace CMakeProjectManager
#endif // MAKESTEP_H
......@@ -27,12 +27,13 @@
**
**************************************************************************/
#include "makestep.h"
#include "genericmakestep.h"
#include "genericprojectconstants.h"
#include "genericproject.h"
#include <extensionsystem/pluginmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
#include <QtGui/QFormLayout>
#include <QtGui/QGroupBox>
#include <QtGui/QCheckBox>
......@@ -43,22 +44,21 @@ namespace {
bool debug = false;
}
using namespace GenericProjectManager;
using namespace GenericProjectManager::Internal;
MakeStep::MakeStep(GenericProject *pro)
GenericMakeStep::GenericMakeStep(GenericProject *pro)
: AbstractProcessStep(pro), m_pro(pro), m_buildParser(0)
{
}
MakeStep::~MakeStep()
GenericMakeStep::~GenericMakeStep()
{
delete m_buildParser;
m_buildParser = 0;
}
bool MakeStep::init(const QString &buildConfiguration)
bool GenericMakeStep::init(const QString &buildConfiguration)
{
// TODO figure out the correct build parser
delete m_buildParser;
......@@ -107,46 +107,46 @@ bool MakeStep::init(const QString &buildConfiguration)
return AbstractProcessStep::init(buildConfiguration);
}
void MakeStep::run(QFutureInterface<bool> &fi)
void GenericMakeStep::run(QFutureInterface<bool> &fi)
{
AbstractProcessStep::run(fi);
}
QString MakeStep::name()
QString GenericMakeStep::name()
{
return Constants::MAKESTEP;
}
QString MakeStep::displayName()
QString GenericMakeStep::displayName()
{
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;
}
void MakeStep::stdOut(const QString &line)
void GenericMakeStep::stdOut(const QString &line)
{
if (m_buildParser)
m_buildParser->stdOutput(line);
AbstractProcessStep::stdOut(line);
}
void MakeStep::stdError(const QString &line)
void GenericMakeStep::stdError(const QString &line)
{
if (m_buildParser)
m_buildParser->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;
if (!filePath.isEmpty() && !QDir::isAbsolutePath(filePath)) {
......@@ -192,30 +192,30 @@ void MakeStep::slotAddToTaskWindow(const QString & fn, int type, int linenumber,
emit addToTaskWindow(filePath, type, linenumber, description);
}
void MakeStep::addDirectory(const QString &dir)
void GenericMakeStep::addDirectory(const QString &dir)
{
if (!m_openDirectories.contains(dir))
m_openDirectories.insert(dir);
}
void MakeStep::removeDirectory(const QString &dir)
void GenericMakeStep::removeDirectory(const QString &dir)
{
if (m_openDirectories.contains(dir))
m_openDirectories.remove(dir);
}
GenericProject *MakeStep::project() const
GenericProject *GenericMakeStep::project() const
{
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);
}
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();
if (on && !old.contains(target))
......@@ -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)
{
QFormLayout *fl = new QFormLayout(this);
......@@ -246,17 +247,17 @@ MakeBuildStepConfigWidget::MakeBuildStepConfigWidget(MakeStep *makeStep)
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);
}
QString MakeBuildStepConfigWidget::displayName() const
QString GenericMakeStepConfigWidget::displayName() const
{
return "Make";
}
void MakeBuildStepConfigWidget::init(const QString &buildConfiguration)
void GenericMakeStepConfigWidget::init(const QString &buildConfiguration)
{
// TODO
......@@ -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);
}
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);
GenericProject *pro = qobject_cast<GenericProject *>(project);
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();
}
QString MakeBuildStepFactory::displayNameForName(const QString & /* name */) const
QString GenericMakeStepFactory::displayNameForName(const QString & /* name */) const
{
return "Make";
}
......@@ -43,12 +43,12 @@ namespace Internal {
class GenericProject;
class MakeStep : public ProjectExplorer::AbstractProcessStep
class GenericMakeStep : public ProjectExplorer::AbstractProcessStep
{
Q_OBJECT
public:
MakeStep(GenericProject *pro);
~MakeStep();
GenericMakeStep(GenericProject *pro);
~GenericMakeStep();
virtual bool init(const QString &buildConfiguration);
virtual void run(QFutureInterface<bool> &fi);
......@@ -73,22 +73,22 @@ private:
QSet<QString> m_openDirectories;
};
class MakeBuildStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget
class GenericMakeStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget
{
Q_OBJECT
public:
MakeBuildStepConfigWidget(MakeStep *makeStep);
GenericMakeStepConfigWidget(GenericMakeStep *makeStep);
virtual QString displayName() const;
virtual void init(const QString &buildConfiguration);
private slots:
void itemChanged(QListWidgetItem*);
private:
QString m_buildConfiguration;
MakeStep * m_makeStep;
GenericMakeStep *m_makeStep;
QListWidget *m_targetsList;
};
class MakeBuildStepFactory : public ProjectExplorer::IBuildStepFactory
class GenericMakeStepFactory : public ProjectExplorer::IBuildStepFactory
{
virtual bool canCreate(const QString &name) const;
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro, const QString &name) const;
......
......@@ -29,17 +29,15 @@
#include "genericproject.h"
#include "genericprojectconstants.h"
#include "genericprojectnodes.h"
#include "makestep.h"
#include "genericmakestep.h"
#include <projectexplorer/projectexplorerconstants.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/pathchooser.h>
#include <utils/qtcassert.h>
#include <coreplugin/icore.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <QtCore/QtDebug>
#include <QtCore/QDir>
#include <QtCore/QSettings>
......@@ -55,10 +53,6 @@
using namespace GenericProjectManager;
using namespace GenericProjectManager::Internal;
////////////////////////////////////////////////////////////////////////////////////
// GenericProject
////////////////////////////////////////////////////////////////////////////////////
namespace {
class ListModel: public QStringListModel
......@@ -104,6 +98,10 @@ public:
} // end of anonymous namespace
////////////////////////////////////////////////////////////////////////////////////
// GenericProject
////////////////////////////////////////////////////////////////////////////////////
GenericProject::GenericProject(Manager *manager, const QString &fileName)
: m_manager(manager),
m_fileName(fileName),
......@@ -401,10 +399,10 @@ QStringList GenericProject::targets() const
return targets;
}
MakeStep *GenericProject::makeStep() const
GenericMakeStep *GenericProject::makeStep() const
{
foreach (ProjectExplorer::BuildStep *bs, buildSteps()) {
if (MakeStep *ms = qobject_cast<MakeStep *>(bs))
if (GenericMakeStep *ms = qobject_cast<GenericMakeStep *>(bs))
return ms;
}
......@@ -416,7 +414,7 @@ void GenericProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsRead
Project::restoreSettingsImpl(reader);
if (buildConfigurations().isEmpty()) {
MakeStep *makeStep = new MakeStep(this);
GenericMakeStep *makeStep = new GenericMakeStep(this);
insertBuildStep(0, makeStep);
const QLatin1String all("all");
......@@ -457,6 +455,7 @@ void GenericProject::saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter
////////////////////////////////////////////////////////////////////////////////////
// GenericBuildSettingsWidget
////////////////////////////////////////////////////////////////////////////////////
GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericProject *project)
: m_project(project)
{
......@@ -496,6 +495,7 @@ void GenericBuildSettingsWidget::buildDirectoryChanged()
////////////////////////////////////////////////////////////////////////////////////
// GenericProjectFile
////////////////////////////////////////////////////////////////////////////////////
GenericProjectFile::GenericProjectFile(GenericProject *parent, QString fileName)
: Core::IFile(parent),
m_project(parent),
......
......@@ -32,23 +32,28 @@
#include "genericprojectmanager.h"
#include "genericprojectnodes.h"
#include "makestep.h"
#include <projectexplorer/project.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/buildstep.h>
#include <projectexplorer/toolchain.h>
#include <coreplugin/ifile.h>
#include <utils/pathchooser.h>
QT_BEGIN_NAMESPACE
class QPushButton;
class QStringListModel;
QT_END_NAMESPACE
namespace Core {
namespace Utils {
class PathChooser;
}
}
namespace GenericProjectManager {
namespace Internal{
namespace Internal {
class GenericMakeStep;
class GenericProjectFile;
class GenericProject : public ProjectExplorer::Project
......@@ -82,7 +87,7 @@ public:
virtual QStringList files(FilesMode fileMode) const;
QStringList targets() const;
MakeStep *makeStep() const;
GenericMakeStep *makeStep() const;
QString buildParser(const QString &buildConfiguration) const;
QStringList convertToAbsoluteFiles(const QStringList &paths) const;
......
......@@ -10,7 +10,7 @@ HEADERS = genericproject.h \
genericprojectwizard.h \
genericprojectfileseditor.h \
pkgconfigtool.h \
makestep.h
genericmakestep.h
SOURCES = genericproject.cpp \
genericprojectplugin.cpp \
genericprojectmanager.cpp \
......@@ -18,5 +18,5 @@ SOURCES = genericproject.cpp \
genericprojectwizard.cpp \
genericprojectfileseditor.cpp \
pkgconfigtool.cpp \
makestep.cpp
genericmakestep.cpp
RESOURCES += genericproject.qrc
......@@ -32,7 +32,7 @@
#include "genericprojectwizard.h"
#include "genericprojectconstants.h"
#include "genericprojectfileseditor.h"
#include "makestep.h"
#include "genericmakestep.h"
#include <coreplugin/icore.h>
#include <coreplugin/mimedatabase.h>
......@@ -76,7 +76,7 @@ bool GenericProjectPlugin::initialize(const QStringList &, QString *errorMessage
addObject(m_projectFilesEditorFactory);
addAutoReleasedObject(manager);
addAutoReleasedObject(new MakeBuildStepFactory);
addAutoReleasedObject(new GenericMakeStepFactory);
addAutoReleasedObject(new GenericProjectWizard);
return true;
......
......@@ -301,7 +301,6 @@ void MakeStepConfigWidget::init(const QString &buildConfiguration)
m_makeStep->value(buildConfiguration, "makeargs").toStringList();
m_ui.makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments));
}
}
void MakeStepConfigWidget::makeLineEditTextEdited()
......
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