pollymc/launcher/tasks/MultipleOptionsTask.cpp
flow 064ae49d2b
fix: make MultipleOptionsTask inherit directly from SequentialTask
It's not a good idea to have multiple concurrent tasks running on a
sequential thing like this one.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-28 16:29:02 -03:00

28 lines
729 B
C++

#include "MultipleOptionsTask.h"
#include <QDebug>
MultipleOptionsTask::MultipleOptionsTask(QObject* parent, const QString& task_name) : SequentialTask(parent, task_name) {}
void MultipleOptionsTask::startNext()
{
if (m_done.size() != m_failed.size()) {
emitSucceeded();
return;
}
if (m_queue.isEmpty()) {
emitFailed(tr("All attempts have failed!"));
qWarning() << "All attempts have failed!";
return;
}
ConcurrentTask::startNext();
}
void MultipleOptionsTask::updateState()
{
setProgress(m_done.count(), m_total_size);
setStatus(tr("Attempting task %1 out of %2").arg(QString::number(m_doing.count() + m_done.count()), QString::number(m_total_size)));
}