Browse Source

Add keyboard navigation keys

* Added keyboard navigation keys for context menu with `&`
* Added `CTRL+M` for force resume.

PR #16988.

Co-authored-by: itLezy <itLezy@users.noreply.github.com>
Co-authored-by: Vladimir Golovnev <glassez@yandex.ru>
adaptive-webui-19844
itlezy 3 years ago committed by GitHub
parent
commit
a266599118
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 62
      src/gui/transferlistwidget.cpp

62
src/gui/transferlistwidget.cpp

@ -223,6 +223,8 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow) @@ -223,6 +223,8 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow)
connect(doubleClickHotkeyEnter, &QShortcut::activated, this, &TransferListWidget::torrentDoubleClicked);
const auto *recheckHotkey = new QShortcut(Qt::CTRL + Qt::Key_R, this, nullptr, nullptr, Qt::WidgetShortcut);
connect(recheckHotkey, &QShortcut::activated, this, &TransferListWidget::recheckSelectedTorrents);
const auto *forceStartHotkey = new QShortcut(Qt::CTRL + Qt::Key_M, this, nullptr, nullptr, Qt::WidgetShortcut);
connect(forceStartHotkey, &QShortcut::activated, this, &TransferListWidget::forceStartSelectedTorrents);
}
TransferListWidget::~TransferListWidget()
@ -907,47 +909,47 @@ void TransferListWidget::displayListMenu() @@ -907,47 +909,47 @@ void TransferListWidget::displayListMenu()
// Create actions
auto *actionStart = new QAction(UIThemeManager::instance()->getIcon(u"media-playback-start"_qs), tr("Resume", "Resume/start the torrent"), listMenu);
auto *actionStart = new QAction(UIThemeManager::instance()->getIcon(u"media-playback-start"_qs), tr("&Resume", "Resume/start the torrent"), listMenu);
connect(actionStart, &QAction::triggered, this, &TransferListWidget::startSelectedTorrents);
auto *actionPause = new QAction(UIThemeManager::instance()->getIcon(u"media-playback-pause"_qs), tr("Pause", "Pause the torrent"), listMenu);
auto *actionPause = new QAction(UIThemeManager::instance()->getIcon(u"media-playback-pause"_qs), tr("&Pause", "Pause the torrent"), listMenu);
connect(actionPause, &QAction::triggered, this, &TransferListWidget::pauseSelectedTorrents);
auto *actionForceStart = new QAction(UIThemeManager::instance()->getIcon(u"media-seek-forward"_qs), tr("Force Resume", "Force Resume/start the torrent"), listMenu);
auto *actionForceStart = new QAction(UIThemeManager::instance()->getIcon(u"media-seek-forward"_qs), tr("Force Resu&me", "Force Resume/start the torrent"), listMenu);
connect(actionForceStart, &QAction::triggered, this, &TransferListWidget::forceStartSelectedTorrents);
auto *actionDelete = new QAction(UIThemeManager::instance()->getIcon(u"list-remove"_qs), tr("Delete", "Delete the torrent"), listMenu);
auto *actionDelete = new QAction(UIThemeManager::instance()->getIcon(u"list-remove"_qs), tr("&Delete", "Delete the torrent"), listMenu);
connect(actionDelete, &QAction::triggered, this, &TransferListWidget::softDeleteSelectedTorrents);
auto *actionPreviewFile = new QAction(UIThemeManager::instance()->getIcon(u"view-preview"_qs), tr("Preview file..."), listMenu);
auto *actionPreviewFile = new QAction(UIThemeManager::instance()->getIcon(u"view-preview"_qs), tr("Pre&view file..."), listMenu);
connect(actionPreviewFile, &QAction::triggered, this, &TransferListWidget::previewSelectedTorrents);
auto *actionTorrentOptions = new QAction(UIThemeManager::instance()->getIcon(u"configure"_qs), tr("Torrent options..."), listMenu);
auto *actionTorrentOptions = new QAction(UIThemeManager::instance()->getIcon(u"configure"_qs), tr("Torrent &options..."), listMenu);
connect(actionTorrentOptions, &QAction::triggered, this, &TransferListWidget::setTorrentOptions);
auto *actionOpenDestinationFolder = new QAction(UIThemeManager::instance()->getIcon(u"inode-directory"_qs), tr("Open destination folder"), listMenu);
auto *actionOpenDestinationFolder = new QAction(UIThemeManager::instance()->getIcon(u"inode-directory"_qs), tr("Open destination &folder"), listMenu);
connect(actionOpenDestinationFolder, &QAction::triggered, this, &TransferListWidget::openSelectedTorrentsFolder);
auto *actionIncreaseQueuePos = new QAction(UIThemeManager::instance()->getIcon(u"go-up"_qs), tr("Move up", "i.e. move up in the queue"), listMenu);
auto *actionIncreaseQueuePos = new QAction(UIThemeManager::instance()->getIcon(u"go-up"_qs), tr("Move &up", "i.e. move up in the queue"), listMenu);
connect(actionIncreaseQueuePos, &QAction::triggered, this, &TransferListWidget::increaseQueuePosSelectedTorrents);
auto *actionDecreaseQueuePos = new QAction(UIThemeManager::instance()->getIcon(u"go-down"_qs), tr("Move down", "i.e. Move down in the queue"), listMenu);
auto *actionDecreaseQueuePos = new QAction(UIThemeManager::instance()->getIcon(u"go-down"_qs), tr("Move &down", "i.e. Move down in the queue"), listMenu);
connect(actionDecreaseQueuePos, &QAction::triggered, this, &TransferListWidget::decreaseQueuePosSelectedTorrents);
auto *actionTopQueuePos = new QAction(UIThemeManager::instance()->getIcon(u"go-top"_qs), tr("Move to top", "i.e. Move to top of the queue"), listMenu);
auto *actionTopQueuePos = new QAction(UIThemeManager::instance()->getIcon(u"go-top"_qs), tr("Move to &top", "i.e. Move to top of the queue"), listMenu);
connect(actionTopQueuePos, &QAction::triggered, this, &TransferListWidget::topQueuePosSelectedTorrents);
auto *actionBottomQueuePos = new QAction(UIThemeManager::instance()->getIcon(u"go-bottom"_qs), tr("Move to bottom", "i.e. Move to bottom of the queue"), listMenu);
auto *actionBottomQueuePos = new QAction(UIThemeManager::instance()->getIcon(u"go-bottom"_qs), tr("Move to &bottom", "i.e. Move to bottom of the queue"), listMenu);
connect(actionBottomQueuePos, &QAction::triggered, this, &TransferListWidget::bottomQueuePosSelectedTorrents);
auto *actionSetTorrentPath = new QAction(UIThemeManager::instance()->getIcon(u"inode-directory"_qs), tr("Set location..."), listMenu);
auto *actionSetTorrentPath = new QAction(UIThemeManager::instance()->getIcon(u"inode-directory"_qs), tr("Set loc&ation..."), listMenu);
connect(actionSetTorrentPath, &QAction::triggered, this, &TransferListWidget::setSelectedTorrentsLocation);
auto *actionForceRecheck = new QAction(UIThemeManager::instance()->getIcon(u"document-edit-verify"_qs), tr("Force recheck"), listMenu);
auto *actionForceRecheck = new QAction(UIThemeManager::instance()->getIcon(u"document-edit-verify"_qs), tr("Force rec&heck"), listMenu);
connect(actionForceRecheck, &QAction::triggered, this, &TransferListWidget::recheckSelectedTorrents);
auto *actionForceReannounce = new QAction(UIThemeManager::instance()->getIcon(u"document-edit-verify"_qs), tr("Force reannounce"), listMenu);
auto *actionForceReannounce = new QAction(UIThemeManager::instance()->getIcon(u"document-edit-verify"_qs), tr("Force r&eannounce"), listMenu);
connect(actionForceReannounce, &QAction::triggered, this, &TransferListWidget::reannounceSelectedTorrents);
auto *actionCopyMagnetLink = new QAction(UIThemeManager::instance()->getIcon(u"kt-magnet"_qs), tr("Magnet link"), listMenu);
auto *actionCopyMagnetLink = new QAction(UIThemeManager::instance()->getIcon(u"kt-magnet"_qs), tr("&Magnet link"), listMenu);
connect(actionCopyMagnetLink, &QAction::triggered, this, &TransferListWidget::copySelectedMagnetURIs);
auto *actionCopyID = new QAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Torrent ID"), listMenu);
auto *actionCopyID = new QAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Torrent &ID"), listMenu);
connect(actionCopyID, &QAction::triggered, this, &TransferListWidget::copySelectedIDs);
auto *actionCopyName = new QAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Name"), listMenu);
auto *actionCopyName = new QAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("&Name"), listMenu);
connect(actionCopyName, &QAction::triggered, this, &TransferListWidget::copySelectedNames);
auto *actionCopyHash1 = new QAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Info hash v1"), listMenu);
auto *actionCopyHash1 = new QAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Info &hash v1"), listMenu);
connect(actionCopyHash1, &QAction::triggered, this, [this]() { copySelectedInfohashes(CopyInfohashPolicy::Version1); });
auto *actionCopyHash2 = new QAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Info hash v2"), listMenu);
auto *actionCopyHash2 = new QAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Info h&ash v2"), listMenu);
connect(actionCopyHash2, &QAction::triggered, this, [this]() { copySelectedInfohashes(CopyInfohashPolicy::Version2); });
auto *actionSuperSeedingMode = new TriStateAction(tr("Super seeding mode"), listMenu);
connect(actionSuperSeedingMode, &QAction::triggered, this, &TransferListWidget::setSelectedTorrentsSuperSeeding);
auto *actionRename = new QAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs), tr("Rename..."), listMenu);
auto *actionRename = new QAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs), tr("Re&name..."), listMenu);
connect(actionRename, &QAction::triggered, this, &TransferListWidget::renameSelectedTorrent);
auto *actionSequentialDownload = new TriStateAction(tr("Download in sequential order"), listMenu);
connect(actionSequentialDownload, &QAction::triggered, this, &TransferListWidget::setSelectedTorrentsSequentialDownload);
@ -956,9 +958,9 @@ void TransferListWidget::displayListMenu() @@ -956,9 +958,9 @@ void TransferListWidget::displayListMenu()
auto *actionAutoTMM = new TriStateAction(tr("Automatic Torrent Management"), listMenu);
actionAutoTMM->setToolTip(tr("Automatic mode means that various torrent properties (e.g. save path) will be decided by the associated category"));
connect(actionAutoTMM, &QAction::triggered, this, &TransferListWidget::setSelectedAutoTMMEnabled);
auto *actionEditTracker = new QAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs), tr("Edit trackers..."), listMenu);
auto *actionEditTracker = new QAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs), tr("Edit trac&kers..."), listMenu);
connect(actionEditTracker, &QAction::triggered, this, &TransferListWidget::editTorrentTrackers);
auto *actionExportTorrent = new QAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Export .torrent..."), listMenu);
auto *actionExportTorrent = new QAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("E&xport .torrent..."), listMenu);
connect(actionExportTorrent, &QAction::triggered, this, &TransferListWidget::exportTorrent);
// End of actions
@ -1098,11 +1100,11 @@ void TransferListWidget::displayListMenu() @@ -1098,11 +1100,11 @@ void TransferListWidget::displayListMenu()
QStringList categories = BitTorrent::Session::instance()->categories();
std::sort(categories.begin(), categories.end(), Utils::Compare::NaturalLessThan<Qt::CaseInsensitive>());
QMenu *categoryMenu = listMenu->addMenu(UIThemeManager::instance()->getIcon(u"view-categories"_qs), tr("Category"));
QMenu *categoryMenu = listMenu->addMenu(UIThemeManager::instance()->getIcon(u"view-categories"_qs), tr("Categor&y"));
categoryMenu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("New...", "New category...")
categoryMenu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("&New...", "New category...")
, this, &TransferListWidget::askNewCategoryForSelection);
categoryMenu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("Reset", "Reset category")
categoryMenu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("&Reset", "Reset category")
, this, [this]() { setSelectionCategory(u""_qs); });
categoryMenu->addSeparator();
@ -1123,11 +1125,11 @@ void TransferListWidget::displayListMenu() @@ -1123,11 +1125,11 @@ void TransferListWidget::displayListMenu()
QStringList tags(BitTorrent::Session::instance()->tags().values());
std::sort(tags.begin(), tags.end(), Utils::Compare::NaturalLessThan<Qt::CaseInsensitive>());
QMenu *tagsMenu = listMenu->addMenu(UIThemeManager::instance()->getIcon(u"view-categories"_qs), tr("Tags"));
QMenu *tagsMenu = listMenu->addMenu(UIThemeManager::instance()->getIcon(u"view-categories"_qs), tr("Ta&gs"));
tagsMenu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("Add...", "Add / assign multiple tags...")
tagsMenu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("&Add...", "Add / assign multiple tags...")
, this, &TransferListWidget::askAddTagsForSelection);
tagsMenu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("Remove All", "Remove all tags")
tagsMenu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("&Remove All", "Remove all tags")
, this, [this]()
{
if (Preferences::instance()->confirmRemoveAllTags())
@ -1208,14 +1210,14 @@ void TransferListWidget::displayListMenu() @@ -1208,14 +1210,14 @@ void TransferListWidget::displayListMenu()
if (BitTorrent::Session::instance()->isQueueingSystemEnabled() && oneNotSeed)
{
listMenu->addSeparator();
QMenu *queueMenu = listMenu->addMenu(tr("Queue"));
QMenu *queueMenu = listMenu->addMenu(tr("&Queue"));
queueMenu->addAction(actionTopQueuePos);
queueMenu->addAction(actionIncreaseQueuePos);
queueMenu->addAction(actionDecreaseQueuePos);
queueMenu->addAction(actionBottomQueuePos);
}
QMenu *copySubMenu = listMenu->addMenu(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Copy"));
QMenu *copySubMenu = listMenu->addMenu(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("&Copy"));
copySubMenu->addAction(actionCopyName);
copySubMenu->addAction(actionCopyHash1);
actionCopyHash1->setEnabled(hasInfohashV1);

Loading…
Cancel
Save