feat: add remaining links to modrinth mods
This commit is contained in:
parent
d0337da8ea
commit
ae2ef324f2
@ -32,6 +32,11 @@ struct IndexedVersion {
|
|||||||
|
|
||||||
struct ExtraPackData {
|
struct ExtraPackData {
|
||||||
QList<DonationData> donate;
|
QList<DonationData> donate;
|
||||||
|
|
||||||
|
QString issuesUrl;
|
||||||
|
QString sourceUrl;
|
||||||
|
QString wikiUrl;
|
||||||
|
QString discordUrl;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IndexedPack {
|
struct IndexedPack {
|
||||||
|
@ -52,6 +52,22 @@ void Modrinth::loadIndexedPack(ModPlatform::IndexedPack& pack, QJsonObject& obj)
|
|||||||
|
|
||||||
void Modrinth::loadExtraPackData(ModPlatform::IndexedPack& pack, QJsonObject& obj)
|
void Modrinth::loadExtraPackData(ModPlatform::IndexedPack& pack, QJsonObject& obj)
|
||||||
{
|
{
|
||||||
|
pack.extraData.issuesUrl = Json::ensureString(obj, "issues_url");
|
||||||
|
if(pack.extraData.issuesUrl.endsWith('/'))
|
||||||
|
pack.extraData.issuesUrl.chop(1);
|
||||||
|
|
||||||
|
pack.extraData.sourceUrl = Json::ensureString(obj, "source_url");
|
||||||
|
if(pack.extraData.sourceUrl.endsWith('/'))
|
||||||
|
pack.extraData.sourceUrl.chop(1);
|
||||||
|
|
||||||
|
pack.extraData.wikiUrl = Json::ensureString(obj, "wiki_url");
|
||||||
|
if(pack.extraData.wikiUrl.endsWith('/'))
|
||||||
|
pack.extraData.wikiUrl.chop(1);
|
||||||
|
|
||||||
|
pack.extraData.discordUrl = Json::ensureString(obj, "discord_url");
|
||||||
|
if(pack.extraData.discordUrl.endsWith('/'))
|
||||||
|
pack.extraData.discordUrl.chop(1);
|
||||||
|
|
||||||
auto donate_arr = Json::ensureArray(obj, "donation_urls");
|
auto donate_arr = Json::ensureArray(obj, "donation_urls");
|
||||||
for(auto d : donate_arr){
|
for(auto d : donate_arr){
|
||||||
auto d_obj = Json::requireObject(d);
|
auto d_obj = Json::requireObject(d);
|
||||||
|
@ -215,19 +215,38 @@ void ModPage::updateUi()
|
|||||||
text += "<br>" + tr(" by ") + authorStrs.join(", ");
|
text += "<br>" + tr(" by ") + authorStrs.join(", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!current.extraData.donate.isEmpty()) {
|
|
||||||
text += tr("<br><br>Donate information:<br>");
|
if(current.extraDataLoaded) {
|
||||||
auto donateToStr = [](ModPlatform::DonationData& donate) -> QString {
|
if (!current.extraData.donate.isEmpty()) {
|
||||||
return QString("<a href=\"%1\">%2</a>").arg(donate.url, donate.platform);
|
text += "<br><br>" + tr("Donate information: ");
|
||||||
};
|
auto donateToStr = [](ModPlatform::DonationData& donate) -> QString {
|
||||||
QStringList donates;
|
return QString("<a href=\"%1\">%2</a>").arg(donate.url, donate.platform);
|
||||||
for (auto& donate : current.extraData.donate) {
|
};
|
||||||
donates.append(donateToStr(donate));
|
QStringList donates;
|
||||||
|
for (auto& donate : current.extraData.donate) {
|
||||||
|
donates.append(donateToStr(donate));
|
||||||
|
}
|
||||||
|
text += donates.join(", ");
|
||||||
}
|
}
|
||||||
text += donates.join(", ");
|
|
||||||
|
if (!current.extraData.issuesUrl.isEmpty()
|
||||||
|
|| !current.extraData.sourceUrl.isEmpty()
|
||||||
|
|| !current.extraData.wikiUrl.isEmpty()
|
||||||
|
|| !current.extraData.discordUrl.isEmpty()) {
|
||||||
|
text += "<br><br>" + tr("External links:") + "<br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!current.extraData.issuesUrl.isEmpty())
|
||||||
|
text += "- " + tr("Issues: <a href=%1>%1</a>").arg(current.extraData.issuesUrl) + "<br>";
|
||||||
|
if (!current.extraData.wikiUrl.isEmpty())
|
||||||
|
text += "- " + tr("Wiki: <a href=%1>%1</a>").arg(current.extraData.wikiUrl) + "<br>";
|
||||||
|
if (!current.extraData.sourceUrl.isEmpty())
|
||||||
|
text += "- " + tr("Source code: <a href=%1>%1</a>").arg(current.extraData.sourceUrl) + "<br>";
|
||||||
|
if (!current.extraData.discordUrl.isEmpty())
|
||||||
|
text += "- " + tr("Discord: <a href=%1>%1</a>").arg(current.extraData.discordUrl) + "<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
text += "<br><br>";
|
text += "<hr>";
|
||||||
|
|
||||||
ui->packDescription->setHtml(text + current.description);
|
ui->packDescription->setHtml(text + current.description);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user