| 148 | } |
| 149 | |
| 150 | QVariant PeerTableModel::data(const QModelIndex &index, int role) const |
| 151 | { |
| 152 | if(!index.isValid()) |
| 153 | return QVariant(); |
| 154 | |
| 155 | CNodeCombinedStats *rec = static_cast<CNodeCombinedStats*>(index.internalPointer()); |
| 156 | |
| 157 | if (role == Qt::DisplayRole) { |
| 158 | switch(index.column()) |
| 159 | { |
| 160 | case NetNodeId: |
| 161 | return (qint64)rec->nodeStats.nodeid; |
| 162 | case Address: |
| 163 | // prepend to peer address down-arrow symbol for inbound connection and up-arrow for outbound connection |
| 164 | return QString(rec->nodeStats.fInbound ? "↓ " : "↑ ") + QString::fromStdString(rec->nodeStats.addrName); |
| 165 | case Subversion: |
| 166 | return QString::fromStdString(rec->nodeStats.cleanSubVer); |
| 167 | case Ping: |
| 168 | return GUIUtil::formatPingTime(rec->nodeStats.dMinPing); |
| 169 | case Sent: |
| 170 | return GUIUtil::formatBytes(rec->nodeStats.nSendBytes); |
| 171 | case Received: |
| 172 | return GUIUtil::formatBytes(rec->nodeStats.nRecvBytes); |
| 173 | } |
| 174 | } else if (role == Qt::TextAlignmentRole) { |
| 175 | switch (index.column()) { |
| 176 | case Ping: |
| 177 | case Sent: |
| 178 | case Received: |
| 179 | return QVariant(Qt::AlignRight | Qt::AlignVCenter); |
| 180 | default: |
| 181 | return QVariant(); |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | return QVariant(); |
| 186 | } |
| 187 | |
| 188 | QVariant PeerTableModel::headerData(int section, Qt::Orientation orientation, int role) const |
| 189 | { |
nothing calls this directly
no test coverage detected