mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-11 04:37:37 -06:00
parent
518fd7cc1b
commit
62b5619bc1
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#include "logfiltermodel.h"
|
#include "logfiltermodel.h"
|
||||||
|
|
||||||
|
#include <QtVersionChecks>
|
||||||
|
|
||||||
#include "logmodel.h"
|
#include "logmodel.h"
|
||||||
|
|
||||||
LogFilterModel::LogFilterModel(const Log::MsgTypes types, QObject *parent)
|
LogFilterModel::LogFilterModel(const Log::MsgTypes types, QObject *parent)
|
||||||
@ -38,8 +40,14 @@ LogFilterModel::LogFilterModel(const Log::MsgTypes types, QObject *parent)
|
|||||||
|
|
||||||
void LogFilterModel::setMessageTypes(const Log::MsgTypes types)
|
void LogFilterModel::setMessageTypes(const Log::MsgTypes types)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
|
||||||
|
beginFilterChange();
|
||||||
|
m_types = types;
|
||||||
|
endFilterChange(Direction::Rows);
|
||||||
|
#else
|
||||||
m_types = types;
|
m_types = types;
|
||||||
invalidateRowsFilter();
|
invalidateRowsFilter();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LogFilterModel::filterAcceptsRow(const int sourceRow, const QModelIndex &sourceParent) const
|
bool LogFilterModel::filterAcceptsRow(const int sourceRow, const QModelIndex &sourceParent) const
|
||||||
|
|||||||
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include <QtVersionChecks>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
|
||||||
#include "base/bittorrent/infohash.h"
|
#include "base/bittorrent/infohash.h"
|
||||||
@ -125,44 +126,86 @@ void TransferListSortModel::sort(const int column, const Qt::SortOrder order)
|
|||||||
|
|
||||||
void TransferListSortModel::setStatusFilter(const TorrentFilter::Type filter)
|
void TransferListSortModel::setStatusFilter(const TorrentFilter::Type filter)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
|
||||||
|
beginFilterChange();
|
||||||
|
m_filter.setType(filter);
|
||||||
|
endFilterChange(Direction::Rows);
|
||||||
|
#else
|
||||||
if (m_filter.setType(filter))
|
if (m_filter.setType(filter))
|
||||||
invalidateRowsFilter();
|
invalidateRowsFilter();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListSortModel::setCategoryFilter(const QString &category)
|
void TransferListSortModel::setCategoryFilter(const QString &category)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
|
||||||
|
beginFilterChange();
|
||||||
|
m_filter.setCategory(category);
|
||||||
|
endFilterChange(Direction::Rows);
|
||||||
|
#else
|
||||||
if (m_filter.setCategory(category))
|
if (m_filter.setCategory(category))
|
||||||
invalidateRowsFilter();
|
invalidateRowsFilter();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListSortModel::disableCategoryFilter()
|
void TransferListSortModel::disableCategoryFilter()
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
|
||||||
|
beginFilterChange();
|
||||||
|
m_filter.setCategory(TorrentFilter::AnyCategory);
|
||||||
|
endFilterChange(Direction::Rows);
|
||||||
|
#else
|
||||||
if (m_filter.setCategory(TorrentFilter::AnyCategory))
|
if (m_filter.setCategory(TorrentFilter::AnyCategory))
|
||||||
invalidateRowsFilter();
|
invalidateRowsFilter();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListSortModel::setTagFilter(const Tag &tag)
|
void TransferListSortModel::setTagFilter(const Tag &tag)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
|
||||||
|
beginFilterChange();
|
||||||
|
m_filter.setTag(tag);
|
||||||
|
endFilterChange(Direction::Rows);
|
||||||
|
#else
|
||||||
if (m_filter.setTag(tag))
|
if (m_filter.setTag(tag))
|
||||||
invalidateRowsFilter();
|
invalidateRowsFilter();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListSortModel::disableTagFilter()
|
void TransferListSortModel::disableTagFilter()
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
|
||||||
|
beginFilterChange();
|
||||||
|
m_filter.setTag(TorrentFilter::AnyTag);
|
||||||
|
endFilterChange(Direction::Rows);
|
||||||
|
#else
|
||||||
if (m_filter.setTag(TorrentFilter::AnyTag))
|
if (m_filter.setTag(TorrentFilter::AnyTag))
|
||||||
invalidateRowsFilter();
|
invalidateRowsFilter();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListSortModel::setTrackerFilter(const QSet<BitTorrent::TorrentID> &torrentIDs)
|
void TransferListSortModel::setTrackerFilter(const QSet<BitTorrent::TorrentID> &torrentIDs)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
|
||||||
|
beginFilterChange();
|
||||||
|
m_filter.setTorrentIDSet(torrentIDs);
|
||||||
|
endFilterChange(Direction::Rows);
|
||||||
|
#else
|
||||||
if (m_filter.setTorrentIDSet(torrentIDs))
|
if (m_filter.setTorrentIDSet(torrentIDs))
|
||||||
invalidateRowsFilter();
|
invalidateRowsFilter();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListSortModel::disableTrackerFilter()
|
void TransferListSortModel::disableTrackerFilter()
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
|
||||||
|
beginFilterChange();
|
||||||
|
m_filter.setTorrentIDSet(TorrentFilter::AnyID);
|
||||||
|
endFilterChange(Direction::Rows);
|
||||||
|
#else
|
||||||
if (m_filter.setTorrentIDSet(TorrentFilter::AnyID))
|
if (m_filter.setTorrentIDSet(TorrentFilter::AnyID))
|
||||||
invalidateRowsFilter();
|
invalidateRowsFilter();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int TransferListSortModel::compare(const QModelIndex &left, const QModelIndex &right) const
|
int TransferListSortModel::compare(const QModelIndex &left, const QModelIndex &right) const
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user