diff options
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/QtUI/ChatList/QtChatListWindow.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/ChatList/QtChatListWindow.h | 3 | ||||
-rw-r--r-- | Swift/QtUI/QtMainWindow.cpp | 12 | ||||
-rw-r--r-- | Swift/QtUI/QtMainWindow.h | 1 |
4 files changed, 18 insertions, 2 deletions
diff --git a/Swift/QtUI/ChatList/QtChatListWindow.cpp b/Swift/QtUI/ChatList/QtChatListWindow.cpp index fab6374..9beb9dc 100644 --- a/Swift/QtUI/ChatList/QtChatListWindow.cpp +++ b/Swift/QtUI/ChatList/QtChatListWindow.cpp @@ -99,8 +99,8 @@ void QtChatListWindow::setRecents(const std::list<ChatListWindow::Chat>& recents model_->setRecents(recents); } -void QtChatListWindow::setUnreadCount(int /*unread*/) { - +void QtChatListWindow::setUnreadCount(int unread) { + emit onCountUpdated(unread); } void QtChatListWindow::handleRemoveBookmark() { diff --git a/Swift/QtUI/ChatList/QtChatListWindow.h b/Swift/QtUI/ChatList/QtChatListWindow.h index 67f2c41..8775c3e 100644 --- a/Swift/QtUI/ChatList/QtChatListWindow.h +++ b/Swift/QtUI/ChatList/QtChatListWindow.h @@ -26,6 +26,9 @@ namespace Swift { void setRecents(const std::list<ChatListWindow::Chat>& recents); void setUnreadCount(int unread); void clearBookmarks(); + + signals: + void onCountUpdated(int count); private slots: void handleItemActivated(const QModelIndex&); void handleAddBookmark(); diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp index 0c959d6..51aaf3e 100644 --- a/Swift/QtUI/QtMainWindow.cpp +++ b/Swift/QtUI/QtMainWindow.cpp @@ -72,6 +72,7 @@ QtMainWindow::QtMainWindow(QtSettingsProvider* settings, UIEventStream* uiEventS connect(eventWindow_, SIGNAL(onNewEventCountUpdated(int)), this, SLOT(handleEventCountUpdated(int))); chatListWindow_ = new QtChatListWindow(uiEventStream_); + connect(chatListWindow_, SIGNAL(onCountUpdated(int)), this, SLOT(handleChatCountUpdated(int))); tabs_->addTab(chatListWindow_, tr("C&hats")); tabs_->addTab(eventWindow_, tr("&Notices")); @@ -162,6 +163,17 @@ void QtMainWindow::handleEventCountUpdated(int count) { tabs_->setTabText(eventIndex, text); } +void QtMainWindow::handleChatCountUpdated(int count) { + QColor chatTabColor = (count == 0) ? QColor() : QColor(255, 0, 0); // invalid resets to default + int chatIndex = 1; + tabs_->tabBar()->setTabTextColor(chatIndex, chatTabColor); + QString text = tr("&Chats"); + if (count > 0) { + text += QString(" (%1)").arg(count); + } + tabs_->setTabText(chatIndex, text); +} + void QtMainWindow::handleAddUserActionTriggered(bool /*checked*/) { boost::shared_ptr<UIEvent> event(new RequestAddUserDialogUIEvent()); uiEventStream_->send(event); diff --git a/Swift/QtUI/QtMainWindow.h b/Swift/QtUI/QtMainWindow.h index 5c29f6d..bb3e9df 100644 --- a/Swift/QtUI/QtMainWindow.h +++ b/Swift/QtUI/QtMainWindow.h @@ -59,6 +59,7 @@ namespace Swift { void handleChatUserActionTriggered(bool checked); void handleAdHocActionTriggered(bool checked); void handleEventCountUpdated(int count); + void handleChatCountUpdated(int count); void handleEditProfileRequest(); void handleTabChanged(int index); |