Use QString::compare with Qt::CaseInsensitive to reduce allocations

This commit is contained in:
Jonas Kvinge
2021-07-13 23:18:12 +02:00
parent a87863229f
commit 68dbc29f2c
16 changed files with 192 additions and 181 deletions

View File

@@ -126,7 +126,7 @@ void ChartLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64
}
else if (type == QXmlStreamReader::EndElement) {
if (name == "GetLyricResult") {
if (!result.artist.isEmpty() && !result.title.isEmpty() && !result.lyrics.isEmpty() && (result.artist.toLower() == artist.toLower() || result.title.toLower() == title.toLower())) {
if (!result.artist.isEmpty() && !result.title.isEmpty() && !result.lyrics.isEmpty() && (result.artist.compare(artist, Qt::CaseInsensitive) == 0 || result.title.compare(title, Qt::CaseInsensitive) == 0)) {
result.lyrics = Utilities::DecodeHtmlEntities(result.lyrics);
results << result;
}