11 #include "validation.h" 23 if (
order == Qt::DescendingOrder)
24 std::swap(pLeft, pRight);
59 std::vector<CNodeStats> vstats;
62 #if QT_VERSION >= 0x040700 65 Q_FOREACH (
const CNodeStats& nodestats, vstats)
113 QAbstractTableModel(parent),
117 columns << tr(
"NodeId") << tr(
"Node/Service") << tr(
"User Agent") << tr(
"Ping");
120 priv->sortColumn = -1;
123 timer =
new QTimer(
this);
165 if (role == Qt::DisplayRole) {
166 switch(
index.column())
177 }
else if (role == Qt::TextAlignmentRole) {
179 return (QVariant)(Qt::AlignRight | Qt::AlignVCenter);
187 if(orientation == Qt::Horizontal)
189 if(role == Qt::DisplayRole && section <
columns.size())
202 Qt::ItemFlags
retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
212 return createIndex(row, column,
data);
213 return QModelIndex();
218 return priv->index(idx);
223 Q_EMIT layoutAboutToBeChanged();
224 priv->refreshPeers();
225 Q_EMIT layoutChanged();
230 std::map<NodeId, int>::iterator it =
priv->mapNodeRows.find(nodeid);
231 if (it ==
priv->mapNodeRows.end())
239 priv->sortColumn = column;
240 priv->sortOrder = order;
std::unique_ptr< PeerTablePriv > priv
PeerTableModel(ClientModel *parent=0)
QVariant data(const QModelIndex &index, int role) const
#define TRY_LOCK(cs, name)
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats)
Qt::ItemFlags flags(const QModelIndex &index) const
bool fNodeStateStatsAvailable
CNodeCombinedStats * index(int idx)
QModelIndex index(int row, int column, const QModelIndex &parent) const
bool operator()(const CNodeCombinedStats &left, const CNodeCombinedStats &right) const
int rowCount(const QModelIndex &parent) const
QVariant headerData(int section, Qt::Orientation orientation, int role) const
int getRowByNodeId(NodeId nodeid)
CNodeStateStats nodeStateStats
static const int MODEL_UPDATE_DELAY
const CNodeCombinedStats * getNodeStats(int idx)
int columnCount(const QModelIndex &parent) const
std::unique_ptr< CConnman > g_connman
void sort(int column, Qt::SortOrder order)
std::map< NodeId, int > mapNodeRows
QList< CNodeCombinedStats > cachedNodeStats
QString formatPingTime(double dPingTime)