]> Git Repo - VerusCoin.git/blob - src/qt/rpcconsole.h
Merge pull request #4618
[VerusCoin.git] / src / qt / rpcconsole.h
1 // Copyright (c) 2011-2014 The Bitcoin developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5 #ifndef RPCCONSOLE_H
6 #define RPCCONSOLE_H
7
8 #include "guiutil.h"
9 #include "peertablemodel.h"
10
11 #include "net.h"
12
13 #include <QDialog>
14
15 class ClientModel;
16
17 QT_BEGIN_NAMESPACE
18 class QItemSelection;
19 QT_END_NAMESPACE
20
21 namespace Ui {
22     class RPCConsole;
23 }
24
25 /** Local Bitcoin RPC console. */
26 class RPCConsole: public QDialog
27 {
28     Q_OBJECT
29
30 public:
31     explicit RPCConsole(QWidget *parent);
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:
45     virtual bool eventFilter(QObject* obj, QEvent *event);
46
47 private slots:
48     void on_lineEdit_returnPressed();
49     void on_tabWidget_currentChanged(int index);
50     /** open the debug.log from the current datadir */
51     void on_openDebugLogfileButton_clicked();
52     /** change the time range of the network traffic graph */
53     void on_sldGraphRange_valueChanged(int value);
54     /** update traffic statistics */
55     void updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut);
56     void resizeEvent(QResizeEvent *event);
57     void showEvent(QShowEvent *event);
58     void hideEvent(QHideEvent *event);
59
60 public slots:
61     void clear();
62     void reject();
63     void message(int category, const QString &message, bool html = false);
64     /** Set number of connections shown in the UI */
65     void setNumConnections(int count);
66     /** Set number of blocks shown in the UI */
67     void setNumBlocks(int count);
68     /** Go forward or back in history */
69     void browseHistory(int offset);
70     /** Scroll console view to end */
71     void scrollToEnd();
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();
76
77 signals:
78     // For RPC command executor
79     void stopExecutor();
80     void cmdRequest(const QString &command);
81
82 private:
83     static QString FormatBytes(quint64 bytes);
84     void startExecutor();
85     void setTrafficGraphRange(int mins);
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     };
95
96     Ui::RPCConsole *ui;
97     ClientModel *clientModel;
98     QStringList history;
99     int historyPtr;
100     NodeId cachedNodeid;
101 };
102
103 #endif // RPCCONSOLE_H
This page took 0.02955 seconds and 4 git commands to generate.