diff options
author | hjk <hjk@qt.io> | 2019-06-25 11:26:08 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-06-25 13:36:05 +0000 |
commit | 1f0a4c0152d876b08e2a1e0399d026657edd94bb (patch) | |
tree | 315aa0e7764ef87673d98f3fc041cb2d7d462c79 /src | |
parent | 6e3c039f9e8013a0f927145b4299e75a7b935edf (diff) | |
download | qt-creator-1f0a4c0152d876b08e2a1e0399d026657edd94bb.tar.gz |
Qbs: Use new widget summary updating in clean step
Change-Id: I8ea3a53fcedeb1f9b3a8a97797fc418b8c3983ff
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/qbsprojectmanager/qbscleanstep.cpp | 39 | ||||
-rw-r--r-- | src/plugins/qbsprojectmanager/qbscleanstep.h | 6 |
2 files changed, 10 insertions, 35 deletions
diff --git a/src/plugins/qbsprojectmanager/qbscleanstep.cpp b/src/plugins/qbsprojectmanager/qbscleanstep.cpp index 167299a0bb..119c61450e 100644 --- a/src/plugins/qbsprojectmanager/qbscleanstep.cpp +++ b/src/plugins/qbsprojectmanager/qbscleanstep.cpp @@ -58,18 +58,16 @@ QbsCleanStep::QbsCleanStep(ProjectExplorer::BuildStepList *bsl) : m_keepGoingAspect->setSettingsKey("Qbs.DryKeepGoing"); m_keepGoingAspect->setLabel(tr("Keep going")); - m_effectiveCommandAspect = addAspect<BaseStringAspect>(); - m_effectiveCommandAspect->setDisplayStyle(BaseStringAspect::TextEditDisplay); - m_effectiveCommandAspect->setLabelText(tr("Equivalent command line:")); - - updateState(); - - connect(this, &ProjectExplorer::ProjectConfiguration::displayNameChanged, - this, &QbsCleanStep::updateState); - connect(m_dryRunAspect, &BaseBoolAspect::changed, - this, &QbsCleanStep::updateState); - connect(m_keepGoingAspect, &BaseBoolAspect::changed, - this, &QbsCleanStep::updateState); + auto effectiveCommandAspect = addAspect<BaseStringAspect>(); + effectiveCommandAspect->setDisplayStyle(BaseStringAspect::TextEditDisplay); + effectiveCommandAspect->setLabelText(tr("Equivalent command line:")); + + setSummaryUpdater([this, effectiveCommandAspect] { + QString command = static_cast<QbsBuildConfiguration *>(buildConfiguration()) + ->equivalentCommandLine(this); + effectiveCommandAspect->setValue(command); + return tr("<b>Qbs:</b> %1").arg(command); + }); } QbsCleanStep::~QbsCleanStep() @@ -119,15 +117,6 @@ void QbsCleanStep::doRun() this, &QbsCleanStep::handleProgress); } -ProjectExplorer::BuildStepConfigWidget *QbsCleanStep::createConfigWidget() -{ - auto w = BuildStep::createConfigWidget(); - connect(this, &QbsCleanStep::stateChanged, w, [this, w] { - w->setSummaryText(tr("<b>Qbs:</b> %1").arg(m_effectiveCommandAspect->value())); - }); - return w; -} - void QbsCleanStep::doCancel() { if (m_job) @@ -159,14 +148,6 @@ void QbsCleanStep::handleProgress(int value) emit progress(value * 100 / m_maxProgress, m_description); } -void QbsCleanStep::updateState() -{ - QString command = static_cast<QbsBuildConfiguration *>(buildConfiguration()) - ->equivalentCommandLine(this); - m_effectiveCommandAspect->setValue(command); - emit stateChanged(); -} - void QbsCleanStep::createTaskAndOutput(ProjectExplorer::Task::TaskType type, const QString &message, const QString &file, int line) { ProjectExplorer::Task task = ProjectExplorer::Task(type, message, diff --git a/src/plugins/qbsprojectmanager/qbscleanstep.h b/src/plugins/qbsprojectmanager/qbscleanstep.h index bfac0d2b68..fa07d35292 100644 --- a/src/plugins/qbsprojectmanager/qbscleanstep.h +++ b/src/plugins/qbsprojectmanager/qbscleanstep.h @@ -47,26 +47,20 @@ public: bool dryRun() const { return m_dryRunAspect->value(); } bool keepGoing() const { return m_keepGoingAspect->value(); } -signals: - void stateChanged(); - private: bool init() override; void doRun() override; void doCancel() override; - ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override; void cleaningDone(bool success); void handleTaskStarted(const QString &desciption, int max); void handleProgress(int value); - void updateState(); void createTaskAndOutput(ProjectExplorer::Task::TaskType type, const QString &message, const QString &file, int line); ProjectExplorer::BaseBoolAspect *m_dryRunAspect = nullptr; ProjectExplorer::BaseBoolAspect *m_keepGoingAspect = nullptr; - ProjectExplorer::BaseStringAspect *m_effectiveCommandAspect = nullptr; QStringList m_products; |