mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-10-30 17:40:47 +03:00
Add a checkmark to messages that have been received by the server (#93)
This commit is contained in:
parent
dfeb0c833a
commit
c4fa8c844d
3 changed files with 14 additions and 1 deletions
|
@ -84,6 +84,7 @@ public:
|
|||
DescInfo descriptionMessage() const { return descriptionMsg_; }
|
||||
QString eventId() const { return event_id_; }
|
||||
void setEventId(const QString &event_id) { event_id_ = event_id; }
|
||||
void markReceived();
|
||||
|
||||
~TimelineItem();
|
||||
|
||||
|
|
|
@ -340,6 +340,16 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Text>
|
|||
mainLayout_->addLayout(messageLayout_);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineItem::markReceived()
|
||||
{
|
||||
auto checkmark = new QLabel("✓", this);
|
||||
checkmark->setStyleSheet(QString("font-size: %1px;").arg(conf::timeline::fonts::timestamp));
|
||||
checkmark->setAlignment(Qt::AlignTop);
|
||||
|
||||
messageLayout_->insertWidget(1, checkmark);
|
||||
}
|
||||
|
||||
// Only the body is displayed.
|
||||
void
|
||||
TimelineItem::generateBody(const QString &body)
|
||||
|
|
|
@ -461,8 +461,10 @@ TimelineView::updatePendingMessage(int txn_id, QString event_id)
|
|||
auto msg = pending_msgs_.dequeue();
|
||||
msg.event_id = event_id;
|
||||
|
||||
if (msg.widget)
|
||||
if (msg.widget) {
|
||||
msg.widget->setEventId(event_id);
|
||||
msg.widget->markReceived();
|
||||
}
|
||||
|
||||
pending_sent_msgs_.append(msg);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue