From 85add9a5c84961ae67cac908a922667ed2327eea Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sat, 6 Aug 2016 11:27:44 +0800 Subject: [PATCH] Use "Standard Shortcuts" defined by Qt whenever possible. --- src/gui/mainwindow.cpp | 8 ++++---- src/gui/properties/peerlistwidget.cpp | 2 +- src/gui/properties/propertieswidget.cpp | 2 +- src/gui/properties/trackerlist.cpp | 2 +- src/gui/rss/automatedrssdownloader.cpp | 2 +- src/gui/rss/rss_imp.cpp | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 23bef83b4..12d61b326 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -743,8 +743,8 @@ void MainWindow::fullDiskError(BitTorrent::TorrentHandle *const torrent, QString void MainWindow::createKeyboardShortcuts() { - m_ui->actionCreateTorrent->setShortcut(QKeySequence("Ctrl+N")); - m_ui->actionOpen->setShortcut(QKeySequence("Ctrl+O")); + m_ui->actionCreateTorrent->setShortcut(QKeySequence::New); + m_ui->actionOpen->setShortcut(QKeySequence::Open); m_ui->actionDownloadFromURL->setShortcut(QKeySequence("Ctrl+Shift+O")); m_ui->actionExit->setShortcut(QKeySequence("Ctrl+Q")); @@ -752,12 +752,12 @@ void MainWindow::createKeyboardShortcuts() connect(switchTransferShortcut, SIGNAL(activated()), this, SLOT(displayTransferTab())); QShortcut *switchSearchShortcut = new QShortcut(QKeySequence("Alt+2"), this); connect(switchSearchShortcut, SIGNAL(activated()), this, SLOT(displaySearchTab())); - QShortcut *switchSearchShortcut2 = new QShortcut(QKeySequence("Ctrl+F"), this); + QShortcut *switchSearchShortcut2 = new QShortcut(QKeySequence::Find, this); connect(switchSearchShortcut2, SIGNAL(activated()), this, SLOT(displaySearchTab())); QShortcut *switchRSSShortcut = new QShortcut(QKeySequence("Alt+3"), this); connect(switchRSSShortcut, SIGNAL(activated()), this, SLOT(displayRSSTab())); - m_ui->actionDocumentation->setShortcut(QKeySequence("F1")); + m_ui->actionDocumentation->setShortcut(QKeySequence::HelpContents); m_ui->actionOptions->setShortcut(QKeySequence("Alt+O")); m_ui->actionStart->setShortcut(QKeySequence("Ctrl+S")); m_ui->actionStartAll->setShortcut(QKeySequence("Ctrl+Shift+S")); diff --git a/src/gui/properties/peerlistwidget.cpp b/src/gui/properties/peerlistwidget.cpp index dd763268a..1189a1a95 100644 --- a/src/gui/properties/peerlistwidget.cpp +++ b/src/gui/properties/peerlistwidget.cpp @@ -124,7 +124,7 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent) connect(header(), SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(displayToggleColumnsMenu(const QPoint &))); connect(header(), SIGNAL(sectionClicked(int)), SLOT(handleSortColumnChanged(int))); handleSortColumnChanged(header()->sortIndicatorSection()); - m_copyHotkey = new QShortcut(QKeySequence(Qt::ControlModifier + Qt::Key_C), this, SLOT(copySelectedPeers()), 0, Qt::WidgetShortcut); + m_copyHotkey = new QShortcut(QKeySequence::Copy, this, SLOT(copySelectedPeers()), 0, Qt::WidgetShortcut); #ifdef QBT_USES_QT5 // This hack fixes reordering of first column with Qt5. diff --git a/src/gui/properties/propertieswidget.cpp b/src/gui/properties/propertieswidget.cpp index 483ebf69a..5fbb2b625 100644 --- a/src/gui/properties/propertieswidget.cpp +++ b/src/gui/properties/propertieswidget.cpp @@ -164,7 +164,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, MainWindow *main_window, Tra editHotkeyWeb = new QShortcut(QKeySequence("F2"), listWebSeeds, 0, 0, Qt::WidgetShortcut); connect(editHotkeyWeb, SIGNAL(activated()), SLOT(editWebSeed())); connect(listWebSeeds, SIGNAL(doubleClicked(QModelIndex)), SLOT(editWebSeed())); - deleteHotkeyWeb = new QShortcut(QKeySequence(QKeySequence::Delete), listWebSeeds, 0, 0, Qt::WidgetShortcut); + deleteHotkeyWeb = new QShortcut(QKeySequence::Delete, listWebSeeds, 0, 0, Qt::WidgetShortcut); connect(deleteHotkeyWeb, SIGNAL(activated()), SLOT(deleteSelectedUrlSeeds())); openHotkeyFile = new QShortcut(QKeySequence("Return"), filesList, 0, 0, Qt::WidgetShortcut); connect(openHotkeyFile, SIGNAL(activated()), SLOT(openSelectedFile())); diff --git a/src/gui/properties/trackerlist.cpp b/src/gui/properties/trackerlist.cpp index 9772c38cf..f2d655b40 100644 --- a/src/gui/properties/trackerlist.cpp +++ b/src/gui/properties/trackerlist.cpp @@ -83,7 +83,7 @@ TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), propertie editHotkey = new QShortcut(QKeySequence("F2"), this, SLOT(editSelectedTracker()), 0, Qt::WidgetShortcut); connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(editSelectedTracker())); deleteHotkey = new QShortcut(QKeySequence(QKeySequence::Delete), this, SLOT(deleteSelectedTrackers()), 0, Qt::WidgetShortcut); - copyHotkey = new QShortcut(QKeySequence(Qt::ControlModifier + Qt::Key_C), this, SLOT(copyTrackerUrl()), 0, Qt::WidgetShortcut); + copyHotkey = new QShortcut(QKeySequence::Copy, this, SLOT(copyTrackerUrl()), 0, Qt::WidgetShortcut); #ifdef QBT_USES_QT5 // This hack fixes reordering of first column with Qt5. diff --git a/src/gui/rss/automatedrssdownloader.cpp b/src/gui/rss/automatedrssdownloader.cpp index 4396d106e..9a2483f6c 100644 --- a/src/gui/rss/automatedrssdownloader.cpp +++ b/src/gui/rss/automatedrssdownloader.cpp @@ -119,7 +119,7 @@ AutomatedRssDownloader::AutomatedRssDownloader(const QWeakPointer& Q_ASSERT(ok); ok = connect(ui->listRules, SIGNAL(doubleClicked(QModelIndex)), SLOT(renameSelectedRule())); Q_ASSERT(ok); - deleteHotkey = new QShortcut(QKeySequence(QKeySequence::Delete), ui->listRules, 0, 0, Qt::WidgetShortcut); + deleteHotkey = new QShortcut(QKeySequence::Delete, ui->listRules, 0, 0, Qt::WidgetShortcut); ok = connect(deleteHotkey, SIGNAL(activated()), SLOT(on_removeRuleBtn_clicked())); Q_ASSERT(ok); updateRuleDefinitionBox(); diff --git a/src/gui/rss/rss_imp.cpp b/src/gui/rss/rss_imp.cpp index 85c571a08..3581cfd6a 100644 --- a/src/gui/rss/rss_imp.cpp +++ b/src/gui/rss/rss_imp.cpp @@ -709,7 +709,7 @@ RSSImp::RSSImp(QWidget *parent): editHotkey = new QShortcut(QKeySequence("F2"), m_feedList, 0, 0, Qt::WidgetShortcut); connect(editHotkey, SIGNAL(activated()), SLOT(renameSelectedRssFile())); connect(m_feedList, SIGNAL(doubleClicked(QModelIndex)), SLOT(renameSelectedRssFile())); - deleteHotkey = new QShortcut(QKeySequence(QKeySequence::Delete), m_feedList, 0, 0, Qt::WidgetShortcut); + deleteHotkey = new QShortcut(QKeySequence::Delete, m_feedList, 0, 0, Qt::WidgetShortcut); connect(deleteHotkey, SIGNAL(activated()), SLOT(deleteSelectedItems())); m_rssManager->loadStreamList();