Merge pull request #2055 from Trial97/show_minecraft_version_modrinth

Display minecraft version if not mentioned for modrinth/curse packs
This commit is contained in:
Alexandru Ionut Tripon
2024-06-09 15:59:24 +03:00
committed by GitHub
4 changed files with 16 additions and 6 deletions

View File

@ -224,11 +224,12 @@ void ModrinthPage::onSelectionChanged(QModelIndex curr, [[maybe_unused]] QModelI
}
for (auto version : current.versions) {
auto release_type = version.version_type.isValid() ? QString(" [%1]").arg(version.version_type.toString()) : "";
if (!version.name.contains(version.version))
ui->versionSelectionBox->addItem(QString("%1 — %2%3").arg(version.name, version.version, release_type),
QVariant(version.id));
else
ui->versionSelectionBox->addItem(QString("%1%2").arg(version.name, release_type), QVariant(version.id));
auto mcVersion = !version.gameVersion.isEmpty() && !version.name.contains(version.gameVersion)
? QString(" for %1").arg(version.gameVersion)
: "";
auto versionStr = !version.name.contains(version.version) ? version.version : "";
ui->versionSelectionBox->addItem(QString("%1%2 — %3%4").arg(version.name, mcVersion, versionStr, release_type),
QVariant(version.id));
}
QVariant current_updated;