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"));
m_dryRunAspect = addAspect<BoolAspect>();
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<BoolAspect>();
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<StringAspect>();
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<QbsBuildConfiguration *>(buildConfiguration())
->equivalentCommandLine(data);
effectiveCommandAspect->setValue(command);
effectiveCommand.setValue(command);
return Tr::tr("<b>Qbs:</b> %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);

View File

@@ -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;