Changed modrinth author data to not be a list
This commit is contained in:
parent
a2d88f6df4
commit
1d0e6bf453
@ -18,10 +18,10 @@ void Modrinth::loadIndexedPack(Modrinth::IndexedPack & pack, QJsonObject & obj)
|
|||||||
pack.logoUrl = Json::requireString(obj, "icon_url");
|
pack.logoUrl = Json::requireString(obj, "icon_url");
|
||||||
pack.logoName = pack.addonId;
|
pack.logoName = pack.addonId;
|
||||||
|
|
||||||
Modrinth::ModpackAuthor packAuthor;
|
Modrinth::ModpackAuthor modAuthor;
|
||||||
packAuthor.name = Json::requireString(obj, "author");
|
modAuthor.name = Json::requireString(obj, "author");
|
||||||
packAuthor.url = Json::requireString(obj, "author_url");
|
modAuthor.url = Json::requireString(obj, "author_url");
|
||||||
pack.authors.append(packAuthor); //TODO delete this ? only one author ever exists
|
pack.author = modAuthor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Modrinth::loadIndexedPackVersions(Modrinth::IndexedPack & pack, QJsonArray & arr, const shared_qobject_ptr<QNetworkAccessManager>& network, BaseInstance * inst)
|
void Modrinth::loadIndexedPackVersions(Modrinth::IndexedPack & pack, QJsonArray & arr, const shared_qobject_ptr<QNetworkAccessManager>& network, BaseInstance * inst)
|
||||||
|
@ -32,7 +32,7 @@ struct IndexedPack
|
|||||||
QString addonId;
|
QString addonId;
|
||||||
QString name;
|
QString name;
|
||||||
QString description;
|
QString description;
|
||||||
QList<ModpackAuthor> authors;
|
ModpackAuthor author;
|
||||||
QString logoName;
|
QString logoName;
|
||||||
QString logoUrl;
|
QString logoUrl;
|
||||||
QString websiteUrl;
|
QString websiteUrl;
|
||||||
|
@ -90,21 +90,7 @@ void ModrinthPage::onSelectionChanged(QModelIndex first, QModelIndex second)
|
|||||||
text = name;
|
text = name;
|
||||||
else
|
else
|
||||||
text = "<a href=\"" + current.websiteUrl + "\">" + name + "</a>";
|
text = "<a href=\"" + current.websiteUrl + "\">" + name + "</a>";
|
||||||
if (!current.authors.empty()) {
|
text += "<br>"+ tr(" by ") + "<a href=\""+current.author.url+"\">"+current.author.name+"</a><br><br>";
|
||||||
auto authorToStr = [](Modrinth::ModpackAuthor & author) {
|
|
||||||
if(author.url.isEmpty()) {
|
|
||||||
return author.name;
|
|
||||||
}
|
|
||||||
return QString("<a href=\"%1\">%2</a>").arg(author.url, author.name);
|
|
||||||
};
|
|
||||||
QStringList authorStrs;
|
|
||||||
for(auto & author: current.authors) {
|
|
||||||
authorStrs.push_back(authorToStr(author));
|
|
||||||
}
|
|
||||||
text += "<br>" + tr(" by ") + authorStrs.join(", ");
|
|
||||||
}
|
|
||||||
text += "<br><br>";
|
|
||||||
|
|
||||||
ui->packDescription->setHtml(text + current.description);
|
ui->packDescription->setHtml(text + current.description);
|
||||||
|
|
||||||
if (!current.versionsLoaded)
|
if (!current.versionsLoaded)
|
||||||
|
Loading…
Reference in New Issue
Block a user