Skip to content

Commit

Permalink
Merge pull request ros-industrial#49 from Levi-Armstrong/upgrade4.1
Browse files Browse the repository at this point in the history
Upgrade plugin for qtcreator 4.1
  • Loading branch information
Levi-Armstrong authored Sep 3, 2016
2 parents e4da8bf + d3cd287 commit a4e25d9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 52 deletions.
43 changes: 6 additions & 37 deletions src/project_manager/ros_make_step.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,17 +332,9 @@ ROSMakeStepFactory::ROSMakeStepFactory(QObject *parent) :
{
}

bool ROSMakeStepFactory::canCreate(BuildStepList *parent, const Id id) const
{
if (parent->target()->project()->id() == Constants::ROSPROJECT_ID)
return id == ROS_MS_ID;
return false;
}

BuildStep *ROSMakeStepFactory::create(BuildStepList *parent, const Id id)
{
if (!canCreate(parent, id))
return 0;
Q_UNUSED(id);
ROSMakeStep *step = new ROSMakeStep(parent);
if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) {
step->setClean(true);
Expand All @@ -353,49 +345,26 @@ BuildStep *ROSMakeStepFactory::create(BuildStepList *parent, const Id id)
return step;
}

bool ROSMakeStepFactory::canClone(BuildStepList *parent, BuildStep *source) const
{
return canCreate(parent, source->id());
}

BuildStep *ROSMakeStepFactory::clone(BuildStepList *parent, BuildStep *source)
{
if (!canClone(parent, source))
return 0;
ROSMakeStep *old(qobject_cast<ROSMakeStep *>(source));
Q_ASSERT(old);
return new ROSMakeStep(parent, old);
}

bool ROSMakeStepFactory::canRestore(BuildStepList *parent, const QVariantMap &map) const
{
return canCreate(parent, idFromMap(map));
return new ROSMakeStep(parent, qobject_cast<ROSMakeStep *>(source));
}

BuildStep *ROSMakeStepFactory::restore(BuildStepList *parent, const QVariantMap &map)
{
if (!canRestore(parent, map))
return 0;
ROSMakeStep *bs(new ROSMakeStep(parent));
if (bs->fromMap(map))
return bs;
delete bs;
return 0;
}

QList<Id> ROSMakeStepFactory::availableCreationIds(BuildStepList *parent) const
QList<ProjectExplorer::BuildStepInfo> ROSMakeStepFactory::availableSteps(BuildStepList *parent) const
{
if (parent->target()->project()->id() == Constants::ROSPROJECT_ID)
return QList<Id>() << Id(ROS_MS_ID);
return QList<Id>();
}
if (parent->target()->project()->id() != Constants::ROSPROJECT_ID)
return {};

QString ROSMakeStepFactory::displayNameForId(const Id id) const
{
if (id == ROS_MS_ID)
return QCoreApplication::translate("ROSProjectManager::Internal::ROSMakeStep",
ROS_MS_DISPLAY_NAME);
return QString();
return {{ROS_MS_ID, QCoreApplication::translate("ROSProjectManager::Internal::ROSMakeStep", ROS_MS_DISPLAY_NAME)}};
}

} // namespace Internal
Expand Down
17 changes: 4 additions & 13 deletions src/project_manager/ros_make_step.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,10 @@ class ROSMakeStepFactory : public ProjectExplorer::IBuildStepFactory

public:
explicit ROSMakeStepFactory(QObject *parent = 0);

bool canCreate(ProjectExplorer::BuildStepList *parent, Core::Id id) const;
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id);
bool canClone(ProjectExplorer::BuildStepList *parent,
ProjectExplorer::BuildStep *source) const;
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent,
ProjectExplorer::BuildStep *source);
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent,
const QVariantMap &map);

QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *bc) const;
QString displayNameForId(Core::Id id) const;
QList<ProjectExplorer::BuildStepInfo> availableSteps(ProjectExplorer::BuildStepList *parent) const override;
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override;
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) override;
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) override;
};

} // namespace Internal
Expand Down
4 changes: 2 additions & 2 deletions src/project_manager/ros_project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/customexecutablerunconfiguration.h>
#include <projectexplorer/customexecutablerunconfiguration.h>
#include <qtsupport/qtkitinformation.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
Expand Down Expand Up @@ -305,7 +305,7 @@ Project::RestoreResult ROSProject::fromMap(const QVariantMap &map, QString *erro
continue;
}
if (!t->activeRunConfiguration())
t->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(t));
t->addRunConfiguration(new ProjectExplorer::CustomExecutableRunConfiguration(t));
}

refresh();
Expand Down

0 comments on commit a4e25d9

Please sign in to comment.