From a01d7e9a7806a87d00ccc21aecc9873f25420099 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 14 Jul 2023 11:35:51 +0200 Subject: [PATCH] Qbs: More direct aspect use in QbsCleanStep Change-Id: Ib917375ab0027b6b6ff75d1ebcbbff25fe63e6ee Reviewed-by: Jarek Kobus --- .../qbsprojectmanager/qbscleanstep.cpp | 27 +++++++++---------- src/plugins/qbsprojectmanager/qbscleanstep.h | 5 ++-- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/plugins/qbsprojectmanager/qbscleanstep.cpp b/src/plugins/qbsprojectmanager/qbscleanstep.cpp index b68b1400308..a0e6916403a 100644 --- a/src/plugins/qbsprojectmanager/qbscleanstep.cpp +++ b/src/plugins/qbsprojectmanager/qbscleanstep.cpp @@ -34,26 +34,23 @@ QbsCleanStep::QbsCleanStep(BuildStepList *bsl, Utils::Id id) { setDisplayName(Tr::tr("Qbs Clean")); - m_dryRunAspect = addAspect(); - m_dryRunAspect->setSettingsKey("Qbs.DryRun"); - m_dryRunAspect->setLabel(Tr::tr("Dry run:"), BoolAspect::LabelPlacement::InExtraLabel); + dryRun.setSettingsKey("Qbs.DryRun"); + dryRun.setLabel(Tr::tr("Dry run:"), BoolAspect::LabelPlacement::InExtraLabel); - m_keepGoingAspect = addAspect(); - m_keepGoingAspect->setSettingsKey("Qbs.DryKeepGoing"); - m_keepGoingAspect->setLabel(Tr::tr("Keep going:"), BoolAspect::LabelPlacement::InExtraLabel); + keepGoing.setSettingsKey("Qbs.DryKeepGoing"); + keepGoing.setLabel(Tr::tr("Keep going:"), BoolAspect::LabelPlacement::InExtraLabel); - auto effectiveCommandAspect = addAspect(); - effectiveCommandAspect->setDisplayStyle(StringAspect::TextEditDisplay); - effectiveCommandAspect->setLabelText(Tr::tr("Equivalent command line:")); + effectiveCommand.setDisplayStyle(StringAspect::TextEditDisplay); + effectiveCommand.setLabelText(Tr::tr("Equivalent command line:")); - setSummaryUpdater([this, effectiveCommandAspect] { + setSummaryUpdater([this] { QbsBuildStepData data; data.command = "clean"; - data.dryRun = m_dryRunAspect->value(); - data.keepGoing = m_keepGoingAspect->value(); + data.dryRun = dryRun(); + data.keepGoing = keepGoing(); QString command = static_cast(buildConfiguration()) ->equivalentCommandLine(data); - effectiveCommandAspect->setValue(command); + effectiveCommand.setValue(command); return Tr::tr("Qbs: %1").arg("clean"); }); } @@ -98,8 +95,8 @@ void QbsCleanStep::doRun() request.insert("type", "clean-project"); if (!m_products.isEmpty()) request.insert("products", QJsonArray::fromStringList(m_products)); - request.insert("dry-run", m_dryRunAspect->value()); - request.insert("keep-going", m_keepGoingAspect->value()); + request.insert("dry-run", dryRun()); + request.insert("keep-going", keepGoing()); m_session->sendRequest(request); m_maxProgress = 0; connect(m_session, &QbsSession::projectCleaned, this, &QbsCleanStep::cleaningDone); diff --git a/src/plugins/qbsprojectmanager/qbscleanstep.h b/src/plugins/qbsprojectmanager/qbscleanstep.h index 921678c65a7..f7f1d58d018 100644 --- a/src/plugins/qbsprojectmanager/qbscleanstep.h +++ b/src/plugins/qbsprojectmanager/qbscleanstep.h @@ -40,8 +40,9 @@ private: void createTaskAndOutput(ProjectExplorer::Task::TaskType type, const QString &message, const QString &file, int line); - Utils::BoolAspect *m_dryRunAspect = nullptr; - Utils::BoolAspect *m_keepGoingAspect = nullptr; + Utils::BoolAspect dryRun{this}; + Utils::BoolAspect keepGoing{this}; + Utils::StringAspect effectiveCommand{this}; QStringList m_products; QbsSession *m_session = nullptr;