diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-07-25 14:52:51 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-07-25 14:52:51 (GMT) |
commit | 25ba37d0fd3ed298d5a0874718f878668a1be62e (patch) | |
tree | 8526d8e7cabe1637969be73ab5de5afdaf651bec /Swift/QtUI/QtChatTabs.cpp | |
parent | aafc6a9b0eb2af64e51943fff89019a937ba137d (diff) | |
download | swift-contrib-25ba37d0fd3ed298d5a0874718f878668a1be62e.zip swift-contrib-25ba37d0fd3ed298d5a0874718f878668a1be62e.tar.bz2 |
ChatTabs improvements.
Resolves: #504
Resolves: #507
Diffstat (limited to 'Swift/QtUI/QtChatTabs.cpp')
-rw-r--r-- | Swift/QtUI/QtChatTabs.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp index 138e815..48c882f 100644 --- a/Swift/QtUI/QtChatTabs.cpp +++ b/Swift/QtUI/QtChatTabs.cpp @@ -63,6 +63,7 @@ void QtChatTabs::addTab(QtTabbable* tab) { connect(tab, SIGNAL(windowOpening()), this, SLOT(handleWidgetShown())); connect(tab, SIGNAL(wantsToActivate()), this, SLOT(handleWantsToActivate())); connect(tab, SIGNAL(requestNextTab()), this, SLOT(handleRequestedNextTab())); + connect(tab, SIGNAL(requestActiveTab()), this, SLOT(handleRequestedActiveTab())); connect(tab, SIGNAL(requestPreviousTab()), this, SLOT(handleRequestedPreviousTab())); setSizePolicy(policy); } @@ -117,7 +118,28 @@ void QtChatTabs::handleRequestedPreviousTab() { void QtChatTabs::handleRequestedNextTab() { int newIndex = tabs_->currentIndex() + 1; tabs_->setCurrentIndex(newIndex < tabs_->count() ? newIndex : 0); - +} + +void QtChatTabs::handleRequestedActiveTab() { + QtTabbable::AlertType types[] = {QtTabbable::WaitingActivity, QtTabbable::ImpendingActivity}; + bool finished = false; + for (int j = 0; j < 2; j++) { + bool looped = false; + for (int i = tabs_->currentIndex() + 1; !finished && i != tabs_->currentIndex(); i++) { + if (i >= tabs_->count()) { + if (looped) { + break; + } + looped = true; + i = 0; + } + if (qobject_cast<QtTabbable*>(tabs_->widget(i))->getWidgetAlertState() == types[j]) { + tabs_->setCurrentIndex(i); + finished = true; + break; + } + } + } } |