3c38b4b8de4a3b952f26609f2f736a3a1c620fe7
[novacoin.git] / src / qt / rpcconsole.h
1 #ifndef RPCCONSOLE_H
2 #define RPCCONSOLE_H
3
4 #include <QDialog>
5
6 namespace Ui {
7     class RPCConsole;
8 }
9 class ClientModel;
10
11 /** Local Bitcoin RPC console. */
12 class RPCConsole: public QDialog
13 {
14     Q_OBJECT
15
16 public:
17     explicit RPCConsole(QWidget *parent = 0);
18     ~RPCConsole();
19
20     void setClientModel(ClientModel *model);
21
22     enum MessageClass {
23         MC_ERROR,
24         MC_DEBUG,
25         CMD_REQUEST,
26         CMD_REPLY,
27         CMD_ERROR
28     };
29
30 protected:
31     virtual bool eventFilter(QObject* obj, QEvent *event);
32
33 private slots:
34     void on_lineEdit_returnPressed();
35     void on_tabWidget_currentChanged(int index);
36     /** open the debug.log from the current datadir */
37     void on_openDebugLogfileButton_clicked();
38     /** display messagebox with program parameters (same as bitcoin-qt --help) */
39     void on_showCLOptionsButton_clicked();
40
41 public slots:
42     void clear();
43     void message(int category, const QString &message, bool html = false);
44     /** Set number of connections shown in the UI */
45     void setNumConnections(int count);
46     /** Set number of blocks shown in the UI */
47     void setNumBlocks(int count, int countOfPeers);
48     /** Go forward or back in history */
49     void browseHistory(int offset);
50     /** Scroll console view to end */
51     void scrollToEnd();
52 signals:
53     // For RPC command executor
54     void stopExecutor();
55     void cmdRequest(const QString &command);
56
57 private:
58     Ui::RPCConsole *ui;
59     ClientModel *clientModel;
60     QStringList history;
61     int historyPtr;
62
63     void startExecutor();
64 };
65
66 #endif // RPCCONSOLE_H