mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 05:08:05 -06:00
Remove redundant variable declarations
This commit is contained in:
@@ -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 &)
|
||||
|
||||
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())
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "propertieswidget.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QClipboard>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
@@ -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 &)
|
||||
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());
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user