aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflow <thiagodonato300@gmail.com>2022-04-13 19:23:12 -0300
committerflow <flowlnlnln@gmail.com>2022-05-23 14:42:27 -0300
commiteaa5ce446765ef4305a1462d68e278b0797966ee (patch)
tree21971ff5569306e6d7a246b69808c2eefe98ae83
parentc86c719e1a09be2dc25ffd26278076566672e3b5 (diff)
downloadPrismLauncher-eaa5ce446765ef4305a1462d68e278b0797966ee.tar.gz
PrismLauncher-eaa5ce446765ef4305a1462d68e278b0797966ee.tar.bz2
PrismLauncher-eaa5ce446765ef4305a1462d68e278b0797966ee.zip
feat(ui): adapt SequentialTask to nested SequentialTasks
-rw-r--r--launcher/modplatform/packwiz/Packwiz.h5
-rw-r--r--launcher/tasks/SequentialTask.cpp10
-rw-r--r--launcher/tasks/SequentialTask.h9
-rw-r--r--launcher/tasks/Task.h1
4 files changed, 14 insertions, 11 deletions
diff --git a/launcher/modplatform/packwiz/Packwiz.h b/launcher/modplatform/packwiz/Packwiz.h
index 64b95e7a..9c90f7de 100644
--- a/launcher/modplatform/packwiz/Packwiz.h
+++ b/launcher/modplatform/packwiz/Packwiz.h
@@ -1,13 +1,12 @@
#pragma once
+#include "modplatform/ModIndex.h"
+
#include <QString>
#include <QUrl>
#include <QVariant>
namespace ModPlatform {
-enum class Provider;
-class IndexedPack;
-class IndexedVersion;
} // namespace ModPlatform
class QDir;
diff --git a/launcher/tasks/SequentialTask.cpp b/launcher/tasks/SequentialTask.cpp
index 1573e476..2d50c299 100644
--- a/launcher/tasks/SequentialTask.cpp
+++ b/launcher/tasks/SequentialTask.cpp
@@ -53,12 +53,18 @@ void SequentialTask::startNext()
return;
}
Task::Ptr next = m_queue[m_currentIndex];
+
connect(next.get(), SIGNAL(failed(QString)), this, SLOT(subTaskFailed(QString)));
+ connect(next.get(), SIGNAL(succeeded()), this, SLOT(startNext()));
+
connect(next.get(), SIGNAL(status(QString)), this, SLOT(subTaskStatus(QString)));
+ connect(next.get(), SIGNAL(stepStatus(QString)), this, SLOT(subTaskStatus(QString)));
+
connect(next.get(), SIGNAL(progress(qint64, qint64)), this, SLOT(subTaskProgress(qint64, qint64)));
- connect(next.get(), SIGNAL(succeeded()), this, SLOT(startNext()));
setStatus(tr("Executing task %1 out of %2").arg(m_currentIndex + 1).arg(m_queue.size()));
+ setStepStatus(next->isMultiStep() ? next->getStepStatus() : next->getStatus());
+
next->start();
}
@@ -68,7 +74,7 @@ void SequentialTask::subTaskFailed(const QString& msg)
}
void SequentialTask::subTaskStatus(const QString& msg)
{
- setStepStatus(m_queue[m_currentIndex]->getStatus());
+ setStepStatus(msg);
}
void SequentialTask::subTaskProgress(qint64 current, qint64 total)
{
diff --git a/launcher/tasks/SequentialTask.h b/launcher/tasks/SequentialTask.h
index 5b3c0111..e10cb6f7 100644
--- a/launcher/tasks/SequentialTask.h
+++ b/launcher/tasks/SequentialTask.h
@@ -32,13 +32,10 @@ slots:
void subTaskStatus(const QString &msg);
void subTaskProgress(qint64 current, qint64 total);
-signals:
- void stepStatus(QString status);
+protected:
+ void setStepStatus(QString status) { m_step_status = status; emit stepStatus(status); };
-private:
- void setStepStatus(QString status) { m_step_status = status; };
-
-private:
+protected:
QString m_name;
QString m_step_status;
diff --git a/launcher/tasks/Task.h b/launcher/tasks/Task.h
index f7765c3d..aafaf68c 100644
--- a/launcher/tasks/Task.h
+++ b/launcher/tasks/Task.h
@@ -92,6 +92,7 @@ class Task : public QObject {
void aborted();
void failed(QString reason);
void status(QString status);
+ void stepStatus(QString status);
public slots:
virtual void start();