mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 05:08:05 -06:00
Peer IPs can be copied to clipboard
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include <QSettings>
|
||||
#include <QHeaderView>
|
||||
#include <QMenu>
|
||||
#include <QClipboard>
|
||||
#include <vector>
|
||||
|
||||
PeerListWidget::PeerListWidget(PropertiesWidget *parent): properties(parent), display_flags(false) {
|
||||
@@ -135,9 +136,13 @@ void PeerListWidget::showPeerListMenu(QPoint) {
|
||||
QAction *upLimitAct = 0;
|
||||
QAction *dlLimitAct = 0;
|
||||
QAction *banAct = 0;
|
||||
QAction *copyIPAct = 0;
|
||||
if(!selectedPeerIPs.isEmpty()) {
|
||||
copyIPAct = menu.addAction(QIcon(":/Icons/oxygen/edit-copy.png"), tr("Copy IP"));
|
||||
menu.addSeparator();
|
||||
dlLimitAct = menu.addAction(QIcon(":/Icons/skin/download.png"), tr("Limit download rate..."));
|
||||
upLimitAct = menu.addAction(QIcon(":/Icons/skin/seeding.png"), tr("Limit upload rate..."));
|
||||
menu.addSeparator();
|
||||
banAct = menu.addAction(QIcon(":/Icons/oxygen/user-group-delete.png"), tr("Ban peer permanently"));
|
||||
empty_menu = false;
|
||||
}
|
||||
@@ -170,6 +175,13 @@ void PeerListWidget::showPeerListMenu(QPoint) {
|
||||
banSelectedPeers(selectedPeerIPs);
|
||||
return;
|
||||
}
|
||||
if(act == copyIPAct) {
|
||||
#ifdef Q_WS_WIN
|
||||
QApplication::clipboard()->setText(selectedPeerIPs.join("\r\n"));
|
||||
#else
|
||||
QApplication::clipboard()->setText(selectedPeerIPs.join("\n"));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void PeerListWidget::banSelectedPeers(QStringList peer_ips) {
|
||||
|
||||
Reference in New Issue
Block a user