PIVX Core  5.6.99
P2P Digital Currency
rpcconsole.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2014 The Bitcoin developers
2 // Copyright (c) 2017-2021 The PIVX Core developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef PIVX_QT_RPCCONSOLE_H
7 #define PIVX_QT_RPCCONSOLE_H
8 
9 #include "guiutil.h"
10 #include "peertablemodel.h"
11 
12 #include "net.h"
13 
14 #include <QDialog>
15 #include <QCompleter>
16 
17 class ClientModel;
18 class RPCTimerInterface;
19 class WalletModel;
20 
21 namespace Ui
22 {
23 class RPCConsole;
24 }
25 
26 QT_BEGIN_NAMESPACE
27 class QMenu;
28 class QItemSelection;
29 QT_END_NAMESPACE
30 
32 class RPCConsole : public QDialog
33 {
34  Q_OBJECT
35 
36 public:
37  explicit RPCConsole(QWidget* parent);
38  ~RPCConsole();
39 
40  void setClientModel(ClientModel* model);
41  void setWalletModel(WalletModel* model);
42 
43 protected:
44  virtual bool eventFilter(QObject* obj, QEvent* event);
45 
46 private Q_SLOTS:
48  void on_tabWidget_currentChanged(int index);
52  void on_sldGraphRange_valueChanged(int value);
54  void updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut);
55  void resizeEvent(QResizeEvent* event);
56  void showEvent(QShowEvent* event);
57  void hideEvent(QHideEvent* event);
59  void showPeersTableContextMenu(const QPoint& point);
61  void showBanTableContextMenu(const QPoint& point);
65  void clearSelectedNode();
66 
67 public Q_SLOTS:
68  void clear();
69 
71  void walletSalvage();
72  void walletRescan();
73  void walletZaptxes1();
74  void walletZaptxes2();
75  void walletUpgrade();
76  void walletReindex();
77  void walletResync();
78 
79  void reject();
80  void message(int category, const QString &msg) { message(category, msg, false); }
81  void message(int category, const QString &message, bool html);
83  void setNumConnections(int count);
85  void setNetworkActive(bool networkActive);
87  void setNumBlocks(int count);
89  void setMasternodeCount(const QString& strMasternodes);
91  void browseHistory(int offset);
93  void scrollToEnd();
95  void showInfo();
97  void showConsole();
99  void showNetwork();
101  void showPeers();
103  void showRepair();
105  void showConfEditor();
107  void showMNConfEditor();
109  void peerSelected(const QItemSelection& selected, const QItemSelection& deselected);
111  void peerLayoutChanged();
113  void disconnectSelectedNode();
115  void banSelectedNode(int bantime);
117  void unbanSelectedNode();
119  void showBackups();
120 
121 Q_SIGNALS:
122  // For RPC command executor
123  void stopExecutor();
124  void cmdRequest(const QString& command);
126  void handleRestart(QStringList args);
127 
128 private:
129  static QString FormatBytes(quint64 bytes);
130  void startExecutor();
131  void setTrafficGraphRange(int mins);
133  void buildParameterlist(QString arg);
135  void updateNodeDetail(const CNodeCombinedStats* stats);
136 
143  };
144 
145  Ui::RPCConsole* ui;
148  QStringList history;
151  QCompleter *autoCompleter;
155 
157  void updateNetworkState(int num_connections);
158 };
159 
160 #endif // PIVX_QT_RPCCONSOLE_H
Model for PIVX network client.
Definition: clientmodel.h:50
Local Bitcoin RPC console.
Definition: rpcconsole.h:33
void showBackups()
Show folder with wallet backups in default browser.
Definition: rpcconsole.cpp:776
QMenu * peersTableContextMenu
Definition: rpcconsole.h:152
void updateNodeDetail(const CNodeCombinedStats *stats)
show detailed information on ui about selected node
Definition: rpcconsole.cpp:699
void resizeEvent(QResizeEvent *event)
Definition: rpcconsole.cpp:747
WalletModel * walletModel
Definition: rpcconsole.h:147
void handleRestart(QStringList args)
Get restart command-line parameters and handle restart.
void browseHistory(int offset)
Go forward or back in history.
Definition: rpcconsole.cpp:510
void setWalletModel(WalletModel *model)
Definition: rpcconsole.cpp:290
void setMasternodeCount(const QString &strMasternodes)
Set number of masternodes shown in the UI.
Definition: rpcconsole.cpp:483
void peerSelected(const QItemSelection &selected, const QItemSelection &deselected)
Handle selection of peer in peers list.
Definition: rpcconsole.cpp:638
RPCTimerInterface * rpcTimerInterface
Definition: rpcconsole.h:154
NodeId cachedNodeid
Definition: rpcconsole.h:150
void on_lineEdit_returnPressed()
Definition: rpcconsole.cpp:488
QStringList history
Definition: rpcconsole.h:148
void buildParameterlist(QString arg)
Build parameter list for restart.
Definition: rpcconsole.cpp:356
void walletResync()
Restart wallet with "-resync".
Definition: rpcconsole.cpp:335
void setClientModel(ClientModel *model)
Definition: rpcconsole.cpp:173
void message(int category, const QString &msg)
Definition: rpcconsole.h:80
Ui::RPCConsole * ui
Definition: rpcconsole.h:145
void updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut)
update traffic statistics
Definition: rpcconsole.cpp:592
void setTrafficGraphRange(int mins)
Definition: rpcconsole.cpp:586
void updateNetworkState(int num_connections)
Update UI with latest network info from model.
Definition: rpcconsole.cpp:443
void cmdRequest(const QString &command)
void walletUpgrade()
Restart wallet with "-upgradewallet".
Definition: rpcconsole.cpp:323
void disconnectSelectedNode()
Disconnect a selected node on the Peers tab.
Definition: rpcconsole.cpp:795
@ BANTIME_COLUMN_WIDTH
Definition: rpcconsole.h:142
@ ADDRESS_COLUMN_WIDTH
Definition: rpcconsole.h:138
@ SUBVERSION_COLUMN_WIDTH
Definition: rpcconsole.h:139
@ PING_COLUMN_WIDTH
Definition: rpcconsole.h:140
@ BANSUBNET_COLUMN_WIDTH
Definition: rpcconsole.h:141
QCompleter * autoCompleter
Definition: rpcconsole.h:151
void showRepair()
Switch to wallet-repair tab and show.
Definition: rpcconsole.cpp:622
virtual bool eventFilter(QObject *obj, QEvent *event)
Definition: rpcconsole.cpp:123
void walletRescan()
Restart wallet with "-rescan".
Definition: rpcconsole.cpp:305
void showMNConfEditor()
Open external (default) editor with masternode.conf.
Definition: rpcconsole.cpp:633
void showPeersTableContextMenu(const QPoint &point)
Show custom context menu on Peers tab.
Definition: rpcconsole.cpp:781
void showPeers()
Switch to peers tab and show.
Definition: rpcconsole.cpp:616
void setNumBlocks(int count)
Set number of blocks shown in the UI.
Definition: rpcconsole.cpp:474
void unbanSelectedNode()
Unban a selected node on the Bans tab.
Definition: rpcconsole.cpp:836
void clearSelectedNode()
clear the selected node
Definition: rpcconsole.cpp:853
void on_sldGraphRange_valueChanged(int value)
change the time range of the network traffic graph
Definition: rpcconsole.cpp:567
void reject()
Definition: rpcconsole.cpp:420
void stopExecutor()
void setNumConnections(int count)
Set number of connections shown in the UI.
Definition: rpcconsole.cpp:460
ClientModel * clientModel
Definition: rpcconsole.h:146
void banSelectedNode(int bantime)
Ban a selected node on the Peers tab.
Definition: rpcconsole.cpp:806
void clear()
Definition: rpcconsole.cpp:377
int historyPtr
Definition: rpcconsole.h:149
void scrollToEnd()
Scroll console view to end.
Definition: rpcconsole.cpp:561
void hideEvent(QHideEvent *event)
Definition: rpcconsole.cpp:764
void showConfEditor()
Open external (default) editor with pivx.conf.
Definition: rpcconsole.cpp:628
void walletZaptxes2()
Restart wallet with "-zapwallettxes=2".
Definition: rpcconsole.cpp:317
void walletZaptxes1()
Restart wallet with "-zapwallettxes=1".
Definition: rpcconsole.cpp:311
void on_tabWidget_currentChanged(int index)
Definition: rpcconsole.cpp:547
void walletReindex()
Restart wallet with "-reindex".
Definition: rpcconsole.cpp:329
void startExecutor()
Definition: rpcconsole.cpp:523
void setNetworkActive(bool networkActive)
Set network state shown in the UI.
Definition: rpcconsole.cpp:468
void walletSalvage()
Wallet repair options.
Definition: rpcconsole.cpp:299
void on_openDebugLogfileButton_clicked()
open the debug.log from the current datadir
Definition: rpcconsole.cpp:556
void showBanTableContextMenu(const QPoint &point)
Show custom context menu on Bans tab.
Definition: rpcconsole.cpp:788
void showInfo()
Switch to info tab and show.
Definition: rpcconsole.cpp:598
void showConsole()
Switch to console tab and show.
Definition: rpcconsole.cpp:604
RPCConsole(QWidget *parent)
Definition: rpcconsole.cpp:60
void showEvent(QShowEvent *event)
Definition: rpcconsole.cpp:752
void showOrHideBanTableIfRequired()
Hides ban table if no bans are present.
Definition: rpcconsole.cpp:861
QMenu * banTableContextMenu
Definition: rpcconsole.h:153
void peerLayoutChanged()
Handle updated peer information.
Definition: rpcconsole.cpp:650
static QString FormatBytes(quint64 bytes)
Definition: rpcconsole.cpp:574
void showNetwork()
Switch to network tab and show.
Definition: rpcconsole.cpp:610
RPC timer "driver".
Definition: server.h:104
Interface to PIVX wallet from Qt view code.
Definition: walletmodel.h:109
int NodeId
Definition: net.h:109