diff options
Diffstat (limited to 'launcher/modplatform/modpacksch')
-rw-r--r-- | launcher/modplatform/modpacksch/FTBPackInstallTask.cpp | 46 | ||||
-rw-r--r-- | launcher/modplatform/modpacksch/FTBPackInstallTask.h | 3 |
2 files changed, 44 insertions, 5 deletions
diff --git a/launcher/modplatform/modpacksch/FTBPackInstallTask.cpp b/launcher/modplatform/modpacksch/FTBPackInstallTask.cpp index 75fda208..f6bf2488 100644 --- a/launcher/modplatform/modpacksch/FTBPackInstallTask.cpp +++ b/launcher/modplatform/modpacksch/FTBPackInstallTask.cpp @@ -176,7 +176,6 @@ void PackInstallTask::resolveMods() void PackInstallTask::onResolveModsSucceeded() { - QList<BlockedMod> blocked_mods; auto anyBlocked = false; Flame::Manifest results = m_mod_id_resolver_task->getResults(); @@ -201,7 +200,7 @@ void PackInstallTask::onResolveModsSucceeded() blocked_mod.matched = false; blocked_mod.localPath = ""; - blocked_mods.append(blocked_mod); + m_blocked_mods.append(blocked_mod); anyBlocked = true; } else { @@ -217,12 +216,16 @@ void PackInstallTask::onResolveModsSucceeded() auto message_dialog = new BlockedModsDialog(m_parent, tr("Blocked files found"), tr("The following files are not available for download in third party launchers.<br/>" "You will need to manually download them and add them to the instance."), - blocked_mods); + m_blocked_mods); - if (message_dialog->exec() == QDialog::Accepted) + if (message_dialog->exec() == QDialog::Accepted) { + qDebug() << "Post dialog mods list: " << m_blocked_mods; createInstance(); - else + } + else { abort(); + } + } else { createInstance(); } @@ -326,6 +329,9 @@ void PackInstallTask::downloadPack() void PackInstallTask::onModDownloadSucceeded() { m_net_job.reset(); + if (m_blocked_mods.length() > 0) { + copyBlockedMods(); + } emitSucceeded(); } @@ -349,4 +355,34 @@ void PackInstallTask::onModDownloadFailed(QString reason) emitFailed(reason); } +void PackInstallTask::copyBlockedMods() { + + setStatus(tr("Copying Blocked Mods...")); + setAbortable(false); + int i = 0; + int total = m_blocked_mods.length(); + setProgress(i, total); + for (auto mod = m_blocked_mods.begin(); mod != m_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); +} + } // namespace ModpacksCH diff --git a/launcher/modplatform/modpacksch/FTBPackInstallTask.h b/launcher/modplatform/modpacksch/FTBPackInstallTask.h index 7c6fbeb9..2cd4d729 100644 --- a/launcher/modplatform/modpacksch/FTBPackInstallTask.h +++ b/launcher/modplatform/modpacksch/FTBPackInstallTask.h @@ -43,6 +43,7 @@ #include "QObjectPtr.h" #include "modplatform/flame/FileResolvingTask.h" #include "net/NetJob.h" +#include "ui/dialogs/BlockedModsDialog.h" #include <QWidget> @@ -76,6 +77,7 @@ private: void resolveMods(); void createInstance(); void downloadPack(); + void copyBlockedMods(); private: NetJob::Ptr m_net_job = nullptr; @@ -90,6 +92,7 @@ private: Version m_version; QMap<QString, QString> m_files_to_copy; + QList<BlockedMod> m_blocked_mods; //FIXME: nuke QWidget* m_parent; |