diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2022-12-17 01:11:19 +0100 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2022-12-17 01:11:19 +0100 |
commit | e8e475956b3d2a57981ad41536a1ddc1b7361591 (patch) | |
tree | 90941aa94f6542ae8ae1a91d54fd48aab3ef221a /src/Utils.h | |
parent | Fix sending confetti (diff) | |
download | nheko-e8e475956b3d2a57981ad41536a1ddc1b7361591.tar.xz |
Fix confetti in the sidebar
Diffstat (limited to 'src/Utils.h')
-rw-r--r-- | src/Utils.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/Utils.h b/src/Utils.h index e4c3ccb3..31a1a0de 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -89,9 +89,6 @@ firstChar(const QString &input); QString humanReadableFileSize(uint64_t bytes); -QString -event_body(const mtx::events::collections::TimelineEvents &event); - //! Match widgets/events with a description message. template<class T> QString @@ -107,6 +104,7 @@ messageDescription(const QString &username = QString(), using Sticker = mtx::events::Sticker; using Text = mtx::events::RoomEvent<mtx::events::msg::Text>; using Video = mtx::events::RoomEvent<mtx::events::msg::Video>; + using Confetti = mtx::events::RoomEvent<mtx::events::msg::Confetti>; using CallInvite = mtx::events::RoomEvent<mtx::events::voip::CallInvite>; using CallAnswer = mtx::events::RoomEvent<mtx::events::voip::CallAnswer>; using CallHangUp = mtx::events::RoomEvent<mtx::events::voip::CallHangUp>; @@ -158,6 +156,23 @@ messageDescription(const QString &username = QString(), else return QCoreApplication::translate("message-description sent:", "%1: %2") .arg(username, body); + } else if (std::is_same<T, Confetti>::value) { + if (body.isEmpty()) { + if (isLocal) + return QCoreApplication::translate("message-description sent:", + "You sent some confetti"); + else + return QCoreApplication::translate("message-description sent:", + "%1 sent some confetti") + .arg(username); + } else { + if (isLocal) + return QCoreApplication::translate("message-description sent:", "You: %1") + .arg(body); + else + return QCoreApplication::translate("message-description sent:", "%1: %2") + .arg(username, body); + } } else if (std::is_same<T, Emote>::value) { return QStringLiteral("* %1 %2").arg(username, body); } else if (std::is_same<T, Encrypted>::value) { |