mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
fix: manually copy task info when connecting
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
a58e3049b9
commit
02d1878a36
4 changed files with 21 additions and 8 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue