diff options
author | Malte E <malte.e@mailbox.org> | 2022-02-07 21:53:37 +0100 |
---|---|---|
committer | Malte E <malte.e@mailbox.org> | 2022-02-07 21:53:37 +0100 |
commit | 12d600db97db7e6e4d9f3acb2755c6dfb5071a83 (patch) | |
tree | 45c1c89f6b71e3f58e12c715c404e2315c5818f3 /src/timeline | |
parent | print state events without bubbles, displaynames or avatars and in a smaller ... (diff) | |
download | nheko-12d600db97db7e6e4d9f3acb2755c6dfb5071a83.tar.xz |
add translations and actually add changes to TimelineModel
Diffstat (limited to 'src/timeline')
-rw-r--r-- | src/timeline/TimelineModel.cpp | 13 | ||||
-rw-r--r-- | src/timeline/TimelineModel.h | 2 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index 6b380f79..dfd06f0b 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -453,6 +453,7 @@ TimelineModel::roleNames() const {UserId, "userId"}, {UserName, "userName"}, {PreviousMessageDay, "previousMessageDay"}, + {PreviousMessageIsStateEvent, "previousMessageIsStateEvent"}, {Day, "day"}, {Timestamp, "timestamp"}, {Url, "url"}, @@ -469,6 +470,7 @@ TimelineModel::roleNames() const {IsEdited, "isEdited"}, {IsEditable, "isEditable"}, {IsEncrypted, "isEncrypted"}, + {IsStateEvent, "isStateEvent"}, {Trustlevel, "trustlevel"}, {EncryptionError, "encryptionError"}, {ReplyTo, "replyTo"}, @@ -666,6 +668,9 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r std::holds_alternative<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>( *encrypted_event); } + case IsStateEvent: { + return is_state_event(event); + } case Trustlevel: { auto encrypted_event = events.get(event_id(event), "", false); @@ -730,6 +735,7 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r m.insert(names[IsEdited], data(event, static_cast<int>(IsEdited))); m.insert(names[IsEditable], data(event, static_cast<int>(IsEditable))); m.insert(names[IsEncrypted], data(event, static_cast<int>(IsEncrypted))); + m.insert(names[IsStateEvent], data(event, static_cast<int>(IsStateEvent))); m.insert(names[ReplyTo], data(event, static_cast<int>(ReplyTo))); m.insert(names[RoomName], data(event, static_cast<int>(RoomName))); m.insert(names[RoomTopic], data(event, static_cast<int>(RoomTopic))); @@ -762,7 +768,8 @@ TimelineModel::data(const QModelIndex &index, int role) const if (!event) return ""; - if (role == PreviousMessageDay || role == PreviousMessageUserId) { + if (role == PreviousMessageDay || role == PreviousMessageUserId || + role == PreviousMessageIsStateEvent) { int prevIdx = rowCount() - index.row() - 2; if (prevIdx < 0) return {}; @@ -771,8 +778,10 @@ TimelineModel::data(const QModelIndex &index, int role) const return {}; if (role == PreviousMessageUserId) return data(*tempEv, UserId); - else + else if (role == PreviousMessageDay) return data(*tempEv, Day); + else + return data(*tempEv, IsStateEvent); } return data(*event, role); diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h index 556f9f54..c50a2c06 100644 --- a/src/timeline/TimelineModel.h +++ b/src/timeline/TimelineModel.h @@ -205,6 +205,7 @@ public: UserId, UserName, PreviousMessageDay, + PreviousMessageIsStateEvent, Day, Timestamp, Url, @@ -221,6 +222,7 @@ public: IsEdited, IsEditable, IsEncrypted, + IsStateEvent, Trustlevel, EncryptionError, ReplyTo, |