Commit 1747155b authored by Yerrey Dev's avatar Yerrey Dev Committed by Nate Graham
Browse files

Enable unicode normalization on track data before matching

Normalizes the value of mainValue, artistValue and oneArtist with
Qt provided normalization before it is compared to
mFilterExpression's mFilterText and used for search. mFilterText is
also normalized before it's being matched against.

With this fix the provided "Björk" file in the bug report is correctly
found when searching "Björk" in the search bar.

BUG: 391462
FIXED-IN: 21.12.2
parent 448a9e57
Pipeline #125721 passed with stage
in 19 seconds
......@@ -41,7 +41,7 @@ void AbstractMediaProxyModel::setFilterText(const QString &filterText)
mFilterText = filterText;
mFilterExpression.setPattern(mFilterText);
mFilterExpression.setPattern(mFilterText.normalized(QString::NormalizationForm_KC));
mFilterExpression.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
mFilterExpression.optimize();
......
......@@ -37,7 +37,7 @@ void FileBrowserProxyModel::setFilterText(const QString &filterText)
mFilterText = filterText;
mFilterExpression.setPattern(mFilterText);
mFilterExpression.setPattern(mFilterText.normalized(QString::NormalizationForm_KC));
mFilterExpression.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
mFilterExpression.optimize();
......
......@@ -44,18 +44,18 @@ bool GridViewProxyModel::filterAcceptsRow(int source_row, const QModelIndex &sou
return result;
}
if (mFilterExpression.match(mainValue).hasMatch()) {
if (mFilterExpression.match(mainValue.normalized(QString::NormalizationForm_KC)).hasMatch()) {
result = true;
return result;
}
if (mFilterExpression.match(artistValue).hasMatch()) {
if (mFilterExpression.match(artistValue.normalized(QString::NormalizationForm_KC)).hasMatch()) {
result = true;
return result;
}
for (const auto &oneArtist : allArtistsValue) {
if (mFilterExpression.match(oneArtist).hasMatch()) {
if (mFilterExpression.match(oneArtist.normalized(QString::NormalizationForm_KC)).hasMatch()) {
result = true;
return result;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment