fix: manually copy task info when connecting

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2026-02-02 13:27:36 +05:00
parent a58e3049b9
commit 02d1878a36
No known key found for this signature in database
GPG key ID: B77C34313AEE1FFF
4 changed files with 21 additions and 8 deletions

View file

@ -194,6 +194,22 @@ QString Task::failReason() const
return m_failReason;
}
void Task::propagateFromOther(Task* other)
{
Q_ASSERT(other);
connect(other, &Task::status, this, &Task::setStatus);
connect(other, &Task::details, this, &Task::setDetails);
connect(other, &Task::progress, this, &Task::setProgress);
connect(other, &Task::stepProgress, this, &Task::propagateStepProgress);
setStatus(other->getStatus());
setDetails(other->getDetails());
setProgress(other->getProgress(), other->getTotalProgress());
for (const auto& progress : other->getStepProgress()) {
propagateStepProgress(*progress);
}
}
void Task::logWarning(const QString& line)
{
qWarning() << line;

View file

@ -127,6 +127,9 @@ class Task : public QObject, public QRunnable {
QUuid getUid() { return m_uid; }
// Copies the other task's status, details, progress, and step progress to this task; and sets up connections for future propagation
void propagateFromOther(Task* other);
protected:
void logWarning(const QString& line);