mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 12:28:52 +00:00
* refactor: Torrent::update() returns a delta bitset Setting up for followup PRs where, instead of doing expensive work every time there is a change, we can be more fine-grained and do the work only if the relevant Torrent properties changed. * chore: make uncrustify happy * refactor: update filterbar counts more selectively Only rebuild the activity and tracker combobox models when the model's size changes or when the relevant Torrent properties change. Previously, rebuild would happen on any Torrent property change even if the properties were unrelated to activity or trackers. * chore: remove redundant "private:" key
53 lines
981 B
C++
53 lines
981 B
C++
/*
|
|
* This file Copyright (C) 2009-2015 Mnemosyne LLC
|
|
*
|
|
* It may be used under the GNU GPL versions 2 or 3
|
|
* or any future license endorsed by Mnemosyne LLC.
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <array>
|
|
|
|
#include <QSortFilterProxyModel>
|
|
#include <QTimer>
|
|
|
|
#include "Filters.h"
|
|
|
|
class QString;
|
|
|
|
class FilterMode;
|
|
class Prefs;
|
|
class Torrent;
|
|
|
|
class TorrentFilter : public QSortFilterProxyModel
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
enum TextMode
|
|
{
|
|
FILTER_BY_NAME,
|
|
FILTER_BY_FILES,
|
|
FILTER_BY_TRACKER
|
|
};
|
|
|
|
public:
|
|
explicit TorrentFilter(Prefs const& prefs);
|
|
[[nodiscard]] std::array<int, FilterMode::NUM_MODES> countTorrentsPerMode() const;
|
|
|
|
protected:
|
|
// QSortFilterProxyModel
|
|
bool filterAcceptsRow(int, QModelIndex const&) const override;
|
|
bool lessThan(QModelIndex const&, QModelIndex const&) const override;
|
|
|
|
private slots:
|
|
void onPrefChanged(int key);
|
|
void refilter();
|
|
|
|
private:
|
|
QTimer refilter_timer_;
|
|
Prefs const& prefs_;
|
|
};
|