summary refs log tree commit diff
path: root/src/timeline/TimelineModel.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2019-12-10 14:46:52 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2019-12-10 14:46:52 +0100
commite98a61fea60cf3b95441ce3d9591ced0cf93f566 (patch)
treef9331c31efcde5089e2a3f6fd825fa28abac159b /src/timeline/TimelineModel.cpp
parentSimplify scroll logic (diff)
downloadnheko-e98a61fea60cf3b95441ce3d9591ced0cf93f566.tar.xz
Show topic and name changes in timeline
Diffstat (limited to 'src/timeline/TimelineModel.cpp')
-rw-r--r--src/timeline/TimelineModel.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp

index e3d87ae6..9da8a194 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp
@@ -61,6 +61,30 @@ eventMsgType(const mtx::events::RoomEvent<T> &e) -> decltype(e.content.msgtype) template<class T> QString +eventRoomName(const T &) +{ + return ""; +} +QString +eventRoomName(const mtx::events::StateEvent<mtx::events::state::Name> &e) +{ + return QString::fromStdString(e.content.name); +} + +template<class T> +QString +eventRoomTopic(const T &) +{ + return ""; +} +QString +eventRoomTopic(const mtx::events::StateEvent<mtx::events::state::Topic> &e) +{ + return QString::fromStdString(e.content.topic); +} + +template<class T> +QString eventBody(const mtx::events::Event<T> &) { return QString(""); @@ -437,6 +461,8 @@ TimelineModel::roleNames() const {State, "state"}, {IsEncrypted, "isEncrypted"}, {ReplyTo, "replyTo"}, + {RoomName, "roomName"}, + {RoomTopic, "roomTopic"}, }; } int @@ -563,6 +589,12 @@ TimelineModel::data(const QModelIndex &index, int role) const [](const auto &e) -> QString { return eventRelatesTo(e); }, event); return QVariant(evId); } + case RoomName: + return QVariant(boost::apply_visitor( + [](const auto &e) -> QString { return eventRoomName(e); }, event)); + case RoomTopic: + return QVariant(boost::apply_visitor( + [](const auto &e) -> QString { return eventRoomTopic(e); }, event)); default: return QVariant(); }