diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2023-01-04 16:12:55 +0100 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2023-01-05 14:22:42 +0000 |
commit | 45c98836a97eb3158a06f0d60afbb1857b15bb6c (patch) | |
tree | a558f00b799fd186a919ad92d86cb3529e6fd38d /src/plugins | |
parent | fdb9cb905b9a3e05d59a1bb220414ca2bdd5d9f2 (diff) | |
download | qt-creator-45c98836a97eb3158a06f0d60afbb1857b15bb6c.tar.gz |
ProcessProgress: Add setKeepOnFinish()
Change-Id: I327cf309081d432b11a85bd98bc9f42de65313da
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/coreplugin/progressmanager/processprogress.cpp | 16 | ||||
-rw-r--r-- | src/plugins/coreplugin/progressmanager/processprogress.h | 1 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/plugins/coreplugin/progressmanager/processprogress.cpp b/src/plugins/coreplugin/progressmanager/processprogress.cpp index 4b5aa0322b..d2109f072a 100644 --- a/src/plugins/coreplugin/progressmanager/processprogress.cpp +++ b/src/plugins/coreplugin/progressmanager/processprogress.cpp @@ -28,7 +28,9 @@ public: ProgressParser m_parser = {}; QFutureWatcher<void> m_watcher; QFutureInterface<void> m_futureInterface; + QPointer<FutureProgress> m_futureProgress; QString m_displayName; + FutureProgress::KeepOnFinishType m_keep = FutureProgress::HideOnFinish; }; ProcessProgressPrivate::ProcessProgressPrivate(ProcessProgress *progress, QtcProcess *process) @@ -91,11 +93,12 @@ ProcessProgress::ProcessProgress(QtcProcess *process) const QString name = d->displayName(); const auto id = Id::fromString(name + ".action"); if (d->m_parser) { - ProgressManager::addTask(d->m_futureInterface.future(), name, id); + d->m_futureProgress = ProgressManager::addTask(d->m_futureInterface.future(), name, id); } else { - ProgressManager::addTimedTask(d->m_futureInterface, name, id, - qMax(2, d->m_process->timeoutS() / 5)); + d->m_futureProgress = ProgressManager::addTimedTask(d->m_futureInterface, name, id, + qMax(2, d->m_process->timeoutS() / 5)); } + d->m_futureProgress->setKeepOnFinish(d->m_keep); }); connect(d->m_process, &QtcProcess::done, this, [this] { if (d->m_process->result() != ProcessResult::FinishedWithSuccess) @@ -109,6 +112,13 @@ void ProcessProgress::setDisplayName(const QString &name) d->m_displayName = name; } +void ProcessProgress::setKeepOnFinish(FutureProgress::KeepOnFinishType keepType) +{ + d->m_keep = keepType; + if (d->m_futureProgress) + d->m_futureProgress->setKeepOnFinish(d->m_keep); +} + void ProcessProgress::setProgressParser(const ProgressParser &parser) { if (d->m_parser) { diff --git a/src/plugins/coreplugin/progressmanager/processprogress.h b/src/plugins/coreplugin/progressmanager/processprogress.h index 4d80a99bd8..d6e1721622 100644 --- a/src/plugins/coreplugin/progressmanager/processprogress.h +++ b/src/plugins/coreplugin/progressmanager/processprogress.h @@ -26,6 +26,7 @@ public: ProcessProgress(Utils::QtcProcess *process); // Makes ProcessProgress a child of process void setDisplayName(const QString &name); + void setKeepOnFinish(FutureProgress::KeepOnFinishType keepType); void setProgressParser(const ProgressParser &parser); private: |