fix: 'All' filter working and get around CF API capabilities
This commit is contained in:
@ -64,7 +64,6 @@ void ModPage::filterMods()
|
||||
m_filter = filter_dialog.getFilter();
|
||||
|
||||
listModel->refresh();
|
||||
|
||||
if(ui->versionSelectionBox->count() > 0){
|
||||
ui->versionSelectionBox->clear();
|
||||
updateModVersions();
|
||||
@ -164,14 +163,14 @@ void ModPage::updateModVersions()
|
||||
for (int i = 0; i < current.versions.size(); i++) {
|
||||
auto version = current.versions[i];
|
||||
bool valid = false;
|
||||
//NOTE: Flame doesn't care about loaderString, so passing it changes nothing.
|
||||
for(auto& mcVer : m_filter->versions){
|
||||
//NOTE: Flame doesn't care about loaderString, so passing it changes nothing.
|
||||
if (validateVersion(version, mcVer.toString(), loaderString)) {
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(valid)
|
||||
if(valid || m_filter->versions.size() == 0)
|
||||
ui->versionSelectionBox->addItem(version.version, QVariant(i));
|
||||
}
|
||||
if (ui->versionSelectionBox->count() == 0) { ui->versionSelectionBox->addItem(tr("No valid version found!"), QVariant(-1)); }
|
||||
|
@ -54,7 +54,7 @@ class ModPage : public QWidget, public BasePage {
|
||||
void updateSelectionButton();
|
||||
|
||||
protected slots:
|
||||
void filterMods();
|
||||
virtual void filterMods();
|
||||
void triggerSearch();
|
||||
void onSelectionChanged(QModelIndex first, QModelIndex second);
|
||||
void onVersionSelectionChanged(QString data);
|
||||
|
@ -67,6 +67,25 @@ auto FlameModPage::validateVersion(ModPlatform::IndexedVersion& ver, QString min
|
||||
return ver.mcVersion.contains(mineVer);
|
||||
}
|
||||
|
||||
// We override this so that it refreshes correctly, otherwise it wouldn't show
|
||||
// any mod on the mod list, because the CF API does not support it :(
|
||||
void FlameModPage::filterMods()
|
||||
{
|
||||
filter_dialog.execWithInstance(static_cast<MinecraftInstance*>(m_instance));
|
||||
|
||||
int prev_size = m_filter->versions.size();
|
||||
m_filter = filter_dialog.getFilter();
|
||||
int new_size = m_filter->versions.size();
|
||||
|
||||
if(new_size <= 1 && new_size != prev_size)
|
||||
listModel->refresh();
|
||||
|
||||
if(ui->versionSelectionBox->count() > 0){
|
||||
ui->versionSelectionBox->clear();
|
||||
updateModVersions();
|
||||
}
|
||||
}
|
||||
|
||||
// I don't know why, but doing this on the parent class makes it so that
|
||||
// other mod providers start loading before being selected, at least with
|
||||
// my Qt, so we need to implement this in every derived class...
|
||||
|
@ -56,5 +56,7 @@ class FlameModPage : public ModPage {
|
||||
|
||||
auto validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, QString loaderVer = "") const -> bool override;
|
||||
|
||||
void filterMods() override;
|
||||
|
||||
auto shouldDisplay() const -> bool override;
|
||||
};
|
||||
|
Reference in New Issue
Block a user