mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Added to count downloads/uploads items
Enabled to get copy the DHT label values via mouse Added counting on DHT Window & added context menu for DHT Tree, to copy IP addresses to clipboard
This commit is contained in:
parent
36c68e71ec
commit
397729bd93
@ -1076,6 +1076,7 @@ int TransfersDialog::addItem(int row, const FileInfo &fileInfo)
|
||||
}
|
||||
|
||||
return row;
|
||||
|
||||
}
|
||||
|
||||
int TransfersDialog::addPeerToItem(QStandardItem *dlItem, const QString& name, const QString& coreID, double dlspeed, uint32_t status, const FileProgressInfo& peerInfo)
|
||||
@ -1401,6 +1402,13 @@ void TransfersDialog::insertTransfers()
|
||||
}
|
||||
|
||||
ui.uploadsList->setSortingEnabled(true);
|
||||
|
||||
downloads = tr("Downloads") + " (" + QString::number(DLListModel->rowCount()) + ")";
|
||||
uploads = tr("Uploads") + " (" + QString::number(ULListModel->rowCount()) + ")" ;
|
||||
|
||||
ui.tabWidget->setTabText(0, downloads);
|
||||
ui.tabWidget_2->setTabText(0, uploads);
|
||||
|
||||
}
|
||||
|
||||
QString TransfersDialog::getPeerName(const RsPeerId& id) const
|
||||
|
@ -240,6 +240,9 @@ private:
|
||||
/** Adds a new action to the toolbar. */
|
||||
void addAction(QAction *action, const char *slot = 0);
|
||||
|
||||
QString downloads;
|
||||
QString uploads;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::TransfersDialog ui;
|
||||
|
||||
|
@ -23,8 +23,10 @@
|
||||
#include "ui_DhtWindow.h"
|
||||
#include "util/QtVersion.h"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QTimer>
|
||||
#include <QDateTime>
|
||||
#include <QMenu>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
@ -51,6 +53,7 @@ DhtWindow::DhtWindow(QWidget *parent)
|
||||
|
||||
connect( ui.filterLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterItems(QString)));
|
||||
connect( ui.filterLineEdit, SIGNAL(filterChanged(int)), this, SLOT(filterColumnChanged(int)));
|
||||
connect( ui.dhtTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(DHTCustomPopupMenu(QPoint)));
|
||||
|
||||
/* add filter actions */
|
||||
ui.filterLineEdit->addFilter(QIcon(), tr("IP"), DTW_COL_IPADDR, tr("Search IP"));
|
||||
@ -62,6 +65,22 @@ DhtWindow::~DhtWindow()
|
||||
|
||||
}
|
||||
|
||||
void DhtWindow::DHTCustomPopupMenu( QPoint )
|
||||
{
|
||||
QMenu contextMnu( this );
|
||||
|
||||
QTreeWidgetItem *item = ui.dhtTreeWidget->currentItem();
|
||||
if (item) {
|
||||
|
||||
QString Ip = item->text(DTW_COL_IPADDR);
|
||||
|
||||
contextMnu.addAction(QIcon(), tr("Copy %1 to clipboard").arg(Ip), this, SLOT(copyIP()));
|
||||
|
||||
}
|
||||
|
||||
contextMnu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void DhtWindow::updateDisplay()
|
||||
{
|
||||
/* do nothing if locked, or not visible */
|
||||
@ -495,6 +514,9 @@ void DhtWindow::updateNetPeers()
|
||||
ui.label_proxy->setText(QString::number(nProxyPeers));
|
||||
ui.label_relay->setText(QString::number(nRelayPeers));
|
||||
|
||||
ui.tabWidget_2->setTabText(1, tr("Peers") + " (" + QString::number(ui.peerTreeWidget->topLevelItemCount()) + ")" );
|
||||
|
||||
|
||||
//peerSummaryLabel->setText(connstr);
|
||||
}
|
||||
|
||||
@ -582,6 +604,9 @@ void DhtWindow::updateRelays()
|
||||
item -> setData(RTW_COL_BANDWIDTH, Qt::DisplayRole, bandwidthstr);
|
||||
|
||||
}
|
||||
|
||||
ui.tabWidget_2->setTabText(2, tr("Relays") + " (" + QString::number(ui.relayTreeWidget->topLevelItemCount()) + ")" );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -674,8 +699,12 @@ void DhtWindow::updateDhtPeers()
|
||||
if (ui.filterLineEdit->text().isEmpty() == false) {
|
||||
filterItems(ui.filterLineEdit->text());
|
||||
}
|
||||
|
||||
ui.tabWidget_2->setTabText(0, tr("DHT") + " (" + QString::number(ui.dhtTreeWidget->topLevelItemCount()) + ")" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void DhtWindow::getDHTStatus()
|
||||
@ -753,3 +782,19 @@ bool DhtWindow::filterItem(QTreeWidgetItem *item, const QString &text, int filte
|
||||
return (visible || visibleChildCount);
|
||||
}
|
||||
|
||||
void DhtWindow::copyIP()
|
||||
{
|
||||
QTreeWidgetItem *item = ui.dhtTreeWidget->currentItem();
|
||||
if (!item)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QString Ip = item->text(DTW_COL_IPADDR);
|
||||
|
||||
QApplication::clipboard()->setText(Ip, QClipboard::Clipboard);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -45,6 +45,10 @@ public slots:
|
||||
void filterColumnChanged(int);
|
||||
void filterItems(const QString &text);
|
||||
|
||||
private slots:
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void DHTCustomPopupMenu( QPoint point );
|
||||
void copyIP();
|
||||
|
||||
protected:
|
||||
//void changeEvent(QEvent *e);
|
||||
|
@ -467,6 +467,9 @@
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QTreeWidget" name="dhtTreeWidget">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="defaultDropAction">
|
||||
<enum>Qt::CopyAction</enum>
|
||||
</property>
|
||||
|
@ -57,6 +57,7 @@ DHTStatus::DHTStatus(QWidget *parent)
|
||||
|
||||
dhtnetworksizeLabel = new QLabel( "0 (0) ",this );
|
||||
dhtnetworksizeLabel->setVisible(false);
|
||||
dhtnetworksizeLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||
hbox->addWidget(dhtnetworksizeLabel);
|
||||
|
||||
hbox->addSpacing(2);
|
||||
|
Loading…
Reference in New Issue
Block a user