2014-02-08 21:50:24 +00:00
|
|
|
// Copyright (c) 2011-2014 The Bitcoin developers
|
2013-11-04 15:20:43 +00: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 19:07:25 +00:00
|
|
|
#ifndef RPCCONSOLE_H
|
|
|
|
#define RPCCONSOLE_H
|
|
|
|
|
2014-05-23 17:09:59 +00:00
|
|
|
#include "guiutil.h"
|
|
|
|
#include "peertablemodel.h"
|
|
|
|
|
2014-06-03 12:42:20 +00:00
|
|
|
#include "net.h"
|
|
|
|
|
2012-04-09 19:07:25 +00:00
|
|
|
#include <QDialog>
|
|
|
|
|
2013-04-13 05:13:08 +00:00
|
|
|
class ClientModel;
|
|
|
|
|
2014-06-03 12:42:20 +00:00
|
|
|
QT_BEGIN_NAMESPACE
|
2014-05-23 17:09:59 +00:00
|
|
|
class QItemSelection;
|
2014-06-03 12:42:20 +00:00
|
|
|
QT_END_NAMESPACE
|
2014-05-23 17:09:59 +00:00
|
|
|
|
2012-04-09 19:07:25 +00:00
|
|
|
namespace Ui {
|
|
|
|
class RPCConsole;
|
|
|
|
}
|
|
|
|
|
2012-05-13 14:09:14 +00:00
|
|
|
/** Local Bitcoin RPC console. */
|
2012-04-09 19:07:25 +00:00
|
|
|
class RPCConsole: public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2013-11-14 18:47:45 +00:00
|
|
|
explicit RPCConsole(QWidget *parent);
|
2012-04-09 19:07:25 +00: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 15:12:05 +00:00
|
|
|
void on_tabWidget_currentChanged(int index);
|
2012-05-18 12:11:55 +00:00
|
|
|
/** open the debug.log from the current datadir */
|
2012-05-09 20:07:00 +00:00
|
|
|
void on_openDebugLogfileButton_clicked();
|
2013-08-22 16:09:32 +00: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 17:09:59 +00:00
|
|
|
void resizeEvent(QResizeEvent *event);
|
|
|
|
void showEvent(QShowEvent *event);
|
|
|
|
void hideEvent(QHideEvent *event);
|
2012-05-09 15:12:05 +00:00
|
|
|
|
2012-04-09 19:07:25 +00:00
|
|
|
public slots:
|
|
|
|
void clear();
|
2014-03-18 13:51:28 +00:00
|
|
|
void reject();
|
2012-05-12 10:30:07 +00:00
|
|
|
void message(int category, const QString &message, bool html = false);
|
2012-04-09 19:07:25 +00:00
|
|
|
/** Set number of connections shown in the UI */
|
|
|
|
void setNumConnections(int count);
|
|
|
|
/** Set number of blocks shown in the UI */
|
2014-05-05 17:43:14 +00:00
|
|
|
void setNumBlocks(int count);
|
2012-04-09 19:07:25 +00:00
|
|
|
/** Go forward or back in history */
|
|
|
|
void browseHistory(int offset);
|
2012-05-14 16:17:12 +00:00
|
|
|
/** Scroll console view to end */
|
|
|
|
void scrollToEnd();
|
2014-05-23 17:09:59 +00: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 07:13:08 +00:00
|
|
|
|
2012-04-09 19:07:25 +00:00
|
|
|
signals:
|
|
|
|
// For RPC command executor
|
|
|
|
void stopExecutor();
|
|
|
|
void cmdRequest(const QString &command);
|
|
|
|
|
|
|
|
private:
|
2013-08-22 16:09:32 +00:00
|
|
|
static QString FormatBytes(quint64 bytes);
|
2014-06-04 10:06:18 +00:00
|
|
|
void startExecutor();
|
2013-08-22 16:09:32 +00:00
|
|
|
void setTrafficGraphRange(int mins);
|
2014-06-04 10:06:18 +00: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 16:09:32 +00:00
|
|
|
|
2012-04-09 19:07:25 +00:00
|
|
|
Ui::RPCConsole *ui;
|
|
|
|
ClientModel *clientModel;
|
|
|
|
QStringList history;
|
|
|
|
int historyPtr;
|
2014-06-04 10:06:18 +00:00
|
|
|
NodeId cachedNodeid;
|
2012-04-09 19:07:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // RPCCONSOLE_H
|