| 282 | } |
| 283 | |
| 284 | void 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 | |
| 309 | void ListModel::versionRequestSucceeded(QJsonDocument doc, QString addonId, const QModelIndex& index) |
| 310 | { |
nothing calls this directly
no test coverage detected