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

Method requestLogo

launcher/ui/pages/modplatform/ftb/FtbListModel.cpp:263–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261}
262
263void ListModel::requestLogo(QString logo, QString url)
264{
265 if(m_logoMap.contains(logo)) {
266 return;
267 }
268
269 MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry("ModpacksCHPacks", QString("logos/%1").arg(logo.section(".", 0, 0)));
270
271 bool stale = entry->isStale();
272
273 NetJob *job = new NetJob(QString("ModpacksCH Icon Download %1").arg(logo), APPLICATION->network());
274 job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
275
276 auto fullPath = entry->getFullPath();
277 QObject::connect(job, &NetJob::finished, this, [this, logo, fullPath, stale]
278 {
279 logoLoaded(logo, stale);
280 });
281
282 QObject::connect(job, &NetJob::failed, this, [this, logo]
283 {
284 logoFailed(logo);
285 });
286
287 auto &newLogoEntry = m_logoMap[logo];
288 newLogoEntry.downloadJob = job;
289 newLogoEntry.fullpath = fullPath;
290 job->start();
291}
292
293}

Callers 1

dataMethod · 0.45

Calls 10

QStringClass · 0.85
QUrlClass · 0.85
resolveEntryMethod · 0.80
metacacheMethod · 0.80
isStaleMethod · 0.80
networkMethod · 0.80
addNetActionMethod · 0.80
getFullPathMethod · 0.80
containsMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected