Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

rpcconsole.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2015 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_RPCCONSOLE_H
6 #define BITCOIN_QT_RPCCONSOLE_H
7 
8 #include <qt/guiutil.h>
9 #include <qt/peertablemodel.h>
10 #include <qt/trafficgraphdata.h>
11 
12 #include <net.h>
13 
14 #include <QButtonGroup>
15 #include <QWidget>
16 #include <QCompleter>
17 #include <QThread>
18 
19 class ClientModel;
20 class RPCTimerInterface;
21 
22 namespace Ui {
23  class RPCConsole;
24 }
25 
26 QT_BEGIN_NAMESPACE
27 class QMenu;
28 class QItemSelection;
29 QT_END_NAMESPACE
30 
32 class RPCConsole: public QWidget
33 {
34  Q_OBJECT
35 
36 public:
37  explicit RPCConsole(QWidget* parent);
38  ~RPCConsole();
39 
40  static bool RPCParseCommandLine(std::string &strResult, const std::string &strCommand, bool fExecute, std::string * const pstrFilteredOut = nullptr);
41  static bool RPCExecuteCommandLine(std::string &strResult, const std::string &strCommand, std::string * const pstrFilteredOut = nullptr) {
42  return RPCParseCommandLine(strResult, strCommand, true, pstrFilteredOut);
43  }
44 
45  void setClientModel(ClientModel *model);
46 
47  enum MessageClass {
53  };
54 
55  enum TabTypes {
56  TAB_INFO = 0,
58  TAB_GRAPH = 2,
59  TAB_PEERS = 3,
61  };
62 
63 protected:
64  virtual bool eventFilter(QObject* obj, QEvent *event);
65  void keyPressEvent(QKeyEvent *);
66 
67 private Q_SLOTS:
69  void showPage(int index);
71  void on_stackedWidgetRPC_currentChanged(int index);
75  void on_sldGraphRange_valueChanged(int value);
76  void resizeEvent(QResizeEvent *event);
77  void showEvent(QShowEvent *event);
78  void hideEvent(QHideEvent *event);
79  void changeEvent(QEvent* e);
81  void showPeersTableContextMenu(const QPoint& point);
83  void showBanTableContextMenu(const QPoint& point);
87  void clearSelectedNode();
88 
89 public Q_SLOTS:
90  void clear(bool clearHistory = true);
91  void fontBigger();
92  void fontSmaller();
93  void setFontSize(int newSize);
94 
96  void walletSalvage();
97  void walletRescan();
98  void walletZaptxes1();
99  void walletZaptxes2();
100  void walletUpgrade();
101  void walletReindex();
102 
104  void message(int category, const QString &message, bool html = false);
106  void setNumConnections(int count);
108  void setNetworkActive(bool networkActive);
110  void updateMasternodeCount();
112  void setNumBlocks(int count, const QDateTime& blockDate, const QString& blockHash, double nVerificationProgress, bool headers);
114  void setMempoolSize(long numberOfTxs, size_t dynUsage);
116  void setInstantSendLockCount(size_t count);
118  void browseHistory(int offset);
120  void scrollToEnd();
122  void peerSelected(const QItemSelection &selected, const QItemSelection &deselected);
126  void peerLayoutChanged();
128  void disconnectSelectedNode();
130  void banSelectedNode(int bantime);
132  void unbanSelectedNode();
134  void setTabFocus(enum TabTypes tabType);
135 
136 Q_SIGNALS:
137  // For RPC command executor
138  void stopExecutor();
139  void cmdRequest(const QString &command);
141  void handleRestart(QStringList args);
142 
143 private:
144  void startExecutor();
147  void buildParameterlist(QString arg);
149  void updateNodeDetail(const CNodeCombinedStats *stats);
151  void setButtonIcons();
152 
154  {
160 
161  };
162 
163  Ui::RPCConsole *ui;
164  QButtonGroup pageButtons;
166  QStringList history;
169  QList<NodeId> cachedNodeids;
174  QCompleter *autoCompleter;
175  QThread thread;
176 
178  void updateNetworkState();
179 };
180 
181 #endif // BITCOIN_QT_RPCCONSOLE_H
void walletUpgrade()
Restart wallet with "-upgradewallet".
Definition: rpcconsole.cpp:793
Local Bitcoin RPC console.
Definition: rpcconsole.h:32
RPC timer "driver".
Definition: server.h:98
void keyPressEvent(QKeyEvent *)
Definition: rpcconsole.cpp:865
QString cmdBeforeBrowsing
Definition: rpcconsole.h:168
void showEvent(QShowEvent *event)
void on_lineEdit_returnPressed()
Definition: rpcconsole.cpp:968
void message(int category, const QString &message, bool html=false)
Append the message to the message widget.
Definition: rpcconsole.cpp:873
static bool RPCExecuteCommandLine(std::string &strResult, const std::string &strCommand, std::string *const pstrFilteredOut=nullptr)
Definition: rpcconsole.h:41
void showPeersTableContextMenu(const QPoint &point)
Show custom context menu on Peers tab.
void walletSalvage()
Wallet repair options.
Definition: rpcconsole.cpp:769
QStringList history
Definition: rpcconsole.h:166
void setInstantSendLockCount(size_t count)
Set number of InstantSend locks.
Definition: rpcconsole.cpp:945
QThread thread
Definition: rpcconsole.h:175
void setNetworkActive(bool networkActive)
Set network state shown in the UI.
Definition: rpcconsole.cpp:909
void scrollToEnd()
Scroll console view to end.
void clearSelectedNode()
clear the selected node
void fontSmaller()
Definition: rpcconsole.cpp:738
void handleRestart(QStringList args)
Get restart command-line parameters and handle restart.
void disconnectSelectedNode()
Disconnect a selected node on the Peers tab.
void updateNodeDetail(const CNodeCombinedStats *stats)
show detailed information on ui about selected node
void setNumBlocks(int count, const QDateTime &blockDate, const QString &blockHash, double nVerificationProgress, bool headers)
Set number of blocks, last block date and last block hash shown in the UI.
Definition: rpcconsole.cpp:914
void setClientModel(ClientModel *model)
Definition: rpcconsole.cpp:584
void resizeEvent(QResizeEvent *event)
void walletRescan()
Restart wallet with "-rescan".
Definition: rpcconsole.cpp:775
QMenu * peersTableContextMenu
Definition: rpcconsole.h:171
void browseHistory(int offset)
Go forward or back in history.
void updateMasternodeCount()
Update number of masternodes shown in the UI.
Definition: rpcconsole.cpp:923
void buildParameterlist(QString arg)
Build parameter list for restart.
Definition: rpcconsole.cpp:805
void walletReindex()
Restart wallet with "-reindex".
Definition: rpcconsole.cpp:799
void setTabFocus(enum TabTypes tabType)
set which tab has the focus (is visible)
void showPage(int index)
custom tab buttons clicked
Definition: rpcconsole.cpp:950
int historyPtr
Definition: rpcconsole.h:167
void walletZaptxes2()
Restart wallet with "-zapwallettxes=2".
Definition: rpcconsole.cpp:787
void peerLayoutChanged()
Handle updated peer information.
RPCTimerInterface * rpcTimerInterface
Definition: rpcconsole.h:170
static bool RPCParseCommandLine(std::string &strResult, const std::string &strCommand, bool fExecute, std::string *const pstrFilteredOut=nullptr)
Split shell command line into a list of arguments and optionally execute the command(s).
Definition: rpcconsole.cpp:147
void updateNetworkState()
Update UI with latest network info from model.
Definition: rpcconsole.cpp:888
void setTrafficGraphRange(TrafficGraphData::GraphRange range)
void on_openDebugLogfileButton_clicked()
open the debug.log from the current datadir
void on_stackedWidgetRPC_currentChanged(int index)
Model for Dash network client.
Definition: clientmodel.h:42
void unbanSelectedNode()
Unban a selected node on the Bans tab.
void hideEvent(QHideEvent *event)
ClientModel * clientModel
Definition: rpcconsole.h:165
virtual bool eventFilter(QObject *obj, QEvent *event)
Definition: rpcconsole.cpp:539
QMenu * banTableContextMenu
Definition: rpcconsole.h:172
void clear(bool clearHistory=true)
Definition: rpcconsole.cpp:826
void showOrHideBanTableIfRequired()
Hides ban table if no bans are present.
void fontBigger()
Definition: rpcconsole.cpp:733
RPCConsole(QWidget *parent)
Definition: rpcconsole.cpp:445
QButtonGroup pageButtons
Definition: rpcconsole.h:164
QList< NodeId > cachedNodeids
Definition: rpcconsole.h:169
void walletZaptxes1()
Restart wallet with "-zapwallettxes=1".
Definition: rpcconsole.cpp:781
void setMempoolSize(long numberOfTxs, size_t dynUsage)
Set size (number of transactions and memory usage) of the mempool in the UI.
Definition: rpcconsole.cpp:935
void setFontSize(int newSize)
Definition: rpcconsole.cpp:743
void setButtonIcons()
Set required icons for buttons inside the dialog.
void changeEvent(QEvent *e)
void setNumConnections(int count)
Set number of connections shown in the UI.
Definition: rpcconsole.cpp:901
void startExecutor()
void peerLayoutAboutToChange()
Handle selection caching before update.
void on_sldGraphRange_valueChanged(int value)
change the time range of the network traffic graph
void banSelectedNode(int bantime)
Ban a selected node on the Peers tab.
static int count
Definition: tests.c:45
int consoleFontSize
Definition: rpcconsole.h:173
void peerSelected(const QItemSelection &selected, const QItemSelection &deselected)
Handle selection of peer in peers list.
Ui::RPCConsole * ui
Definition: rpcconsole.h:163
QCompleter * autoCompleter
Definition: rpcconsole.h:174
void stopExecutor()
void cmdRequest(const QString &command)
void showBanTableContextMenu(const QPoint &point)
Show custom context menu on Bans tab.
Released under the MIT license