Browse Source

Remove redundant variable declarations

adaptive-webui-19844
Chocobo1 4 years ago
parent
commit
6258652c7b
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 5
      src/gui/addnewtorrentdialog.cpp
  2. 54
      src/gui/categoryfilterwidget.cpp
  3. 8
      src/gui/executionlogwidget.cpp
  4. 29
      src/gui/mainwindow.cpp
  5. 14
      src/gui/properties/peerlistwidget.cpp
  6. 34
      src/gui/properties/propertieswidget.cpp
  7. 28
      src/gui/properties/trackerlistwidget.cpp
  8. 23
      src/gui/rss/automatedrssdownloader.cpp
  9. 28
      src/gui/search/searchjobwidget.cpp
  10. 42
      src/gui/tagfilterwidget.cpp
  11. 14
      src/gui/transferlistfilterswidget.cpp
  12. 28
      src/gui/transferlistwidget.cpp

5
src/gui/addnewtorrentdialog.cpp

@ -517,9 +517,8 @@ void AddNewTorrentDialog::displayContentTreeMenu(const QPoint &) @@ -517,9 +517,8 @@ void AddNewTorrentDialog::displayContentTreeMenu(const QPoint &)
if (selectedRows.size() == 1)
{
QAction *actRename = menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Rename..."));
connect(actRename, &QAction::triggered, this, [this]() { m_ui->contentTreeView->renameSelectedFile(m_torrentInfo); });
menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Rename...")
, this, [this]() { m_ui->contentTreeView->renameSelectedFile(m_torrentInfo); });
menu->addSeparator();
}

54
src/gui/categoryfilterwidget.cpp

@ -28,7 +28,6 @@ @@ -28,7 +28,6 @@
#include "categoryfilterwidget.h"
#include <QAction>
#include <QMenu>
#include "base/bittorrent/session.h"
@ -110,54 +109,33 @@ void CategoryFilterWidget::showMenu(const QPoint &) @@ -110,54 +109,33 @@ void CategoryFilterWidget::showMenu(const QPoint &)
QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
const QAction *addAct = menu->addAction(
UIThemeManager::instance()->getIcon("list-add")
, tr("Add category..."));
connect(addAct, &QAction::triggered, this, &CategoryFilterWidget::addCategory);
menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add category...")
, this, &CategoryFilterWidget::addCategory);
const auto selectedRows = selectionModel()->selectedRows();
if (!selectedRows.empty() && !CategoryFilterModel::isSpecialItem(selectedRows.first()))
{
if (BitTorrent::Session::instance()->isSubcategoriesEnabled())
{
const QAction *addSubAct = menu->addAction(
UIThemeManager::instance()->getIcon("list-add")
, tr("Add subcategory..."));
connect(addSubAct, &QAction::triggered, this, &CategoryFilterWidget::addSubcategory);
menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add subcategory...")
, this, &CategoryFilterWidget::addSubcategory);
}
const QAction *editAct = menu->addAction(
UIThemeManager::instance()->getIcon("document-edit")
, tr("Edit category..."));
connect(editAct, &QAction::triggered, this, &CategoryFilterWidget::editCategory);
const QAction *removeAct = menu->addAction(
UIThemeManager::instance()->getIcon("list-remove")
, tr("Remove category"));
connect(removeAct, &QAction::triggered, this, &CategoryFilterWidget::removeCategory);
menu->addAction(UIThemeManager::instance()->getIcon("document-edit"), tr("Edit category...")
, this, &CategoryFilterWidget::editCategory);
menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Remove category")
, this, &CategoryFilterWidget::removeCategory);
}
const QAction *removeUnusedAct = menu->addAction(
UIThemeManager::instance()->getIcon("list-remove")
, tr("Remove unused categories"));
connect(removeUnusedAct, &QAction::triggered, this, &CategoryFilterWidget::removeUnusedCategories);
menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Remove unused categories")
, this, &CategoryFilterWidget::removeUnusedCategories);
menu->addSeparator();
const QAction *startAct = menu->addAction(
UIThemeManager::instance()->getIcon("media-playback-start")
, tr("Resume torrents"));
connect(startAct, &QAction::triggered, this, &CategoryFilterWidget::actionResumeTorrentsTriggered);
const QAction *pauseAct = menu->addAction(
UIThemeManager::instance()->getIcon("media-playback-pause")
, tr("Pause torrents"));
connect(pauseAct, &QAction::triggered, this, &CategoryFilterWidget::actionPauseTorrentsTriggered);
const QAction *deleteTorrentsAct = menu->addAction(
UIThemeManager::instance()->getIcon("edit-delete")
, tr("Delete torrents"));
connect(deleteTorrentsAct, &QAction::triggered, this, &CategoryFilterWidget::actionDeleteTorrentsTriggered);
menu->addAction(UIThemeManager::instance()->getIcon("media-playback-start"), tr("Resume torrents")
, this, &CategoryFilterWidget::actionResumeTorrentsTriggered);
menu->addAction(UIThemeManager::instance()->getIcon("media-playback-pause"), tr("Pause torrents")
, this, &CategoryFilterWidget::actionPauseTorrentsTriggered);
menu->addAction(UIThemeManager::instance()->getIcon("edit-delete"), tr("Delete torrents")
, this, &CategoryFilterWidget::actionDeleteTorrentsTriggered);
menu->popup(QCursor::pos());
}

8
src/gui/executionlogwidget.cpp

@ -91,12 +91,12 @@ void ExecutionLogWidget::displayContextMenu(const QPoint &pos, const LogListView @@ -91,12 +91,12 @@ void ExecutionLogWidget::displayContextMenu(const QPoint &pos, const LogListView
// only show copy action if any of the row is selected
if (view->currentIndex().isValid())
{
const QAction *copyAct = menu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy"));
connect(copyAct, &QAction::triggered, view, &LogListView::copySelection);
menu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy")
, view, &LogListView::copySelection);
}
const QAction *clearAct = menu->addAction(UIThemeManager::instance()->getIcon("edit-clear"), tr("Clear"));
connect(clearAct, &QAction::triggered, model, &BaseLogModel::reset);
menu->addAction(UIThemeManager::instance()->getIcon("edit-clear"), tr("Clear")
, model, &BaseLogModel::reset);
menu->popup(view->mapToGlobal(pos));
}

29
src/gui/mainwindow.cpp

@ -195,10 +195,8 @@ MainWindow::MainWindow(QWidget *parent) @@ -195,10 +195,8 @@ MainWindow::MainWindow(QWidget *parent)
m_ui->actionManageCookies->setIcon(UIThemeManager::instance()->getIcon("preferences-web-browser-cookies"));
auto *lockMenu = new QMenu(this);
QAction *defineUiLockPasswdAct = lockMenu->addAction(tr("&Set Password"));
connect(defineUiLockPasswdAct, &QAction::triggered, this, &MainWindow::defineUILockPassword);
QAction *clearUiLockPasswdAct = lockMenu->addAction(tr("&Clear Password"));
connect(clearUiLockPasswdAct, &QAction::triggered, this, &MainWindow::clearUILockPassword);
lockMenu->addAction(tr("&Set Password"), this, &MainWindow::defineUILockPassword);
lockMenu->addAction(tr("&Clear Password"), this, &MainWindow::clearUILockPassword);
m_ui->actionLock->setMenu(lockMenu);
// Creating Bittorrent session
@ -550,16 +548,11 @@ void MainWindow::addToolbarContextMenu() @@ -550,16 +548,11 @@ void MainWindow::addToolbarContextMenu()
m_ui->toolBar->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_ui->toolBar, &QWidget::customContextMenuRequested, this, &MainWindow::toolbarMenuRequested);
QAction *iconsOnly = m_toolbarMenu->addAction(tr("Icons Only"));
connect(iconsOnly, &QAction::triggered, this, &MainWindow::toolbarIconsOnly);
QAction *textOnly = m_toolbarMenu->addAction(tr("Text Only"));
connect(textOnly, &QAction::triggered, this, &MainWindow::toolbarTextOnly);
QAction *textBesideIcons = m_toolbarMenu->addAction(tr("Text Alongside Icons"));
connect(textBesideIcons, &QAction::triggered, this, &MainWindow::toolbarTextBeside);
QAction *textUnderIcons = m_toolbarMenu->addAction(tr("Text Under Icons"));
connect(textUnderIcons, &QAction::triggered, this, &MainWindow::toolbarTextUnder);
QAction *followSystemStyle = m_toolbarMenu->addAction(tr("Follow System Style"));
connect(followSystemStyle, &QAction::triggered, this, &MainWindow::toolbarFollowSystem);
QAction *iconsOnly = m_toolbarMenu->addAction(tr("Icons Only"), this, &MainWindow::toolbarIconsOnly);
QAction *textOnly = m_toolbarMenu->addAction(tr("Text Only"), this, &MainWindow::toolbarTextOnly);
QAction *textBesideIcons = m_toolbarMenu->addAction(tr("Text Alongside Icons"), this, &MainWindow::toolbarTextBeside);
QAction *textUnderIcons = m_toolbarMenu->addAction(tr("Text Under Icons"), this, &MainWindow::toolbarTextUnder);
QAction *followSystemStyle = m_toolbarMenu->addAction(tr("Follow System Style"), this, &MainWindow::toolbarFollowSystem);
auto *textPositionGroup = new QActionGroup(m_toolbarMenu);
textPositionGroup->addAction(iconsOnly);
@ -1804,21 +1797,21 @@ void MainWindow::on_actionOptions_triggered() @@ -1804,21 +1797,21 @@ void MainWindow::on_actionOptions_triggered()
void MainWindow::on_actionTopToolBar_triggered()
{
const bool isVisible = static_cast<QAction*>(sender())->isChecked();
const bool isVisible = static_cast<QAction *>(sender())->isChecked();
m_ui->toolBar->setVisible(isVisible);
Preferences::instance()->setToolbarDisplayed(isVisible);
}
void MainWindow::on_actionShowStatusbar_triggered()
{
const bool isVisible = static_cast<QAction*>(sender())->isChecked();
const bool isVisible = static_cast<QAction *>(sender())->isChecked();
Preferences::instance()->setStatusbarDisplayed(isVisible);
showStatusBar(isVisible);
}
void MainWindow::on_actionSpeedInTitleBar_triggered()
{
m_displaySpeedInTitle = static_cast<QAction * >(sender())->isChecked();
m_displaySpeedInTitle = static_cast<QAction *>(sender())->isChecked();
Preferences::instance()->showSpeedInTitleBar(m_displaySpeedInTitle);
if (m_displaySpeedInTitle)
reloadSessionStats();
@ -2097,7 +2090,7 @@ void MainWindow::checkProgramUpdate() @@ -2097,7 +2090,7 @@ void MainWindow::checkProgramUpdate()
m_ui->actionCheckForUpdates->setEnabled(false);
m_ui->actionCheckForUpdates->setText(tr("Checking for Updates..."));
m_ui->actionCheckForUpdates->setToolTip(tr("Already checking for program updates in the background"));
bool invokedByUser = m_ui->actionCheckForUpdates == qobject_cast<QAction * >(sender());
bool invokedByUser = m_ui->actionCheckForUpdates == qobject_cast<QAction *>(sender());
ProgramUpdater *updater = new ProgramUpdater(this, invokedByUser);
connect(updater, &ProgramUpdater::updateCheckFinished, this, &MainWindow::handleUpdateCheckFinished);
updater->checkForUpdates();

14
src/gui/properties/peerlistwidget.cpp

@ -270,8 +270,8 @@ void PeerListWidget::showPeerListMenu(const QPoint &) @@ -270,8 +270,8 @@ void PeerListWidget::showPeerListMenu(const QPoint &)
// Do not allow user to add peers in a private torrent
if (!torrent->isQueued() && !torrent->isChecking() && !torrent->isPrivate())
{
const QAction *addPeerAct = menu->addAction(UIThemeManager::instance()->getIcon("user-group-new"), tr("Add a new peer..."));
connect(addPeerAct, &QAction::triggered, this, [this, torrent]()
menu->addAction(UIThemeManager::instance()->getIcon("user-group-new"), tr("Add a new peer...")
, this, [this, torrent]()
{
const QVector<BitTorrent::PeerAddress> peersList = PeersAdditionDialog::askForPeers(this);
const int peerCount = std::count_if(peersList.cbegin(), peersList.cend(), [torrent](const BitTorrent::PeerAddress &peer)
@ -287,13 +287,11 @@ void PeerListWidget::showPeerListMenu(const QPoint &) @@ -287,13 +287,11 @@ void PeerListWidget::showPeerListMenu(const QPoint &)
if (!selectionModel()->selectedRows().isEmpty())
{
const QAction *copyPeerAct = menu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy IP:port"));
connect(copyPeerAct, &QAction::triggered, this, &PeerListWidget::copySelectedPeers);
menu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy IP:port")
, this, &PeerListWidget::copySelectedPeers);
menu->addSeparator();
const QAction *banAct = menu->addAction(UIThemeManager::instance()->getIcon("user-group-delete"), tr("Ban peer permanently"));
connect(banAct, &QAction::triggered, this, &PeerListWidget::banSelectedPeers);
menu->addAction(UIThemeManager::instance()->getIcon("user-group-delete"), tr("Ban peer permanently")
, this, &PeerListWidget::banSelectedPeers);
}
if (menu->isEmpty())

34
src/gui/properties/propertieswidget.cpp

@ -28,7 +28,6 @@ @@ -28,7 +28,6 @@
#include "propertieswidget.h"
#include <QAction>
#include <QClipboard>
#include <QDateTime>
#include <QDebug>
@ -586,15 +585,12 @@ void PropertiesWidget::displayFilesListMenu(const QPoint &) @@ -586,15 +585,12 @@ void PropertiesWidget::displayFilesListMenu(const QPoint &)
{
const QModelIndex index = selectedRows[0];
const QAction *actOpen = menu->addAction(UIThemeManager::instance()->getIcon("folder-documents"), tr("Open"));
connect(actOpen, &QAction::triggered, this, [this, index]() { openItem(index); });
const QAction *actOpenContainingFolder = menu->addAction(UIThemeManager::instance()->getIcon("inode-directory"), tr("Open Containing Folder"));
connect(actOpenContainingFolder, &QAction::triggered, this, [this, index]() { openParentFolder(index); });
const QAction *actRename = menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Rename..."));
connect(actRename, &QAction::triggered, this, [this]() { m_ui->filesList->renameSelectedFile(*m_torrent); });
menu->addAction(UIThemeManager::instance()->getIcon("folder-documents"), tr("Open")
, this, [this, index]() { openItem(index); });
menu->addAction(UIThemeManager::instance()->getIcon("inode-directory"), tr("Open Containing Folder")
, this, [this, index]() { openParentFolder(index); });
menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Rename...")
, this, [this]() { m_ui->filesList->renameSelectedFile(*m_torrent); });
menu->addSeparator();
}
@ -688,21 +684,17 @@ void PropertiesWidget::displayWebSeedListMenu(const QPoint &) @@ -688,21 +684,17 @@ void PropertiesWidget::displayWebSeedListMenu(const QPoint &)
QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
const QAction *actAdd = menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("New Web seed"));
connect(actAdd, &QAction::triggered, this, &PropertiesWidget::askWebSeed);
menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("New Web seed"), this, &PropertiesWidget::askWebSeed);
if (!rows.isEmpty())
{
const QAction *actDel = menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Remove Web seed"));
connect(actDel, &QAction::triggered, this, &PropertiesWidget::deleteSelectedUrlSeeds);
menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Remove Web seed")
, this, &PropertiesWidget::deleteSelectedUrlSeeds);
menu->addSeparator();
const QAction *actCpy = menu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy Web seed URL"));
connect(actCpy, &QAction::triggered, this, &PropertiesWidget::copySelectedWebSeedsToClipboard);
const QAction *actEdit = menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Edit Web seed URL"));
connect(actEdit, &QAction::triggered, this, &PropertiesWidget::editWebSeed);
menu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy Web seed URL")
, this, &PropertiesWidget::copySelectedWebSeedsToClipboard);
menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Edit Web seed URL")
, this, &PropertiesWidget::editWebSeed);
}
menu->popup(QCursor::pos());

28
src/gui/properties/trackerlistwidget.cpp

@ -592,30 +592,26 @@ void TrackerListWidget::showTrackerListMenu(const QPoint &) @@ -592,30 +592,26 @@ void TrackerListWidget::showTrackerListMenu(const QPoint &)
menu->setAttribute(Qt::WA_DeleteOnClose);
// Add actions
const QAction *addAct = menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add a new tracker..."));
connect(addAct, &QAction::triggered, this, &TrackerListWidget::askForTrackers);
menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add a new tracker...")
, this, &TrackerListWidget::askForTrackers);
if (!getSelectedTrackerItems().isEmpty())
{
const QAction *editAct = menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"),tr("Edit tracker URL..."));
connect(editAct, &QAction::triggered, this, &TrackerListWidget::editSelectedTracker);
const QAction *delAct = menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Remove tracker"));
connect(delAct, &QAction::triggered, this, &TrackerListWidget::deleteSelectedTrackers);
const QAction *copyAct = menu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy tracker URL"));
connect(copyAct, &QAction::triggered, this, &TrackerListWidget::copyTrackerUrl);
menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"),tr("Edit tracker URL...")
, this, &TrackerListWidget::editSelectedTracker);
menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Remove tracker")
, this, &TrackerListWidget::deleteSelectedTrackers);
menu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy tracker URL")
, this, &TrackerListWidget::copyTrackerUrl);
}
if (!torrent->isPaused())
{
const QAction *reannounceSelAct = menu->addAction(UIThemeManager::instance()->getIcon("view-refresh"), tr("Force reannounce to selected trackers"));
connect(reannounceSelAct, &QAction::triggered, this, &TrackerListWidget::reannounceSelected);
menu->addAction(UIThemeManager::instance()->getIcon("view-refresh"), tr("Force reannounce to selected trackers")
, this, &TrackerListWidget::reannounceSelected);
menu->addSeparator();
const QAction *reannounceAllAct = menu->addAction(UIThemeManager::instance()->getIcon("view-refresh"), tr("Force reannounce to all trackers"));
connect(reannounceAllAct, &QAction::triggered, this, [this]()
menu->addAction(UIThemeManager::instance()->getIcon("view-refresh"), tr("Force reannounce to all trackers")
, this, [this]()
{
BitTorrent::Torrent *h = m_properties->getCurrentTorrent();
h->forceReannounce();

23
src/gui/rss/automatedrssdownloader.cpp

@ -490,8 +490,8 @@ void AutomatedRssDownloader::displayRulesListMenu() @@ -490,8 +490,8 @@ void AutomatedRssDownloader::displayRulesListMenu()
QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
const QAction *addAct = menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add new rule..."));
connect(addAct, &QAction::triggered, this, &AutomatedRssDownloader::on_addRuleBtn_clicked);
menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add new rule...")
, this, &AutomatedRssDownloader::on_addRuleBtn_clicked);
const QList<QListWidgetItem *> selection = m_ui->listRules->selectedItems();
@ -499,24 +499,21 @@ void AutomatedRssDownloader::displayRulesListMenu() @@ -499,24 +499,21 @@ void AutomatedRssDownloader::displayRulesListMenu()
{
if (selection.count() == 1)
{
const QAction *delAct = menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Delete rule"));
connect(delAct, &QAction::triggered, this, &AutomatedRssDownloader::on_removeRuleBtn_clicked);
menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Delete rule")
, this, &AutomatedRssDownloader::on_removeRuleBtn_clicked);
menu->addSeparator();
const QAction *renameAct = menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Rename rule..."));
connect(renameAct, &QAction::triggered, this, &AutomatedRssDownloader::renameSelectedRule);
menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Rename rule...")
, this, &AutomatedRssDownloader::renameSelectedRule);
}
else
{
const QAction *delAct = menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Delete selected rules"));
connect(delAct, &QAction::triggered, this, &AutomatedRssDownloader::on_removeRuleBtn_clicked);
menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Delete selected rules")
, this, &AutomatedRssDownloader::on_removeRuleBtn_clicked);
}
menu->addSeparator();
const QAction *clearAct = menu->addAction(UIThemeManager::instance()->getIcon("edit-clear"), tr("Clear downloaded episodes..."));
connect(clearAct, &QAction::triggered, this, &AutomatedRssDownloader::clearSelectedRuleDownloadedEpisodeList);
menu->addAction(UIThemeManager::instance()->getIcon("edit-clear"), tr("Clear downloaded episodes...")
, this, &AutomatedRssDownloader::clearSelectedRuleDownloadedEpisodeList);
}
menu->popup(QCursor::pos());

28
src/gui/search/searchjobwidget.cpp

@ -393,31 +393,21 @@ void SearchJobWidget::contextMenuEvent(QContextMenuEvent *event) @@ -393,31 +393,21 @@ void SearchJobWidget::contextMenuEvent(QContextMenuEvent *event)
auto *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
const QAction *downloadAction = menu->addAction(
UIThemeManager::instance()->getIcon("download"), tr("Download"));
connect(downloadAction, &QAction::triggered, this, &SearchJobWidget::downloadTorrents);
menu->addAction(UIThemeManager::instance()->getIcon("download"), tr("Download")
, this, &SearchJobWidget::downloadTorrents);
menu->addSeparator();
const QAction *openDescriptionAction = menu->addAction(
UIThemeManager::instance()->getIcon("application-x-mswinurl"), tr("Open description page"));
connect(openDescriptionAction, &QAction::triggered, this, &SearchJobWidget::openTorrentPages);
menu->addAction(UIThemeManager::instance()->getIcon("application-x-mswinurl"), tr("Open description page")
, this, &SearchJobWidget::openTorrentPages);
QMenu *copySubMenu = menu->addMenu(
UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy"));
const QAction *copyNamesAction = copySubMenu->addAction(
UIThemeManager::instance()->getIcon("edit-copy"), tr("Name"));
connect(copyNamesAction, &QAction::triggered, this, &SearchJobWidget::copyTorrentNames);
const QAction *copyDownloadLinkAction = copySubMenu->addAction(
UIThemeManager::instance()->getIcon("edit-copy"), tr("Download link"));
connect(copyDownloadLinkAction, &QAction::triggered
copySubMenu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Name")
, this, &SearchJobWidget::copyTorrentNames);
copySubMenu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Download link")
, this, &SearchJobWidget::copyTorrentDownloadLinks);
const QAction *copyDescriptionAction = copySubMenu->addAction(
UIThemeManager::instance()->getIcon("edit-copy"), tr("Description page URL"));
connect(copyDescriptionAction, &QAction::triggered, this, &SearchJobWidget::copyTorrentURLs);
copySubMenu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Description page URL")
, this, &SearchJobWidget::copyTorrentURLs);
menu->popup(event->globalPos());
}

42
src/gui/tagfilterwidget.cpp

@ -28,7 +28,6 @@ @@ -28,7 +28,6 @@
#include "tagfilterwidget.h"
#include <QAction>
#include <QMenu>
#include <QMessageBox>
@ -108,44 +107,25 @@ void TagFilterWidget::showMenu(QPoint) @@ -108,44 +107,25 @@ void TagFilterWidget::showMenu(QPoint)
QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
const QAction *addAct = menu->addAction(
UIThemeManager::instance()->getIcon("list-add")
, tr("Add tag..."));
connect(addAct, &QAction::triggered, this, &TagFilterWidget::addTag);
menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add tag...")
, this, &TagFilterWidget::addTag);
const auto selectedRows = selectionModel()->selectedRows();
if (!selectedRows.empty() && !TagFilterModel::isSpecialItem(selectedRows.first()))
{
const QAction *removeAct = menu->addAction(
UIThemeManager::instance()->getIcon("list-remove")
, tr("Remove tag"));
connect(removeAct, &QAction::triggered, this, &TagFilterWidget::removeTag);
menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Remove tag")
, this, &TagFilterWidget::removeTag);
}
const QAction *removeUnusedAct = menu->addAction(
UIThemeManager::instance()->getIcon("list-remove")
, tr("Remove unused tags"));
connect(removeUnusedAct, &QAction::triggered, this, &TagFilterWidget::removeUnusedTags);
menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Remove unused tags")
, this, &TagFilterWidget::removeUnusedTags);
menu->addSeparator();
const QAction *startAct = menu->addAction(
UIThemeManager::instance()->getIcon("media-playback-start")
, tr("Resume torrents"));
connect(startAct, &QAction::triggered
menu->addAction(UIThemeManager::instance()->getIcon("media-playback-start"), tr("Resume torrents")
, this, &TagFilterWidget::actionResumeTorrentsTriggered);
const QAction *pauseAct = menu->addAction(
UIThemeManager::instance()->getIcon("media-playback-pause")
, tr("Pause torrents"));
connect(pauseAct, &QAction::triggered, this
, &TagFilterWidget::actionPauseTorrentsTriggered);
const QAction *deleteTorrentsAct = menu->addAction(
UIThemeManager::instance()->getIcon("edit-delete")
, tr("Delete torrents"));
connect(deleteTorrentsAct, &QAction::triggered, this
, &TagFilterWidget::actionDeleteTorrentsTriggered);
menu->addAction(UIThemeManager::instance()->getIcon("media-playback-pause"), tr("Pause torrents")
, this, &TagFilterWidget::actionPauseTorrentsTriggered);
menu->addAction(UIThemeManager::instance()->getIcon("edit-delete"), tr("Delete torrents")
, this, &TagFilterWidget::actionDeleteTorrentsTriggered);
menu->popup(QCursor::pos());
}

14
src/gui/transferlistfilterswidget.cpp

@ -557,14 +557,12 @@ void TrackerFiltersList::showMenu(const QPoint &) @@ -557,14 +557,12 @@ void TrackerFiltersList::showMenu(const QPoint &)
QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
const QAction *startAct = menu->addAction(UIThemeManager::instance()->getIcon("media-playback-start"), tr("Resume torrents"));
connect(startAct, &QAction::triggered, transferList, &TransferListWidget::startVisibleTorrents);
const QAction *pauseAct = menu->addAction(UIThemeManager::instance()->getIcon("media-playback-pause"), tr("Pause torrents"));
connect(pauseAct, &QAction::triggered, transferList, &TransferListWidget::pauseVisibleTorrents);
const QAction *deleteTorrentsAct = menu->addAction(UIThemeManager::instance()->getIcon("edit-delete"), tr("Delete torrents"));
connect(deleteTorrentsAct, &QAction::triggered, transferList, &TransferListWidget::deleteVisibleTorrents);
menu->addAction(UIThemeManager::instance()->getIcon("media-playback-start"), tr("Resume torrents")
, transferList, &TransferListWidget::startVisibleTorrents);
menu->addAction(UIThemeManager::instance()->getIcon("media-playback-pause"), tr("Pause torrents")
, transferList, &TransferListWidget::pauseVisibleTorrents);
menu->addAction(UIThemeManager::instance()->getIcon("edit-delete"), tr("Delete torrents")
, transferList, &TransferListWidget::deleteVisibleTorrents);
menu->popup(QCursor::pos());
}

28
src/gui/transferlistwidget.cpp

@ -843,7 +843,7 @@ void TransferListWidget::displayListMenu(const QPoint &) @@ -843,7 +843,7 @@ void TransferListWidget::displayListMenu(const QPoint &)
auto *actionAutoTMM = new TriStateAction(tr("Automatic Torrent Management"), listMenu);
actionAutoTMM->setToolTip(tr("Automatic mode means that various torrent properties(eg save path) will be decided by the associated category"));
connect(actionAutoTMM, &QAction::triggered, this, &TransferListWidget::setSelectedAutoTMMEnabled);
QAction *actionEditTracker = new QAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Edit trackers..."), listMenu);
auto *actionEditTracker = new QAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Edit trackers..."), listMenu);
connect(actionEditTracker, &QAction::triggered, this, &TransferListWidget::editTorrentTrackers);
// End of actions
@ -969,27 +969,23 @@ void TransferListWidget::displayListMenu(const QPoint &) @@ -969,27 +969,23 @@ void TransferListWidget::displayListMenu(const QPoint &)
QMenu *categoryMenu = listMenu->addMenu(UIThemeManager::instance()->getIcon("view-categories"), tr("Category"));
const QAction *newCategoryAction = categoryMenu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("New...", "New category..."));
connect(newCategoryAction, &QAction::triggered, this, &TransferListWidget::askNewCategoryForSelection);
const QAction *resetCategoryAction = categoryMenu->addAction(UIThemeManager::instance()->getIcon("edit-clear"), tr("Reset", "Reset category"));
connect(resetCategoryAction, &QAction::triggered, this, [this]() { setSelectionCategory(""); });
categoryMenu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("New...", "New category...")
, this, &TransferListWidget::askNewCategoryForSelection);
categoryMenu->addAction(UIThemeManager::instance()->getIcon("edit-clear"), tr("Reset", "Reset category")
, this, [this]() { setSelectionCategory(""); });
categoryMenu->addSeparator();
for (const QString &category : asConst(categories))
{
const QString escapedCategory = QString(category).replace('&', "&&"); // avoid '&' becomes accelerator key
QAction *cat = categoryMenu->addAction(UIThemeManager::instance()->getIcon("inode-directory"), escapedCategory
, this, [this, category]() { setSelectionCategory(category); });
QAction *cat = new QAction(UIThemeManager::instance()->getIcon("inode-directory"), escapedCategory, categoryMenu);
if (allSameCategory && (category == firstCategory))
{
cat->setCheckable(true);
cat->setChecked(true);
}
connect(cat, &QAction::triggered, this, [this, category]() { setSelectionCategory(category); });
categoryMenu->addAction(cat);
}
// Tag Menu
@ -998,18 +994,16 @@ void TransferListWidget::displayListMenu(const QPoint &) @@ -998,18 +994,16 @@ void TransferListWidget::displayListMenu(const QPoint &)
QMenu *tagsMenu = listMenu->addMenu(UIThemeManager::instance()->getIcon("view-categories"), tr("Tags"));
const QAction *addTagAction = tagsMenu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add...", "Add / assign multiple tags..."));
connect(addTagAction, &QAction::triggered, this, &TransferListWidget::askAddTagsForSelection);
const QAction *removeTagsAction = tagsMenu->addAction(UIThemeManager::instance()->getIcon("edit-clear"), tr("Remove All", "Remove all tags"));
connect(removeTagsAction, &QAction::triggered, this, [this]()
tagsMenu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add...", "Add / assign multiple tags...")
, this, &TransferListWidget::askAddTagsForSelection);
tagsMenu->addAction(UIThemeManager::instance()->getIcon("edit-clear"), tr("Remove All", "Remove all tags")
, this, [this]()
{
if (Preferences::instance()->confirmRemoveAllTags())
confirmRemoveAllTagsForSelection();
else
clearSelectionTags();
});
tagsMenu->addSeparator();
for (const QString &tag : asConst(tags))

Loading…
Cancel
Save