From c30ec7bb6e1b773f760789e9fc50c277eaac22c8 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Wed, 18 Nov 2009 12:40:13 +0000 Subject: [PATCH] - Fix keyboard shortcuts for tab switching --- src/GUI.cpp | 21 ++++++++------------- src/GUI.h | 3 +-- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/GUI.cpp b/src/GUI.cpp index 1227b36fa..f05d33917 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -68,6 +68,7 @@ #include "propertieswidget.h" using namespace libtorrent; +enum TabIndex{TAB_TRANSFER, TAB_SEARCH, TAB_RSS}; /***************************************************** * * @@ -366,14 +367,12 @@ void GUI::createKeyboardShortcuts() { actionOpen->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+O"))); actionExit->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+Q"))); switchDownShortcut = new QShortcut(QKeySequence(tr("Alt+1", "shortcut to switch to first tab")), this); - connect(switchDownShortcut, SIGNAL(activated()), this, SLOT(displayDownTab())); - switchUpShortcut = new QShortcut(QKeySequence(tr("Alt+2", "shortcut to switch to second tab")), this); - connect(switchUpShortcut, SIGNAL(activated()), this, SLOT(displayUpTab())); - switchSearchShortcut = new QShortcut(QKeySequence(tr("Alt+3", "shortcut to switch to third tab")), this); + connect(switchDownShortcut, SIGNAL(activated()), this, SLOT(displayTransferTab())); + switchSearchShortcut = new QShortcut(QKeySequence(tr("Alt+2", "shortcut to switch to third tab")), this); connect(switchSearchShortcut, SIGNAL(activated()), this, SLOT(displaySearchTab())); switchSearchShortcut2 = new QShortcut(QKeySequence(tr("Ctrl+F", "shortcut to switch to search tab")), this); connect(switchSearchShortcut2, SIGNAL(activated()), this, SLOT(displaySearchTab())); - switchRSSShortcut = new QShortcut(QKeySequence(tr("Alt+4", "shortcut to switch to fourth tab")), this); + switchRSSShortcut = new QShortcut(QKeySequence(tr("Alt+3", "shortcut to switch to fourth tab")), this); connect(switchRSSShortcut, SIGNAL(activated()), this, SLOT(displayRSSTab())); actionOptions->setShortcut(QKeySequence(QString::fromUtf8("Alt+O"))); actionDelete->setShortcut(QKeySequence(QString::fromUtf8("Del"))); @@ -386,20 +385,16 @@ void GUI::createKeyboardShortcuts() { } // Keyboard shortcuts slots -void GUI::displayDownTab() const { - tabs->setCurrentIndex(0); -} - -void GUI::displayUpTab() const { - tabs->setCurrentIndex(1); +void GUI::displayTransferTab() const { + tabs->setCurrentIndex(TAB_TRANSFER); } void GUI::displaySearchTab() const { - tabs->setCurrentIndex(2); + tabs->setCurrentIndex(TAB_SEARCH); } void GUI::displayRSSTab() const { - tabs->setCurrentIndex(3); + tabs->setCurrentIndex(TAB_RSS); } // End of keyboard shortcuts slots diff --git a/src/GUI.h b/src/GUI.h index 0e5644578..587bf70a6 100644 --- a/src/GUI.h +++ b/src/GUI.h @@ -133,8 +133,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{ void createSystrayDelayed(); // Keyboard shortcuts void createKeyboardShortcuts(); - void displayDownTab() const; - void displayUpTab() const; + void displayTransferTab() const; void displaySearchTab() const; void displayRSSTab() const; // Torrent actions