Merge pull request #3006 from Trial97/relase_type

add release_type filer for mod/modpacks
This commit is contained in:
Alexandru Ionut Tripon 2024-10-28 22:29:38 +02:00 committed by GitHub
commit fbd3aa36c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 62 additions and 2 deletions

View File

@ -162,6 +162,11 @@ ModFilterWidget::ModFilterWidget(MinecraftInstance* instance, bool extended, QWi
connect(ui->hideInstalled, &QCheckBox::stateChanged, this, &ModFilterWidget::onHideInstalledFilterChanged);
connect(ui->openSource, &QCheckBox::stateChanged, this, &ModFilterWidget::onOpenSourceFilterChanged);
connect(ui->releaseCb, &QCheckBox::stateChanged, this, &ModFilterWidget::onReleaseFilterChanged);
connect(ui->betaCb, &QCheckBox::stateChanged, this, &ModFilterWidget::onReleaseFilterChanged);
connect(ui->alphaCb, &QCheckBox::stateChanged, this, &ModFilterWidget::onReleaseFilterChanged);
connect(ui->unknownCb, &QCheckBox::stateChanged, this, &ModFilterWidget::onReleaseFilterChanged);
setHidden(true);
loadVersionList();
prepareBasicFilter();
@ -349,4 +354,21 @@ void ModFilterWidget::onOpenSourceFilterChanged()
emit filterChanged();
}
void ModFilterWidget::onReleaseFilterChanged()
{
std::list<ModPlatform::IndexedVersionType> releases;
if (ui->releaseCb->isChecked())
releases.push_back(ModPlatform::IndexedVersionType(ModPlatform::IndexedVersionType::VersionType::Release));
if (ui->betaCb->isChecked())
releases.push_back(ModPlatform::IndexedVersionType(ModPlatform::IndexedVersionType::VersionType::Beta));
if (ui->alphaCb->isChecked())
releases.push_back(ModPlatform::IndexedVersionType(ModPlatform::IndexedVersionType::VersionType::Alpha));
if (ui->unknownCb->isChecked())
releases.push_back(ModPlatform::IndexedVersionType(ModPlatform::IndexedVersionType::VersionType::Unknown));
m_filter_changed = releases != m_filter->releases;
m_filter->releases = releases;
if (m_filter_changed)
emit filterChanged();
}
#include "ModFilterWidget.moc"

View File

@ -109,6 +109,7 @@ class ModFilterWidget : public QTabWidget {
void onHideInstalledFilterChanged();
void onShowAllVersionsChanged();
void onOpenSourceFilterChanged();
void onReleaseFilterChanged();
private:
Ui::ModFilterWidget* ui;

View File

@ -63,8 +63,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>308</width>
<height>598</height>
<width>294</width>
<height>781</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@ -195,6 +195,43 @@
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="releaseGroup">
<property name="title">
<string>Release type</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QCheckBox" name="releaseCb">
<property name="text">
<string>Release</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="betaCb">
<property name="text">
<string>Beta</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="alphaCb">
<property name="text">
<string>Alpha</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="unknownCb">
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">