source: trunk/qt/torrent-filter.h @ 8216

Last change on this file since 8216 was 8216, checked in by charles, 13 years ago

(qt) better integration of sort & filter modes into the preferences mechanism

File size: 1.3 KB
Line 
1/*
2 * This file Copyright (C) 2009 Charles Kerr <charles@transmissionbt.com>
3 *
4 * This file is licensed by the GPL version 2.  Works owned by the
5 * Transmission project are granted a special exemption to clause 2(b)
6 * so that the bulk of its code can remain under the MIT license.
7 * This exemption does not extend to derived works not owned by
8 * the Transmission project.
9 *
10 * $Id:$
11 */
12
13#ifndef QTR_TORRENT_FILTER_H
14#define QTR_TORRENT_FILTER_H
15
16#include <QSortFilterProxyModel>
17#include <QMetaType>
18#include <QVariant>
19
20
21struct Prefs;
22struct QString;
23
24class TorrentFilter: public QSortFilterProxyModel
25{
26        Q_OBJECT
27
28    public:
29        TorrentFilter( Prefs& prefs );
30        virtual ~TorrentFilter( );
31
32    public:
33        enum TextMode { FILTER_BY_NAME, FILTER_BY_FILES, FILTER_BY_TRACKER };
34        TextMode getTextMode( ) const { return myTextMode; }
35        int hiddenRowCount( ) const;
36
37    public slots:
38        void setTextMode( int textMode );
39        void setText( QString );
40
41    private slots:
42        void refreshPref( int key );
43
44    protected:
45        virtual bool filterAcceptsRow( int, const QModelIndex& ) const;
46        virtual bool lessThan( const QModelIndex&, const QModelIndex& ) const;
47
48    private:
49        Prefs& myPrefs;
50        TextMode myTextMode;
51        QString myText;
52};
53
54#endif
Note: See TracBrowser for help on using the repository browser.