23 if (
order == Qt::DescendingOrder) {
29 return pLeft->subnet.ToString().compare(
pRight->subnet.ToString()) <
32 return pLeft->banEntry.nBanUntil <
pRight->banEntry.nBanUntil;
55 for (
const auto &entry :
banMap) {
57 banEntry.
subnet = entry.first;
105 if (!
index.isValid()) {
111 if (role == Qt::DisplayRole) {
112 switch (
index.column()) {
114 return QString::fromStdString(
rec->subnet.ToString());
116 QDateTime date = QDateTime::fromMSecsSinceEpoch(0);
117 date = date.addSecs(
rec->banEntry.nBanUntil);
136 if (!
index.isValid()) {
137 return Qt::NoItemFlags;
140 Qt::ItemFlags
retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
162 priv->sortColumn = column;
163 priv->sortOrder = order;
168 return priv->size() > 0;
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
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 CNode 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
Top-level interface for a bitcoin node (bitcoind process).
std::map< CSubNet, CBanEntry > banmap_t
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...