aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/qt/bantablemodel.cpp12
-rw-r--r--src/qt/bantablemodel.h1
-rw-r--r--src/qt/rpcconsole.cpp14
-rw-r--r--src/qt/rpcconsole.h4
4 files changed, 17 insertions, 14 deletions
diff --git a/src/qt/bantablemodel.cpp b/src/qt/bantablemodel.cpp
index 615574cca7..b4b100bf5c 100644
--- a/src/qt/bantablemodel.cpp
+++ b/src/qt/bantablemodel.cpp
@@ -8,7 +8,6 @@
#include "guiconstants.h"
#include "guiutil.h"
-#include "net.h"
#include "sync.h"
#include "utiltime.h"
@@ -41,15 +40,16 @@ public:
cachedBanlist.reserve(banMap.size());
#endif
std::map<CSubNet, int64_t>::iterator iter;
- for (iter = banMap.begin(); iter != banMap.end(); ++iter) {
+ foreach (const PAIRTYPE(CSubNet, int64_t)& banentry, banMap)
+ {
CCombinedBan banEntry;
- banEntry.subnet = iter->first;
- banEntry.bantil = iter->second;
+ banEntry.subnet = banentry.first;
+ banEntry.bantil = banentry.second;
cachedBanlist.append(banEntry);
}
}
- int size()
+ int size() const
{
return cachedBanlist.size();
}
@@ -120,7 +120,7 @@ QVariant BanTableModel::data(const QModelIndex &index, int role) const
case Bantime:
QDateTime date = QDateTime::fromMSecsSinceEpoch(0);
date = date.addSecs(rec->bantil);
- return date.toString(Qt::SystemLocaleShortDate);
+ return date.toString(Qt::SystemLocaleLongDate);
}
} else if (role == Qt::TextAlignmentRole) {
if (index.column() == Bantime)
diff --git a/src/qt/bantablemodel.h b/src/qt/bantablemodel.h
index ef7a26e3c6..8d3da4c737 100644
--- a/src/qt/bantablemodel.h
+++ b/src/qt/bantablemodel.h
@@ -5,7 +5,6 @@
#ifndef BITCOIN_QT_BANTABLEMODEL_H
#define BITCOIN_QT_BANTABLEMODEL_H
-#include "main.h"
#include "net.h"
#include <QAbstractTableModel>
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 3f20f67f24..9271df9535 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -356,10 +356,10 @@ void RPCConsole::setClientModel(ClientModel *model)
// create context menu actions
QAction* disconnectAction = new QAction(tr("&Disconnect Node"), this);
- QAction* banAction1h = new QAction(tr("&Ban Node for 1 hour"), this);
- QAction* banAction24h = new QAction(tr("&Ban Node for 24 hours"), this);
- QAction* banAction7d = new QAction(tr("&Ban Node for 7 days"), this);
- QAction* banAction365d = new QAction(tr("&Ban Node for 1 year"), this);
+ QAction* banAction1h = new QAction(tr("&Ban Node for") + " " + tr("&1 hour"), this);
+ QAction* banAction24h = new QAction(tr("&Ban Node for") + " " + tr("&24 hours"), this);
+ QAction* banAction7d = new QAction(tr("&Ban Node for") + " " + tr("&7 days"), this);
+ QAction* banAction365d = new QAction(tr("&Ban Node for") + " " + tr("&1 year"), this);
// create context menu
peersTableContextMenu = new QMenu();
@@ -798,7 +798,8 @@ void RPCConsole::banSelectedNode(int bantime)
SplitHostPort(nStr, port, addr);
CNode::Ban(CNetAddr(addr), bantime);
- bannedNode->CloseSocketDisconnect();
+ bannedNode->fDisconnect = true;
+
clearSelectedNode();
ui->banlistWidget->setVisible(true);
ui->banHeading->setVisible(true);
@@ -830,6 +831,9 @@ void RPCConsole::clearSelectedNode()
void RPCConsole::showOrHideBanTableIfRequired()
{
+ if (!clientModel)
+ return;
+
bool visible = clientModel->getBanTableModel()->shouldShow();
ui->banlistWidget->setVisible(visible);
ui->banHeading->setVisible(visible);
diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h
index 9674cc5275..3f4d1834f6 100644
--- a/src/qt/rpcconsole.h
+++ b/src/qt/rpcconsole.h
@@ -108,8 +108,8 @@ private:
ADDRESS_COLUMN_WIDTH = 200,
SUBVERSION_COLUMN_WIDTH = 100,
PING_COLUMN_WIDTH = 80,
- BANSUBNET_COLUMN_WIDTH = 300,
- BANTIME_COLUMN_WIDTH = 150
+ BANSUBNET_COLUMN_WIDTH = 250,
+ BANTIME_COLUMN_WIDTH = 200
};