|
|
@ -131,6 +131,8 @@ SearchJobWidget::SearchJobWidget(SearchHandler *searchHandler, QWidget *parent) |
|
|
|
m_lineEditSearchResultsFilter = new LineEdit(this); |
|
|
|
m_lineEditSearchResultsFilter = new LineEdit(this); |
|
|
|
m_lineEditSearchResultsFilter->setFixedWidth(Utils::Gui::scaledSize(this, 170)); |
|
|
|
m_lineEditSearchResultsFilter->setFixedWidth(Utils::Gui::scaledSize(this, 170)); |
|
|
|
m_lineEditSearchResultsFilter->setPlaceholderText(tr("Filter search results...")); |
|
|
|
m_lineEditSearchResultsFilter->setPlaceholderText(tr("Filter search results...")); |
|
|
|
|
|
|
|
m_lineEditSearchResultsFilter->setContextMenuPolicy(Qt::CustomContextMenu); |
|
|
|
|
|
|
|
connect(m_lineEditSearchResultsFilter, &QWidget::customContextMenuRequested, this, &SearchJobWidget::showFilterContextMenu); |
|
|
|
m_ui->horizontalLayout->insertWidget(0, m_lineEditSearchResultsFilter); |
|
|
|
m_ui->horizontalLayout->insertWidget(0, m_lineEditSearchResultsFilter); |
|
|
|
|
|
|
|
|
|
|
|
connect(m_lineEditSearchResultsFilter, &LineEdit::textChanged, this, &SearchJobWidget::filterSearchResults); |
|
|
|
connect(m_lineEditSearchResultsFilter, &LineEdit::textChanged, this, &SearchJobWidget::filterSearchResults); |
|
|
@ -342,10 +344,29 @@ void SearchJobWidget::fillFilterComboBoxes() |
|
|
|
|
|
|
|
|
|
|
|
void SearchJobWidget::filterSearchResults(const QString &name) |
|
|
|
void SearchJobWidget::filterSearchResults(const QString &name) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_proxyModel->setFilterRegExp(QRegExp(name, Qt::CaseInsensitive)); |
|
|
|
const QRegExp::PatternSyntax patternSyntax = Preferences::instance()->getRegexAsFilteringPatternForSearchJob() |
|
|
|
|
|
|
|
? QRegExp::RegExp : QRegExp::WildcardUnix; |
|
|
|
|
|
|
|
m_proxyModel->setFilterRegExp(QRegExp(name, Qt::CaseInsensitive, patternSyntax)); |
|
|
|
updateResultsCount(); |
|
|
|
updateResultsCount(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SearchJobWidget::showFilterContextMenu(const QPoint &) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
const Preferences *pref = Preferences::instance(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QMenu *menu = m_lineEditSearchResultsFilter->createStandardContextMenu(); |
|
|
|
|
|
|
|
menu->addSeparator(); |
|
|
|
|
|
|
|
QAction *useRegexAct = new QAction(tr("Use regular expressions"), menu); |
|
|
|
|
|
|
|
useRegexAct->setCheckable(true); |
|
|
|
|
|
|
|
useRegexAct->setChecked(pref->getRegexAsFilteringPatternForSearchJob()); |
|
|
|
|
|
|
|
menu->addAction(useRegexAct); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(useRegexAct, &QAction::toggled, pref, &Preferences::setRegexAsFilteringPatternForSearchJob); |
|
|
|
|
|
|
|
connect(useRegexAct, &QAction::toggled, this, [this]() { filterSearchResults(m_lineEditSearchResultsFilter->text()); }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
menu->exec(QCursor::pos()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QString SearchJobWidget::statusText(SearchJobWidget::Status st) |
|
|
|
QString SearchJobWidget::statusText(SearchJobWidget::Status st) |
|
|
|
{ |
|
|
|
{ |
|
|
|
switch (st) { |
|
|
|
switch (st) { |
|
|
|