Show the unread message count on the window title
3 files changed, 11 insertions, 0 deletions
diff --git a/include/ChatPage.h b/include/ChatPage.h
index fd0b63dc..182dca3a 100644
--- a/include/ChatPage.h
+++ b/include/ChatPage.h
@@ -48,8 +48,10 @@ public:
signals:
void close();
+ void changeWindowTitle(const QString &msg);
private slots:
+ void showUnreadMessageNotification(int count);
void updateTopBarAvatar(const QString &roomid, const QPixmap &img);
void updateOwnProfileInfo(const QUrl &avatar_url, const QString &display_name);
void setOwnAvatar(const QPixmap &img);
diff --git a/include/RoomInfoListItem.h b/include/RoomInfoListItem.h
index 24e84bd3..5c403dc3 100644
--- a/include/RoomInfoListItem.h
+++ b/include/RoomInfoListItem.h
@@ -42,6 +42,7 @@ public:
inline bool isPressed();
inline RoomInfo info();
inline void setAvatar(const QImage &avatar_image);
+ inline int unreadMessageCount();
signals:
void clicked(const RoomInfo &info_);
@@ -82,6 +83,11 @@ private:
int unread_msg_count_;
};
+inline int RoomInfoListItem::unreadMessageCount()
+{
+ return unread_msg_count_;
+}
+
inline bool RoomInfoListItem::isPressed()
{
return is_pressed_;
diff --git a/include/RoomList.h b/include/RoomList.h
index d6066166..e22f0954 100644
--- a/include/RoomList.h
+++ b/include/RoomList.h
@@ -48,6 +48,7 @@ public:
signals:
void roomChanged(const RoomInfo &info);
+ void totalUnreadMessageCountUpdated(int count);
public slots:
void updateRoomAvatar(const QString &roomid, const QPixmap &img);
@@ -55,6 +56,8 @@ public slots:
void updateUnreadMessageCount(const QString &roomid, int count);
private:
+ void calculateUnreadMessageCount();
+
Ui::RoomList *ui;
QMap<QString, RoomInfoListItem *> rooms_;
|