~ubuntu-branches/ubuntu/maverick/transmission/maverick

« back to all changes in this revision

Viewing changes to qt/torrent-filter.h

  • Committer: Bazaar Package Importer
  • Author(s): Krzysztof Klimonda
  • Date: 2009-05-22 21:57:30 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (2.1.18 sid) (1.3.8 upstream)
  • mto: This revision was merged to the branch mainline in revision 36.
  • Revision ID: james.westby@ubuntu.com-20090522215730-ly5kgv5aw9ig2u82
Tags: upstream-1.61
ImportĀ upstreamĀ versionĀ 1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
21
struct Prefs;
 
22
struct QString;
 
23
 
 
24
class 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