diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2017-04-15 19:04:02 +0300 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2017-04-15 19:04:02 +0300 |
commit | e1d48367f8ccb83fc1fcdaee899e5bf4f8ac2669 (patch) | |
tree | ae84a8e5f6d1208d5cbf7a05c6e8ab2eaf322c48 /src/ChatPage.cc | |
parent | Move the main window to the center (diff) | |
download | nheko-e1d48367f8ccb83fc1fcdaee899e5bf4f8ac2669.tar.xz |
Show the unread message count on the window title
Diffstat (limited to 'src/ChatPage.cc')
-rw-r--r-- | src/ChatPage.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ChatPage.cc b/src/ChatPage.cc index 33cacb3e..3bae177b 100644 --- a/src/ChatPage.cc +++ b/src/ChatPage.cc @@ -64,11 +64,17 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client, QWidget *parent) view_manager_, SLOT(setHistoryView(const RoomInfo &))); + // TODO: Better pass the whole RoomInfo struct instead of the roomid. connect(view_manager_, SIGNAL(unreadMessages(const QString &, int)), room_list_, SLOT(updateUnreadMessageCount(const QString &, int))); + connect(room_list_, + SIGNAL(totalUnreadMessageCountUpdated(int)), + this, + SLOT(showUnreadMessageNotification(int))); + connect(text_input_, SIGNAL(sendTextMessage(const QString &)), view_manager_, @@ -206,6 +212,15 @@ void ChatPage::changeTopRoomInfo(const RoomInfo &info) current_room_ = info; } +void ChatPage::showUnreadMessageNotification(int count) +{ + // TODO: Make the default title a const. + if (count == 0) + emit changeWindowTitle("nheko"); + else + emit changeWindowTitle(QString("nheko (%1)").arg(count)); +} + ChatPage::~ChatPage() { sync_timer_->stop(); |