diff options
author | Kevin Smith <git@kismith.co.uk> | 2011-07-10 12:09:26 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2011-07-10 12:09:26 (GMT) |
commit | 72cd949dd179f0781c156544b87cb6d1d5c34862 (patch) | |
tree | 2a30af0bbef092638d62e4f9163cf26a351fc5ac /Swift/QtUI/QtMainWindow.cpp | |
parent | 8cd2cc3660a4af19ae74b7271571e7e2c3a3e35c (diff) | |
download | swift-contrib-72cd949dd179f0781c156544b87cb6d1d5c34862.zip swift-contrib-72cd949dd179f0781c156544b87cb6d1d5c34862.tar.bz2 |
Update the Chats tab for unread messages
Diffstat (limited to 'Swift/QtUI/QtMainWindow.cpp')
-rw-r--r-- | Swift/QtUI/QtMainWindow.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
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); |