fix: disable major version match for snapshots

This commit is contained in:
Sefa Eyeoglu 2022-04-20 09:43:25 +02:00
parent 4e97f2a6fe
commit db6dae7541
No known key found for this signature in database
GPG Key ID: C10411294912A422

View File

@ -23,12 +23,21 @@ void ModFilterWidget::setInstance(MinecraftInstance* instance)
{ {
m_instance = instance; m_instance = instance;
auto mcVersionSplit = mcVersionStr().split(".");
ui->strictVersionButton->setText( ui->strictVersionButton->setText(
tr("Strict match (= %1)").arg(mcVersionStr())); tr("Strict match (= %1)").arg(mcVersionStr()));
ui->majorVersionButton->setText(
tr("Major version match (= %1.%2.x)").arg(mcVersionSplit[0], mcVersionSplit[1])); // we can't do this for snapshots sadly
if(mcVersionStr().contains('.'))
{
auto mcVersionSplit = mcVersionStr().split(".");
ui->majorVersionButton->setText(
tr("Major version match (= %1.%2.x)").arg(mcVersionSplit[0], mcVersionSplit[1]));
}
else
{
ui->majorVersionButton->setText(tr("Major version match (unsupported)"));
disableVersionButton(Major);
}
ui->allVersionsButton->setText( ui->allVersionsButton->setText(
tr("Any version")); tr("Any version"));
//ui->betweenVersionsButton->setText( //ui->betweenVersionsButton->setText(
@ -67,7 +76,6 @@ void ModFilterWidget::onVersionFilterChanged(int id)
//ui->lowerVersionComboBox->setEnabled(id == VersionButtonID::Between); //ui->lowerVersionComboBox->setEnabled(id == VersionButtonID::Between);
//ui->upperVersionComboBox->setEnabled(id == VersionButtonID::Between); //ui->upperVersionComboBox->setEnabled(id == VersionButtonID::Between);
auto versionSplit = mcVersionStr().split(".");
int index = 0; int index = 0;
auto cast_id = (VersionButtonID) id; auto cast_id = (VersionButtonID) id;
@ -83,12 +91,14 @@ void ModFilterWidget::onVersionFilterChanged(int id)
case(VersionButtonID::Strict): case(VersionButtonID::Strict):
m_filter->versions.push_front(mcVersion()); m_filter->versions.push_front(mcVersion());
break; break;
case(VersionButtonID::Major): case(VersionButtonID::Major): {
auto versionSplit = mcVersionStr().split(".");
for(auto i = Version(QString("%1.%2").arg(versionSplit[0], versionSplit[1])); i <= mcVersion(); index++){ for(auto i = Version(QString("%1.%2").arg(versionSplit[0], versionSplit[1])); i <= mcVersion(); index++){
m_filter->versions.push_front(i); m_filter->versions.push_front(i);
i = Version(QString("%1.%2.%3").arg(versionSplit[0], versionSplit[1], QString("%1").arg(index))); i = Version(QString("%1.%2.%3").arg(versionSplit[0], versionSplit[1], QString("%1").arg(index)));
} }
break; break;
}
case(VersionButtonID::All): case(VersionButtonID::All):
// Empty list to avoid enumerating all versions :P // Empty list to avoid enumerating all versions :P
break; break;