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

Method updateUi

launcher/ui/pages/modplatform/ModPage.cpp:298–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298void ModPage::updateUi()
299{
300 QString text = "";
301 QString name = current.name;
302
303 if (current.websiteUrl.isEmpty())
304 text = name;
305 else
306 text = "<a href=\"" + current.websiteUrl + "\">" + name + "</a>";
307
308 if (!current.authors.empty()) {
309 auto authorToStr = [](ModPlatform::ModpackAuthor& author) -> QString {
310 if (author.url.isEmpty()) { return author.name; }
311 return QString("<a href=\"%1\">%2</a>").arg(author.url, author.name);
312 };
313 QStringList authorStrs;
314 for (auto& author : current.authors) {
315 authorStrs.push_back(authorToStr(author));
316 }
317 text += "<br>" + tr(" by ") + authorStrs.join(", ");
318 }
319
320
321 if(current.extraDataLoaded) {
322 if (!current.extraData.donate.isEmpty()) {
323 text += "<br><br>" + tr("Donate information: ");
324 auto donateToStr = [](ModPlatform::DonationData& donate) -> QString {
325 return QString("<a href=\"%1\">%2</a>").arg(donate.url, donate.platform);
326 };
327 QStringList donates;
328 for (auto& donate : current.extraData.donate) {
329 donates.append(donateToStr(donate));
330 }
331 text += donates.join(", ");
332 }
333
334 if (!current.extraData.issuesUrl.isEmpty()
335 || !current.extraData.sourceUrl.isEmpty()
336 || !current.extraData.wikiUrl.isEmpty()
337 || !current.extraData.discordUrl.isEmpty()) {
338 text += "<br><br>" + tr("External links:") + "<br>";
339 }
340
341 if (!current.extraData.issuesUrl.isEmpty())
342 text += "- " + tr("Issues: <a href=%1>%1</a>").arg(current.extraData.issuesUrl) + "<br>";
343 if (!current.extraData.wikiUrl.isEmpty())
344 text += "- " + tr("Wiki: <a href=%1>%1</a>").arg(current.extraData.wikiUrl) + "<br>";
345 if (!current.extraData.sourceUrl.isEmpty())
346 text += "- " + tr("Source code: <a href=%1>%1</a>").arg(current.extraData.sourceUrl) + "<br>";
347 if (!current.extraData.discordUrl.isEmpty())
348 text += "- " + tr("Discord: <a href=%1>%1</a>").arg(current.extraData.discordUrl) + "<br>";
349 }
350
351 text += "<hr>";
352
353 HoeDown h;
354 ui->packDescription->setHtml(text + (current.extraData.body.isEmpty() ? current.description : h.process(current.extraData.body.toUtf8())));
355}

Callers 1

infoRequestFinishedMethod · 0.45

Calls 5

QStringClass · 0.85
isEmptyMethod · 0.80
appendMethod · 0.80
processMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected