Some qt6 prep

This commit is contained in:
Nicolas Werner 2021-12-28 20:09:08 +01:00
parent 2866826356
commit 5ca98829f7
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
32 changed files with 89 additions and 66 deletions

View file

@ -643,7 +643,7 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r
// only show read receipts for messages not from us
if (acc::sender(event) != http::client()->user_id().to_string())
return qml_mtx_events::Empty;
else if (!id.isEmpty() && id[0] == "m")
else if (!id.isEmpty() && id[0] == 'm')
return qml_mtx_events::Sent;
else if (read.contains(id) || containsOthers(cache::readReceipts(id, room_id_)))
return qml_mtx_events::Read;
@ -1029,7 +1029,7 @@ TimelineModel::setCurrentIndex(int index)
if (!ChatPage::instance()->isActiveWindow())
return;
if (!currentId.startsWith("m")) {
if (!currentId.startsWith('m')) {
auto oldReadIndex =
cache::getEventIndex(roomId().toStdString(), currentReadId.toStdString());
auto nextEventIndexAndId =
@ -1759,16 +1759,16 @@ TimelineModel::formatTypingUsers(const std::vector<QString> &users, const QColor
if (startIndex - index != 0)
coloredUsername +=
prefix +
uncoloredUsername.midRef(index, startIndex > 0 ? startIndex - index : -1) +
"</font>";
prefix + uncoloredUsername.mid(index, startIndex > 0 ? startIndex - index : -1) +
QStringLiteral("</font>");
auto endIndex = uncoloredUsername.indexOf("</font>", startIndex);
if (endIndex > 0)
endIndex += sizeof("</font>") - 1;
if (endIndex - startIndex != 0)
coloredUsername += uncoloredUsername.midRef(startIndex, endIndex - startIndex);
coloredUsername +=
QStringView(uncoloredUsername).mid(startIndex, endIndex - startIndex);
index = endIndex;
} while (index > 0 && index < uncoloredUsername.size());