Changeset View
Changeset View
Standalone View
Standalone View
src/qt/bantablemodel.cpp
// Copyright (c) 2011-2016 The Bitcoin Core developers | // Copyright (c) 2011-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <qt/bantablemodel.h> | #include <qt/bantablemodel.h> | ||||
#include <interfaces/node.h> | #include <interfaces/node.h> | ||||
#include <net_types.h> // For banmap_t | #include <net_types.h> // For banmap_t | ||||
#include <qt/clientmodel.h> | |||||
#include <utility> | #include <utility> | ||||
#include <QDebug> | #include <QDateTime> | ||||
#include <QList> | #include <QList> | ||||
#include <QLocale> | |||||
#include <QModelIndex> | |||||
#include <QVariant> | |||||
bool BannedNodeLessThan::operator()(const CCombinedBan &left, | bool BannedNodeLessThan::operator()(const CCombinedBan &left, | ||||
const CCombinedBan &right) const { | const CCombinedBan &right) const { | ||||
const CCombinedBan *pLeft = &left; | const CCombinedBan *pLeft = &left; | ||||
const CCombinedBan *pRight = &right; | const CCombinedBan *pRight = &right; | ||||
if (order == Qt::DescendingOrder) { | if (order == Qt::DescendingOrder) { | ||||
std::swap(pLeft, pRight); | std::swap(pLeft, pRight); | ||||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | CCombinedBan *index(int idx) { | ||||
if (idx >= 0 && idx < cachedBanlist.size()) { | if (idx >= 0 && idx < cachedBanlist.size()) { | ||||
return &cachedBanlist[idx]; | return &cachedBanlist[idx]; | ||||
} | } | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
}; | }; | ||||
BanTableModel::BanTableModel(interfaces::Node &node, ClientModel *parent) | BanTableModel::BanTableModel(interfaces::Node &node, QObject *parent) | ||||
: QAbstractTableModel(parent), m_node(node), clientModel(parent) { | : QAbstractTableModel(parent), m_node(node) { | ||||
columns << tr("IP/Netmask") << tr("Banned Until"); | columns << tr("IP/Netmask") << tr("Banned Until"); | ||||
priv.reset(new BanTablePriv()); | priv.reset(new BanTablePriv()); | ||||
// load initial data | // load initial data | ||||
refresh(); | refresh(); | ||||
} | } | ||||
BanTableModel::~BanTableModel() { | BanTableModel::~BanTableModel() { | ||||
▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines |