1 | /* |
---|
2 | * This file Copyright (C) 2010-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: FilterBar.h 14539 2015-06-12 22:12:12Z mikedld $ |
---|
8 | */ |
---|
9 | |
---|
10 | #ifndef QTR_FILTER_BAR_H |
---|
11 | #define QTR_FILTER_BAR_H |
---|
12 | |
---|
13 | #include <QWidget> |
---|
14 | |
---|
15 | class QLabel; |
---|
16 | class QStandardItemModel; |
---|
17 | class QTimer; |
---|
18 | |
---|
19 | class FilterBarComboBox; |
---|
20 | class FilterBarLineEdit; |
---|
21 | class Prefs; |
---|
22 | class TorrentFilter; |
---|
23 | class TorrentModel; |
---|
24 | |
---|
25 | class FilterBar: public QWidget |
---|
26 | { |
---|
27 | Q_OBJECT |
---|
28 | |
---|
29 | public: |
---|
30 | FilterBar (Prefs& prefs, const TorrentModel& torrents, const TorrentFilter& filter, QWidget * parent = nullptr); |
---|
31 | virtual ~FilterBar (); |
---|
32 | |
---|
33 | private: |
---|
34 | FilterBarComboBox * createTrackerCombo (QStandardItemModel *); |
---|
35 | FilterBarComboBox * createActivityCombo (); |
---|
36 | void recountSoon (); |
---|
37 | void refreshTrackers (); |
---|
38 | QString getCountString (int n) const; |
---|
39 | |
---|
40 | private slots: |
---|
41 | void recount (); |
---|
42 | void refreshPref (int key); |
---|
43 | void refreshCountLabel (); |
---|
44 | void onActivityIndexChanged (int index); |
---|
45 | void onTrackerIndexChanged (int index); |
---|
46 | void onTorrentModelReset (); |
---|
47 | void onTorrentModelRowsInserted (const QModelIndex&, int, int); |
---|
48 | void onTorrentModelRowsRemoved (const QModelIndex&, int, int); |
---|
49 | void onTorrentModelDataChanged (const QModelIndex&, const QModelIndex&); |
---|
50 | void onTextChanged (const QString&); |
---|
51 | |
---|
52 | private: |
---|
53 | Prefs& myPrefs; |
---|
54 | const TorrentModel& myTorrents; |
---|
55 | const TorrentFilter& myFilter; |
---|
56 | |
---|
57 | FilterBarComboBox * myActivityCombo; |
---|
58 | FilterBarComboBox * myTrackerCombo; |
---|
59 | QLabel * myCountLabel; |
---|
60 | QStandardItemModel * myTrackerModel; |
---|
61 | QTimer * myRecountTimer; |
---|
62 | bool myIsBootstrapping; |
---|
63 | FilterBarLineEdit * myLineEdit; |
---|
64 | }; |
---|
65 | |
---|
66 | #endif // QTR_FILTER_BAR_H |
---|