MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / versionRequestSucceeded

Method versionRequestSucceeded

launcher/ui/pages/modplatform/ModModel.cpp:309–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307}
308
309void ListModel::versionRequestSucceeded(QJsonDocument doc, QString addonId, const QModelIndex& index)
310{
311 auto& current = m_parent->getCurrent();
312 if (addonId != current.addonId) {
313 return;
314 }
315
316 auto arr = doc.isObject() ? Json::ensureArray(doc.object(), "data") : doc.array();
317
318 try {
319 loadIndexedPackVersions(current, arr);
320 } catch (const JSONValidationError& e) {
321 qDebug() << doc;
322 qWarning() << "Error while reading " << debugName() << " mod version: " << e.cause();
323 }
324
325 // Cache info :^)
326 QVariant new_pack;
327 new_pack.setValue(current);
328 if (!setData(index, new_pack, Qt::UserRole)) {
329 qWarning() << "Failed to cache mod versions!";
330 }
331
332
333 m_parent->updateModVersions();
334}
335
336} // namespace ModPlatform
337

Callers

nothing calls this directly

Calls 5

setDataFunction · 0.85
objectMethod · 0.80
causeMethod · 0.80
updateModVersionsMethod · 0.80
getCurrentMethod · 0.45

Tested by

no test coverage detected