| 254 | } |
| 255 | |
| 256 | void ListModel::searchRequestFailed(QString reason) |
| 257 | { |
| 258 | auto failed_action = jobPtr->getFailedActions().at(0); |
| 259 | if (!failed_action->m_reply) { |
| 260 | // Network error |
| 261 | QMessageBox::critical(nullptr, tr("Error"), tr("A network error occurred. Could not load mods.")); |
| 262 | } else if (failed_action->m_reply && failed_action->m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 409) { |
| 263 | // 409 Gone, notify user to update |
| 264 | QMessageBox::critical(nullptr, tr("Error"), |
| 265 | //: %1 refers to the launcher itself |
| 266 | QString("%1 %2") |
| 267 | .arg(m_parent->displayName()) |
| 268 | .arg(tr("API version too old!\nPlease update %1!").arg(BuildConfig.LAUNCHER_NAME))); |
| 269 | } |
| 270 | jobPtr.reset(); |
| 271 | |
| 272 | if (searchState == ResetRequested) { |
| 273 | beginResetModel(); |
| 274 | modpacks.clear(); |
| 275 | endResetModel(); |
| 276 | |
| 277 | nextSearchOffset = 0; |
| 278 | performPaginatedSearch(); |
| 279 | } else { |
| 280 | searchState = Finished; |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | void ListModel::infoRequestFinished(QJsonDocument& doc, ModPlatform::IndexedPack& pack, const QModelIndex& index) |
| 285 | { |
nothing calls this directly
no test coverage detected