aboutsummaryrefslogtreecommitdiff
path: root/src/qt/rpcconsole.cpp
diff options
context:
space:
mode:
authorPhilip Kaufmann <phil.kaufmann@t-online.de>2015-06-23 21:10:42 +0200
committerJonas Schnelli <jonas.schnelli@include7.ch>2015-09-16 16:50:19 +0200
commit9e521c173586257f57764b479beb5923c33ed0eb (patch)
tree8a83ab4b363cfadfa8738b99ead769e3e0797945 /src/qt/rpcconsole.cpp
parent607809f037950f114f64f1ee09c1486a3c66638b (diff)
downloadbitcoin-9e521c173586257f57764b479beb5923c33ed0eb.tar.xz
[Qt] polish ban table
Diffstat (limited to 'src/qt/rpcconsole.cpp')
-rw-r--r--src/qt/rpcconsole.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 9271df9535..380586f610 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -5,6 +5,7 @@
#include "rpcconsole.h"
#include "ui_rpcconsole.h"
+#include "bantablemodel.h"
#include "clientmodel.h"
#include "guiutil.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(disconnectAction, SIGNAL(triggered()), this, SLOT(disconnectSelectedNode()));
- //add a signal mapping to allow a dynamic argument
- //we need to use int (instead of int64_t) because signal mapper only supports int or objects
- //this is okay because max bantime (1 Year) is smaler then int_max
+ // 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, which is okay because max bantime (1 year) is < int_max.
QSignalMapper* signalMapper = new QSignalMapper(this);
signalMapper->setMapping(banAction1h, 60*60);
signalMapper->setMapping(banAction24h, 60*60*24);
@@ -385,7 +386,7 @@ void RPCConsole::setClientModel(ClientModel *model)
connect(banAction24h, SIGNAL(triggered()), signalMapper, SLOT(map()));
connect(banAction7d, 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(ui->peerWidget->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
@@ -403,8 +404,12 @@ void RPCConsole::setClientModel(ClientModel *model)
ui->banlistWidget->setContextMenuPolicy(Qt::CustomContextMenu);
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
- QAction* unbanAction = new QAction(tr("&Unban Node"), this);
+ QAction* unbanAction = new QAction(tr("&Unban Node"), this);
banTableContextMenu = new QMenu();
banTableContextMenu->addAction(unbanAction);
@@ -419,9 +424,6 @@ void RPCConsole::setClientModel(ClientModel *model)
ui->buildDate->setText(model->formatBuildDate());
ui->startupTime->setText(model->formatClientStartupTime());
ui->networkName->setText(QString::fromStdString(Params().NetworkIDString()));
-
- connect(model, SIGNAL(banListChanged()), this, SLOT(showOrHideBanTableIfRequired()));
- showOrHideBanTableIfRequired();
}
}
@@ -833,7 +835,7 @@ void RPCConsole::showOrHideBanTableIfRequired()
{
if (!clientModel)
return;
-
+
bool visible = clientModel->getBanTableModel()->shouldShow();
ui->banlistWidget->setVisible(visible);
ui->banHeading->setVisible(visible);