diff options
author | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2022-10-25 10:59:37 -0700 |
---|---|---|
committer | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2022-11-01 04:24:11 -0700 |
commit | 13c7efa0584caf34950a6e6efa4b8e3bee16d764 (patch) | |
tree | 2478664b4361d38a9f3102597ee3fa2fcaae28a7 /launcher/modplatform/flame | |
parent | 1598d6582473f1bb6aa02fd9b4dabc8210771e56 (diff) | |
download | PrismLauncher-13c7efa0584caf34950a6e6efa4b8e3bee16d764.tar.gz PrismLauncher-13c7efa0584caf34950a6e6efa4b8e3bee16d764.tar.bz2 PrismLauncher-13c7efa0584caf34950a6e6efa4b8e3bee16d764.zip |
copy found mods to instance (FTB and Flame)
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Diffstat (limited to 'launcher/modplatform/flame')
-rw-r--r-- | launcher/modplatform/flame/FlameInstanceCreationTask.cpp | 35 | ||||
-rw-r--r-- | launcher/modplatform/flame/FlameInstanceCreationTask.h | 3 |
2 files changed, 37 insertions, 1 deletions
diff --git a/launcher/modplatform/flame/FlameInstanceCreationTask.cpp b/launcher/modplatform/flame/FlameInstanceCreationTask.cpp index 15e660a9..fbc4ecf3 100644 --- a/launcher/modplatform/flame/FlameInstanceCreationTask.cpp +++ b/launcher/modplatform/flame/FlameInstanceCreationTask.cpp @@ -399,6 +399,7 @@ void FlameCreationTask::idResolverSucceeded(QEventLoop& loop) message_dialog->setModal(true); if (message_dialog->exec()) { + copyBlockedMods(blocked_mods); setupDownloadJob(loop); } else { m_mod_id_resolver.reset(); @@ -410,6 +411,36 @@ void FlameCreationTask::idResolverSucceeded(QEventLoop& loop) } } +void FlameCreationTask::copyBlockedMods(QList<BlockedMod> blocked_mods) { + + setStatus(tr("Copying Blocked Mods...")); + setAbortable(false); + int i = 0; + int total = blocked_mods.length(); + setProgress(i, total); + for (auto mod = blocked_mods.begin(); mod != blocked_mods.end(); mod++, i++) { + + if (!mod->matched) { + qDebug() << mod->name << "was not matched to a local file, skipping copy"; + continue; + } + + auto dest_path = FS::PathCombine(m_stagingPath, "minecraft", "mods", mod->name); + + setStatus(tr("Copying Blocked Mods (%1 out of %2 are done)").arg(QString::number(i), QString::number(total))); + + qDebug() << "Will try to copy" << mod->localPath << "to" << dest_path; + + if (!FS::copyFile(mod->localPath, dest_path)) { + qDebug() << "Copy of" << mod->localPath << "to" << dest_path << "Failed"; + } + + setProgress(i+1, total); + } + + setAbortable(true); +} + void FlameCreationTask::setupDownloadJob(QEventLoop& loop) { m_files_job = new NetJob(tr("Mod download"), APPLICATION->network()); @@ -455,7 +486,9 @@ void FlameCreationTask::setupDownloadJob(QEventLoop& loop) m_files_job.reset(); setError(reason); }); - connect(m_files_job.get(), &NetJob::progress, [&](qint64 current, qint64 total) { setProgress(current, total); }); + connect(m_files_job.get(), &NetJob::progress, [&](qint64 current, qint64 total) { + setProgress(current, total); + }); connect(m_files_job.get(), &NetJob::finished, &loop, &QEventLoop::quit); setStatus(tr("Downloading mods...")); diff --git a/launcher/modplatform/flame/FlameInstanceCreationTask.h b/launcher/modplatform/flame/FlameInstanceCreationTask.h index ded0e2ce..69a8f1ab 100644 --- a/launcher/modplatform/flame/FlameInstanceCreationTask.h +++ b/launcher/modplatform/flame/FlameInstanceCreationTask.h @@ -10,6 +10,8 @@ #include "net/NetJob.h" +#include "ui/dialogs/BlockedModsDialog.h" + class FlameCreationTask final : public InstanceCreationTask { Q_OBJECT @@ -29,6 +31,7 @@ class FlameCreationTask final : public InstanceCreationTask { private slots: void idResolverSucceeded(QEventLoop&); void setupDownloadJob(QEventLoop&); + void copyBlockedMods(QList<BlockedMod> blocked_mods); private: QWidget* m_parent = nullptr; |