22 if (
order == Qt::DescendingOrder)
54 cachedBanlist.clear();
55 #if QT_VERSION >= 0x040700 56 cachedBanlist.reserve(banMap.size());
58 for (banmap_t::iterator it = banMap.begin(); it != banMap.end(); it++)
61 banEntry.
subnet = (*it).first;
63 cachedBanlist.append(banEntry);
68 qStableSort(cachedBanlist.begin(), cachedBanlist.end(),
BannedNodeLessThan(sortColumn, sortOrder));
73 return cachedBanlist.size();
78 if (idx >= 0 && idx < cachedBanlist.size())
79 return &cachedBanlist[idx];
86 QAbstractTableModel(parent),
89 columns << tr(
"IP/Netmask") << tr(
"Banned Until");
92 priv->sortColumn = -1;
122 if (role == Qt::DisplayRole) {
123 switch(index.column())
128 QDateTime date = QDateTime::fromMSecsSinceEpoch(0);
130 return date.toString(Qt::SystemLocaleLongDate);
139 if(orientation == Qt::Horizontal)
141 if(role == Qt::DisplayRole && section <
columns.size())
154 Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
164 return createIndex(row, column, data);
165 return QModelIndex();
170 Q_EMIT layoutAboutToBeChanged();
171 priv->refreshBanlist();
172 Q_EMIT layoutChanged();
177 priv->sortColumn = column;
178 priv->sortOrder = order;
184 return priv->size() > 0;
void refreshBanlist()
Pull a full list of banned nodes from CNode into our cache.
void swap(dev::eth::Watch &_a, dev::eth::Watch &_b)
bool operator()(const CCombinedBan &left, const CCombinedBan &right) const
int sortColumn
Column to sort nodes by.
std::string ToString() const
QVariant headerData(int section, Qt::Orientation orientation, int role) const
int columnCount(const QModelIndex &parent) const
std::map< CSubNet, CBanEntry > banmap_t
std::unique_ptr< BanTablePriv > priv
QVariant data(const QModelIndex &index, int role) const
Qt::ItemFlags flags(const QModelIndex &index) const
int rowCount(const QModelIndex &parent) const
Qt::SortOrder sortOrder
Order (ascending or descending) to sort nodes by.
Model for Fabcoin network client.
BannedNodeLessThan(int nColumn, Qt::SortOrder fOrder)
QModelIndex index(int row, int column, const QModelIndex &parent) const
std::unique_ptr< CConnman > g_connman
BanTableModel(ClientModel *parent=0)
QList< CCombinedBan > cachedBanlist
Local cache of peer information.
void sort(int column, Qt::SortOrder order)
CCombinedBan * index(int idx)