Add unread notification color for user mentioned

When user is mentioned (via matrix 'highlight_count'), inactive
rooms will use a different color for the notification circle than
when only general unread messages exist.
This commit is contained in:
redsky17 2019-01-25 02:43:54 +00:00
parent d70bc94f61
commit 4185b8d121
9 changed files with 33 additions and 13 deletions

View file

@ -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();
}