mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 00:17:23 -06:00
Switch to lightweight function for filtering data
We can use this function since the columns doesn't change. PR #20518.
This commit is contained in:
@@ -39,7 +39,7 @@ LogFilterModel::LogFilterModel(const Log::MsgTypes types, QObject *parent)
|
|||||||
void LogFilterModel::setMessageTypes(const Log::MsgTypes types)
|
void LogFilterModel::setMessageTypes(const Log::MsgTypes types)
|
||||||
{
|
{
|
||||||
m_types = types;
|
m_types = types;
|
||||||
invalidateFilter();
|
invalidateRowsFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LogFilterModel::filterAcceptsRow(const int sourceRow, const QModelIndex &sourceParent) const
|
bool LogFilterModel::filterAcceptsRow(const int sourceRow, const QModelIndex &sourceParent) const
|
||||||
|
|||||||
@@ -112,46 +112,46 @@ void TransferListSortModel::sort(const int column, const Qt::SortOrder order)
|
|||||||
QSortFilterProxyModel::sort(column, order);
|
QSortFilterProxyModel::sort(column, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListSortModel::setStatusFilter(TorrentFilter::Type filter)
|
void TransferListSortModel::setStatusFilter(const TorrentFilter::Type filter)
|
||||||
{
|
{
|
||||||
if (m_filter.setType(filter))
|
if (m_filter.setType(filter))
|
||||||
invalidateFilter();
|
invalidateRowsFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListSortModel::setCategoryFilter(const QString &category)
|
void TransferListSortModel::setCategoryFilter(const QString &category)
|
||||||
{
|
{
|
||||||
if (m_filter.setCategory(category))
|
if (m_filter.setCategory(category))
|
||||||
invalidateFilter();
|
invalidateRowsFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListSortModel::disableCategoryFilter()
|
void TransferListSortModel::disableCategoryFilter()
|
||||||
{
|
{
|
||||||
if (m_filter.setCategory(TorrentFilter::AnyCategory))
|
if (m_filter.setCategory(TorrentFilter::AnyCategory))
|
||||||
invalidateFilter();
|
invalidateRowsFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListSortModel::setTagFilter(const Tag &tag)
|
void TransferListSortModel::setTagFilter(const Tag &tag)
|
||||||
{
|
{
|
||||||
if (m_filter.setTag(tag))
|
if (m_filter.setTag(tag))
|
||||||
invalidateFilter();
|
invalidateRowsFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListSortModel::disableTagFilter()
|
void TransferListSortModel::disableTagFilter()
|
||||||
{
|
{
|
||||||
if (m_filter.setTag(TorrentFilter::AnyTag))
|
if (m_filter.setTag(TorrentFilter::AnyTag))
|
||||||
invalidateFilter();
|
invalidateRowsFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListSortModel::setTrackerFilter(const QSet<BitTorrent::TorrentID> &torrentIDs)
|
void TransferListSortModel::setTrackerFilter(const QSet<BitTorrent::TorrentID> &torrentIDs)
|
||||||
{
|
{
|
||||||
if (m_filter.setTorrentIDSet(torrentIDs))
|
if (m_filter.setTorrentIDSet(torrentIDs))
|
||||||
invalidateFilter();
|
invalidateRowsFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListSortModel::disableTrackerFilter()
|
void TransferListSortModel::disableTrackerFilter()
|
||||||
{
|
{
|
||||||
if (m_filter.setTorrentIDSet(TorrentFilter::AnyID))
|
if (m_filter.setTorrentIDSet(TorrentFilter::AnyID))
|
||||||
invalidateFilter();
|
invalidateRowsFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
int TransferListSortModel::compare(const QModelIndex &left, const QModelIndex &right) const
|
int TransferListSortModel::compare(const QModelIndex &left, const QModelIndex &right) const
|
||||||
|
|||||||
Reference in New Issue
Block a user