aboutsummaryrefslogtreecommitdiff
path: root/launcher/tasks/MultipleOptionsTask.cpp
blob: 034499dfa41738f63038f20e4664ae341c4dd4d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#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(), totalSize());
    setStatus(tr("Attempting task %1 out of %2").arg(QString::number(m_doing.count() + m_done.count()), QString::number(totalSize())));
}