mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-06-12 13:17:41 +02:00
add open source filter
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
@ -134,6 +134,7 @@ ModFilterWidget::ModFilterWidget(MinecraftInstance* instance, bool extended, QWi
|
||||
ui->versions->hide();
|
||||
ui->showAllVersions->hide();
|
||||
ui->environmentGroup->hide();
|
||||
ui->openSource->hide();
|
||||
}
|
||||
|
||||
ui->versions->setStyleSheet("combobox-popup: 0;");
|
||||
@ -159,6 +160,7 @@ ModFilterWidget::ModFilterWidget(MinecraftInstance* instance, bool extended, QWi
|
||||
}
|
||||
|
||||
connect(ui->hideInstalled, &QCheckBox::stateChanged, this, &ModFilterWidget::onHideInstalledFilterChanged);
|
||||
connect(ui->openSource, &QCheckBox::stateChanged, this, &ModFilterWidget::onOpenSourceFilterChanged);
|
||||
|
||||
setHidden(true);
|
||||
loadVersionList();
|
||||
@ -208,6 +210,7 @@ void ModFilterWidget::loadVersionList()
|
||||
|
||||
void ModFilterWidget::prepareBasicFilter()
|
||||
{
|
||||
m_filter->openSource = false;
|
||||
if (m_instance) {
|
||||
m_filter->hideInstalled = false;
|
||||
m_filter->side = ""; // or "both"
|
||||
@ -337,4 +340,13 @@ void ModFilterWidget::setCategories(const QList<ModPlatform::Category>& categori
|
||||
}
|
||||
}
|
||||
|
||||
#include "ModFilterWidget.moc"
|
||||
void ModFilterWidget::onOpenSourceFilterChanged()
|
||||
{
|
||||
auto open = ui->openSource->isChecked();
|
||||
m_filter_changed = open != m_filter->openSource;
|
||||
m_filter->openSource = open;
|
||||
if (m_filter_changed)
|
||||
emit filterChanged();
|
||||
}
|
||||
|
||||
#include "ModFilterWidget.moc"
|
||||
|
@ -64,11 +64,12 @@ class ModFilterWidget : public QTabWidget {
|
||||
QString side;
|
||||
bool hideInstalled;
|
||||
QStringList categoryIds;
|
||||
bool openSource;
|
||||
|
||||
bool operator==(const Filter& other) const
|
||||
{
|
||||
return hideInstalled == other.hideInstalled && side == other.side && loaders == other.loaders && versions == other.versions &&
|
||||
releases == other.releases && categoryIds == other.categoryIds;
|
||||
releases == other.releases && categoryIds == other.categoryIds && openSource == other.openSource;
|
||||
}
|
||||
bool operator!=(const Filter& other) const { return !(*this == other); }
|
||||
|
||||
@ -107,6 +108,7 @@ class ModFilterWidget : public QTabWidget {
|
||||
void onSideFilterChanged();
|
||||
void onHideInstalledFilterChanged();
|
||||
void onShowAllVersionsChanged();
|
||||
void onOpenSourceFilterChanged();
|
||||
|
||||
private:
|
||||
Ui::ModFilterWidget* ui;
|
||||
|
@ -188,6 +188,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="openSource">
|
||||
<property name="text">
|
||||
<string>Open Source only</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
Reference in New Issue
Block a user