|
|
@ -49,9 +49,11 @@ |
|
|
|
#include "base/utils/misc.h" |
|
|
|
#include "base/utils/misc.h" |
|
|
|
#include "addnewtorrentdialog.h" |
|
|
|
#include "addnewtorrentdialog.h" |
|
|
|
#include "guiiconprovider.h" |
|
|
|
#include "guiiconprovider.h" |
|
|
|
|
|
|
|
#include "lineedit.h" |
|
|
|
#include "searchlistdelegate.h" |
|
|
|
#include "searchlistdelegate.h" |
|
|
|
#include "searchsortmodel.h" |
|
|
|
#include "searchsortmodel.h" |
|
|
|
#include "ui_searchjobwidget.h" |
|
|
|
#include "ui_searchjobwidget.h" |
|
|
|
|
|
|
|
#include "utils.h" |
|
|
|
|
|
|
|
|
|
|
|
SearchJobWidget::SearchJobWidget(SearchHandler *searchHandler, QWidget *parent) |
|
|
|
SearchJobWidget::SearchJobWidget(SearchHandler *searchHandler, QWidget *parent) |
|
|
|
: QWidget(parent) |
|
|
|
: QWidget(parent) |
|
|
@ -126,6 +128,12 @@ SearchJobWidget::SearchJobWidget(SearchHandler *searchHandler, QWidget *parent) |
|
|
|
|
|
|
|
|
|
|
|
updateFilter(); |
|
|
|
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) |
|
|
|
connect(m_ui->filterMode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged) |
|
|
|
, this, &SearchJobWidget::updateFilter); |
|
|
|
, this, &SearchJobWidget::updateFilter); |
|
|
|
connect(m_ui->minSeeds, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter); |
|
|
|
connect(m_ui->minSeeds, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter); |
|
|
@ -190,6 +198,11 @@ int SearchJobWidget::visibleResultsCount() const |
|
|
|
return m_proxyModel->rowCount(); |
|
|
|
return m_proxyModel->rowCount(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LineEdit *SearchJobWidget::lineEditSearchResultsFilter() const |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return m_lineEditSearchResultsFilter; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void SearchJobWidget::cancelSearch() |
|
|
|
void SearchJobWidget::cancelSearch() |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_searchHandler->cancelSearch(); |
|
|
|
m_searchHandler->cancelSearch(); |
|
|
@ -327,6 +340,12 @@ void SearchJobWidget::fillFilterComboBoxes() |
|
|
|
m_ui->filterMode->setCurrentIndex((index == -1) ? 0 : index); |
|
|
|
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) |
|
|
|
QString SearchJobWidget::statusText(SearchJobWidget::Status st) |
|
|
|
{ |
|
|
|
{ |
|
|
|
switch (st) { |
|
|
|
switch (st) { |
|
|
|