MCPcopy Create free account
hub / github.com/MultiMC/Launcher / fileListSucceeded

Method fileListSucceeded

launcher/modplatform/technic/SolderPackInstallTask.cpp:78–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78void Technic::SolderPackInstallTask::fileListSucceeded()
79{
80 setStatus(tr("Downloading modpack:"));
81 QStringList modUrls;
82 try
83 {
84 QJsonDocument doc = Json::requireDocument(m_response);
85 QJsonObject obj = Json::requireObject(doc);
86 QString minecraftVersion = Json::ensureString(obj, "minecraft", QString(), "__placeholder__");
87 if (!minecraftVersion.isEmpty())
88 m_minecraftVersion = minecraftVersion;
89 QJsonArray mods = Json::requireArray(obj, "mods", "'mods'");
90 for (auto mod: mods)
91 {
92 QJsonObject modObject = Json::requireValueObject(mod);
93 modUrls.append(Json::requireString(modObject, "url", "'url'"));
94 }
95 }
96 catch (const JSONValidationError &e)
97 {
98 emitFailed(e.cause());
99 m_filesNetJob.reset();
100 return;
101 }
102 m_filesNetJob = new NetJob(tr("Downloading modpack"), m_network);
103 int i = 0;
104 for (auto &modUrl: modUrls)
105 {
106 auto path = FS::PathCombine(m_outputDir.path(), QString("%1").arg(i));
107 m_filesNetJob->addNetAction(Net::Download::makeFile(modUrl, path));
108 i++;
109 }
110
111 m_modCount = modUrls.size();
112
113 connect(m_filesNetJob.get(), &NetJob::succeeded, this, &Technic::SolderPackInstallTask::downloadSucceeded);
114 connect(m_filesNetJob.get(), &NetJob::progress, this, &Technic::SolderPackInstallTask::downloadProgressChanged);
115 connect(m_filesNetJob.get(), &NetJob::failed, this, &Technic::SolderPackInstallTask::downloadFailed);
116 m_filesNetJob->start();
117}
118
119void Technic::SolderPackInstallTask::downloadSucceeded()
120{

Callers

nothing calls this directly

Calls 14

requireDocumentFunction · 0.85
requireObjectFunction · 0.85
QStringClass · 0.85
requireArrayFunction · 0.85
PathCombineFunction · 0.85
isEmptyMethod · 0.80
appendMethod · 0.80
causeMethod · 0.80
pathMethod · 0.80
addNetActionMethod · 0.80
resetMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected