source: trunk/qt/TorrentFilter.h @ 14539

Last change on this file since 14539 was 14539, checked in by mikedld, 6 years ago

Unify/prettify Qt client headers style

  • Property svn:keywords set to Date Rev Author Id
File size: 1.2 KB
Line 
1/*
2 * This file Copyright (C) 2009-2015 Mnemosyne LLC
3 *
4 * It may be used under the GNU GPL versions 2 or 3
5 * or any future license endorsed by Mnemosyne LLC.
6 *
7 * $Id: TorrentFilter.h 14539 2015-06-12 22:12:12Z mikedld $
8 */
9
10#ifndef QTR_TORRENT_FILTER_H
11#define QTR_TORRENT_FILTER_H
12
13#include <QSortFilterProxyModel>
14
15class QString;
16
17class FilterMode;
18class Prefs;
19class Torrent;
20
21class TorrentFilter: public QSortFilterProxyModel
22{
23    Q_OBJECT
24
25  public:
26    enum TextMode
27    {
28      FILTER_BY_NAME,
29      FILTER_BY_FILES,
30      FILTER_BY_TRACKER
31    };
32
33  public:
34    TorrentFilter (const Prefs& prefs);
35    virtual ~TorrentFilter ();
36
37    int hiddenRowCount () const;
38
39    void countTorrentsPerMode (int * setmeCounts) const;
40
41  protected:
42    // QSortFilterProxyModel
43    virtual bool filterAcceptsRow (int, const QModelIndex&) const;
44    virtual bool lessThan (const QModelIndex&, const QModelIndex&) const;
45
46  private:
47    bool activityFilterAcceptsTorrent (const Torrent * tor, const FilterMode& mode) const;
48    bool trackerFilterAcceptsTorrent (const Torrent * tor, const QString& tracker) const;
49
50  private slots:
51    void refreshPref (int key);
52
53  private:
54    const Prefs& myPrefs;
55};
56
57#endif // QTR_TORRENT_FILTER_H
Note: See TracBrowser for help on using the repository browser.