2014-02-08 22:50:24 +01:00
|
|
|
// Copyright (c) 2011-2014 The Bitcoin developers
|
2013-11-04 16:20:43 +01:00
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2012-04-09 21:07:25 +02:00
|
|
|
#ifndef RPCCONSOLE_H
|
|
|
|
#define RPCCONSOLE_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
|
2013-04-13 07:13:08 +02:00
|
|
|
class ClientModel;
|
|
|
|
|
2012-04-09 21:07:25 +02:00
|
|
|
namespace Ui {
|
|
|
|
class RPCConsole;
|
|
|
|
}
|
|
|
|
|
2012-05-13 16:09:14 +02:00
|
|
|
/** Local Bitcoin RPC console. */
|
2012-04-09 21:07:25 +02:00
|
|
|
class RPCConsole: public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2013-11-14 19:47:45 +01:00
|
|
|
explicit RPCConsole(QWidget *parent);
|
2012-04-09 21:07:25 +02:00
|
|
|
~RPCConsole();
|
|
|
|
|
|
|
|
void setClientModel(ClientModel *model);
|
|
|
|
|
|
|
|
enum MessageClass {
|
|
|
|
MC_ERROR,
|
|
|
|
MC_DEBUG,
|
|
|
|
CMD_REQUEST,
|
|
|
|
CMD_REPLY,
|
|
|
|
CMD_ERROR
|
|
|
|
};
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual bool eventFilter(QObject* obj, QEvent *event);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void on_lineEdit_returnPressed();
|
2012-05-09 17:12:05 +02:00
|
|
|
void on_tabWidget_currentChanged(int index);
|
2012-05-18 14:11:55 +02:00
|
|
|
/** open the debug.log from the current datadir */
|
2012-05-09 22:07:00 +02:00
|
|
|
void on_openDebugLogfileButton_clicked();
|
2013-08-22 18:09:32 +02:00
|
|
|
/** change the time range of the network traffic graph */
|
|
|
|
void on_sldGraphRange_valueChanged(int value);
|
|
|
|
/** update traffic statistics */
|
|
|
|
void updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut);
|
2012-05-09 17:12:05 +02:00
|
|
|
|
2012-04-09 21:07:25 +02:00
|
|
|
public slots:
|
|
|
|
void clear();
|
2014-03-18 14:51:28 +01:00
|
|
|
void reject();
|
2012-05-12 12:30:07 +02:00
|
|
|
void message(int category, const QString &message, bool html = false);
|
2012-04-09 21:07:25 +02:00
|
|
|
/** Set number of connections shown in the UI */
|
|
|
|
void setNumConnections(int count);
|
|
|
|
/** Set number of blocks shown in the UI */
|
2012-05-05 16:07:14 +02:00
|
|
|
void setNumBlocks(int count, int countOfPeers);
|
2012-04-09 21:07:25 +02:00
|
|
|
/** Go forward or back in history */
|
|
|
|
void browseHistory(int offset);
|
2012-05-14 18:17:12 +02:00
|
|
|
/** Scroll console view to end */
|
|
|
|
void scrollToEnd();
|
2013-11-08 08:13:08 +01:00
|
|
|
|
2012-04-09 21:07:25 +02:00
|
|
|
signals:
|
|
|
|
// For RPC command executor
|
|
|
|
void stopExecutor();
|
|
|
|
void cmdRequest(const QString &command);
|
|
|
|
|
|
|
|
private:
|
2013-08-22 18:09:32 +02:00
|
|
|
static QString FormatBytes(quint64 bytes);
|
|
|
|
void setTrafficGraphRange(int mins);
|
|
|
|
|
2012-04-09 21:07:25 +02:00
|
|
|
Ui::RPCConsole *ui;
|
|
|
|
ClientModel *clientModel;
|
|
|
|
QStringList history;
|
|
|
|
int historyPtr;
|
|
|
|
|
|
|
|
void startExecutor();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // RPCCONSOLE_H
|