parent
290de548bb
commit
d6b61fbb14
7 changed files with 64 additions and 6 deletions
|
|
@ -68,6 +68,12 @@ public:
|
|||
QString currentRoom() const { return current_room_; }
|
||||
|
||||
static ChatPage *instance() { return instance_; }
|
||||
void readEvent(const QString &room_id, const QString &event_id)
|
||||
{
|
||||
client_->readEvent(room_id, event_id);
|
||||
}
|
||||
|
||||
QSharedPointer<UserSettings> userSettings() { return userSettings_; }
|
||||
|
||||
signals:
|
||||
void contentLoaded();
|
||||
|
|
|
|||
|
|
@ -61,6 +61,12 @@ public:
|
|||
save();
|
||||
};
|
||||
|
||||
void setReadReceipts(bool state)
|
||||
{
|
||||
isReadReceiptsEnabled_ = state;
|
||||
save();
|
||||
}
|
||||
|
||||
void setTypingNotifications(bool state)
|
||||
{
|
||||
isTypingNotificationsEnabled_ = state;
|
||||
|
|
@ -72,6 +78,7 @@ public:
|
|||
bool isOrderingEnabled() const { return isOrderingEnabled_; }
|
||||
bool isGroupViewEnabled() const { return isGroupViewEnabled_; }
|
||||
bool isTypingNotificationsEnabled() const { return isTypingNotificationsEnabled_; }
|
||||
bool isReadReceiptsEnabled() const { return isReadReceiptsEnabled_; }
|
||||
|
||||
signals:
|
||||
void groupViewStateChanged(bool state);
|
||||
|
|
@ -82,6 +89,7 @@ private:
|
|||
bool isOrderingEnabled_;
|
||||
bool isGroupViewEnabled_;
|
||||
bool isTypingNotificationsEnabled_;
|
||||
bool isReadReceiptsEnabled_;
|
||||
};
|
||||
|
||||
class HorizontalLine : public QFrame
|
||||
|
|
@ -123,6 +131,7 @@ private:
|
|||
Toggle *roomOrderToggle_;
|
||||
Toggle *groupViewToggle_;
|
||||
Toggle *typingNotifications_;
|
||||
Toggle *readReceipts_;
|
||||
|
||||
QComboBox *themeCombo_;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include <QStyleOption>
|
||||
|
||||
#include "AvatarProvider.h"
|
||||
#include "ChatPage.h"
|
||||
#include "RoomInfoListItem.h"
|
||||
#include "TimelineViewManager.h"
|
||||
#include "Utils.h"
|
||||
|
|
@ -85,6 +86,12 @@ public:
|
|||
QString eventId() const { return event_id_; }
|
||||
void setEventId(const QString &event_id) { event_id_ = event_id; }
|
||||
void markReceived();
|
||||
void setRoomId(const QString &room_id) { room_id_ = room_id; }
|
||||
void sendReadReceipt() const
|
||||
{
|
||||
if (!event_id_.isEmpty())
|
||||
ChatPage::instance()->readEvent(room_id_, event_id_);
|
||||
}
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
|
@ -114,11 +121,13 @@ private:
|
|||
|
||||
QString replaceEmoji(const QString &body);
|
||||
QString event_id_;
|
||||
QString room_id_;
|
||||
|
||||
DescInfo descriptionMsg_;
|
||||
|
||||
QMenu *receiptsMenu_;
|
||||
QMenu *contextMenu_;
|
||||
QAction *showReadReceipts_;
|
||||
QAction *markAsRead_;
|
||||
|
||||
QHBoxLayout *topLayout_;
|
||||
//! The message and the timestamp/checkmark.
|
||||
|
|
|
|||
|
|
@ -252,6 +252,7 @@ TimelineView::addUserMessage(const QString &url,
|
|||
|
||||
TimelineItem *view_item =
|
||||
new TimelineItem(widget, local_user_, with_sender, scroll_widget_);
|
||||
view_item->setRoomId(room_id_);
|
||||
|
||||
addTimelineItem(view_item);
|
||||
|
||||
|
|
@ -272,6 +273,7 @@ TimelineItem *
|
|||
TimelineView::createTimelineItem(const Event &event, bool withSender)
|
||||
{
|
||||
TimelineItem *item = new TimelineItem(event, withSender, scroll_widget_);
|
||||
item->setRoomId(room_id_);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
|
@ -281,6 +283,7 @@ TimelineView::createTimelineItem(const Event &event, bool withSender)
|
|||
{
|
||||
auto eventWidget = new Widget(client_, event);
|
||||
auto item = new TimelineItem(eventWidget, event, withSender, scroll_widget_);
|
||||
item->setRoomId(room_id_);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue