pollymc/launcher/tasks/MultipleOptionsTask.cpp
flow 87a0482b8b
refactor: make MultipleOptionsTask inherit from ConcurrentTask too
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-28 16:29:01 -03:00

28 lines
729 B
C++

#include "MultipleOptionsTask.h"
#include <QDebug>
MultipleOptionsTask::MultipleOptionsTask(QObject* parent, const QString& task_name) : ConcurrentTask(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)));
}