forked from qt-creator/qt-creator
TaskProgress: Make is possible to set id for associated future progress
Change-Id: I9e3e2038289a3e2f38030deb3e63dd69babb69ce Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -39,6 +39,7 @@ public:
|
||||
QFutureWatcher<void> m_watcher;
|
||||
QFutureInterface<void> m_futureInterface;
|
||||
QPointer<FutureProgress> m_futureProgress;
|
||||
Id m_id;
|
||||
bool m_isAutoStopOnCancel = true;
|
||||
int m_halfLifeTimePerTask = 1000; // 1000 ms
|
||||
QString m_displayName;
|
||||
@@ -112,7 +113,7 @@ TaskProgress::TaskProgress(TaskTree *taskTree)
|
||||
d->m_futureInterface.reportStarted();
|
||||
d->advanceProgress(0);
|
||||
|
||||
const auto id = Id::fromString(d->m_displayName + ".action");
|
||||
const Id id = d->m_id.isValid() ? d->m_id : Id::fromString(d->m_displayName + ".action");
|
||||
d->m_futureProgress = ProgressManager::addTask(d->m_futureInterface.future(),
|
||||
d->m_displayName, id);
|
||||
d->m_futureProgress->setKeepOnFinish(d->m_keep);
|
||||
@@ -136,6 +137,11 @@ TaskProgress::TaskProgress(TaskTree *taskTree)
|
||||
|
||||
TaskProgress::~TaskProgress() = default;
|
||||
|
||||
void TaskProgress::setId(Utils::Id id)
|
||||
{
|
||||
d->m_id = id;
|
||||
}
|
||||
|
||||
void TaskProgress::setAutoStopOnCancel(bool enable)
|
||||
{
|
||||
d->m_isAutoStopOnCancel = enable;
|
||||
|
@@ -23,6 +23,7 @@ public:
|
||||
TaskProgress(Utils::TaskTree *taskTree); // Makes TaskProgress a child of task tree
|
||||
~TaskProgress() override;
|
||||
|
||||
void setId(Utils::Id id);
|
||||
void setAutoStopOnCancel(bool enable); // Default is true
|
||||
void setHalfLifeTimePerTask(int msecs); // Default is 1000 ms
|
||||
void setDisplayName(const QString &name);
|
||||
|
Reference in New Issue
Block a user