Connected filters

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2023-10-21 18:28:33 +03:00
parent 4850434c67
commit 9e85297f7a
23 changed files with 214 additions and 152 deletions

View File

@@ -399,12 +399,17 @@ void ResourceModel::searchRequestSucceeded(QJsonDocument& doc)
m_search_state = SearchState::CanFetchMore;
}
QList<ModPlatform::IndexedPack::Ptr> filteredNewList;
for (auto p : newList)
if (checkFilters(p))
filteredNewList << p;
// When you have a Qt build with assertions turned on, proceeding here will abort the application
if (newList.size() == 0)
if (filteredNewList.size() == 0)
return;
beginInsertRows(QModelIndex(), m_packs.size(), m_packs.size() + newList.size() - 1);
m_packs.append(newList);
beginInsertRows(QModelIndex(), m_packs.size(), m_packs.size() + filteredNewList.size() - 1);
m_packs.append(filteredNewList);
endInsertRows();
}
@@ -547,4 +552,8 @@ void ResourceModel::removePack(const QString& rem)
ver.is_currently_selected = false;
}
bool ResourceModel::checkVersionFilters(const ModPlatform::IndexedVersion& v)
{
return (!optedOut(v));
}
} // namespace ResourceDownload