feat: add (current) indicator to the currently installed version in MR

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-10-13 20:32:40 -03:00
parent cba2608c1c
commit 1c567232e3
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469

View File

@ -127,10 +127,19 @@ void ModrinthManagedPackPage::parseManagedPack()
}
for (auto version : m_pack.versions) {
QString name;
if (!version.name.contains(version.version))
ui->versionsComboBox->addItem(QString("%1 — %2").arg(version.name, version.version), QVariant(version.id));
name = QString("%1 — %2").arg(version.name, version.version);
else
ui->versionsComboBox->addItem(version.name, QVariant(version.id));
name = version.name;
// NOTE: the id from version isn't the same id in the modpack format spec...
// e.g. HexMC's 4.4.0 has versionId 4.0.0 in the modpack index..............
if (version.version == m_inst->getManagedPackVersionName())
name.append(tr(" (Current)"));
ui->versionsComboBox->addItem(name, QVariant(version.id));
}
suggestVersion();