Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
•All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
rpcconsole.cpp
Go to the documentation of this file.
147 bool RPCConsole::RPCParseCommandLine(std::string &strResult, const std::string &strCommand, const bool fExecute, std::string * const pstrFilteredOut)
172 if (stack.back().empty() && (!nDepthInsideSensitive) && historyFilter.contains(QString::fromStdString(strArg), Qt::CaseInsensitive)) {
302 req.params = RPCConvertValues(stack.back()[0], std::vector<std::string>(stack.back().begin() + 1, stack.back().end()));
308 QByteArray encodedName = QUrl::toPercentEncoding(QString::fromStdString(GetWallets()[0]->GetName()));
357 if(ch != '"' && ch != '\\') curarg += '\\'; // keep '\' for everything but the quote and '\' itself
394 // Catch the console-only-help command before RPC call is executed and reply with help text as-if a RPC reply.
432 Q_EMIT reply(RPCConsole::CMD_ERROR, QString::fromStdString(message) + " (code " + QString::number(code) + ")");
434 catch (const std::runtime_error&) // raised when converting to invalid type, i.e. missing code or message
475 ui->openDebugLogfileButton->setToolTip(ui->openDebugLogfileButton->toolTip().arg(tr(PACKAGE_NAME)));
518 consoleFontSize = settings.value(fontSizeSettingsKey, QFontInfo(GUIUtil::getFontNormal()).pointSize()).toInt();
593 setNumBlocks(model->getNumBlocks(), model->getLastBlockDate(), model->getLastBlockHash(), model->getVerificationProgress(nullptr), false);
594 connect(model, SIGNAL(numBlocksChanged(int,QDateTime,QString,double,bool)), this, SLOT(setNumBlocks(int,QDateTime,QString,double,bool)));
602 connect(model, SIGNAL(mempoolSizeChanged(long,size_t)), this, SLOT(setMempoolSize(long,size_t)));
603 connect(model, SIGNAL(islockCountChanged(size_t)), this, SLOT(setInstantSendLockCount(size_t)));
647 connect(ui->peerWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showPeersTableContextMenu(const QPoint&)));
651 connect(ui->peerWidget->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
656 connect(model->getPeerTableModel(), SIGNAL(layoutAboutToBeChanged()), this, SLOT(peerLayoutAboutToChange()));
677 connect(ui->banlistWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showBanTableContextMenu(const QPoint&)));
681 connect(ui->banlistWidget, SIGNAL(clicked(const QModelIndex&)), this, SLOT(clearSelectedNode()));
683 connect(model->getBanTableModel(), SIGNAL(layoutChanged()), this, SLOT(showOrHideBanTableIfRequired()));
755 str.replace(QString("font-size:%1pt").arg(consoleFontSize), QString("font-size:%1pt").arg(newSize));
762 float oldPosFactor = 1.0 / ui->messagesWidget->verticalScrollBar()->maximum() * ui->messagesWidget->verticalScrollBar()->value();
765 ui->messagesWidget->verticalScrollBar()->setValue(oldPosFactor * ui->messagesWidget->verticalScrollBar()->maximum());
842 "td.time { " + GUIUtil::getThemedStyleQString(GUIUtil::ThemedStyle::TS_SECONDARY) + " font-size: %2; } "
843 "td.message { " + GUIUtil::getThemedStyleQString(GUIUtil::ThemedStyle::TS_PRIMARY) + " font-family: %1; font-size: %2; white-space:pre-wrap; } "
844 "td.cmd-request, b { " + GUIUtil::getThemedStyleQString(GUIUtil::ThemedStyle::TS_COMMAND) + " } "
845 "td.cmd-error, .secwarning { " + GUIUtil::getThemedStyleQString(GUIUtil::ThemedStyle::TS_ERROR) + " }"
856 tr("Use up and down arrows to navigate history, and %1 to clear screen.").arg("<b>"+clsKey+"</b>") + "<br>" +
860 tr("WARNING: Scammers have been active, telling users to type commands here, stealing their wallet contents. Do not use this console without fully understanding the ramifications of a command.") +
891 connections += tr("In:") + " " + QString::number(clientModel->getNumConnections(CONNECTIONS_IN)) + " / ";
892 connections += tr("Out:") + " " + QString::number(clientModel->getNumConnections(CONNECTIONS_OUT)) + ")";
914 void RPCConsole::setNumBlocks(int count, const QDateTime& blockDate, const QString& blockHash, double nVerificationProgress, bool headers)
1079 ui->lblGraphRange->setText(GUIUtil::formatDurationStr(TrafficGraphData::RangeMinutes[range] * 60));
1082 void RPCConsole::peerSelected(const QItemSelection &selected, const QItemSelection &deselected)
1089 const CNodeCombinedStats *stats = clientModel->getPeerTableModel()->getNodeStats(selected.indexes().first().row());
1100 const CNodeCombinedStats *stats = clientModel->getPeerTableModel()->getNodeStats(selected.at(i).row());
1154 ui->peerWidget->selectRow(clientModel->getPeerTableModel()->getRowByNodeId(cachedNodeids.at(i)));
1168 peerAddrDetails += "<br />" + tr("via %1").arg(QString::fromStdString(stats->nodeStats.addrLocal));
1171 ui->peerLastSend->setText(stats->nodeStats.nLastSend ? GUIUtil::formatDurationStr(GetSystemTimeInSeconds() - stats->nodeStats.nLastSend) : tr("never"));
1172 ui->peerLastRecv->setText(stats->nodeStats.nLastRecv ? GUIUtil::formatDurationStr(GetSystemTimeInSeconds() - stats->nodeStats.nLastRecv) : tr("never"));
1175 ui->peerConnTime->setText(GUIUtil::formatDurationStr(GetSystemTimeInSeconds() - stats->nodeStats.nTimeConnected));
1212 GUIUtil::setIcon(ui->fontBiggerButton, "fontbigger", GUIUtil::ThemedColor::BLUE, consoleButtonsSize);
1213 GUIUtil::setIcon(ui->fontSmallerButton, "fontsmaller", GUIUtil::ThemedColor::BLUE, consoleButtonsSize);
1304 const CNodeCombinedStats *stats = clientModel->getPeerTableModel()->getNodeStats(detailNodeRow);
Definition: rpcconsole.h:155
QString formatClientStartupTime() const
Definition: clientmodel.cpp:285
Definition: addrdb.h:23
bool getNetworkActive() const
Return true if network activity in core is enabled.
Definition: clientmodel.cpp:242
const QString SALVAGEWALLET("-salvagewallet")
QList< QModelIndex > getEntryData(QAbstractItemView *view, int column)
Return a field of the currently selected entry as a QString.
Definition: guiutil.cpp:514
Definition: peertablemodel.h:23
void setFont(const std::vector< QWidget *> &vecWidgets, FontWeight weight, int nPointSize, bool fItalic)
Workaround to set correct font styles in all themes since there is a bug in macOS which leads to issu...
Definition: guiutil.cpp:1552
Definition: peertablemodel.h:63
void message(int category, const QString &message, bool html=false)
Append the message to the message widget.
Definition: rpcconsole.cpp:873
static bool RPCExecuteCommandLine(std::string &strResult, const std::string &strCommand, std::string *const pstrFilteredOut=nullptr)
Definition: rpcconsole.h:41
void showPeersTableContextMenu(const QPoint &point)
Show custom context menu on Peers tab.
Definition: rpcconsole.cpp:1255
bool dashThemeActive()
Check if a dash specific theme is activated (light/dark).
Definition: guiutil.cpp:1775
Definition: addressbookpage.h:12
void setInstantSendLockCount(size_t count)
Set number of InstantSend locks.
Definition: rpcconsole.cpp:945
Definition: peertablemodel.h:59
void setNetworkActive(bool networkActive)
Set network state shown in the UI.
Definition: rpcconsole.cpp:909
const QString REINDEX("-reindex")
std::string write(unsigned int prettyIndent=0, unsigned int indentLevel=0) const
Definition: univalue_write.cpp:31
Definition: univalue.h:20
Definition: rpcconsole.h:52
Definition: rpcconsole.h:50
const QString UPGRADEWALLET("-upgradewallet")
QString HtmlEscape(const QString &str, bool fMultiLine)
Definition: guiutil.cpp:481
void handleRestart(QStringList args)
Get restart command-line parameters and handle restart.
void disconnectSelectedNode()
Disconnect a selected node on the Peers tab.
Definition: rpcconsole.cpp:1269
const QString ZAPTXES2("-zapwallettxes=2 -persistmempool=0")
void updateNodeDetail(const CNodeCombinedStats *stats)
show detailed information on ui about selected node
Definition: rpcconsole.cpp:1162
void RPCUnsetTimerInterface(RPCTimerInterface *iface)
Unset factory function for timers.
Definition: server.cpp:601
void setNumBlocks(int count, const QDateTime &blockDate, const QString &blockHash, double nVerificationProgress, bool headers)
Set number of blocks, last block date and last block hash shown in the UI.
Definition: rpcconsole.cpp:914
const UniValue & find_value(const UniValue &obj, const std::string &name)
Definition: univalue.cpp:236
Definition: netaddress.h:105
Definition: bantablemodel.h:51
Definition: clientmodel.h:37
UniValue RPCConvertValues(const std::string &strMethod, const std::vector< std::string > &strParams)
Convert positional arguments to command-specific RPC representation.
Definition: client.cpp:230
void reply(int category, const QString &command)
const QString ZAPTXES1("-zapwallettxes=1 -persistmempool=0")
Definition: rpcconsole.h:51
void updateFonts()
Update the font of all widgets where a custom font has been set with GUIUtil::setFont.
Definition: guiutil.cpp:1563
Definition: clientmodel.h:36
const TrafficGraphData::GraphRange INITIAL_TRAFFIC_GRAPH_SETTING
Definition: rpcconsole.cpp:55
RPCTimerBase * NewTimer(std::function< void(void)> &func, int64_t millis) override
Factory function for timers.
Definition: rpcconsole.cpp:119
bool fNodeStateStatsAvailable
Definition: peertablemodel.h:26
Definition: rpcconsole.cpp:81
void updateMasternodeCount()
Update number of masternodes shown in the UI.
Definition: rpcconsole.cpp:923
int getNumConnections(unsigned int flags=CONNECTIONS_ALL) const
Return number of connections, default is in- and outbound (total)
Definition: clientmodel.cpp:62
double getVerificationProgress(const CBlockIndex *tip) const
Definition: clientmodel.cpp:184
const QString RESCAN("-rescan")
void buildParameterlist(QString arg)
Build parameter list for restart.
Definition: rpcconsole.cpp:805
QtRPCTimerBase(std::function< void(void)> &_func, int64_t millis)
Definition: rpcconsole.cpp:99
void setTabFocus(enum TabTypes tabType)
set which tab has the focus (is visible)
Definition: rpcconsole.cpp:1353
static bool RPCParseCommandLine(std::string &strResult, const std::string &strCommand, bool fExecute, std::string *const pstrFilteredOut=nullptr)
Split shell command line into a list of arguments and optionally execute the command(s).
Definition: rpcconsole.cpp:147
void updateNetworkState()
Update UI with latest network info from model.
Definition: rpcconsole.cpp:888
const CNodeCombinedStats * getNodeStats(int idx)
Definition: peertablemodel.cpp:230
CDeterministicMNList getMasternodeList() const
Definition: clientmodel.cpp:88
Definition: rpcconsole.h:157
void setTrafficGraphRange(TrafficGraphData::GraphRange range)
Definition: rpcconsole.cpp:1076
void on_openDebugLogfileButton_clicked()
open the debug.log from the current datadir
Definition: rpcconsole.cpp:1060
void on_stackedWidgetRPC_currentChanged(int index)
Definition: rpcconsole.cpp:1052
void RPCSetTimerInterfaceIfUnset(RPCTimerInterface *iface)
Set the factory function for timer, but only, if unset.
Definition: server.cpp:590
void disableMacFocusRect(const QWidget *w)
Disable the OS default focus rect for macOS because we have custom focus rects set in the css files...
Definition: guiutil.cpp:1789
virtual bool eventFilter(QObject *obj, QEvent *event)
Definition: rpcconsole.cpp:539
Definition: rpcconsole.h:159
void showOrHideBanTableIfRequired()
Hides ban table if no bans are present.
Definition: rpcconsole.cpp:1343
void setMempoolSize(long numberOfTxs, size_t dynUsage)
Set size (number of transactions and memory usage) of the mempool in the UI.
Definition: rpcconsole.cpp:935
void setButtonIcons()
Set required icons for buttons inside the dialog.
Definition: rpcconsole.cpp:1208
void setNumConnections(int count)
Set number of connections shown in the UI.
Definition: rpcconsole.cpp:901
const CChainParams & Params()
Return the currently selected parameters.
Definition: chainparams.cpp:947
void peerLayoutAboutToChange()
Handle selection caching before update.
Definition: rpcconsole.cpp:1094
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
Definition: util.cpp:808
void on_sldGraphRange_valueChanged(int value)
change the time range of the network traffic graph
Definition: rpcconsole.cpp:1071
void banSelectedNode(int bantime)
Ban a selected node on the Peers tab.
Definition: rpcconsole.cpp:1286
QString getThemedStyleQString(ThemedStyle style)
Helper to get css style strings which are injected into rich text through qt.
Definition: guiutil.cpp:210
Definition: server.h:37
void setIcon(QAbstractButton *button, const QString &strIcon, const ThemedColor color, const ThemedColor colorAlternative, const QSize &size)
Helper to set an icon for a button with the given color (replaces black) and colorAlternative (replac...
Definition: guiutil.cpp:247
void peerSelected(const QItemSelection &selected, const QItemSelection &deselected)
Handle selection of peer in peers list.
Definition: rpcconsole.cpp:1082
Definition: peertablemodel.h:58
const QSize FONT_RANGE(4, 40)
void loadStyleSheet(QWidget *widget, bool fForceUpdate)
Updates the widgets stylesheet and adds it to the list of ui debug elements.
Definition: guiutil.cpp:1155
Definition: rpcconsole.cpp:114
Definition: peertablemodel.h:60
std::vector< std::string > listCommands() const
Returns a list of registered commands.
Definition: server.cpp:567
void stopExecutor()
void cmdRequest(const QString &command)
Definition: bantablemodel.h:50
Definition: trafficgraphdata.h:39
void showBanTableContextMenu(const QPoint &point)
Show custom context menu on Bans tab.
Definition: rpcconsole.cpp:1262