LCOV - code coverage report
Current view: top level - src/qt - bantablemodel.h (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 0 4 0.0 %
Date: 2020-09-26 01:30:44 Functions: 0 12 0.0 %

          Line data    Source code
       1             : // Copyright (c) 2011-2020 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_BANTABLEMODEL_H
       6             : #define BITCOIN_QT_BANTABLEMODEL_H
       7             : 
       8             : #include <net.h>
       9             : 
      10             : #include <memory>
      11             : 
      12             : #include <QAbstractTableModel>
      13             : #include <QStringList>
      14             : 
      15             : class BanTablePriv;
      16             : 
      17             : namespace interfaces {
      18             :     class Node;
      19             : }
      20             : 
      21           0 : struct CCombinedBan {
      22             :     CSubNet subnet;
      23             :     CBanEntry banEntry;
      24             : };
      25             : 
      26             : class BannedNodeLessThan
      27             : {
      28             : public:
      29           0 :     BannedNodeLessThan(int nColumn, Qt::SortOrder fOrder) :
      30           0 :         column(nColumn), order(fOrder) {}
      31             :     bool operator()(const CCombinedBan& left, const CCombinedBan& right) const;
      32             : 
      33             : private:
      34             :     int column;
      35             :     Qt::SortOrder order;
      36             : };
      37             : 
      38             : /**
      39             :    Qt model providing information about connected peers, similar to the
      40             :    "getpeerinfo" RPC call. Used by the rpc console UI.
      41             :  */
      42             : class BanTableModel : public QAbstractTableModel
      43             : {
      44           0 :     Q_OBJECT
      45             : 
      46             : public:
      47             :     explicit BanTableModel(interfaces::Node& node, QObject* parent);
      48             :     ~BanTableModel();
      49             :     void startAutoRefresh();
      50             :     void stopAutoRefresh();
      51             : 
      52             :     enum ColumnIndex {
      53             :         Address = 0,
      54             :         Bantime = 1
      55             :     };
      56             : 
      57             :     /** @name Methods overridden from QAbstractTableModel
      58             :         @{*/
      59             :     int rowCount(const QModelIndex &parent) const override;
      60             :     int columnCount(const QModelIndex &parent) const override;
      61             :     QVariant data(const QModelIndex &index, int role) const override;
      62             :     QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
      63             :     QModelIndex index(int row, int column, const QModelIndex &parent) const override;
      64             :     Qt::ItemFlags flags(const QModelIndex &index) const override;
      65             :     void sort(int column, Qt::SortOrder order) override;
      66             :     /*@}*/
      67             : 
      68             :     bool shouldShow();
      69             : 
      70             : public Q_SLOTS:
      71             :     void refresh();
      72             : 
      73             : private:
      74             :     interfaces::Node& m_node;
      75             :     QStringList columns;
      76             :     std::unique_ptr<BanTablePriv> priv;
      77             : };
      78             : 
      79             : #endif // BITCOIN_QT_BANTABLEMODEL_H

Generated by: LCOV version 1.15