Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mod downloader page improvements #1979

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions launcher/modplatform/ModIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ struct ExtraPackData {
QString wikiUrl;
QString discordUrl;

QString status;

QString body;
};

Expand Down
2 changes: 2 additions & 0 deletions launcher/modplatform/modrinth/ModrinthPackIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions launcher/modplatform/modrinth/ModrinthPackManifest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions launcher/modplatform/modrinth/ModrinthPackManifest.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ struct ModpackExtra {
QString discordUrl;

QList<DonationData> donate;

QString status;
};

struct ModpackVersion {
Expand Down
5 changes: 5 additions & 0 deletions launcher/ui/pages/modplatform/ResourcePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ 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 {
Expand Down
2 changes: 1 addition & 1 deletion launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 5 additions & 0 deletions launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ 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 {
Expand Down
2 changes: 1 addition & 1 deletion launcher/ui/widgets/ProjectItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void ProjectItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o
}

{ // Description painting
auto description = index.data(UserDataTypes::DESCRIPTION).toString();
auto description = index.data(UserDataTypes::DESCRIPTION).toString().simplified();

QTextLayout text_layout(description, opt.font);

Expand Down