mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-21 16:55:46 +03:00
Search: Lax separator matching when filtering results
Any separator will now match any other separator when filtering search results. Example: Type "live server" in filter. Currently it would only match "live server". Consequently, if you type "live.server" it will only match "live.server" and not "live server" even though the user likely wants to see both. With this update any separator now matches any other separator; A space now matches `.` `-` `_`, an underscore also matches a space and a dash, etcetera. This means that a filter of "live server" will now show "live.server" in the results. This is a lot more intuitive in my opinion.
This commit is contained in:
parent
1c43286616
commit
08dae5feea
1 changed files with 6 additions and 2 deletions
|
@ -395,8 +395,12 @@ void SearchJobWidget::fillFilterComboBoxes()
|
|||
|
||||
void SearchJobWidget::filterSearchResults(const QString &name)
|
||||
{
|
||||
const QString pattern = (Preferences::instance()->getRegexAsFilteringPatternForSearchJob()
|
||||
? name : Utils::String::wildcardToRegexPattern(name));
|
||||
QString pattern = name;
|
||||
if (!Preferences::instance()->getRegexAsFilteringPatternForSearchJob())
|
||||
{
|
||||
pattern.replace(QRegularExpression(u"[-.\\s_]+"_s), u"[-. _]"_s);
|
||||
pattern = Utils::String::wildcardToRegexPattern(pattern);
|
||||
}
|
||||
m_proxyModel->setFilterRegularExpression(QRegularExpression(pattern, QRegularExpression::CaseInsensitiveOption));
|
||||
updateResultsCount();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue