2010-07-30 22:31:31 +00:00
|
|
|
/*
|
2015-06-10 21:27:11 +00:00
|
|
|
* This file Copyright (C) 2010-2015 Mnemosyne LLC
|
2010-07-30 22:31:31 +00:00
|
|
|
*
|
2014-01-21 03:10:30 +00:00
|
|
|
* It may be used under the GNU GPL versions 2 or 3
|
2014-01-19 01:09:44 +00:00
|
|
|
* or any future license endorsed by Mnemosyne LLC.
|
2010-07-30 22:31:31 +00:00
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*/
|
|
|
|
|
2015-06-10 21:27:11 +00:00
|
|
|
#ifndef QTR_FILTER_BAR_H
|
|
|
|
#define QTR_FILTER_BAR_H
|
2010-07-30 22:31:31 +00:00
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
2013-02-01 20:58:55 +00:00
|
|
|
class QLabel;
|
2010-07-30 22:31:31 +00:00
|
|
|
class QStandardItemModel;
|
|
|
|
class QTimer;
|
|
|
|
|
2015-06-10 21:27:11 +00:00
|
|
|
class FilterBarComboBox;
|
|
|
|
class FilterBarLineEdit;
|
2010-07-30 22:31:31 +00:00
|
|
|
class Prefs;
|
|
|
|
class TorrentFilter;
|
|
|
|
class TorrentModel;
|
|
|
|
|
|
|
|
class FilterBar: public QWidget
|
|
|
|
{
|
2013-01-26 01:19:54 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2015-06-12 22:12:12 +00:00
|
|
|
FilterBar (Prefs& prefs, const TorrentModel& torrents, const TorrentFilter& filter, QWidget * parent = nullptr);
|
|
|
|
virtual ~FilterBar ();
|
2013-01-26 01:19:54 +00:00
|
|
|
|
2015-10-24 20:56:45 +00:00
|
|
|
public slots:
|
|
|
|
void clear ();
|
|
|
|
|
2013-01-26 01:19:54 +00:00
|
|
|
private:
|
2015-06-12 22:12:12 +00:00
|
|
|
FilterBarComboBox * createTrackerCombo (QStandardItemModel *);
|
2013-02-02 22:29:14 +00:00
|
|
|
FilterBarComboBox * createActivityCombo ();
|
2013-01-26 01:19:54 +00:00
|
|
|
void refreshTrackers ();
|
|
|
|
QString getCountString (int n) const;
|
|
|
|
|
|
|
|
private slots:
|
2015-08-17 08:14:45 +00:00
|
|
|
void recountSoon ();
|
2013-01-26 01:19:54 +00:00
|
|
|
void recount ();
|
|
|
|
void refreshPref (int key);
|
|
|
|
void onActivityIndexChanged (int index);
|
|
|
|
void onTrackerIndexChanged (int index);
|
|
|
|
void onTextChanged (const QString&);
|
2015-06-12 22:12:12 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Prefs& myPrefs;
|
|
|
|
const TorrentModel& myTorrents;
|
|
|
|
const TorrentFilter& myFilter;
|
|
|
|
|
|
|
|
FilterBarComboBox * myActivityCombo;
|
|
|
|
FilterBarComboBox * myTrackerCombo;
|
|
|
|
QLabel * myCountLabel;
|
|
|
|
QStandardItemModel * myTrackerModel;
|
|
|
|
QTimer * myRecountTimer;
|
|
|
|
bool myIsBootstrapping;
|
|
|
|
FilterBarLineEdit * myLineEdit;
|
2010-07-30 22:31:31 +00:00
|
|
|
};
|
|
|
|
|
2015-06-10 21:27:11 +00:00
|
|
|
#endif // QTR_FILTER_BAR_H
|