Fabcoin Core  0.16.2
P2P Digital Currency
rpcconsole.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2017 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 FABCOIN_QT_RPCCONSOLE_H
6 #define FABCOIN_QT_RPCCONSOLE_H
7 
8 #include <guiutil.h>
9 #include <peertablemodel.h>
10 
11 #include <net.h>
12 
13 #include <QWidget>
14 #include <QCompleter>
15 #include <QThread>
16 
17 class ClientModel;
18 class PlatformStyle;
19 class RPCTimerInterface;
20 
21 namespace Ui {
22  class RPCConsole;
23 }
24 
25 QT_BEGIN_NAMESPACE
26 class QMenu;
27 class QItemSelection;
28 QT_END_NAMESPACE
29 
31 class RPCConsole: public QWidget
32 {
33  Q_OBJECT
34 
35 public:
36  explicit RPCConsole(const PlatformStyle *platformStyle, QWidget *parent);
37  ~RPCConsole();
38 
39  static bool RPCParseCommandLine(std::string &strResult, const std::string &strCommand, bool fExecute, std::string * const pstrFilteredOut = nullptr);
40  static bool RPCExecuteCommandLine(std::string &strResult, const std::string &strCommand, std::string * const pstrFilteredOut = nullptr) {
41  return RPCParseCommandLine(strResult, strCommand, true, pstrFilteredOut);
42  }
43 
44  void setClientModel(ClientModel *model);
45 
46  enum MessageClass {
51  CMD_ERROR
52  };
53 
54  enum TabTypes {
55  TAB_INFO = 0,
56  TAB_CONSOLE = 1,
57  TAB_GRAPH = 2,
58  TAB_PEERS = 3
59  };
60 
61 protected:
62  virtual bool eventFilter(QObject* obj, QEvent *event);
63  void keyPressEvent(QKeyEvent *);
64 
65 private Q_SLOTS:
66  void on_lineEdit_returnPressed();
67  void on_tabWidget_currentChanged(int index);
69  void on_openDebugLogfileButton_clicked();
71  void on_sldGraphRange_valueChanged(int value);
73  void updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut);
74  void resizeEvent(QResizeEvent *event);
75  void showEvent(QShowEvent *event);
76  void hideEvent(QHideEvent *event);
78  void showPeersTableContextMenu(const QPoint& point);
80  void showBanTableContextMenu(const QPoint& point);
82  void showOrHideBanTableIfRequired();
84  void clearSelectedNode();
85 
86 public Q_SLOTS:
87  void clear(bool clearHistory = true);
88  void fontBigger();
89  void fontSmaller();
90  void setFontSize(int newSize);
92  void message(int category, const QString &message, bool html = false);
94  void setNumConnections(int count);
96  void setNetworkActive(bool networkActive);
98  void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool headers);
100  void setMempoolSize(long numberOfTxs, size_t dynUsage);
102  void browseHistory(int offset);
104  void scrollToEnd();
106  void peerSelected(const QItemSelection &selected, const QItemSelection &deselected);
108  void peerLayoutAboutToChange();
110  void peerLayoutChanged();
112  void disconnectSelectedNode();
114  void banSelectedNode(int bantime);
116  void unbanSelectedNode();
118  void setTabFocus(enum TabTypes tabType);
119 
120 Q_SIGNALS:
121  // For RPC command executor
122  void stopExecutor();
123  void cmdRequest(const QString &command);
124 
125 private:
126  static QString FormatBytes(quint64 bytes);
127  void startExecutor();
128  void setTrafficGraphRange(int mins);
130  void updateNodeDetail(const CNodeCombinedStats *stats);
131 
133  {
134  ADDRESS_COLUMN_WIDTH = 200,
135  SUBVERSION_COLUMN_WIDTH = 150,
136  PING_COLUMN_WIDTH = 80,
137  BANSUBNET_COLUMN_WIDTH = 200,
138  BANTIME_COLUMN_WIDTH = 250
139 
140  };
141 
144  QStringList history;
147  QList<NodeId> cachedNodeids;
153  QCompleter *autoCompleter;
154  QThread thread;
155 
157  void updateNetworkState();
158 };
159 
160 #endif // FABCOIN_QT_RPCCONSOLE_H
Local Fabcoin RPC console.
Definition: rpcconsole.h:31
RPC timer "driver".
Definition: server.h:157
QString cmdBeforeBrowsing
Definition: rpcconsole.h:146
static bool RPCExecuteCommandLine(std::string &strResult, const std::string &strCommand, std::string *const pstrFilteredOut=nullptr)
Definition: rpcconsole.h:40
QStringList history
Definition: rpcconsole.h:144
size_t count
Definition: ExecStats.cpp:37
QThread thread
Definition: rpcconsole.h:154
QMenu * peersTableContextMenu
Definition: rpcconsole.h:150
std::vector< byte > bytes
Definition: Common.h:75
int historyPtr
Definition: rpcconsole.h:145
RPCTimerInterface * rpcTimerInterface
Definition: rpcconsole.h:149
Model for Fabcoin network client.
Definition: clientmodel.h:38
ClientModel * clientModel
Definition: rpcconsole.h:143
QMenu * banTableContextMenu
Definition: rpcconsole.h:151
QList< NodeId > cachedNodeids
Definition: rpcconsole.h:147
int consoleFontSize
Definition: rpcconsole.h:152
Ui::RPCConsole * ui
Definition: rpcconsole.h:142
QCompleter * autoCompleter
Definition: rpcconsole.h:153
const PlatformStyle * platformStyle
Definition: rpcconsole.h:148