2022-06-02 23:34:08 +01:00
|
|
|
#include "MultipleOptionsTask.h"
|
|
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
2022-08-28 19:51:14 +01:00
|
|
|
MultipleOptionsTask::MultipleOptionsTask(QObject* parent, const QString& task_name) : SequentialTask(parent, task_name) {}
|
2022-06-02 23:34:08 +01:00
|
|
|
|
|
|
|
void MultipleOptionsTask::startNext()
|
|
|
|
{
|
2022-07-22 02:40:06 +01:00
|
|
|
if (m_done.size() != m_failed.size()) {
|
2022-06-02 23:34:08 +01:00
|
|
|
emitSucceeded();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-07-22 02:40:06 +01:00
|
|
|
if (m_queue.isEmpty()) {
|
|
|
|
emitFailed(tr("All attempts have failed!"));
|
|
|
|
qWarning() << "All attempts have failed!";
|
|
|
|
return;
|
|
|
|
}
|
2022-06-02 23:34:08 +01:00
|
|
|
|
2022-07-22 02:40:06 +01:00
|
|
|
ConcurrentTask::startNext();
|
2022-06-02 23:34:08 +01:00
|
|
|
}
|
|
|
|
|
2022-07-22 02:40:06 +01:00
|
|
|
void MultipleOptionsTask::updateState()
|
2022-06-02 23:34:08 +01:00
|
|
|
{
|
2022-12-19 14:35:34 +00:00
|
|
|
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())));
|
2022-06-02 23:34:08 +01:00
|
|
|
}
|