summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swift/QtUI/ChatList/QtChatListWindow.cpp4
-rw-r--r--Swift/QtUI/ChatList/QtChatListWindow.h3
-rw-r--r--Swift/QtUI/QtMainWindow.cpp12
-rw-r--r--Swift/QtUI/QtMainWindow.h1
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
@@ -93,20 +93,20 @@ void QtChatListWindow::addMUCBookmark(const MUCBookmark& bookmark) {
void QtChatListWindow::removeMUCBookmark(const MUCBookmark& bookmark) {
model_->removeMUCBookmark(bookmark);
}
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() {
ChatListMUCItem* mucItem = dynamic_cast<ChatListMUCItem*>(contextMenuItem_);
if (!mucItem) return;
eventStream_->send(boost::shared_ptr<UIEvent>(new RemoveMUCBookmarkUIEvent(mucItem->getBookmark())));
}
void QtChatListWindow::handleAddBookmark() {
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
@@ -20,18 +20,21 @@ namespace Swift {
public:
QtChatListWindow(UIEventStream *uiEventStream, QWidget* parent = NULL);
virtual ~QtChatListWindow();
void addMUCBookmark(const MUCBookmark& bookmark);
void removeMUCBookmark(const MUCBookmark& bookmark);
void setBookmarksEnabled(bool enabled);
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();
void handleEditBookmark();
void handleRemoveBookmark();
void handleClicked(const QModelIndex& index);
protected:
void contextMenuEvent(QContextMenuEvent* event);
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
@@ -66,18 +66,19 @@ QtMainWindow::QtMainWindow(QtSettingsProvider* settings, UIEventStream* uiEventS
treeWidget_->setEditable(true);
contactTabLayout->addWidget(treeWidget_);
tabs_->addTab(contactsTabWidget_, tr("&Contacts"));
eventWindow_ = new QtEventWindow(uiEventStream_);
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"));
tabs_->setCurrentIndex(settings_->getIntSetting(CURRENT_ROSTER_TAB, 0));
connect(tabs_, SIGNAL(currentChanged(int)), this, SLOT(handleTabChanged(int)));
this->setLayout(mainLayout);
@@ -156,18 +157,29 @@ void QtMainWindow::handleEventCountUpdated(int count) {
int eventIndex = 2;
tabs_->tabBar()->setTabTextColor(eventIndex, eventTabColor);
QString text = tr("&Notices");
if (count > 0) {
text += QString(" (%1)").arg(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);
}
void QtMainWindow::handleChatUserActionTriggered(bool /*checked*/) {
boost::shared_ptr<UIEvent> event(new RequestChatWithUserDialogUIEvent());
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
@@ -53,18 +53,19 @@ namespace Swift {
void handleUIEvent(boost::shared_ptr<UIEvent> event);
void handleShowOfflineToggled(bool);
void handleJoinMUCAction();
void handleSignOutAction();
void handleEditProfileAction();
void handleAddUserActionTriggered(bool checked);
void handleChatUserActionTriggered(bool checked);
void handleAdHocActionTriggered(bool checked);
void handleEventCountUpdated(int count);
+ void handleChatCountUpdated(int count);
void handleEditProfileRequest();
void handleTabChanged(int index);
private:
QtSettingsProvider* settings_;
std::vector<QMenu*> menus_;
QtTreeWidget* treeWidget_;
QtRosterHeader* meView_;
QAction* addUserAction_;