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

Method searchRequestFinished

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

Source from the content-addressed store, hash-verified

218}
219
220void ListModel::searchRequestFinished(QJsonDocument& doc)
221{
222 jobPtr.reset();
223
224 QList<ModPlatform::IndexedPack> newList;
225 auto packs = documentToArray(doc);
226
227 for (auto packRaw : packs) {
228 auto packObj = packRaw.toObject();
229
230 ModPlatform::IndexedPack pack;
231 try {
232 loadIndexedPack(pack, packObj);
233 newList.append(pack);
234 } catch (const JSONValidationError& e) {
235 qWarning() << "Error while loading mod from " << m_parent->debugName() << ": " << e.cause();
236 continue;
237 }
238 }
239
240 if (packs.size() < 25) {
241 searchState = Finished;
242 } else {
243 nextSearchOffset += 25;
244 searchState = CanPossiblyFetchMore;
245 }
246
247 // When you have a Qt build with assertions turned on, proceeding here will abort the application
248 if (newList.size() == 0)
249 return;
250
251 beginInsertRows(QModelIndex(), modpacks.size(), modpacks.size() + newList.size() - 1);
252 modpacks.append(newList);
253 endInsertRows();
254}
255
256void ListModel::searchRequestFailed(QString reason)
257{

Callers 1

searchModsMethod · 0.45

Calls 7

loadIndexedPackFunction · 0.85
QModelIndexClass · 0.85
appendMethod · 0.80
causeMethod · 0.80
resetMethod · 0.45
debugNameMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected