2014-02-08 22:50:24 +01:00
|
|
|
// Copyright (c) 2011-2014 The Bitcoin developers
|
2014-12-13 05:09:33 +01:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
2013-11-04 16:20:43 +01:00
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2014-11-03 16:16:40 +01:00
|
|
|
#ifndef BITCOIN_QT_RPCCONSOLE_H
|
|
|
|
#define BITCOIN_QT_RPCCONSOLE_H
|
2012-04-09 21:07:25 +02:00
|
|
|
|
2014-05-23 19:09:59 +02:00
|
|
|
#include "guiutil.h"
|
|
|
|
#include "peertablemodel.h"
|
|
|
|
|
2014-06-03 14:42:20 +02:00
|
|
|
#include "net.h"
|
|
|
|
|
2014-11-10 16:41:57 +01:00
|
|
|
#include <QWidget>
|
2012-04-09 21:07:25 +02:00
|
|
|
|
2013-04-13 07:13:08 +02:00
|
|
|
class ClientModel;
|
|
|
|
|
2012-04-09 21:07:25 +02:00
|
|
|
namespace Ui {
|
|
|
|
class RPCConsole;
|
|
|
|
}
|
|
|
|
|
2014-09-05 13:18:35 +02:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
class QItemSelection;
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
2012-05-13 16:09:14 +02:00
|
|
|
/** Local Bitcoin RPC console. */
|
2014-11-10 16:41:57 +01:00
|
|
|
class RPCConsole: public QWidget
|
2012-04-09 21:07:25 +02:00
|
|
|
{
|
|
|
|
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);
|
2014-11-10 16:41:57 +01:00
|
|
|
void keyPressEvent(QKeyEvent *);
|
2012-04-09 21:07:25 +02:00
|
|
|
|
|
|
|
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);
|
2014-05-23 19:09:59 +02:00
|
|
|
void resizeEvent(QResizeEvent *event);
|
|
|
|
void showEvent(QShowEvent *event);
|
|
|
|
void hideEvent(QHideEvent *event);
|
2012-05-09 17:12:05 +02:00
|
|
|
|
2012-04-09 21:07:25 +02:00
|
|
|
public slots:
|
|
|
|
void clear();
|
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 */
|
2014-05-05 19:43:14 +02:00
|
|
|
void setNumBlocks(int count);
|
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();
|
2014-05-23 19:09:59 +02:00
|
|
|
/** Handle selection of peer in peers list */
|
|
|
|
void peerSelected(const QItemSelection &selected, const QItemSelection &deselected);
|
|
|
|
/** Handle updated peer information */
|
|
|
|
void peerLayoutChanged();
|
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);
|
2014-06-04 12:06:18 +02:00
|
|
|
void startExecutor();
|
2013-08-22 18:09:32 +02:00
|
|
|
void setTrafficGraphRange(int mins);
|
2014-06-04 12:06:18 +02:00
|
|
|
/** show detailed information on ui about selected node */
|
|
|
|
void updateNodeDetail(const CNodeCombinedStats *stats);
|
|
|
|
|
|
|
|
enum ColumnWidths
|
|
|
|
{
|
|
|
|
ADDRESS_COLUMN_WIDTH = 200,
|
|
|
|
SUBVERSION_COLUMN_WIDTH = 100,
|
|
|
|
PING_COLUMN_WIDTH = 80
|
|
|
|
};
|
2013-08-22 18:09:32 +02:00
|
|
|
|
2012-04-09 21:07:25 +02:00
|
|
|
Ui::RPCConsole *ui;
|
|
|
|
ClientModel *clientModel;
|
|
|
|
QStringList history;
|
|
|
|
int historyPtr;
|
2014-06-04 12:06:18 +02:00
|
|
|
NodeId cachedNodeid;
|
2012-04-09 21:07:25 +02:00
|
|
|
};
|
|
|
|
|
2014-11-03 16:16:40 +01:00
|
|
|
#endif // BITCOIN_QT_RPCCONSOLE_H
|