Make roomlist look nice
This commit is contained in:
parent
10fd2752f9
commit
cd67046f60
10 changed files with 265 additions and 45 deletions
|
|
@ -723,6 +723,20 @@ TimelineModel::fetchMore(const QModelIndex &)
|
|||
events.fetchMore();
|
||||
}
|
||||
|
||||
void
|
||||
TimelineModel::sync(const mtx::responses::JoinedRoom &room)
|
||||
{
|
||||
this->syncState(room.state);
|
||||
this->addEvents(room.timeline);
|
||||
|
||||
if (room.unread_notifications.highlight_count != highlight_count ||
|
||||
room.unread_notifications.notification_count != notification_count) {
|
||||
notification_count = room.unread_notifications.notification_count;
|
||||
highlight_count = room.unread_notifications.highlight_count;
|
||||
emit notificationsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TimelineModel::syncState(const mtx::responses::State &s)
|
||||
{
|
||||
|
|
@ -866,14 +880,18 @@ TimelineModel::updateLastMessage()
|
|||
if (std::visit([](const auto &e) -> bool { return isYourJoin(e); }, *event)) {
|
||||
auto time = mtx::accessors::origin_server_ts(*event);
|
||||
uint64_t ts = time.toMSecsSinceEpoch();
|
||||
emit manager_->updateRoomsLastMessage(
|
||||
room_id_,
|
||||
auto description =
|
||||
DescInfo{QString::fromStdString(mtx::accessors::event_id(*event)),
|
||||
QString::fromStdString(http::client()->user_id().to_string()),
|
||||
tr("You joined this room."),
|
||||
utils::descriptiveTime(time),
|
||||
ts,
|
||||
time});
|
||||
time};
|
||||
if (description != lastMessage_) {
|
||||
lastMessage_ = description;
|
||||
emit manager_->updateRoomsLastMessage(room_id_, lastMessage_);
|
||||
emit lastMessageChanged();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!std::visit([](const auto &e) -> bool { return isMessage(e); }, *event))
|
||||
|
|
@ -884,7 +902,11 @@ TimelineModel::updateLastMessage()
|
|||
QString::fromStdString(http::client()->user_id().to_string()),
|
||||
cache::displayName(room_id_,
|
||||
QString::fromStdString(mtx::accessors::sender(*event))));
|
||||
emit manager_->updateRoomsLastMessage(room_id_, description);
|
||||
if (description != lastMessage_) {
|
||||
lastMessage_ = description;
|
||||
emit manager_->updateRoomsLastMessage(room_id_, description);
|
||||
emit lastMessageChanged();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue