add archived project warning

Signed-off-by: lumiscosity <averyrudelphe@gmail.com>
This commit is contained in:
lumiscosity 2023-12-22 22:01:05 +01:00
parent e39a03421a
commit 358cf5b348
7 changed files with 17 additions and 1 deletions

View File

@ -122,6 +122,8 @@ struct ExtraPackData {
QString wikiUrl;
QString discordUrl;
QString status;
QString body;
};

View File

@ -104,6 +104,8 @@ void Modrinth::loadExtraPackData(ModPlatform::IndexedPack& pack, QJsonObject& ob
pack.extraData.donate.append(donate);
}
pack.extraData.status = Json::ensureString(obj, "status");
pack.extraData.body = Json::ensureString(obj, "body").remove("<br>");
pack.extraDataLoaded = true;

View File

@ -95,6 +95,8 @@ void loadIndexedInfo(Modpack& pack, QJsonObject& obj)
pack.extra.donate.append(donate);
}
pack.extra.status = Json::ensureString(obj, "status");
pack.extraInfoLoaded = true;
}

View File

@ -77,6 +77,8 @@ struct ModpackExtra {
QString discordUrl;
QList<DonationData> donate;
QString status;
};
struct ModpackVersion {

View File

@ -200,6 +200,10 @@ void ResourcePage::updateUi()
}
if (current_pack->extraDataLoaded) {
if (current_pack->extraData.status == "archived") {
text += "<br><br>" + tr("<b>This project has been archived. It will not receive any further updates unless the author decides to unarchive the project.</b>");
}
if (!current_pack->extraData.donate.isEmpty()) {
text += "<br><br>" + tr("Donate information: ");
auto donateToStr = [](ModPlatform::DonationData& donate) -> QString {

View File

@ -142,7 +142,7 @@ void ModpackListModel::performPaginatedSearch()
callbacks.on_succeed = [this](auto& doc, auto& pack) { searchRequestForOneSucceeded(doc); };
callbacks.on_abort = [this] {
qCritical() << "Search task aborted by an unknown reason!";
searchRequestFailed("Abborted");
searchRequestFailed("Aborted");
};
static const ModrinthAPI api;
if (auto job = api.getProjectInfo({ projectId }, std::move(callbacks)); job) {

View File

@ -267,6 +267,10 @@ void ModrinthPage::updateUI()
text += "<br>" + tr(" by ") + QString("<a href=%1>%2</a>").arg(std::get<1>(current.author).toString(), std::get<0>(current.author));
if (current.extraInfoLoaded) {
if (current.extra.status == "archived") {
text += "<br><br>" + tr("<b>This project has been archived. It will not receive any further updates unless the author decides to unarchive the project.</b>");
}
if (!current.extra.donate.isEmpty()) {
text += "<br><br>" + tr("Donate information: ");
auto donateToStr = [](Modrinth::DonationData& donate) -> QString {