LCOV - code coverage report
Current view: top level - src/qt - peertablemodel.h (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 0 5 0.0 %
Date: 2015-10-12 22:39:14 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Copyright (c) 2011-2013 The Bitcoin Core developers
       2             : // Distributed under the MIT software license, see the accompanying
       3             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       4             : 
       5             : #ifndef BITCOIN_QT_PEERTABLEMODEL_H
       6             : #define BITCOIN_QT_PEERTABLEMODEL_H
       7             : 
       8             : #include "main.h" // For CNodeStateStats
       9             : #include "net.h"
      10             : 
      11             : #include <QAbstractTableModel>
      12             : #include <QStringList>
      13             : 
      14             : class ClientModel;
      15             : class PeerTablePriv;
      16             : 
      17             : QT_BEGIN_NAMESPACE
      18             : class QTimer;
      19             : QT_END_NAMESPACE
      20             : 
      21           0 : struct CNodeCombinedStats {
      22             :     CNodeStats nodeStats;
      23             :     CNodeStateStats nodeStateStats;
      24             :     bool fNodeStateStatsAvailable;
      25             : };
      26             : 
      27             : class NodeLessThan
      28             : {
      29             : public:
      30           0 :     NodeLessThan(int nColumn, Qt::SortOrder fOrder) :
      31           0 :         column(nColumn), order(fOrder) {}
      32             :     bool operator()(const CNodeCombinedStats &left, const CNodeCombinedStats &right) const;
      33             : 
      34             : private:
      35             :     int column;
      36             :     Qt::SortOrder order;
      37             : };
      38             : 
      39             : /**
      40             :    Qt model providing information about connected peers, similar to the
      41             :    "getpeerinfo" RPC call. Used by the rpc console UI.
      42             :  */
      43           0 : class PeerTableModel : public QAbstractTableModel
      44             : {
      45           0 :     Q_OBJECT
      46             : 
      47             : public:
      48             :     explicit PeerTableModel(ClientModel *parent = 0);
      49             :     const CNodeCombinedStats *getNodeStats(int idx);
      50             :     int getRowByNodeId(NodeId nodeid);
      51             :     void startAutoRefresh();
      52             :     void stopAutoRefresh();
      53             : 
      54             :     enum ColumnIndex {
      55             :         Address = 0,
      56             :         Subversion = 1,
      57             :         Ping = 2
      58             :     };
      59             : 
      60             :     /** @name Methods overridden from QAbstractTableModel
      61             :         @{*/
      62             :     int rowCount(const QModelIndex &parent) const;
      63             :     int columnCount(const QModelIndex &parent) const;
      64             :     QVariant data(const QModelIndex &index, int role) const;
      65             :     QVariant headerData(int section, Qt::Orientation orientation, int role) const;
      66             :     QModelIndex index(int row, int column, const QModelIndex &parent) const;
      67             :     Qt::ItemFlags flags(const QModelIndex &index) const;
      68             :     void sort(int column, Qt::SortOrder order);
      69             :     /*@}*/
      70             : 
      71             : public Q_SLOTS:
      72             :     void refresh();
      73             : 
      74             : private:
      75             :     ClientModel *clientModel;
      76             :     QStringList columns;
      77             :     PeerTablePriv *priv;
      78             :     QTimer *timer;
      79             : };
      80             : 
      81             : #endif // BITCOIN_QT_PEERTABLEMODEL_H

Generated by: LCOV version 1.11