From b1189cfa105da414d8645f7284c16a443a710cfe Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Fri, 3 Jul 2015 08:35:14 +0200 Subject: [Qt] adapt QT ban option to banlist.dat changes --- src/qt/bantablemodel.cpp | 10 +++++----- src/qt/bantablemodel.h | 2 +- src/qt/forms/rpcconsole.ui | 2 +- src/qt/rpcconsole.cpp | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/qt/bantablemodel.cpp b/src/qt/bantablemodel.cpp index 04840b0526..42542371ec 100644 --- a/src/qt/bantablemodel.cpp +++ b/src/qt/bantablemodel.cpp @@ -27,7 +27,7 @@ bool BannedNodeLessThan::operator()(const CCombinedBan& left, const CCombinedBan case BanTableModel::Address: return pLeft->subnet.ToString().compare(pRight->subnet.ToString()) < 0; case BanTableModel::Bantime: - return pLeft->bantil < pRight->bantil; + return pLeft->banEntry.nBanUntil < pRight->banEntry.nBanUntil; } return false; @@ -47,18 +47,18 @@ public: /** Pull a full list of banned nodes from CNode into our cache */ void refreshBanlist() { - std::map banMap; + banmap_t banMap; CNode::GetBanned(banMap); cachedBanlist.clear(); #if QT_VERSION >= 0x040700 cachedBanlist.reserve(banMap.size()); #endif - foreach (const PAIRTYPE(CSubNet, int64_t)& banentry, banMap) + foreach (const PAIRTYPE(CSubNet, CBanEntry)& banentry, banMap) { CCombinedBan banEntry; banEntry.subnet = banentry.first; - banEntry.bantil = banentry.second; + banEntry.banEntry = banentry.second; cachedBanlist.append(banEntry); } @@ -120,7 +120,7 @@ QVariant BanTableModel::data(const QModelIndex &index, int role) const return QString::fromStdString(rec->subnet.ToString()); case Bantime: QDateTime date = QDateTime::fromMSecsSinceEpoch(0); - date = date.addSecs(rec->bantil); + date = date.addSecs(rec->banEntry.nBanUntil); return date.toString(Qt::SystemLocaleLongDate); } } diff --git a/src/qt/bantablemodel.h b/src/qt/bantablemodel.h index ec93ed1014..09eb468fb9 100644 --- a/src/qt/bantablemodel.h +++ b/src/qt/bantablemodel.h @@ -15,7 +15,7 @@ class BanTablePriv; struct CCombinedBan { CSubNet subnet; - int64_t bantil; + CBanEntry banEntry; }; class BannedNodeLessThan diff --git a/src/qt/forms/rpcconsole.ui b/src/qt/forms/rpcconsole.ui index c920e6130f..4117da57f5 100644 --- a/src/qt/forms/rpcconsole.ui +++ b/src/qt/forms/rpcconsole.ui @@ -768,7 +768,7 @@ true - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + Qt::NoTextInteraction diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index c417ec3f32..b224d89183 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -356,10 +356,10 @@ void RPCConsole::setClientModel(ClientModel *model) // create peer table context menu actions QAction* disconnectAction = new QAction(tr("&Disconnect Node"), 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); + 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 peer table context menu peersTableContextMenu = new QMenu(); @@ -806,7 +806,7 @@ void RPCConsole::banSelectedNode(int bantime) int port = 0; SplitHostPort(nStr, port, addr); - CNode::Ban(CNetAddr(addr), bantime); + CNode::Ban(CNetAddr(addr), BanReasonManuallyAdded, bantime); bannedNode->fDisconnect = true; clearSelectedNode(); -- cgit v1.2.3