Bitcoin
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Slots | Private Member Functions | Private Attributes | List of all members
RPCConsole Class Reference

#include <rpcconsole.h>

Inheritance diagram for RPCConsole:

Public Types

enum  MessageClass {
  MC_ERROR, MC_DEBUG, CMD_REQUEST, CMD_REPLY,
  CMD_ERROR
}
 
enum  TabTypes { TAB_INFO = 0, TAB_CONSOLE = 1, TAB_GRAPH = 2, TAB_PEERS = 3 }
 

Public Slots

void clear (bool clearHistory=true)
 
void fontBigger ()
 
void fontSmaller ()
 
void setFontSize (int newSize)
 
void message (int category, const QString &msg)
 
void message (int category, const QString &message, bool html)
 
void setNumConnections (int count)
 
void setNetworkActive (bool networkActive)
 
void setNumBlocks (int count, const QDateTime &blockDate, double nVerificationProgress, bool headers)
 
void setMempoolSize (long numberOfTxs, size_t dynUsage)
 
void browseHistory (int offset)
 
void scrollToEnd ()
 
void peerSelected (const QItemSelection &selected, const QItemSelection &deselected)
 
void peerLayoutAboutToChange ()
 
void peerLayoutChanged ()
 
void disconnectSelectedNode ()
 
void banSelectedNode (int bantime)
 
void unbanSelectedNode ()
 
void setTabFocus (enum TabTypes tabType)
 

Signals

void cmdRequest (const QString &command, const WalletModel *wallet_model)
 

Public Member Functions

 RPCConsole (interfaces::Node &node, const PlatformStyle *platformStyle, QWidget *parent)
 
 ~RPCConsole ()
 
void setClientModel (ClientModel *model)
 
void addWallet (WalletModel *const walletModel)
 
void removeWallet (WalletModel *const walletModel)
 
std::vector< TabTypestabs () const
 
TabTypes tabFocus () const
 
QString tabTitle (TabTypes tab_type) const
 

Static Public Member Functions

static bool RPCParseCommandLine (interfaces::Node *node, std::string &strResult, const std::string &strCommand, bool fExecute, std::string *const pstrFilteredOut=nullptr, const WalletModel *wallet_model=nullptr)
 
static bool RPCExecuteCommandLine (interfaces::Node &node, std::string &strResult, const std::string &strCommand, std::string *const pstrFilteredOut=nullptr, const WalletModel *wallet_model=nullptr)
 

Protected Member Functions

virtual bool eventFilter (QObject *obj, QEvent *event)
 
void keyPressEvent (QKeyEvent *)
 

Private Types

enum  ColumnWidths {
  ADDRESS_COLUMN_WIDTH = 200, SUBVERSION_COLUMN_WIDTH = 150, PING_COLUMN_WIDTH = 80, BANSUBNET_COLUMN_WIDTH = 200,
  BANTIME_COLUMN_WIDTH = 250
}
 

Private Slots

void on_lineEdit_returnPressed ()
 
void on_tabWidget_currentChanged (int index)
 
void on_openDebugLogfileButton_clicked ()
 
void on_sldGraphRange_valueChanged (int value)
 
void updateTrafficStats (quint64 totalBytesIn, quint64 totalBytesOut)
 
void resizeEvent (QResizeEvent *event)
 
void showEvent (QShowEvent *event)
 
void hideEvent (QHideEvent *event)
 
void showPeersTableContextMenu (const QPoint &point)
 
void showBanTableContextMenu (const QPoint &point)
 
void showOrHideBanTableIfRequired ()
 
void clearSelectedNode ()
 

Private Member Functions

void startExecutor ()
 
void setTrafficGraphRange (int mins)
 
void updateNodeDetail (const CNodeCombinedStats *stats)
 
void updateNetworkState ()
 

Private Attributes

interfaces::Nodem_node
 
Ui::RPCConsole *const ui
 
ClientModelclientModel = nullptr
 
QStringList history
 
int historyPtr = 0
 
QString cmdBeforeBrowsing
 
QList< NodeIdcachedNodeids
 
const PlatformStyle *const platformStyle
 
RPCTimerInterfacerpcTimerInterface = nullptr
 
QMenu * peersTableContextMenu = nullptr
 
QMenu * banTableContextMenu = nullptr
 
int consoleFontSize = 0
 
QCompleter * autoCompleter = nullptr
 
QThread thread
 
WalletModelm_last_wallet_model {nullptr}
 

Detailed Description

Local Bitcoin RPC console.

Member Enumeration Documentation

◆ ColumnWidths

Enumerator
ADDRESS_COLUMN_WIDTH 
SUBVERSION_COLUMN_WIDTH 
PING_COLUMN_WIDTH 
BANSUBNET_COLUMN_WIDTH 
BANTIME_COLUMN_WIDTH 

◆ MessageClass

Enumerator
MC_ERROR 
MC_DEBUG 
CMD_REQUEST 
CMD_REPLY 
CMD_ERROR 

◆ TabTypes

Enumerator
TAB_INFO 
TAB_CONSOLE 
TAB_GRAPH 
TAB_PEERS 

Constructor & Destructor Documentation

◆ RPCConsole()

RPCConsole::RPCConsole ( interfaces::Node node,
const PlatformStyle platformStyle,
QWidget *  parent 
)
explicit

◆ ~RPCConsole()

RPCConsole::~RPCConsole ( )

Member Function Documentation

◆ addWallet()

void RPCConsole::addWallet ( WalletModel *const  walletModel)

◆ banSelectedNode

void RPCConsole::banSelectedNode ( int  bantime)
slot

Ban a selected node on the Peers tab

◆ browseHistory

void RPCConsole::browseHistory ( int  offset)
slot

Go forward or back in history

◆ clear

void RPCConsole::clear ( bool  clearHistory = true)
slot

◆ clearSelectedNode

void RPCConsole::clearSelectedNode ( )
privateslot

clear the selected node

◆ cmdRequest

void RPCConsole::cmdRequest ( const QString &  command,
const WalletModel wallet_model 
)
signal

◆ disconnectSelectedNode

void RPCConsole::disconnectSelectedNode ( )
slot

Disconnect a selected node on the Peers tab

◆ eventFilter()

bool RPCConsole::eventFilter ( QObject *  obj,
QEvent *  event 
)
protectedvirtual

◆ fontBigger

void RPCConsole::fontBigger ( )
slot

◆ fontSmaller

void RPCConsole::fontSmaller ( )
slot

◆ hideEvent

void RPCConsole::hideEvent ( QHideEvent *  event)
privateslot

◆ keyPressEvent()

void RPCConsole::keyPressEvent ( QKeyEvent *  event)
protected

◆ message [1/2]

void RPCConsole::message ( int  category,
const QString &  msg 
)
inlineslot

Append the message to the message widget

◆ message [2/2]

void RPCConsole::message ( int  category,
const QString &  message,
bool  html 
)
slot

◆ on_lineEdit_returnPressed

void RPCConsole::on_lineEdit_returnPressed ( )
privateslot

◆ on_openDebugLogfileButton_clicked

void RPCConsole::on_openDebugLogfileButton_clicked ( )
privateslot

open the debug.log from the current datadir

◆ on_sldGraphRange_valueChanged

void RPCConsole::on_sldGraphRange_valueChanged ( int  value)
privateslot

change the time range of the network traffic graph

◆ on_tabWidget_currentChanged

void RPCConsole::on_tabWidget_currentChanged ( int  index)
privateslot

◆ peerLayoutAboutToChange

void RPCConsole::peerLayoutAboutToChange ( )
slot

Handle selection caching before update

◆ peerLayoutChanged

void RPCConsole::peerLayoutChanged ( )
slot

Handle updated peer information

◆ peerSelected

void RPCConsole::peerSelected ( const QItemSelection &  selected,
const QItemSelection &  deselected 
)
slot

Handle selection of peer in peers list

◆ removeWallet()

void RPCConsole::removeWallet ( WalletModel *const  walletModel)

◆ resizeEvent

void RPCConsole::resizeEvent ( QResizeEvent *  event)
privateslot

◆ RPCExecuteCommandLine()

static bool RPCConsole::RPCExecuteCommandLine ( interfaces::Node node,
std::string &  strResult,
const std::string &  strCommand,
std::string *const  pstrFilteredOut = nullptr,
const WalletModel wallet_model = nullptr 
)
inlinestatic

◆ RPCParseCommandLine()

bool RPCConsole::RPCParseCommandLine ( interfaces::Node node,
std::string &  strResult,
const std::string &  strCommand,
bool  fExecute,
std::string *const  pstrFilteredOut = nullptr,
const WalletModel wallet_model = nullptr 
)
static

Split shell command line into a list of arguments and optionally execute the command(s). Aims to emulate bash and friends.

  • Command nesting is possible with parenthesis; for example: validateaddress(getnewaddress())
  • Arguments are delimited with whitespace or comma
  • Extra whitespace at the beginning and end and between arguments will be ignored
  • Text can be "double" or 'single' quoted
  • The backslash \ is used as escape character
    • Outside quotes, any character can be escaped
    • Within double quotes, only escape " and backslashes before a \c " or another backslash
    • Within single quotes, no escaping is possible and no special interpretation takes place
Parameters
[in]nodeoptional node to execute command on
[out]strResultstringified result from the executed command(chain)
[in]strCommandCommand line to split
[in]fExecuteset true if you want the command to be executed
[out]pstrFilteredOutCommand line, filtered to remove any sensitive data

◆ scrollToEnd

void RPCConsole::scrollToEnd ( )
slot

Scroll console view to end

◆ setClientModel()

void RPCConsole::setClientModel ( ClientModel model)

◆ setFontSize

void RPCConsole::setFontSize ( int  newSize)
slot

◆ setMempoolSize

void RPCConsole::setMempoolSize ( long  numberOfTxs,
size_t  dynUsage 
)
slot

Set size (number of transactions and memory usage) of the mempool in the UI

◆ setNetworkActive

void RPCConsole::setNetworkActive ( bool  networkActive)
slot

Set network state shown in the UI

◆ setNumBlocks

void RPCConsole::setNumBlocks ( int  count,
const QDateTime &  blockDate,
double  nVerificationProgress,
bool  headers 
)
slot

Set number of blocks and last block date shown in the UI

◆ setNumConnections

void RPCConsole::setNumConnections ( int  count)
slot

Set number of connections shown in the UI

◆ setTabFocus

void RPCConsole::setTabFocus ( enum TabTypes  tabType)
slot

set which tab has the focus (is visible)

◆ setTrafficGraphRange()

void RPCConsole::setTrafficGraphRange ( int  mins)
private

◆ showBanTableContextMenu

void RPCConsole::showBanTableContextMenu ( const QPoint &  point)
privateslot

Show custom context menu on Bans tab

◆ showEvent

void RPCConsole::showEvent ( QShowEvent *  event)
privateslot

◆ showOrHideBanTableIfRequired

void RPCConsole::showOrHideBanTableIfRequired ( )
privateslot

Hides ban table if no bans are present

◆ showPeersTableContextMenu

void RPCConsole::showPeersTableContextMenu ( const QPoint &  point)
privateslot

Show custom context menu on Peers tab

◆ startExecutor()

void RPCConsole::startExecutor ( )
private

◆ tabFocus()

RPCConsole::TabTypes RPCConsole::tabFocus ( ) const

◆ tabs()

std::vector<TabTypes> RPCConsole::tabs ( ) const
inline

◆ tabTitle()

QString RPCConsole::tabTitle ( TabTypes  tab_type) const

◆ unbanSelectedNode

void RPCConsole::unbanSelectedNode ( )
slot

Unban a selected node on the Bans tab

◆ updateNetworkState()

void RPCConsole::updateNetworkState ( )
private

Update UI with latest network info from model.

◆ updateNodeDetail()

void RPCConsole::updateNodeDetail ( const CNodeCombinedStats stats)
private

show detailed information on ui about selected node

◆ updateTrafficStats

void RPCConsole::updateTrafficStats ( quint64  totalBytesIn,
quint64  totalBytesOut 
)
privateslot

update traffic statistics

Member Data Documentation

◆ autoCompleter

QCompleter* RPCConsole::autoCompleter = nullptr
private

◆ banTableContextMenu

QMenu* RPCConsole::banTableContextMenu = nullptr
private

◆ cachedNodeids

QList<NodeId> RPCConsole::cachedNodeids
private

◆ clientModel

ClientModel* RPCConsole::clientModel = nullptr
private

◆ cmdBeforeBrowsing

QString RPCConsole::cmdBeforeBrowsing
private

◆ consoleFontSize

int RPCConsole::consoleFontSize = 0
private

◆ history

QStringList RPCConsole::history
private

◆ historyPtr

int RPCConsole::historyPtr = 0
private

◆ m_last_wallet_model

WalletModel* RPCConsole::m_last_wallet_model {nullptr}
private

◆ m_node

interfaces::Node& RPCConsole::m_node
private

◆ peersTableContextMenu

QMenu* RPCConsole::peersTableContextMenu = nullptr
private

◆ platformStyle

const PlatformStyle* const RPCConsole::platformStyle
private

◆ rpcTimerInterface

RPCTimerInterface* RPCConsole::rpcTimerInterface = nullptr
private

◆ thread

QThread RPCConsole::thread
private

◆ ui

Ui::RPCConsole* const RPCConsole::ui
private

The documentation for this class was generated from the following files: