1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-22 12:34:19 +00:00

- Fix keyboard shortcuts for tab switching

This commit is contained in:
Christophe Dumez 2009-11-18 12:40:13 +00:00
parent 0bc2e9aeeb
commit c30ec7bb6e
2 changed files with 9 additions and 15 deletions

View File

@ -68,6 +68,7 @@
#include "propertieswidget.h" #include "propertieswidget.h"
using namespace libtorrent; 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"))); actionOpen->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+O")));
actionExit->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+Q"))); actionExit->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+Q")));
switchDownShortcut = new QShortcut(QKeySequence(tr("Alt+1", "shortcut to switch to first tab")), this); switchDownShortcut = new QShortcut(QKeySequence(tr("Alt+1", "shortcut to switch to first tab")), this);
connect(switchDownShortcut, SIGNAL(activated()), this, SLOT(displayDownTab())); connect(switchDownShortcut, SIGNAL(activated()), this, SLOT(displayTransferTab()));
switchUpShortcut = new QShortcut(QKeySequence(tr("Alt+2", "shortcut to switch to second tab")), this); switchSearchShortcut = new QShortcut(QKeySequence(tr("Alt+2", "shortcut to switch to third tab")), this);
connect(switchUpShortcut, SIGNAL(activated()), this, SLOT(displayUpTab()));
switchSearchShortcut = new QShortcut(QKeySequence(tr("Alt+3", "shortcut to switch to third tab")), this);
connect(switchSearchShortcut, SIGNAL(activated()), this, SLOT(displaySearchTab())); connect(switchSearchShortcut, SIGNAL(activated()), this, SLOT(displaySearchTab()));
switchSearchShortcut2 = new QShortcut(QKeySequence(tr("Ctrl+F", "shortcut to switch to search tab")), this); switchSearchShortcut2 = new QShortcut(QKeySequence(tr("Ctrl+F", "shortcut to switch to search tab")), this);
connect(switchSearchShortcut2, SIGNAL(activated()), this, SLOT(displaySearchTab())); 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())); connect(switchRSSShortcut, SIGNAL(activated()), this, SLOT(displayRSSTab()));
actionOptions->setShortcut(QKeySequence(QString::fromUtf8("Alt+O"))); actionOptions->setShortcut(QKeySequence(QString::fromUtf8("Alt+O")));
actionDelete->setShortcut(QKeySequence(QString::fromUtf8("Del"))); actionDelete->setShortcut(QKeySequence(QString::fromUtf8("Del")));
@ -386,20 +385,16 @@ void GUI::createKeyboardShortcuts() {
} }
// Keyboard shortcuts slots // Keyboard shortcuts slots
void GUI::displayDownTab() const { void GUI::displayTransferTab() const {
tabs->setCurrentIndex(0); tabs->setCurrentIndex(TAB_TRANSFER);
}
void GUI::displayUpTab() const {
tabs->setCurrentIndex(1);
} }
void GUI::displaySearchTab() const { void GUI::displaySearchTab() const {
tabs->setCurrentIndex(2); tabs->setCurrentIndex(TAB_SEARCH);
} }
void GUI::displayRSSTab() const { void GUI::displayRSSTab() const {
tabs->setCurrentIndex(3); tabs->setCurrentIndex(TAB_RSS);
} }
// End of keyboard shortcuts slots // End of keyboard shortcuts slots

View File

@ -133,8 +133,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void createSystrayDelayed(); void createSystrayDelayed();
// Keyboard shortcuts // Keyboard shortcuts
void createKeyboardShortcuts(); void createKeyboardShortcuts();
void displayDownTab() const; void displayTransferTab() const;
void displayUpTab() const;
void displaySearchTab() const; void displaySearchTab() const;
void displayRSSTab() const; void displayRSSTab() const;
// Torrent actions // Torrent actions