summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swift/QtUI/QtChatTabs.cpp24
-rw-r--r--Swift/QtUI/QtChatTabs.h1
-rw-r--r--Swift/QtUI/QtChatWindow.cpp9
-rw-r--r--Swift/QtUI/QtTabbable.h1
-rw-r--r--Swift/QtUI/QtTextEdit.cpp6
5 files changed, 36 insertions, 5 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;
+ }
+ }
+ }
}
diff --git a/Swift/QtUI/QtChatTabs.h b/Swift/QtUI/QtChatTabs.h
index 41d7b2f..69dd8d1 100644
--- a/Swift/QtUI/QtChatTabs.h
+++ b/Swift/QtUI/QtChatTabs.h
@@ -37,6 +37,7 @@ namespace Swift {
void handleWantsToActivate();
void handleRequestedPreviousTab();
void handleRequestedNextTab();
+ void handleRequestedActiveTab();
private:
void checkForFirstShow();
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index 5e96b3e..fdf1ebc 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -96,14 +96,19 @@ void QtChatWindow::handleKeyPressEvent(QKeyEvent* event) {
close();
} else if (
(key == Qt::Key_PageUp && modifiers == Qt::ControlModifier)
- || (key == Qt::Key_Left && modifiers == (Qt::ControlModifier & Qt::ShiftModifier))
+// || (key == Qt::Key_Left && modifiers == (Qt::ControlModifier & Qt::ShiftModifier))
) {
emit requestPreviousTab();
} else if (
(key == Qt::Key_PageDown && modifiers == Qt::ControlModifier)
- || (key == Qt::Key_Right && modifiers == (Qt::ControlModifier & Qt::ShiftModifier))
+// || (key == Qt::Key_Right && modifiers == (Qt::ControlModifier & Qt::ShiftModifier)
+ || (key == Qt::Key_Tab && modifiers == Qt::ControlModifier)
) {
emit requestNextTab();
+ } else if (
+ (key == Qt::Key_A && modifiers == Qt::AltModifier)
+ ) {
+ emit requestActiveTab();
} else if (key == Qt::Key_Tab) {
tabComplete();
} else {
diff --git a/Swift/QtUI/QtTabbable.h b/Swift/QtUI/QtTabbable.h
index 9309841..1a1170f 100644
--- a/Swift/QtUI/QtTabbable.h
+++ b/Swift/QtUI/QtTabbable.h
@@ -29,5 +29,6 @@ namespace Swift {
void wantsToActivate();
void requestPreviousTab();
void requestNextTab();
+ void requestActiveTab();
};
}
diff --git a/Swift/QtUI/QtTextEdit.cpp b/Swift/QtUI/QtTextEdit.cpp
index 89fc68f..f94d80d 100644
--- a/Swift/QtUI/QtTextEdit.cpp
+++ b/Swift/QtUI/QtTextEdit.cpp
@@ -27,8 +27,10 @@ void QtTextEdit::keyPressEvent(QKeyEvent* event) {
|| (key == Qt::Key_W && modifiers == Qt::ControlModifier)
|| (key == Qt::Key_PageUp && modifiers == Qt::ControlModifier)
|| (key == Qt::Key_PageDown && modifiers == Qt::ControlModifier)
- || (key == Qt::Key_Left && modifiers == (Qt::ControlModifier | Qt::ShiftModifier))
- || (key == Qt::Key_Right && modifiers == (Qt::ControlModifier | Qt::ShiftModifier))
+// || (key == Qt::Key_Left && modifiers == (Qt::ControlModifier | Qt::ShiftModifier))
+// || (key == Qt::Key_Right && modifiers == (Qt::ControlModifier | Qt::ShiftModifier))
+ || (key == Qt::Key_Tab && modifiers == Qt::ControlModifier)
+ || (key == Qt::Key_A && modifiers == Qt::AltModifier)
|| (key == Qt::Key_Tab)
) {
emit unhandledKeyPressEvent(event);