Avoid allocations for case-insensetive compare

This commit is contained in:
Ilya Fedin 2021-03-15 22:07:14 +04:00 committed by John Preston
parent 4659cc50f2
commit 0c8febce9c
2 changed files with 2 additions and 2 deletions

View File

@ -782,7 +782,7 @@ void InnerWidget::paintPeerSearchResult(
QRect tr(nameleft, st::dialogsPadding.y() + st::msgNameFont->height + st::dialogsSkip, namewidth, st::dialogsTextFont->height);
p.setFont(st::dialogsTextFont);
QString username = peer->userName();
if (!active && username.toLower().startsWith(_peerSearchQuery)) {
if (!active && username.startsWith(_peerSearchQuery, Qt::CaseInsensitive)) {
auto first = '@' + username.mid(0, _peerSearchQuery.size());
auto second = username.mid(_peerSearchQuery.size());
auto w = st::dialogsTextFont->width(first);

View File

@ -465,7 +465,7 @@ std::optional<bool> IsDarkMode() {
if (!themeName.has_value()) {
return std::nullopt;
} else if (themeName->toLower().contains(qsl("-dark"))) {
} else if (themeName->contains(qsl("-dark"), Qt::CaseInsensitive)) {
return true;
}