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