| 307 | } |
| 308 | |
| 309 | void 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 |
nothing calls this directly
no test coverage detected