forked from qt-creator/qt-creator
Qbs: Use new widget summary updating in clean step
Change-Id: I8ea3a53fcedeb1f9b3a8a97797fc418b8c3983ff Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -58,18 +58,16 @@ QbsCleanStep::QbsCleanStep(ProjectExplorer::BuildStepList *bsl) :
|
|||||||
m_keepGoingAspect->setSettingsKey("Qbs.DryKeepGoing");
|
m_keepGoingAspect->setSettingsKey("Qbs.DryKeepGoing");
|
||||||
m_keepGoingAspect->setLabel(tr("Keep going"));
|
m_keepGoingAspect->setLabel(tr("Keep going"));
|
||||||
|
|
||||||
m_effectiveCommandAspect = addAspect<BaseStringAspect>();
|
auto effectiveCommandAspect = addAspect<BaseStringAspect>();
|
||||||
m_effectiveCommandAspect->setDisplayStyle(BaseStringAspect::TextEditDisplay);
|
effectiveCommandAspect->setDisplayStyle(BaseStringAspect::TextEditDisplay);
|
||||||
m_effectiveCommandAspect->setLabelText(tr("Equivalent command line:"));
|
effectiveCommandAspect->setLabelText(tr("Equivalent command line:"));
|
||||||
|
|
||||||
updateState();
|
setSummaryUpdater([this, effectiveCommandAspect] {
|
||||||
|
QString command = static_cast<QbsBuildConfiguration *>(buildConfiguration())
|
||||||
connect(this, &ProjectExplorer::ProjectConfiguration::displayNameChanged,
|
->equivalentCommandLine(this);
|
||||||
this, &QbsCleanStep::updateState);
|
effectiveCommandAspect->setValue(command);
|
||||||
connect(m_dryRunAspect, &BaseBoolAspect::changed,
|
return tr("<b>Qbs:</b> %1").arg(command);
|
||||||
this, &QbsCleanStep::updateState);
|
});
|
||||||
connect(m_keepGoingAspect, &BaseBoolAspect::changed,
|
|
||||||
this, &QbsCleanStep::updateState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QbsCleanStep::~QbsCleanStep()
|
QbsCleanStep::~QbsCleanStep()
|
||||||
@@ -119,15 +117,6 @@ void QbsCleanStep::doRun()
|
|||||||
this, &QbsCleanStep::handleProgress);
|
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()
|
void QbsCleanStep::doCancel()
|
||||||
{
|
{
|
||||||
if (m_job)
|
if (m_job)
|
||||||
@@ -159,14 +148,6 @@ void QbsCleanStep::handleProgress(int value)
|
|||||||
emit progress(value * 100 / m_maxProgress, m_description);
|
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)
|
void QbsCleanStep::createTaskAndOutput(ProjectExplorer::Task::TaskType type, const QString &message, const QString &file, int line)
|
||||||
{
|
{
|
||||||
ProjectExplorer::Task task = ProjectExplorer::Task(type, message,
|
ProjectExplorer::Task task = ProjectExplorer::Task(type, message,
|
||||||
|
|||||||
@@ -47,26 +47,20 @@ public:
|
|||||||
bool dryRun() const { return m_dryRunAspect->value(); }
|
bool dryRun() const { return m_dryRunAspect->value(); }
|
||||||
bool keepGoing() const { return m_keepGoingAspect->value(); }
|
bool keepGoing() const { return m_keepGoingAspect->value(); }
|
||||||
|
|
||||||
signals:
|
|
||||||
void stateChanged();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool init() override;
|
bool init() override;
|
||||||
void doRun() override;
|
void doRun() override;
|
||||||
void doCancel() override;
|
void doCancel() override;
|
||||||
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
|
||||||
|
|
||||||
void cleaningDone(bool success);
|
void cleaningDone(bool success);
|
||||||
void handleTaskStarted(const QString &desciption, int max);
|
void handleTaskStarted(const QString &desciption, int max);
|
||||||
void handleProgress(int value);
|
void handleProgress(int value);
|
||||||
void updateState();
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
ProjectExplorer::BaseBoolAspect *m_dryRunAspect = nullptr;
|
ProjectExplorer::BaseBoolAspect *m_dryRunAspect = nullptr;
|
||||||
ProjectExplorer::BaseBoolAspect *m_keepGoingAspect = nullptr;
|
ProjectExplorer::BaseBoolAspect *m_keepGoingAspect = nullptr;
|
||||||
ProjectExplorer::BaseStringAspect *m_effectiveCommandAspect = nullptr;
|
|
||||||
|
|
||||||
QStringList m_products;
|
QStringList m_products;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user