2
* This file Copyright (C) 2009 Charles Kerr <charles@transmissionbt.com>
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.
13
#ifndef QTR_TORRENT_FILTER_H
14
#define QTR_TORRENT_FILTER_H
16
#include <QSortFilterProxyModel>
20
class TorrentFilter: public QSortFilterProxyModel
25
TorrentFilter( Prefs& prefs );
26
virtual ~TorrentFilter( );
29
enum ShowMode { SHOW_ALL, SHOW_ACTIVE, SHOW_DOWNLOADING, SHOW_SEEDING, SHOW_PAUSED };
30
ShowMode getShowMode( ) const { return myShowMode; }
32
enum TextMode { FILTER_BY_NAME, FILTER_BY_FILES, FILTER_BY_TRACKER };
33
TextMode getTextMode( ) const { return myTextMode; }
35
enum SortMode{ SORT_BY_ACTIVITY, SORT_BY_AGE, SORT_BY_ETA, SORT_BY_NAME,
36
SORT_BY_PROGRESS, SORT_BY_RATIO, SORT_BY_SIZE,
37
SORT_BY_STATE, SORT_BY_TRACKER, SORT_BY_ID };
38
const char * getSortKey( int mode=-1 );
39
SortMode getSortMode( ) const { return mySortMode; }
41
bool isAscending( ) const { return myIsAscending; }
43
int hiddenRowCount( ) const;
47
void setShowMode( int showMode );
48
void setTextMode( int textMode );
49
void setSortMode( int sortMode );
50
void setText( QString );
51
void sortByActivity( );
56
void sortByProgress( );
60
void sortByTracker( );
61
void setAscending( bool );
65
virtual bool filterAcceptsRow( int, const QModelIndex& ) const;
66
virtual bool lessThan( const QModelIndex&, const QModelIndex& ) const;