]>
Commit | Line | Data |
---|---|---|
f914f1a7 | 1 | // Copyright (c) 2011-2014 The Bitcoin Core developers |
78253fcb | 2 | // Distributed under the MIT software license, see the accompanying |
e592d43f WL |
3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. |
4 | ||
84738627 PJ |
5 | #ifndef BITCOIN_QT_RPCCONSOLE_H |
6 | #define BITCOIN_QT_RPCCONSOLE_H | |
460c51fd | 7 | |
65f78a11 | 8 | #include "guiutil.h" |
65f78a11 AH |
9 | #include "peertablemodel.h" |
10 | ||
bbe1925c PK |
11 | #include "net.h" |
12 | ||
4a8fc152 | 13 | #include <QWidget> |
460c51fd | 14 | |
51ed9ec9 BD |
15 | class ClientModel; |
16 | ||
460c51fd WL |
17 | namespace Ui { |
18 | class RPCConsole; | |
19 | } | |
460c51fd | 20 | |
5e83bc40 PK |
21 | QT_BEGIN_NAMESPACE |
22 | class QItemSelection; | |
23 | QT_END_NAMESPACE | |
24 | ||
ff0ee876 | 25 | /** Local Bitcoin RPC console. */ |
4a8fc152 | 26 | class RPCConsole: public QWidget |
460c51fd WL |
27 | { |
28 | Q_OBJECT | |
29 | ||
30 | public: | |
309f796b | 31 | explicit RPCConsole(QWidget *parent); |
460c51fd WL |
32 | ~RPCConsole(); |
33 | ||
34 | void setClientModel(ClientModel *model); | |
35 | ||
36 | enum MessageClass { | |
37 | MC_ERROR, | |
38 | MC_DEBUG, | |
39 | CMD_REQUEST, | |
40 | CMD_REPLY, | |
41 | CMD_ERROR | |
42 | }; | |
43 | ||
44 | protected: | |
460c51fd | 45 | virtual bool eventFilter(QObject* obj, QEvent *event); |
4a8fc152 | 46 | void keyPressEvent(QKeyEvent *); |
460c51fd | 47 | |
e092f229 | 48 | private Q_SLOTS: |
460c51fd | 49 | void on_lineEdit_returnPressed(); |
b8417243 | 50 | void on_tabWidget_currentChanged(int index); |
a3b4caac | 51 | /** open the debug.log from the current datadir */ |
4d3dda5d | 52 | void on_openDebugLogfileButton_clicked(); |
ce14345a SE |
53 | /** change the time range of the network traffic graph */ |
54 | void on_sldGraphRange_valueChanged(int value); | |
55 | /** update traffic statistics */ | |
56 | void updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut); | |
65f78a11 AH |
57 | void resizeEvent(QResizeEvent *event); |
58 | void showEvent(QShowEvent *event); | |
59 | void hideEvent(QHideEvent *event); | |
b8417243 | 60 | |
e092f229 | 61 | public Q_SLOTS: |
460c51fd | 62 | void clear(); |
c6aa86af | 63 | void message(int category, const QString &message, bool html = false); |
460c51fd WL |
64 | /** Set number of connections shown in the UI */ |
65 | void setNumConnections(int count); | |
8517e970 PK |
66 | /** Set number of blocks and last block date shown in the UI */ |
67 | void setNumBlocks(int count, const QDateTime& blockDate); | |
460c51fd WL |
68 | /** Go forward or back in history */ |
69 | void browseHistory(int offset); | |
5a060b8d WL |
70 | /** Scroll console view to end */ |
71 | void scrollToEnd(); | |
65f78a11 AH |
72 | /** Handle selection of peer in peers list */ |
73 | void peerSelected(const QItemSelection &selected, const QItemSelection &deselected); | |
74 | /** Handle updated peer information */ | |
75 | void peerLayoutChanged(); | |
91163c15 | 76 | |
e092f229 | 77 | Q_SIGNALS: |
460c51fd WL |
78 | // For RPC command executor |
79 | void stopExecutor(); | |
80 | void cmdRequest(const QString &command); | |
81 | ||
82 | private: | |
ce14345a | 83 | static QString FormatBytes(quint64 bytes); |
a5b2d9c8 | 84 | void startExecutor(); |
ce14345a | 85 | void setTrafficGraphRange(int mins); |
a5b2d9c8 PK |
86 | /** show detailed information on ui about selected node */ |
87 | void updateNodeDetail(const CNodeCombinedStats *stats); | |
88 | ||
89 | enum ColumnWidths | |
90 | { | |
91 | ADDRESS_COLUMN_WIDTH = 200, | |
92 | SUBVERSION_COLUMN_WIDTH = 100, | |
93 | PING_COLUMN_WIDTH = 80 | |
94 | }; | |
ce14345a | 95 | |
460c51fd WL |
96 | Ui::RPCConsole *ui; |
97 | ClientModel *clientModel; | |
460c51fd WL |
98 | QStringList history; |
99 | int historyPtr; | |
a5b2d9c8 | 100 | NodeId cachedNodeid; |
460c51fd WL |
101 | }; |
102 | ||
84738627 | 103 | #endif // BITCOIN_QT_RPCCONSOLE_H |