summary refs log tree commit diff
path: root/src/ui
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-12-29 06:01:38 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-12-29 06:01:38 +0100
commit19dc6cadea0168f72daff7c0ed679ccdac71a7d5 (patch)
treeb10a86fcd0ab0f12f5e242996b307bb2cac97940 /src/ui
parentReduce allocations required for the palette (diff)
downloadnheko-19dc6cadea0168f72daff7c0ed679ccdac71a7d5.tar.xz
Reserve size of some containers we are filling
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/NhekoGlobalObject.cpp4
-rw-r--r--src/ui/RoomSettings.cpp6
-rw-r--r--src/ui/UserProfile.cpp19
3 files changed, 16 insertions, 13 deletions
diff --git a/src/ui/NhekoGlobalObject.cpp b/src/ui/NhekoGlobalObject.cpp

index b6122ac9..56c0d9f0 100644 --- a/src/ui/NhekoGlobalObject.cpp +++ b/src/ui/NhekoGlobalObject.cpp
@@ -28,8 +28,8 @@ void Nheko::updateUserProfile() { if (cache::client() && cache::client()->isInitialized()) - currentUser_.reset( - new UserProfile(QLatin1String(""), utils::localUser(), ChatPage::instance()->timelineManager())); + currentUser_.reset(new UserProfile( + QLatin1String(""), utils::localUser(), ChatPage::instance()->timelineManager())); else currentUser_.reset(); emit profileChanged(); diff --git a/src/ui/RoomSettings.cpp b/src/ui/RoomSettings.cpp
index 038c2e89..b9042524 100644 --- a/src/ui/RoomSettings.cpp +++ b/src/ui/RoomSettings.cpp
@@ -234,8 +234,10 @@ RoomSettings::roomName() const QString RoomSettings::roomTopic() const { - return utils::replaceEmoji(utils::linkifyMessage( - QString::fromStdString(info_.topic).toHtmlEscaped().replace(QLatin1String("\n"), QLatin1String("<br>")))); + return utils::replaceEmoji( + utils::linkifyMessage(QString::fromStdString(info_.topic) + .toHtmlEscaped() + .replace(QLatin1String("\n"), QLatin1String("<br>")))); } QString diff --git a/src/ui/UserProfile.cpp b/src/ui/UserProfile.cpp
index cd9e170d..19bbb007 100644 --- a/src/ui/UserProfile.cpp +++ b/src/ui/UserProfile.cpp
@@ -232,6 +232,7 @@ UserProfile::updateVerificationStatus() this->isUserVerified = verificationStatus.user_verified; emit userStatusChanged(); + deviceInfo.reserve(devices.size()); for (const auto &d : devices) { auto device = d.second; verification::Status verified = @@ -244,9 +245,9 @@ UserProfile::updateVerificationStatus() if (isSelf() && device.device_id == ::http::client()->device_id()) verified = verification::Status::SELF; - deviceInfo.push_back({QString::fromStdString(d.first), - QString::fromStdString(device.unsigned_info.device_display_name), - verified}); + deviceInfo.emplace_back(QString::fromStdString(d.first), + QString::fromStdString(device.unsigned_info.device_display_name), + verified); } // For self, also query devices without keys @@ -270,17 +271,17 @@ UserProfile::updateVerificationStatus() found = true; // Gottem! Let's fill in the blanks e.lastIp = QString::fromStdString(d.last_seen_ip); - e.lastTs = d.last_seen_ts; + e.lastTs = static_cast<qlonglong>(d.last_seen_ts); break; } } // No entry? Let's add one. if (!found) { - deviceInfo.push_back({QString::fromStdString(d.device_id), - QString::fromStdString(d.display_name), - verification::NOT_APPLICABLE, - QString::fromStdString(d.last_seen_ip), - d.last_seen_ts}); + deviceInfo.emplace_back(QString::fromStdString(d.device_id), + QString::fromStdString(d.display_name), + verification::NOT_APPLICABLE, + QString::fromStdString(d.last_seen_ip), + d.last_seen_ts); } }