|
|
@ -5,6 +5,7 @@ |
|
|
|
#include "rpcconsole.h" |
|
|
|
#include "rpcconsole.h" |
|
|
|
#include "ui_rpcconsole.h" |
|
|
|
#include "ui_rpcconsole.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "bantablemodel.h" |
|
|
|
#include "clientmodel.h" |
|
|
|
#include "clientmodel.h" |
|
|
|
#include "guiutil.h" |
|
|
|
#include "guiutil.h" |
|
|
|
#include "platformstyle.h" |
|
|
|
#include "platformstyle.h" |
|
|
@ -373,9 +374,9 @@ void RPCConsole::setClientModel(ClientModel *model) |
|
|
|
connect(ui->peerWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showPeersTableContextMenu(const QPoint&))); |
|
|
|
connect(ui->peerWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showPeersTableContextMenu(const QPoint&))); |
|
|
|
connect(disconnectAction, SIGNAL(triggered()), this, SLOT(disconnectSelectedNode())); |
|
|
|
connect(disconnectAction, SIGNAL(triggered()), this, SLOT(disconnectSelectedNode())); |
|
|
|
|
|
|
|
|
|
|
|
//add a signal mapping to allow a dynamic argument
|
|
|
|
// Add a signal mapping to allow dynamic context menu arguments.
|
|
|
|
//we need to use int (instead of int64_t) because signal mapper only supports int or objects
|
|
|
|
// We need to use int (instead of int64_t), because signal mapper only supports
|
|
|
|
//this is okay because max bantime (1 Year) is smaler then int_max
|
|
|
|
// int or objects, which is okay because max bantime (1 year) is < int_max.
|
|
|
|
QSignalMapper* signalMapper = new QSignalMapper(this); |
|
|
|
QSignalMapper* signalMapper = new QSignalMapper(this); |
|
|
|
signalMapper->setMapping(banAction1h, 60*60); |
|
|
|
signalMapper->setMapping(banAction1h, 60*60); |
|
|
|
signalMapper->setMapping(banAction24h, 60*60*24); |
|
|
|
signalMapper->setMapping(banAction24h, 60*60*24); |
|
|
@ -385,7 +386,7 @@ void RPCConsole::setClientModel(ClientModel *model) |
|
|
|
connect(banAction24h, SIGNAL(triggered()), signalMapper, SLOT(map())); |
|
|
|
connect(banAction24h, SIGNAL(triggered()), signalMapper, SLOT(map())); |
|
|
|
connect(banAction7d, SIGNAL(triggered()), signalMapper, SLOT(map())); |
|
|
|
connect(banAction7d, SIGNAL(triggered()), signalMapper, SLOT(map())); |
|
|
|
connect(banAction365d, SIGNAL(triggered()), signalMapper, SLOT(map())); |
|
|
|
connect(banAction365d, SIGNAL(triggered()), signalMapper, SLOT(map())); |
|
|
|
connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(banSelectedNode(int))) ; |
|
|
|
connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(banSelectedNode(int))); |
|
|
|
|
|
|
|
|
|
|
|
// connect the peerWidget selection model to our peerSelected() handler
|
|
|
|
// connect the peerWidget selection model to our peerSelected() handler
|
|
|
|
connect(ui->peerWidget->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), |
|
|
|
connect(ui->peerWidget->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), |
|
|
@ -403,6 +404,10 @@ void RPCConsole::setClientModel(ClientModel *model) |
|
|
|
ui->banlistWidget->setContextMenuPolicy(Qt::CustomContextMenu); |
|
|
|
ui->banlistWidget->setContextMenuPolicy(Qt::CustomContextMenu); |
|
|
|
ui->banlistWidget->horizontalHeader()->setStretchLastSection(true); |
|
|
|
ui->banlistWidget->horizontalHeader()->setStretchLastSection(true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ensure ban table is shown or hidden (if empty)
|
|
|
|
|
|
|
|
connect(model, SIGNAL(banListChanged()), this, SLOT(showOrHideBanTableIfRequired())); |
|
|
|
|
|
|
|
showOrHideBanTableIfRequired(); |
|
|
|
|
|
|
|
|
|
|
|
// create banlist context menu actions
|
|
|
|
// create banlist context menu actions
|
|
|
|
QAction* unbanAction = new QAction(tr("&Unban Node"), this); |
|
|
|
QAction* unbanAction = new QAction(tr("&Unban Node"), this); |
|
|
|
banTableContextMenu = new QMenu(); |
|
|
|
banTableContextMenu = new QMenu(); |
|
|
@ -419,9 +424,6 @@ void RPCConsole::setClientModel(ClientModel *model) |
|
|
|
ui->buildDate->setText(model->formatBuildDate()); |
|
|
|
ui->buildDate->setText(model->formatBuildDate()); |
|
|
|
ui->startupTime->setText(model->formatClientStartupTime()); |
|
|
|
ui->startupTime->setText(model->formatClientStartupTime()); |
|
|
|
ui->networkName->setText(QString::fromStdString(Params().NetworkIDString())); |
|
|
|
ui->networkName->setText(QString::fromStdString(Params().NetworkIDString())); |
|
|
|
|
|
|
|
|
|
|
|
connect(model, SIGNAL(banListChanged()), this, SLOT(showOrHideBanTableIfRequired())); |
|
|
|
|
|
|
|
showOrHideBanTableIfRequired(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|