23 if (
order == Qt::DescendingOrder) {
24 std::swap(pLeft, pRight);
51 node.getBanned(banMap);
55 for (
const auto &entry : banMap) {
57 banEntry.
subnet = entry.first;
83 columns << tr(
"IP/Netmask") << tr(
"Banned Until");
105 if (!
index.isValid()) {
111 if (role == Qt::DisplayRole) {
112 switch (
index.column()) {
116 QDateTime date = QDateTime::fromMSecsSinceEpoch(0);
118 return date.toString(QLocale().dateTimeFormat());
127 if (orientation == Qt::Horizontal) {
128 if (role == Qt::DisplayRole && section <
columns.size()) {
136 if (!
index.isValid()) {
137 return Qt::NoItemFlags;
140 Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
145 const QModelIndex &parent)
const {
150 return createIndex(row, column,
data);
152 return QModelIndex();
156 Q_EMIT layoutAboutToBeChanged();
158 Q_EMIT layoutChanged();
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
std::string ToString() const
Top-level interface for a bitcoin node (bitcoind process).
std::map< CSubNet, CBanEntry > banmap_t