mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-26 14:34:30 +00:00
parent
9d58a189d7
commit
df9aa6dc36
@ -49,9 +49,11 @@
|
||||
#include "base/utils/misc.h"
|
||||
#include "addnewtorrentdialog.h"
|
||||
#include "guiiconprovider.h"
|
||||
#include "lineedit.h"
|
||||
#include "searchlistdelegate.h"
|
||||
#include "searchsortmodel.h"
|
||||
#include "ui_searchjobwidget.h"
|
||||
#include "utils.h"
|
||||
|
||||
SearchJobWidget::SearchJobWidget(SearchHandler *searchHandler, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
@ -126,6 +128,12 @@ SearchJobWidget::SearchJobWidget(SearchHandler *searchHandler, QWidget *parent)
|
||||
|
||||
updateFilter();
|
||||
|
||||
m_lineEditSearchResultsFilter = new LineEdit(this);
|
||||
m_lineEditSearchResultsFilter->setFixedWidth(Utils::Gui::scaledSize(this, 170));
|
||||
m_lineEditSearchResultsFilter->setPlaceholderText(tr("Filter search results..."));
|
||||
m_ui->horizontalLayout->insertWidget(0, m_lineEditSearchResultsFilter);
|
||||
|
||||
connect(m_lineEditSearchResultsFilter, &LineEdit::textChanged, this, &SearchJobWidget::filterSearchResults);
|
||||
connect(m_ui->filterMode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged)
|
||||
, this, &SearchJobWidget::updateFilter);
|
||||
connect(m_ui->minSeeds, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter);
|
||||
@ -327,6 +335,12 @@ void SearchJobWidget::fillFilterComboBoxes()
|
||||
m_ui->filterMode->setCurrentIndex((index == -1) ? 0 : index);
|
||||
}
|
||||
|
||||
void SearchJobWidget::filterSearchResults(const QString &name)
|
||||
{
|
||||
m_proxyModel->setFilterRegExp(QRegExp(name, Qt::CaseInsensitive));
|
||||
updateResultsCount();
|
||||
}
|
||||
|
||||
QString SearchJobWidget::statusText(SearchJobWidget::Status st)
|
||||
{
|
||||
switch (st) {
|
||||
|
@ -41,6 +41,7 @@ class QStandardItemModel;
|
||||
|
||||
template <typename T> class CachedSettingValue;
|
||||
|
||||
class LineEdit;
|
||||
class SearchHandler;
|
||||
class SearchListDelegate;
|
||||
class SearchSortModel;
|
||||
@ -93,6 +94,7 @@ private:
|
||||
void loadSettings();
|
||||
void saveSettings() const;
|
||||
void updateFilter();
|
||||
void filterSearchResults(const QString &name);
|
||||
void displayToggleColumnsMenu(const QPoint&);
|
||||
void onItemDoubleClicked(const QModelIndex &index);
|
||||
void searchFinished(bool cancelled);
|
||||
@ -115,6 +117,7 @@ private:
|
||||
QStandardItemModel *m_searchListModel;
|
||||
SearchSortModel *m_proxyModel;
|
||||
SearchListDelegate *m_searchDelegate;
|
||||
LineEdit *m_lineEditSearchResultsFilter;
|
||||
Status m_status = Status::Ongoing;
|
||||
bool m_noSearchResults = true;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user