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
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-03-29 16:37:21 +00:00
|
|
|
#pragma once
|
2010-07-30 22:31:31 +00:00
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
2013-02-01 20:58:55 +00:00
|
|
|
class QLabel;
|
2017-02-11 10:44:34 +00:00
|
|
|
class QLineEdit;
|
2010-07-30 22:31:31 +00:00
|
|
|
class QStandardItemModel;
|
|
|
|
class QTimer;
|
|
|
|
|
2015-06-10 21:27:11 +00:00
|
|
|
class FilterBarComboBox;
|
2010-07-30 22:31:31 +00:00
|
|
|
class Prefs;
|
|
|
|
class TorrentFilter;
|
|
|
|
class TorrentModel;
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
class FilterBar : public QWidget
|
2010-07-30 22:31:31 +00:00
|
|
|
{
|
2013-01-26 01:19:54 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
public:
|
2017-04-20 16:02:19 +00:00
|
|
|
FilterBar(Prefs& prefs, TorrentModel const& torrents, TorrentFilter const& filter, QWidget* parent = nullptr);
|
2017-04-19 12:04:45 +00:00
|
|
|
virtual ~FilterBar();
|
2013-01-26 01:19:54 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
public slots:
|
|
|
|
void clear();
|
2015-10-24 20:56:45 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
private:
|
|
|
|
FilterBarComboBox* createTrackerCombo(QStandardItemModel*);
|
|
|
|
FilterBarComboBox* createActivityCombo();
|
|
|
|
void refreshTrackers();
|
|
|
|
QString getCountString(int n) const;
|
2013-01-26 01:19:54 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
private slots:
|
|
|
|
void recountSoon();
|
|
|
|
void recount();
|
|
|
|
void refreshPref(int key);
|
|
|
|
void onActivityIndexChanged(int index);
|
|
|
|
void onTrackerIndexChanged(int index);
|
2017-04-20 16:02:19 +00:00
|
|
|
void onTextChanged(QString const&);
|
2015-06-12 22:12:12 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
private:
|
2015-06-12 22:12:12 +00:00
|
|
|
Prefs& myPrefs;
|
2017-04-20 16:02:19 +00:00
|
|
|
TorrentModel const& myTorrents;
|
|
|
|
TorrentFilter const& myFilter;
|
2015-06-12 22:12:12 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
FilterBarComboBox* myActivityCombo;
|
|
|
|
FilterBarComboBox* myTrackerCombo;
|
|
|
|
QLabel* myCountLabel;
|
|
|
|
QStandardItemModel* myTrackerModel;
|
|
|
|
QTimer* myRecountTimer;
|
2015-06-12 22:12:12 +00:00
|
|
|
bool myIsBootstrapping;
|
2017-04-19 12:04:45 +00:00
|
|
|
QLineEdit* myLineEdit;
|
2010-07-30 22:31:31 +00:00
|
|
|
};
|