Browse Source

Peers tab tweaks

pull/7/head
Duke Leto 3 years ago
parent
commit
9f32f3e04f
  1. 14
      src/mainwindow.cpp
  2. 2
      src/mainwindow.ui
  3. 2
      src/peerstablemodel.cpp

14
src/mainwindow.cpp

@ -1116,6 +1116,7 @@ void MainWindow::setupBalancesTab() {
QDesktopServices::openUrl(QUrl(url));
});
//TODO: should this be kept?
menu.addAction(tr("Convert Address"), [=] () {
QString url;
url = "https://dexstats.info/addressconverter.php?fromcoin=HUSH3&address=" + addr;
@ -1135,6 +1136,8 @@ void MainWindow::setupPeersTab() {
// Table right click
QObject::connect(ui->peersTable, &QTableView::customContextMenuRequested, [=] (QPoint pos) {
QModelIndex index = ui->peersTable->indexAt(pos);
// we auto-sort by conntime
//ui->peersTable->setSortingEnabled(true);
if (index.row() < 0) return;
QMenu menu(this);
@ -1146,6 +1149,14 @@ void MainWindow::setupPeersTab() {
QString ip = addr.split(":")[0];
QString as = QString::number(asn);
if(ip.contains("[")) {
// this is actually ipv6, grab it all except the port
auto parts = addr.split(":");
parts[8]=""; // remove port
ip = parts.join(":");
ip.chop(1); // remove trailing :
}
menu.addAction(tr("Copy peer address+port"), [=] () {
QGuiApplication::clipboard()->setText(addr);
ui->statusBar->showMessage(tr("Copied to clipboard"), 3 * 1000);
@ -1167,7 +1178,8 @@ void MainWindow::setupPeersTab() {
ui->statusBar->showMessage(tr("Copied to clipboard"), 3 * 1000);
});
if(!ip.isEmpty()) {
// shodan only supports ipv4 addresses
if(!ip.isEmpty() && !ip.contains("[")) {
menu.addAction(tr("View host on shodan.io (3rd party service)"), [=] () {
QString url = "https://www.shodan.io/host/" + ip;
qDebug() << "opening " << url;

2
src/mainwindow.ui

@ -940,7 +940,7 @@
<string>Peers</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QTableView" name="peersTable">
<property name="selectionMode">

2
src/peerstablemodel.cpp

@ -162,7 +162,7 @@ int PeersTableModel::columnCount(const QModelIndex&) const
QVariant PeersTableModel::headerData(int section, Qt::Orientation orientation, int role) const
{
//if (role == Qt::TextAlignmentRole && section == 3) return QVariant(Qt::AlignRight | Qt::AlignVCenter);
if (role == Qt::TextAlignmentRole) return QVariant(Qt::AlignRight | Qt::AlignVCenter);
if (role == Qt::TextAlignmentRole) return QVariant(Qt::AlignCenter | Qt::AlignVCenter);
if (role == Qt::FontRole) {
QFont f;

Loading…
Cancel
Save