23 if (
order == Qt::DescendingOrder)
24 std::swap(pLeft, pRight);
50 node.getBanned(banMap);
54 for (
const auto& entry : banMap)
57 banEntry.
subnet = entry.first;
82 QAbstractTableModel(parent),
85 columns << tr(
"IP/Netmask") << tr(
"Banned Until");
96 if (parent.isValid()) {
104 if (parent.isValid()) {
118 if (role == Qt::DisplayRole) {
123 QDateTime date = QDateTime::fromMSecsSinceEpoch(0);
125 return QLocale::system().toString(date, QLocale::LongFormat);
135 if(orientation == Qt::Horizontal)
137 if(role == Qt::DisplayRole && section <
columns.size())
147 if (!
index.isValid())
return Qt::NoItemFlags;
149 Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
159 return createIndex(row, column,
data);
160 return QModelIndex();
165 Q_EMIT layoutAboutToBeChanged();
167 Q_EMIT layoutChanged();
172 priv->sortColumn = column;
173 priv->sortOrder = order;
179 return priv->size() > 0;
185 return ban !=
nullptr &&
m_node.
unban(ban->subnet);
std::unique_ptr< BanTablePriv > priv
QVariant data(const QModelIndex &index, int role) const override
Qt::ItemFlags flags(const QModelIndex &index) const override
interfaces::Node & m_node
int columnCount(const QModelIndex &parent) const override
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
void sort(int column, Qt::SortOrder order) override
int rowCount(const QModelIndex &parent) const override
bool unban(const QModelIndex &index)
QModelIndex index(int row, int column, const QModelIndex &parent) const override
BanTableModel(interfaces::Node &node, QObject *parent)
int sortColumn
Column to sort nodes by (default to unsorted)
void refreshBanlist(interfaces::Node &node)
Pull a full list of banned nodes from interfaces::Node into our cache.
Qt::SortOrder sortOrder
Order (ascending or descending) to sort nodes by.
QList< CCombinedBan > cachedBanlist
Local cache of peer information.
CCombinedBan * index(int idx)
bool operator()(const CCombinedBan &left, const CCombinedBan &right) const
std::string ToString() const
Top-level interface for a bitcoin node (bitcoind process).
virtual bool unban(const CSubNet &ip)=0
Unban node.
std::map< CSubNet, CBanEntry > banmap_t