transmission/qt/FilterBar.h

63 lines
1.3 KiB
C
Raw Normal View History

/*
* This file Copyright (C) 2010-2015 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3
* or any future license endorsed by Mnemosyne LLC.
*
*/
#pragma once
#include <unordered_map>
#include <QWidget>
class QLabel;
2017-02-11 10:44:34 +00:00
class QLineEdit;
class QStandardItemModel;
class QTimer;
class FilterBarComboBox;
class Prefs;
class TorrentFilter;
class TorrentModel;
class FilterBar : public QWidget
{
Q_OBJECT
public:
FilterBar(Prefs& prefs, TorrentModel const& torrents, TorrentFilter const& filter, QWidget* parent = nullptr);
virtual ~FilterBar();
public slots:
void clear();
private:
FilterBarComboBox* createTrackerCombo(QStandardItemModel*);
FilterBarComboBox* createActivityCombo();
void refreshTrackers();
private slots:
void recountSoon();
void recount();
void refreshPref(int key);
void onActivityIndexChanged(int index);
void onTrackerIndexChanged(int index);
void onTextChanged(QString const&);
2015-06-12 22:12:12 +00:00
private:
2015-06-12 22:12:12 +00:00
Prefs& myPrefs;
TorrentModel const& myTorrents;
TorrentFilter const& myFilter;
2015-06-12 22:12:12 +00:00
FilterBarComboBox* myActivityCombo;
FilterBarComboBox* myTrackerCombo;
QLabel* myCountLabel;
QStandardItemModel* myTrackerModel;
QTimer* myRecountTimer;
2015-06-12 22:12:12 +00:00
bool myIsBootstrapping;
QLineEdit* myLineEdit;
std::map<QString, int> myTrackerCounts;
};