feat: display release type

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers
2023-05-26 16:23:43 -07:00
parent c156034069
commit cf4df19986
17 changed files with 73 additions and 34 deletions

View File

@ -137,8 +137,10 @@ void ModPage::updateVersionList()
}
// Only add the version if it's valid or using the 'Any' filter, but never if the version is opted out
if ((valid || m_filter->versions.empty()) && !optedOut(version))
m_ui->versionSelectionBox->addItem(version.version, QVariant(i));
if ((valid || m_filter->versions.empty()) && !optedOut(version)) {
auto release_type = version.verison_type.isValid() ? QString(" : %1").arg(version.verison_type.toString()) : "";
m_ui->versionSelectionBox->addItem(QString("%1%2").arg(version.version, release_type), QVariant(i));
}
}
if (m_ui->versionSelectionBox->count() == 0) {
m_ui->versionSelectionBox->addItem(tr("No valid version found!"), QVariant(-1));

View File

@ -256,8 +256,8 @@ void ResourcePage::updateVersionList()
auto& version = current_pack.versions[i];
if (optedOut(version))
continue;
m_ui->versionSelectionBox->addItem(current_pack.versions[i].version, QVariant(i));
auto release_type = current_pack.versions[i].verison_type.isValid() ? QString(" : %1").arg(current_pack.versions[i].verison_type.toString()) : "";
m_ui->versionSelectionBox->addItem(QString("%1%2").arg(current_pack.versions[i].version, release_type), QVariant(i));
}
if (m_ui->versionSelectionBox->count() == 0) {

View File

@ -155,7 +155,8 @@ void FlamePage::onSelectionChanged(QModelIndex curr, QModelIndex prev)
}
for (auto version : current.versions) {
ui->versionSelectionBox->addItem(version.version, QVariant(version.downloadUrl));
auto release_type = version.version_type.isValid() ? QString(" : %1").arg(version.version_type.toString()) : "";
ui->versionSelectionBox->addItem(QString("%1%2").arg(version.version, release_type), QVariant(version.downloadUrl));
}
QVariant current_updated;

View File

@ -201,12 +201,12 @@ void ModrinthPage::onSelectionChanged(QModelIndex curr, QModelIndex prev)
qDebug() << *response;
qWarning() << "Error while reading modrinth modpack version: " << e.cause();
}
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").arg(version.name, version.version), QVariant(version.id));
ui->versionSelectionBox->addItem(QString("%1 — %2%3").arg(version.name, version.version, release_type), QVariant(version.id));
else
ui->versionSelectionBox->addItem(version.name, QVariant(version.id));
ui->versionSelectionBox->addItem(QString("%1%2").arg(version.name, release_type), QVariant(version.id));
}
QVariant current_updated;