Qbs: More direct aspect use in QbsCleanStep

Change-Id: Ib917375ab0027b6b6ff75d1ebcbbff25fe63e6ee
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2023-07-14 11:35:51 +02:00
parent f65cffdfa2
commit a01d7e9a78
2 changed files with 15 additions and 17 deletions

View File

@@ -34,26 +34,23 @@ QbsCleanStep::QbsCleanStep(BuildStepList *bsl, Utils::Id id)
{ {
setDisplayName(Tr::tr("Qbs Clean")); setDisplayName(Tr::tr("Qbs Clean"));
m_dryRunAspect = addAspect<BoolAspect>(); dryRun.setSettingsKey("Qbs.DryRun");
m_dryRunAspect->setSettingsKey("Qbs.DryRun"); dryRun.setLabel(Tr::tr("Dry run:"), BoolAspect::LabelPlacement::InExtraLabel);
m_dryRunAspect->setLabel(Tr::tr("Dry run:"), BoolAspect::LabelPlacement::InExtraLabel);
m_keepGoingAspect = addAspect<BoolAspect>(); keepGoing.setSettingsKey("Qbs.DryKeepGoing");
m_keepGoingAspect->setSettingsKey("Qbs.DryKeepGoing"); keepGoing.setLabel(Tr::tr("Keep going:"), BoolAspect::LabelPlacement::InExtraLabel);
m_keepGoingAspect->setLabel(Tr::tr("Keep going:"), BoolAspect::LabelPlacement::InExtraLabel);
auto effectiveCommandAspect = addAspect<StringAspect>(); effectiveCommand.setDisplayStyle(StringAspect::TextEditDisplay);
effectiveCommandAspect->setDisplayStyle(StringAspect::TextEditDisplay); effectiveCommand.setLabelText(Tr::tr("Equivalent command line:"));
effectiveCommandAspect->setLabelText(Tr::tr("Equivalent command line:"));
setSummaryUpdater([this, effectiveCommandAspect] { setSummaryUpdater([this] {
QbsBuildStepData data; QbsBuildStepData data;
data.command = "clean"; data.command = "clean";
data.dryRun = m_dryRunAspect->value(); data.dryRun = dryRun();
data.keepGoing = m_keepGoingAspect->value(); data.keepGoing = keepGoing();
QString command = static_cast<QbsBuildConfiguration *>(buildConfiguration()) QString command = static_cast<QbsBuildConfiguration *>(buildConfiguration())
->equivalentCommandLine(data); ->equivalentCommandLine(data);
effectiveCommandAspect->setValue(command); effectiveCommand.setValue(command);
return Tr::tr("<b>Qbs:</b> %1").arg("clean"); return Tr::tr("<b>Qbs:</b> %1").arg("clean");
}); });
} }
@@ -98,8 +95,8 @@ void QbsCleanStep::doRun()
request.insert("type", "clean-project"); request.insert("type", "clean-project");
if (!m_products.isEmpty()) if (!m_products.isEmpty())
request.insert("products", QJsonArray::fromStringList(m_products)); request.insert("products", QJsonArray::fromStringList(m_products));
request.insert("dry-run", m_dryRunAspect->value()); request.insert("dry-run", dryRun());
request.insert("keep-going", m_keepGoingAspect->value()); request.insert("keep-going", keepGoing());
m_session->sendRequest(request); m_session->sendRequest(request);
m_maxProgress = 0; m_maxProgress = 0;
connect(m_session, &QbsSession::projectCleaned, this, &QbsCleanStep::cleaningDone); connect(m_session, &QbsSession::projectCleaned, this, &QbsCleanStep::cleaningDone);

View File

@@ -40,8 +40,9 @@ private:
void createTaskAndOutput(ProjectExplorer::Task::TaskType type, void createTaskAndOutput(ProjectExplorer::Task::TaskType type,
const QString &message, const QString &file, int line); const QString &message, const QString &file, int line);
Utils::BoolAspect *m_dryRunAspect = nullptr; Utils::BoolAspect dryRun{this};
Utils::BoolAspect *m_keepGoingAspect = nullptr; Utils::BoolAspect keepGoing{this};
Utils::StringAspect effectiveCommand{this};
QStringList m_products; QStringList m_products;
QbsSession *m_session = nullptr; QbsSession *m_session = nullptr;