aboutsummaryrefslogtreecommitdiff
path: root/launcher/tasks
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2022-05-30 13:41:02 +0200
committerGitHub <noreply@github.com>2022-05-30 13:41:02 +0200
commit9054ee18a1d472dd201cec870c77530d218167de (patch)
tree561b6505fdc9eb45d8d66bda392da79a56b40343 /launcher/tasks
parentd7fad4bd04a9f6d4fa149ff0b3aa526f1524cd56 (diff)
parentf8e7fb3d481d41473a6d7102d5c218e4a18bba3d (diff)
downloadPrismLauncher-9054ee18a1d472dd201cec870c77530d218167de.tar.gz
PrismLauncher-9054ee18a1d472dd201cec870c77530d218167de.tar.bz2
PrismLauncher-9054ee18a1d472dd201cec870c77530d218167de.zip
Merge pull request #505 from flowln/improve_download_ux
Diffstat (limited to 'launcher/tasks')
-rw-r--r--launcher/tasks/SequentialTask.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/launcher/tasks/SequentialTask.cpp b/launcher/tasks/SequentialTask.cpp
index 1573e476..ee57cac1 100644
--- a/launcher/tasks/SequentialTask.cpp
+++ b/launcher/tasks/SequentialTask.cpp
@@ -33,11 +33,22 @@ void SequentialTask::executeTask()
bool SequentialTask::abort()
{
- bool succeeded = true;
- for (auto& task : m_queue) {
- if (!task->abort()) succeeded = false;
+ if(m_currentIndex == -1 || m_currentIndex >= m_queue.size()) {
+ if(m_currentIndex == -1) {
+ // Don't call emitAborted() here, we want to bypass the 'is the task running' check
+ emit aborted();
+ emit finished();
+ }
+ m_queue.clear();
+ return true;
}
+ bool succeeded = m_queue[m_currentIndex]->abort();
+ m_queue.clear();
+
+ if(succeeded)
+ emitAborted();
+
return succeeded;
}
@@ -76,7 +87,7 @@ void SequentialTask::subTaskProgress(qint64 current, qint64 total)
setProgress(0, 100);
return;
}
- setProgress(m_currentIndex, m_queue.count());
+ setProgress(m_currentIndex + 1, m_queue.count());
m_stepProgress = current;
m_stepTotalProgress = total;