diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp
index a60c09cb..72c667ce 100644
--- a/src/ChatPage.cpp
+++ b/src/ChatPage.cpp
@@ -546,7 +546,9 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
updateTypingUsers(room_id, room.second.ephemeral.typing);
updateRoomNotificationCount(
- room_id, room.second.unread_notifications.notification_count);
+ room_id,
+ room.second.unread_notifications.notification_count,
+ room.second.unread_notifications.highlight_count);
if (room.second.unread_notifications.notification_count > 0)
hasNotifications = true;
@@ -908,9 +910,11 @@ ChatPage::setGroupViewState(bool isEnabled)
}
void
-ChatPage::updateRoomNotificationCount(const QString &room_id, uint16_t notification_count)
+ChatPage::updateRoomNotificationCount(const QString &room_id,
+ uint16_t notification_count,
+ uint16_t highlight_count)
{
- room_list_->updateUnreadMessageCount(room_id, notification_count);
+ room_list_->updateUnreadMessageCount(room_id, notification_count, highlight_count);
}
void
diff --git a/src/ChatPage.h b/src/ChatPage.h
index 492613ec..7d3b3273 100644
--- a/src/ChatPage.h
+++ b/src/ChatPage.h
@@ -197,7 +197,9 @@ private:
Memberships getMemberships(const std::vector<Collection> &events) const;
//! Update the room with the new notification count.
- void updateRoomNotificationCount(const QString &room_id, uint16_t notification_count);
+ void updateRoomNotificationCount(const QString &room_id,
+ uint16_t notification_count,
+ uint16_t highlight_count);
//! Send desktop notification for the received messages.
void sendDesktopNotifications(const mtx::responses::Notifications &);
diff --git a/src/RoomInfoListItem.cpp b/src/RoomInfoListItem.cpp
index fcf5bd72..f17b383c 100644
--- a/src/RoomInfoListItem.cpp
+++ b/src/RoomInfoListItem.cpp
@@ -101,6 +101,7 @@ RoomInfoListItem::RoomInfoListItem(QString room_id, RoomInfo info, QWidget *pare
, roomName_{QString::fromStdString(std::move(info.name))}
, isPressed_(false)
, unreadMsgCount_(0)
+ , unreadHighlightedMsgCount_(0)
{
init(parent);
@@ -301,7 +302,11 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
if (unreadMsgCount_ > 0) {
QBrush brush;
brush.setStyle(Qt::SolidPattern);
- brush.setColor(bubbleBgColor());
+ if (unreadHighlightedMsgCount_ > 0) {
+ brush.setColor(mentionedColor());
+ } else {
+ brush.setColor(bubbleBgColor());
+ }
if (isPressed_)
brush.setColor(bubbleFgColor());
@@ -354,9 +359,10 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
}
void
-RoomInfoListItem::updateUnreadMessageCount(int count)
+RoomInfoListItem::updateUnreadMessageCount(int count, int highlightedCount)
{
- unreadMsgCount_ = count;
+ unreadMsgCount_ = count;
+ unreadHighlightedMsgCount_ = highlightedCount;
update();
}
diff --git a/src/RoomInfoListItem.h b/src/RoomInfoListItem.h
index 5fa89853..40c938c1 100644
--- a/src/RoomInfoListItem.h
+++ b/src/RoomInfoListItem.h
@@ -59,14 +59,15 @@ class RoomInfoListItem : public QWidget
Q_PROPERTY(QColor hoverTitleColor READ hoverTitleColor WRITE setHoverTitleColor)
Q_PROPERTY(QColor hoverSubtitleColor READ hoverSubtitleColor WRITE setHoverSubtitleColor)
+ Q_PROPERTY(QColor mentionedColor READ mentionedColor WRITE setMentionedColor)
Q_PROPERTY(QColor btnColor READ btnColor WRITE setBtnColor)
Q_PROPERTY(QColor btnTextColor READ btnTextColor WRITE setBtnTextColor)
public:
RoomInfoListItem(QString room_id, RoomInfo info, QWidget *parent = 0);
- void updateUnreadMessageCount(int count);
- void clearUnreadMessageCount() { updateUnreadMessageCount(0); };
+ void updateUnreadMessageCount(int count, int highlightedCount);
+ void clearUnreadMessageCount() { updateUnreadMessageCount(0, 0); };
QString roomId() { return roomId_; }
bool isPressed() const { return isPressed_; }
@@ -97,6 +98,7 @@ public:
QColor bubbleFgColor() const { return bubbleFgColor_; }
QColor bubbleBgColor() const { return bubbleBgColor_; }
+ QColor mentionedColor() const { return mentionedFontColor_; }
void setHighlightedBackgroundColor(QColor &color) { highlightedBackgroundColor_ = color; }
void setHoverBackgroundColor(QColor &color) { hoverBackgroundColor_ = color; }
@@ -120,6 +122,7 @@ public:
void setBubbleFgColor(QColor &color) { bubbleFgColor_ = color; }
void setBubbleBgColor(QColor &color) { bubbleBgColor_ = color; }
+ void setMentionedColor(QColor &color) { mentionedFontColor_ = color; }
void setRoomName(const QString &name) { roomName_ = name; }
void setRoomType(bool isInvite)
@@ -184,7 +187,8 @@ private:
bool isPressed_ = false;
bool hasUnreadMessages_ = true;
- int unreadMsgCount_ = 0;
+ int unreadMsgCount_ = 0;
+ int unreadHighlightedMsgCount_ = 0;
QColor highlightedBackgroundColor_;
QColor hoverBackgroundColor_;
@@ -206,6 +210,7 @@ private:
QRectF declineBtnRegion_;
// Fonts
+ QColor mentionedFontColor_;
QFont unreadCountFont_;
int bubbleDiameter_;
diff --git a/src/RoomList.cpp b/src/RoomList.cpp
index c1b080c0..1abf3533 100644
--- a/src/RoomList.cpp
+++ b/src/RoomList.cpp
@@ -143,7 +143,7 @@ RoomList::removeRoom(const QString &room_id, bool reset)
}
void
-RoomList::updateUnreadMessageCount(const QString &roomid, int count)
+RoomList::updateUnreadMessageCount(const QString &roomid, int count, int highlightedCount)
{
if (!roomExists(roomid)) {
nhlog::ui()->warn("updateUnreadMessageCount: unknown room_id {}",
@@ -151,7 +151,7 @@ RoomList::updateUnreadMessageCount(const QString &roomid, int count)
return;
}
- rooms_[roomid]->updateUnreadMessageCount(count);
+ rooms_[roomid]->updateUnreadMessageCount(count, highlightedCount);
calculateUnreadMessageCount();
}
diff --git a/src/RoomList.h b/src/RoomList.h
index 88e6d1ad..155a969c 100644
--- a/src/RoomList.h
+++ b/src/RoomList.h
@@ -68,7 +68,7 @@ signals:
public slots:
void updateRoomAvatar(const QString &roomid, const QPixmap &img);
void highlightSelectedRoom(const QString &room_id);
- void updateUnreadMessageCount(const QString &roomid, int count);
+ void updateUnreadMessageCount(const QString &roomid, int count, int highlightedCount);
void updateRoomDescription(const QString &roomid, const DescInfo &info);
void closeJoinRoomDialog(bool isJoining, QString roomAlias);
void updateReadStatus(const std::map<QString, bool> &status);
|