2022-06-03 04:04:08 +05:30
|
|
|
#include "MultipleOptionsTask.h"
|
|
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
2022-08-29 00:21:14 +05:30
|
|
|
MultipleOptionsTask::MultipleOptionsTask(QObject* parent, const QString& task_name) : SequentialTask(parent, task_name) {}
|
2022-06-03 04:04:08 +05:30
|
|
|
|
|
|
|
void MultipleOptionsTask::startNext()
|
|
|
|
{
|
2022-07-22 07:10:06 +05:30
|
|
|
if (m_done.size() != m_failed.size()) {
|
2022-06-03 04:04:08 +05:30
|
|
|
emitSucceeded();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-07-22 07:10:06 +05:30
|
|
|
if (m_queue.isEmpty()) {
|
|
|
|
emitFailed(tr("All attempts have failed!"));
|
|
|
|
qWarning() << "All attempts have failed!";
|
|
|
|
return;
|
|
|
|
}
|
2022-06-03 04:04:08 +05:30
|
|
|
|
2022-07-22 07:10:06 +05:30
|
|
|
ConcurrentTask::startNext();
|
2022-06-03 04:04:08 +05:30
|
|
|
}
|
|
|
|
|
2022-07-22 07:10:06 +05:30
|
|
|
void MultipleOptionsTask::updateState()
|
2022-06-03 04:04:08 +05:30
|
|
|
{
|
2022-07-22 07:10:06 +05:30
|
|
|
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)));
|
2022-06-03 04:04:08 +05:30
|
|
|
}
|