forked from qt-creator/qt-creator
GenericProject: Cleanup and modernize
* Use nullptr instead 0
* Remove QLatin1{String|Char} where possible
* Use C++11 list init and auto
* Add some const as drive-by-change
Change-Id: Ife4c9c7b0869bcf2c864b88b8061ac6b7c3f33c0
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
André Hartmann
parent
c2d25982a1
commit
70556e8495
@@ -142,19 +142,19 @@ QVariantMap GenericMakeStep::toMap() const
|
||||
{
|
||||
QVariantMap map(AbstractProcessStep::toMap());
|
||||
|
||||
map.insert(QLatin1String(BUILD_TARGETS_KEY), m_buildTargets);
|
||||
map.insert(QLatin1String(MAKE_ARGUMENTS_KEY), m_makeArguments);
|
||||
map.insert(QLatin1String(MAKE_COMMAND_KEY), m_makeCommand);
|
||||
map.insert(QLatin1String(CLEAN_KEY), m_clean);
|
||||
map.insert(BUILD_TARGETS_KEY, m_buildTargets);
|
||||
map.insert(MAKE_ARGUMENTS_KEY, m_makeArguments);
|
||||
map.insert(MAKE_COMMAND_KEY, m_makeCommand);
|
||||
map.insert(CLEAN_KEY, m_clean);
|
||||
return map;
|
||||
}
|
||||
|
||||
bool GenericMakeStep::fromMap(const QVariantMap &map)
|
||||
{
|
||||
m_buildTargets = map.value(QLatin1String(BUILD_TARGETS_KEY)).toStringList();
|
||||
m_makeArguments = map.value(QLatin1String(MAKE_ARGUMENTS_KEY)).toString();
|
||||
m_makeCommand = map.value(QLatin1String(MAKE_COMMAND_KEY)).toString();
|
||||
m_clean = map.value(QLatin1String(CLEAN_KEY)).toBool();
|
||||
m_buildTargets = map.value(BUILD_TARGETS_KEY).toStringList();
|
||||
m_makeArguments = map.value(MAKE_ARGUMENTS_KEY).toString();
|
||||
m_makeCommand = map.value(MAKE_COMMAND_KEY).toString();
|
||||
m_clean = map.value(CLEAN_KEY).toBool();
|
||||
|
||||
return BuildStep::fromMap(map);
|
||||
}
|
||||
@@ -174,7 +174,7 @@ QString GenericMakeStep::makeCommand(const Utils::Environment &environment) cons
|
||||
if (tc)
|
||||
command = tc->makeCommand(environment);
|
||||
else
|
||||
command = QLatin1String("make");
|
||||
command = "make";
|
||||
}
|
||||
return command;
|
||||
}
|
||||
@@ -220,9 +220,10 @@ GenericMakeStepConfigWidget::GenericMakeStepConfigWidget(GenericMakeStep *makeSt
|
||||
m_ui = new Ui::GenericMakeStep;
|
||||
m_ui->setupUi(this);
|
||||
|
||||
GenericProject *pro = static_cast<GenericProject *>(m_makeStep->target()->project());
|
||||
foreach (const QString &target, pro->buildTargets()) {
|
||||
QListWidgetItem *item = new QListWidgetItem(target, m_ui->targetsList);
|
||||
const auto pro = static_cast<GenericProject *>(m_makeStep->target()->project());
|
||||
const auto buildTargets = pro->buildTargets();
|
||||
for (const QString &target : buildTargets) {
|
||||
auto item = new QListWidgetItem(target, m_ui->targetsList);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(m_makeStep->buildsTarget(item->text()) ? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
@@ -333,19 +334,19 @@ QList<BuildStepInfo> GenericMakeStepFactory::availableSteps(BuildStepList *paren
|
||||
BuildStep *GenericMakeStepFactory::create(BuildStepList *parent, const Id id)
|
||||
{
|
||||
Q_UNUSED(id)
|
||||
GenericMakeStep *step = new GenericMakeStep(parent);
|
||||
auto step = new GenericMakeStep(parent);
|
||||
if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) {
|
||||
step->setClean(true);
|
||||
step->setBuildTarget(QLatin1String("clean"), /* on = */ true);
|
||||
step->setBuildTarget("clean", /* on = */ true);
|
||||
} else if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_BUILD) {
|
||||
step->setBuildTarget(QLatin1String("all"), /* on = */ true);
|
||||
step->setBuildTarget("all", /* on = */ true);
|
||||
}
|
||||
return step;
|
||||
}
|
||||
|
||||
BuildStep *GenericMakeStepFactory::clone(BuildStepList *parent, BuildStep *source)
|
||||
{
|
||||
GenericMakeStep *old(qobject_cast<GenericMakeStep *>(source));
|
||||
auto old = qobject_cast<GenericMakeStep *>(source);
|
||||
Q_ASSERT(old);
|
||||
return new GenericMakeStep(parent, old);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user