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

Method infoRequestFinished

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

Source from the content-addressed store, hash-verified

282}
283
284void ListModel::infoRequestFinished(QJsonDocument& doc, ModPlatform::IndexedPack& pack, const QModelIndex& index)
285{
286 qDebug() << "Loading mod info";
287
288 try {
289 auto obj = Json::requireObject(doc);
290 loadExtraPackInfo(pack, obj);
291 } catch (const JSONValidationError& e) {
292 qDebug() << doc;
293 qWarning() << "Error while reading " << debugName() << " mod info: " << e.cause();
294 }
295
296 // Check if the index is still valid for this mod or not
297 if (pack.addonId == data(index, Qt::UserRole).value<ModPlatform::IndexedPack>().addonId) {
298 // Cache info :^)
299 QVariant new_pack;
300 new_pack.setValue(pack);
301 if (!setData(index, new_pack, Qt::UserRole)) {
302 qWarning() << "Failed to cache mod info!";
303 }
304 }
305
306 m_parent->updateUi();
307}
308
309void ListModel::versionRequestSucceeded(QJsonDocument doc, QString addonId, const QModelIndex& index)
310{

Callers

nothing calls this directly

Calls 5

requireObjectFunction · 0.85
dataFunction · 0.85
setDataFunction · 0.85
causeMethod · 0.80
updateUiMethod · 0.45

Tested by

no test coverage detected