From 4bfc445cf8f2a9b0e1d704e43f5a81f841159f79 Mon Sep 17 00:00:00 2001 From: flow Date: Thu, 23 Jun 2022 07:58:27 -0300 Subject: [PATCH] fix: add progress indicator on Flame mod resolution dialog This code is super :pofat: omg Signed-off-by: flow --- launcher/InstanceImportTask.cpp | 15 +++++++-------- launcher/modplatform/flame/FileResolvingTask.cpp | 4 +++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/launcher/InstanceImportTask.cpp b/launcher/InstanceImportTask.cpp index d5684805..6b0f08d1 100644 --- a/launcher/InstanceImportTask.cpp +++ b/launcher/InstanceImportTask.cpp @@ -412,12 +412,8 @@ void InstanceImportTask::processFlame() "You will need to manually download them and add them to the modpack"), text); message_dialog->setModal(true); - message_dialog->show(); - connect(message_dialog, &QDialog::rejected, [&]() { - m_modIdResolver.reset(); - emitFailed("Canceled"); - }); - connect(message_dialog, &QDialog::accepted, [&]() { + + if (message_dialog->exec()) { m_filesNetJob = new NetJob(tr("Mod download"), APPLICATION->network()); for (const auto &result: m_modIdResolver->getResults().files) { QString filename = result.fileName; @@ -469,8 +465,11 @@ void InstanceImportTask::processFlame() }); setStatus(tr("Downloading mods...")); m_filesNetJob->start(); - }); - }else{ + } else { + m_modIdResolver.reset(); + emitFailed("Canceled"); + } + } else { //TODO extract to function ? m_filesNetJob = new NetJob(tr("Mod download"), APPLICATION->network()); for (const auto &result: m_modIdResolver->getResults().files) { diff --git a/launcher/modplatform/flame/FileResolvingTask.cpp b/launcher/modplatform/flame/FileResolvingTask.cpp index a790ab9c..c1f56658 100644 --- a/launcher/modplatform/flame/FileResolvingTask.cpp +++ b/launcher/modplatform/flame/FileResolvingTask.cpp @@ -10,7 +10,7 @@ Flame::FileResolvingTask::FileResolvingTask(const shared_qobject_ptr