2009-04-09 18:55:47 +00:00
|
|
|
/*
|
|
|
|
* This file Copyright (C) 2009 Charles Kerr <charles@transmissionbt.com>
|
|
|
|
*
|
|
|
|
* This file is licensed by the GPL version 2. Works owned by the
|
|
|
|
* Transmission project are granted a special exemption to clause 2(b)
|
|
|
|
* so that the bulk of its code can remain under the MIT license.
|
|
|
|
* This exemption does not extend to derived works not owned by
|
|
|
|
* the Transmission project.
|
|
|
|
*
|
|
|
|
* $Id:$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QTR_TORRENT_FILTER_H
|
|
|
|
#define QTR_TORRENT_FILTER_H
|
|
|
|
|
|
|
|
#include <QSortFilterProxyModel>
|
2009-04-11 18:25:12 +00:00
|
|
|
#include <QMetaType>
|
|
|
|
#include <QVariant>
|
|
|
|
|
2009-04-09 18:55:47 +00:00
|
|
|
|
|
|
|
struct Prefs;
|
2009-04-10 03:48:19 +00:00
|
|
|
struct QString;
|
2009-04-09 18:55:47 +00:00
|
|
|
|
|
|
|
class TorrentFilter: public QSortFilterProxyModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
TorrentFilter( Prefs& prefs );
|
|
|
|
virtual ~TorrentFilter( );
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum TextMode { FILTER_BY_NAME, FILTER_BY_FILES, FILTER_BY_TRACKER };
|
|
|
|
TextMode getTextMode( ) const { return myTextMode; }
|
|
|
|
int hiddenRowCount( ) const;
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void setTextMode( int textMode );
|
|
|
|
void setText( QString );
|
2009-04-11 18:25:12 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void refreshPref( int key );
|
2009-04-09 18:55:47 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual bool filterAcceptsRow( int, const QModelIndex& ) const;
|
|
|
|
virtual bool lessThan( const QModelIndex&, const QModelIndex& ) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
Prefs& myPrefs;
|
|
|
|
TextMode myTextMode;
|
|
|
|
QString myText;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|