5 #if defined(HAVE_CONFIG_H) 6 #include <config/bitcoin-config.h> 17 #include <qt/forms/ui_debugwindow.h> 36 #include <QMessageBox> 40 #include <QStringList> 58 {
"cmd-reply",
":/icons/tx_output"},
59 {
"cmd-error",
":/icons/tx_output"},
60 {
"misc",
":/icons/tx_inout"},
66 const QStringList historyFilter = QStringList() <<
"importprivkey" 69 <<
"signmessagewithprivkey" 70 <<
"signrawtransactionwithkey" 72 <<
"walletpassphrasechange" 87 void reply(
int category,
const QString &command);
100 timer.setSingleShot(
true);
101 connect(&timer, &QTimer::timeout, [
this] { func(); });
114 const char *
Name()
override {
return "Qt"; }
116 int64_t millis)
override {
121 #include <qt/rpcconsole.moc> 150 std::string &strResult,
151 const std::string &strCommand,
153 std::string *
const pstrFilteredOut,
155 std::vector<std::vector<std::string>> stack;
156 stack.push_back(std::vector<std::string>());
160 STATE_EATING_SPACES_IN_ARG,
161 STATE_EATING_SPACES_IN_BRACKETS,
166 STATE_ESCAPE_DOUBLEQUOTED,
167 STATE_COMMAND_EXECUTED,
168 STATE_COMMAND_EXECUTED_INNER
169 } state = STATE_EATING_SPACES;
172 unsigned nDepthInsideSensitive = 0;
173 size_t filter_begin_pos = 0, chpos;
174 std::vector<std::pair<size_t, size_t>> filter_ranges;
176 auto add_to_current_stack = [&](
const std::string &strArg) {
177 if (stack.back().empty() && (!nDepthInsideSensitive) &&
178 historyFilter.contains(QString::fromStdString(strArg),
179 Qt::CaseInsensitive)) {
180 nDepthInsideSensitive = 1;
181 filter_begin_pos = chpos;
185 stack.
push_back(std::vector<std::string>());
187 stack.back().push_back(strArg);
190 auto close_out_params = [&]() {
191 if (nDepthInsideSensitive) {
192 if (!--nDepthInsideSensitive) {
193 assert(filter_begin_pos);
194 filter_ranges.push_back(
195 std::make_pair(filter_begin_pos, chpos));
196 filter_begin_pos = 0;
202 std::string strCommandTerminated = strCommand;
203 if (strCommandTerminated.back() !=
'\n') {
204 strCommandTerminated +=
"\n";
206 for (chpos = 0; chpos < strCommandTerminated.size(); ++chpos) {
207 char ch = strCommandTerminated[chpos];
209 case STATE_COMMAND_EXECUTED_INNER:
210 case STATE_COMMAND_EXECUTED: {
211 bool breakParsing =
true;
215 state = STATE_COMMAND_EXECUTED_INNER;
218 if (state == STATE_COMMAND_EXECUTED_INNER) {
225 if (curarg.size() && fExecute) {
230 for (
char argch : curarg) {
232 throw std::runtime_error(
233 "Invalid result query");
237 lastResult[
atoi(curarg.c_str())];
242 throw std::runtime_error(
243 "Invalid result query");
245 lastResult = subelement;
248 state = STATE_COMMAND_EXECUTED;
253 breakParsing =
false;
261 if (lastResult.
isStr()) {
264 curarg = lastResult.
write(2);
271 add_to_current_stack(curarg);
278 state = STATE_EATING_SPACES;
287 case STATE_EATING_SPACES_IN_ARG:
288 case STATE_EATING_SPACES_IN_BRACKETS:
289 case STATE_EATING_SPACES:
292 state = STATE_DOUBLEQUOTED;
295 state = STATE_SINGLEQUOTED;
298 state = STATE_ESCAPE_OUTER;
303 if (state == STATE_EATING_SPACES_IN_ARG) {
304 throw std::runtime_error(
"Invalid Syntax");
306 if (state == STATE_ARGUMENT) {
307 if (ch ==
'(' && stack.size() &&
308 stack.back().size() > 0) {
309 if (nDepthInsideSensitive) {
310 ++nDepthInsideSensitive;
312 stack.push_back(std::vector<std::string>());
318 throw std::runtime_error(
"Invalid Syntax");
321 add_to_current_stack(curarg);
323 state = STATE_EATING_SPACES_IN_BRACKETS;
325 if ((ch ==
')' || ch ==
'\n') && stack.size() > 0) {
332 std::vector<std::string>(
333 stack.back().begin() + 1,
334 stack.back().end()));
335 std::string method = stack.back()[0];
340 QByteArray encodedName =
341 QUrl::toPercentEncoding(
344 std::string(encodedName.constData(),
345 encodedName.length());
355 state = STATE_COMMAND_EXECUTED;
362 if (state == STATE_EATING_SPACES_IN_ARG &&
363 curarg.empty() && ch ==
',') {
364 throw std::runtime_error(
"Invalid Syntax");
365 }
else if (state == STATE_ARGUMENT) {
367 add_to_current_stack(curarg);
370 if ((state == STATE_EATING_SPACES_IN_BRACKETS ||
371 state == STATE_ARGUMENT) &&
373 state = STATE_EATING_SPACES_IN_ARG;
376 state = STATE_EATING_SPACES;
380 state = STATE_ARGUMENT;
383 case STATE_SINGLEQUOTED:
386 state = STATE_ARGUMENT;
392 case STATE_DOUBLEQUOTED:
395 state = STATE_ARGUMENT;
398 state = STATE_ESCAPE_DOUBLEQUOTED;
404 case STATE_ESCAPE_OUTER:
406 state = STATE_ARGUMENT;
408 case STATE_ESCAPE_DOUBLEQUOTED:
409 if (ch !=
'"' && ch !=
'\\') {
414 state = STATE_DOUBLEQUOTED;
418 if (pstrFilteredOut) {
419 if (STATE_COMMAND_EXECUTED == state) {
420 assert(!stack.empty());
423 *pstrFilteredOut = strCommand;
424 for (
auto i = filter_ranges.rbegin(); i != filter_ranges.rend(); ++i) {
425 pstrFilteredOut->replace(i->first, i->second - i->first,
"(…)");
431 case STATE_COMMAND_EXECUTED:
432 if (lastResult.
isStr()) {
433 strResult = lastResult.
get_str();
435 strResult = lastResult.
write(2);
439 case STATE_EATING_SPACES:
450 std::string executableCommand = command.toStdString() +
"\n";
454 if (executableCommand ==
"help-console\n") {
458 "This console accepts RPC commands using the standard " 460 " example: getblockhash 0\n\n" 462 "This console can also accept RPC commands using " 463 "parenthesized syntax.\n" 464 " example: getblockhash(0)\n\n" 466 "Commands may be nested when specified with the " 467 "parenthesized syntax.\n" 468 " example: getblock(getblockhash(0) 1)\n\n" 470 "A space or a comma can be used to delimit arguments " 471 "for either syntax.\n" 472 " example: getblockhash 0\n" 473 " getblockhash,0\n\n" 475 "Named results can be queried with a non-quoted key " 476 "string in brackets.\n" 477 " example: getblock(getblockhash(0) true)[tx]\n\n" 479 "Results without keys can be queried using an integer " 482 "getblock(getblockhash(0),true)[tx][0]\n\n")));
486 m_node, result, executableCommand,
nullptr, wallet_model)) {
488 QString(
"Parse error: unbalanced ' or \""));
499 QString::fromStdString(message) +
" (code " +
500 QString::number(code) +
")");
501 }
catch (
const std::runtime_error &) {
505 QString::fromStdString(objError.
write()));
507 }
catch (
const std::exception &e) {
509 QString(
"Error: ") + QString::fromStdString(e.what()));
516 platformStyle(_platformStyle) {
519 if (!restoreGeometry(
520 settings.value(
"RPCConsoleWindowGeometry").toByteArray())) {
522 move(QGuiApplication::primaryScreen()->availableGeometry().center() -
523 frameGeometry().center());
526 QChar nonbreaking_hyphen(8209);
527 ui->dataDir->setToolTip(
528 ui->dataDir->toolTip().arg(QString(nonbreaking_hyphen) +
"datadir"));
529 ui->blocksDir->setToolTip(
ui->blocksDir->toolTip().arg(
530 QString(nonbreaking_hyphen) +
"blocksdir"));
531 ui->openDebugLogfileButton->setToolTip(
532 ui->openDebugLogfileButton->toolTip().arg(PACKAGE_NAME));
535 ui->openDebugLogfileButton->setIcon(
539 ui->fontBiggerButton->setIcon(
541 ui->fontSmallerButton->setIcon(
545 ui->lineEdit->installEventFilter(
this);
546 ui->messagesWidget->installEventFilter(
this);
549 connect(
ui->fontBiggerButton, &QPushButton::clicked,
this,
551 connect(
ui->fontSmallerButton, &QPushButton::clicked,
this,
553 connect(
ui->btnClearTrafficGraph, &QPushButton::clicked,
ui->trafficGraph,
557 ui->WalletSelector->setVisible(
false);
558 ui->WalletSelectorLabel->setVisible(
false);
562 ui->berkeleyDBVersion->setText(DbEnv::version(
nullptr,
nullptr,
nullptr));
564 ui->label_berkeleyDBVersion->hide();
565 ui->berkeleyDBVersion->hide();
575 ui->detailWidget->hide();
576 ui->peerHeading->setText(tr(
"Select a peer to view detailed information."));
588 settings.setValue(
"RPCConsoleWindowGeometry", saveGeometry());
596 if (event->type() == QEvent::KeyPress) {
597 QKeyEvent *keyevt =
static_cast<QKeyEvent *
>(event);
598 int key = keyevt->key();
599 Qt::KeyboardModifiers mod = keyevt->modifiers();
602 if (obj ==
ui->lineEdit) {
608 if (obj ==
ui->lineEdit) {
614 case Qt::Key_PageDown:
615 if (obj ==
ui->lineEdit) {
616 QApplication::postEvent(
ui->messagesWidget,
617 new QKeyEvent(*keyevt));
625 QApplication::postEvent(
ui->lineEdit,
626 new QKeyEvent(*keyevt));
634 if (obj ==
ui->messagesWidget &&
635 ((!mod && !keyevt->text().isEmpty() &&
636 key != Qt::Key_Tab) ||
637 ((mod & Qt::ControlModifier) && key == Qt::Key_V) ||
638 ((mod & Qt::ShiftModifier) && key == Qt::Key_Insert))) {
639 ui->lineEdit->setFocus();
640 QApplication::postEvent(
ui->lineEdit,
641 new QKeyEvent(*keyevt));
646 return QWidget::eventFilter(obj, event);
652 bool wallet_enabled{
false};
655 #endif // ENABLE_WALLET 656 if (model && !wallet_enabled) {
663 ui->trafficGraph->setClientModel(model);
691 ui->peerWidget->verticalHeader()->hide();
692 ui->peerWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
693 ui->peerWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
694 ui->peerWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
695 ui->peerWidget->setContextMenuPolicy(Qt::CustomContextMenu);
701 ui->peerWidget->horizontalHeader()->setStretchLastSection(
true);
704 QAction *disconnectAction =
new QAction(tr(
"&Disconnect"),
this);
705 QAction *banAction1h =
706 new QAction(tr(
"Ban for") +
" " + tr(
"1 &hour"),
this);
707 QAction *banAction24h =
708 new QAction(tr(
"Ban for") +
" " + tr(
"1 &day"),
this);
709 QAction *banAction7d =
710 new QAction(tr(
"Ban for") +
" " + tr(
"1 &week"),
this);
711 QAction *banAction365d =
712 new QAction(tr(
"Ban for") +
" " + tr(
"1 &year"),
this);
722 connect(banAction1h, &QAction::triggered,
724 connect(banAction24h, &QAction::triggered,
726 connect(banAction7d, &QAction::triggered,
728 connect(banAction365d, &QAction::triggered,
732 connect(
ui->peerWidget, &QTableView::customContextMenuRequested,
this,
734 connect(disconnectAction, &QAction::triggered,
this,
739 connect(
ui->peerWidget->selectionModel(),
740 &QItemSelectionModel::selectionChanged,
this,
748 &PeerTableModel::layoutAboutToBeChanged,
this,
753 ui->banlistWidget->verticalHeader()->hide();
754 ui->banlistWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
755 ui->banlistWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
756 ui->banlistWidget->setSelectionMode(QAbstractItemView::SingleSelection);
757 ui->banlistWidget->setContextMenuPolicy(Qt::CustomContextMenu);
762 ui->banlistWidget->horizontalHeader()->setStretchLastSection(
true);
765 QAction *unbanAction =
new QAction(tr(
"&Unban"),
this);
772 connect(
ui->banlistWidget, &QTableView::customContextMenuRequested,
774 connect(unbanAction, &QAction::triggered,
this,
779 connect(
ui->banlistWidget, &QTableView::clicked,
this,
793 ui->networkName->setText(
794 QString::fromStdString(
Params().NetworkIDString()));
797 QStringList wordList;
799 for (
size_t i = 0; i < commandList.size(); ++i) {
800 wordList << commandList[i].c_str();
801 wordList << (
"help " + commandList[i]).c_str();
804 wordList <<
"help-console";
807 autoCompleter->setModelSorting(QCompleter::CaseSensitivelySortedModel);
810 ui->lineEdit->setEnabled(
true);
829 QVariant::fromValue(walletModel));
830 if (
ui->WalletSelector->count() == 2 && !isVisible()) {
833 ui->WalletSelector->setCurrentIndex(1);
835 if (
ui->WalletSelector->count() > 2) {
836 ui->WalletSelector->setVisible(
true);
837 ui->WalletSelectorLabel->setVisible(
true);
842 ui->WalletSelector->removeItem(
843 ui->WalletSelector->findData(QVariant::fromValue(walletModel)));
844 if (
ui->WalletSelector->count() == 2) {
845 ui->WalletSelector->setVisible(
false);
846 ui->WalletSelectorLabel->setVisible(
false);
854 return "cmd-request";
884 QString str =
ui->messagesWidget->toHtml();
888 QString(
"font-size:%1pt").arg(newSize));
896 float oldPosFactor = 1.0 /
897 ui->messagesWidget->verticalScrollBar()->maximum() *
898 ui->messagesWidget->verticalScrollBar()->value();
900 ui->messagesWidget->setHtml(str);
901 ui->messagesWidget->verticalScrollBar()->setValue(
902 oldPosFactor *
ui->messagesWidget->verticalScrollBar()->maximum());
906 ui->messagesWidget->clear();
911 ui->lineEdit->clear();
912 ui->lineEdit->setFocus();
918 ui->messagesWidget->document()->addResource(
922 Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
927 ui->messagesWidget->document()->setDefaultStyleSheet(
929 "td.time { color: #808080; font-size: %2; padding-top: 3px; } " 930 "td.message { font-family: %1; font-size: %2; " 931 "white-space:pre-wrap; } " 932 "td.cmd-request { color: #006060; } " 933 "td.cmd-error { color: red; } " 934 ".secwarning { color: red; }" 935 "b { color: #006060; } ")
939 QString clsKey =
"(⌘)-L";
941 QString clsKey =
"Ctrl-L";
945 (tr(
"Welcome to the %1 RPC console.").arg(PACKAGE_NAME) +
"<br>" +
946 tr(
"Use up and down arrows to navigate history, and " 947 "%1 to clear screen.")
948 .arg(
"<b>" + clsKey +
"</b>") +
950 tr(
"Type %1 for an overview of available commands.")
951 .arg(
"<b>help</b>") +
953 tr(
"For more information on using this console type %1.")
954 .arg(
"<b>help-console</b>") +
955 "<br><span class=\"secwarning\"><br>" +
956 tr(
"WARNING: Scammers have been active, telling users to type " 957 "commands here, stealing their wallet contents. Do not use " 958 "this console without fully understanding the ramifications " 965 if (windowType() != Qt::Widget && event->key() == Qt::Key_Escape) {
971 QTime time = QTime::currentTime();
972 QString timeString = time.toString();
974 out +=
"<table><tr><td class=\"time\" width=\"65\">" + timeString +
"</td>";
975 out +=
"<td class=\"icon\" width=\"32\"><img src=\"" +
978 "\" valign=\"middle\">";
984 out +=
"</td></tr></table>";
985 ui->messagesWidget->append(out);
989 QString connections =
991 connections += tr(
"In:") +
" " +
995 connections += tr(
"Out:") +
" " +
1001 connections +=
" (" + tr(
"Network activity disabled") +
")";
1004 ui->numberOfConnections->setText(connections);
1020 double nVerificationProgress,
bool headers) {
1022 ui->numberOfBlocks->setText(QString::number(count));
1023 ui->lastBlockTime->setText(blockDate.toString());
1028 ui->mempoolNumberTxs->setText(QString::number(numberOfTxs));
1030 if (dynUsage < 1000000) {
1031 ui->mempoolSize->setText(QString::number(dynUsage / 1000.0,
'f', 2) +
1034 ui->mempoolSize->setText(QString::number(dynUsage / 1000000.0,
'f', 2) +
1040 QString cmd =
ui->lineEdit->text();
1042 if (!cmd.isEmpty()) {
1043 std::string strFilteredCmd;
1050 throw std::runtime_error(
"Invalid command line");
1052 }
catch (
const std::exception &e) {
1053 QMessageBox::critical(
this,
"Error",
1054 QString(
"Error: ") +
1055 QString::fromStdString(e.what()));
1059 ui->lineEdit->clear();
1063 #ifdef ENABLE_WALLET 1073 tr(
"Executing command without any wallet"));
1082 cmd = QString::fromStdString(strFilteredCmd);
1119 ui->lineEdit->setText(cmd);
1124 executor->moveToThread(&
thread);
1128 static_cast<void (
RPCConsole::*)(
int,
const QString &)
>(
1135 connect(&
thread, &QThread::finished, executor, &RPCExecutor::deleteLater);
1143 if (
ui->tabWidget->widget(index) ==
ui->tab_console) {
1144 ui->lineEdit->setFocus();
1153 QScrollBar *scrollbar =
ui->messagesWidget->verticalScrollBar();
1154 scrollbar->setValue(scrollbar->maximum());
1158 const int multiplier = 5;
1159 int mins = value * multiplier;
1164 ui->trafficGraph->setGraphRangeMins(mins);
1169 quint64 totalBytesOut) {
1175 const QItemSelection &deselected) {
1176 Q_UNUSED(deselected);
1179 selected.indexes().isEmpty()) {
1185 selected.indexes().first().row());
1192 QModelIndexList selected =
1193 ui->peerWidget->selectionModel()->selectedIndexes();
1195 for (
int i = 0; i < selected.size(); i++) {
1198 selected.at(i).row());
1209 bool fUnselect =
false;
1210 bool fReselect =
false;
1218 int selectedRow = -1;
1219 QModelIndexList selectedModelIndex =
1220 ui->peerWidget->selectionModel()->selectedIndexes();
1221 if (!selectedModelIndex.isEmpty()) {
1222 selectedRow = selectedModelIndex.first().row();
1230 if (detailNodeRow < 0) {
1234 if (detailNodeRow != selectedRow) {
1244 if (fUnselect && selectedRow >= 0) {
1250 ui->peerWidget->selectRow(
1268 peerAddrDetails +=
"<br />" + tr(
"via %1").arg(QString::fromStdString(
1271 ui->peerHeading->setText(peerAddrDetails);
1272 ui->peerServices->setText(
1274 ui->peerLastSend->setText(
1279 ui->peerLastRecv->setText(
1284 ui->peerBytesSent->setText(
1286 ui->peerBytesRecv->setText(
1290 ui->peerPingTime->setText(
1292 ui->peerPingWait->setText(
1294 ui->peerMinPing->setText(
1296 ui->timeoffset->setText(
1299 ui->peerSubversion->setText(
1304 ui->peerWhitelisted->setText(
1306 ui->peerMappedAS->setText(
1316 ui->peerSyncHeight->setText(
1319 ui->peerSyncHeight->setText(tr(
"Unknown"));
1324 ui->peerCommonHeight->setText(
1327 ui->peerCommonHeight->setText(tr(
"Unknown"));
1331 ui->detailWidget->show();
1335 QWidget::resizeEvent(event);
1339 QWidget::showEvent(event);
1350 QWidget::hideEvent(event);
1361 QModelIndex index =
ui->peerWidget->indexAt(point);
1362 if (index.isValid()) {
1368 QModelIndex index =
ui->banlistWidget->indexAt(point);
1369 if (index.isValid()) {
1376 QList<QModelIndex> nodes =
1378 for (
int i = 0; i < nodes.count(); i++) {
1380 NodeId id = nodes.at(i).data().toLongLong();
1394 QList<QModelIndex> nodes =
1396 for (
int i = 0; i < nodes.count(); i++) {
1398 NodeId id = nodes.at(i).data().toLongLong();
1403 if (detailNodeRow < 0) {
1425 QList<QModelIndex> nodes =
1427 for (
int i = 0; i < nodes.count(); i++) {
1429 QString strNode = nodes.at(i).data().toString();
1440 ui->peerWidget->selectionModel()->clearSelection();
1442 ui->detailWidget->hide();
1443 ui->peerHeading->setText(tr(
"Select a peer to view detailed information."));
1452 ui->banlistWidget->setVisible(visible);
1453 ui->banHeading->setVisible(visible);
1457 ui->tabWidget->setCurrentIndex(
int(tabType));
1461 return ui->tabWidget->tabText(
int(tab_type));
1467 return QKeySequence(Qt::CTRL + Qt::Key_I);
1469 return QKeySequence(Qt::CTRL + Qt::Key_T);
1471 return QKeySequence(Qt::CTRL + Qt::Key_N);
1473 return QKeySequence(Qt::CTRL + Qt::Key_P);
1480 this->
ui->label_alerts->setVisible(!warnings.isEmpty());
1481 this->
ui->label_alerts->setText(warnings);
QString formatClientStartupTime() const
int getRowByNodeId(NodeId nodeid)
void addWallet(WalletModel *const walletModel)
QString formatSubVersion() const
int getNumConnections(NumConnections flags=CONNECTIONS_ALL) const
Return number of connections, default is in- and outbound (total)
Local Bitcoin RPC console.
QString cmdBeforeBrowsing
CNodeStateStats nodeStateStats
virtual bool getNetworkActive()=0
Get network active.
QList< QModelIndex > getEntryData(QAbstractItemView *view, int column)
Return a field of the currently selected entry as a QString.
static bool isWalletEnabled()
void on_lineEdit_returnPressed()
RPCExecutor(interfaces::Node &node)
QString blocksDir() const
virtual double getVerificationProgress()=0
Get verification progress.
void showPeersTableContextMenu(const QPoint &point)
Show custom context menu on Peers tab.
virtual bool unban(const CSubNet &ip)=0
Unban node.
WalletModel * m_last_wallet_model
virtual void rpcUnsetTimerInterface(RPCTimerInterface *iface)=0
Unset RPC timer interface.
virtual int64_t getTotalBytesRecv()=0
Get total bytes recv.
interfaces::Node & m_node
constexpr bool IsDigit(char c)
Tests if the given character is a decimal digit.
void setNetworkActive(bool networkActive)
Set network state shown in the UI.
void scrollToEnd()
Scroll console view to end.
QString formatBytes(uint64_t bytes)
QString formatTimeOffset(int64_t nTimeOffset)
void networkActiveChanged(bool networkActive)
virtual UniValue executeRpc(Config &config, const std::string &command, const UniValue ¶ms, const std::string &uri)=0
Execute rpc command.
static QString categoryClass(int category)
void clearSelectedNode()
clear the selected node
RPCConsole(interfaces::Node &node, const PlatformStyle *platformStyle, QWidget *parent)
const std::string & get_str() const
QString HtmlEscape(const QString &str, bool fMultiLine)
PeerTableModel * getPeerTableModel()
void numBlocksChanged(int count, const QDateTime &blockDate, double nVerificationProgress, bool header, SynchronizationState sync_state)
void disconnectSelectedNode()
Disconnect a selected node on the Peers tab.
void on_tabWidget_currentChanged(int index)
int64_t GetSystemTimeInSeconds()
Returns the system time (not mockable)
void numConnectionsChanged(int count)
virtual bool ban(const CNetAddr &net_addr, int64_t ban_time_offset)=0
Ban node.
void updateNodeDetail(const CNodeCombinedStats *stats)
show detailed information on ui about selected node
virtual void rpcSetTimerInterfaceIfUnset(RPCTimerInterface *iface)=0
Set RPC timer interface if unset.
QString getStatusBarWarnings() const
Return warnings to be displayed in status bar.
QString tabTitle(TabTypes tab_type) const
void alertsChanged(const QString &warnings)
const UniValue & find_value(const UniValue &obj, const std::string &name)
bool LookupSubNet(const std::string &strSubnet, CSubNet &ret)
Parse and resolve a specified subnet string into the appropriate internal representation.
UniValue RPCConvertValues(const std::string &strMethod, const std::vector< std::string > &strParams)
Convert positional arguments to command-specific RPC representation.
void setClientModel(ClientModel *model)
void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut)
const PlatformStyle *const platformStyle
void reply(int category, const QString &command)
QMenu * peersTableContextMenu
void browseHistory(int offset)
Go forward or back in history.
bool fNodeStateStatsAvailable
void resizeEvent(QResizeEvent *event) override
bool push_back(const UniValue &val)
void message(int category, const QString &msg)
Append the message to the message widget.
QString formatPingTime(int64_t ping_usec)
Class for handling RPC timers (used for e.g.
QString formatDurationStr(int secs)
const int CONSOLE_HISTORY
void handleCloseWindowShortcut(QWidget *w)
const struct @10 ICON_MAPPING[]
int atoi(const std::string &str)
void setTabFocus(enum TabTypes tabType)
set which tab has the focus (is visible)
BanTableModel * getBanTableModel()
interfaces::Node & node() const
std::string write(unsigned int prettyIndent=0, unsigned int indentLevel=0) const
void peerLayoutChanged()
Handle updated peer information.
RPCTimerInterface * rpcTimerInterface
virtual bool disconnectByAddress(const CNetAddr &net_addr)=0
Disconnect node by address.
void updateNetworkState()
Update UI with latest network info from model.
const CNodeCombinedStats * getNodeStats(int idx)
QString getWalletName() const
void on_openDebugLogfileButton_clicked()
open the debug.log from the current datadir
const char * Name() override
Implementation name.
QtRPCTimerBase(std::function< void()> &_func, int64_t millis)
Model for Bitcoin network client.
void unbanSelectedNode()
Unban a selected node on the Bans tab.
ClientModel * clientModel
QMenu * banTableContextMenu
void setTrafficGraphRange(int mins)
QKeySequence tabShortcut(TabTypes tab_type) const
void clear(bool clearHistory=true)
void showOrHideBanTableIfRequired()
Hides ban table if no bans are present.
void updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut)
update traffic statistics
virtual int64_t getLastBlockTime()=0
Get last block time.
QList< NodeId > cachedNodeids
void setMempoolSize(long numberOfTxs, size_t dynUsage)
Set size (number of transactions and memory usage) of the mempool in the UI.
void setFontSize(int newSize)
std::function< void()> func
void setNumConnections(int count)
Set number of connections shown in the UI.
const CChainParams & Params()
Return the currently selected parameters.
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)
Split shell command line into a list of arguments and optionally execute the command(s).
interfaces::Node & m_node
void peerLayoutAboutToChange()
Handle selection caching before update.
Interface to Bitcoin wallet from Qt view code.
virtual std::vector< std::string > listRpcCommands()=0
List rpc commands.
QString formatServicesStr(quint64 mask)
void on_sldGraphRange_valueChanged(int value)
change the time range of the network traffic graph
void banSelectedNode(int bantime)
Ban a selected node on the Peers tab.
void updateAlerts(const QString &warnings)
Opaque base class for timers returned by NewTimerFunc.
void removeWallet(WalletModel *const walletModel)
const int INITIAL_TRAFFIC_GRAPH_MINS
const char fontSizeSettingsKey[]
void peerSelected(const QItemSelection &selected, const QItemSelection &deselected)
Handle selection of peer in peers list.
RPCTimerBase * NewTimer(std::function< void()> &func, int64_t millis) override
Factory function for timers.
QString getDisplayName() const
void request(const QString &command, const WalletModel *wallet_model)
void mempoolSizeChanged(long count, size_t mempoolSizeInBytes)
const QSize FONT_RANGE(4, 40)
static bool RPCExecuteCommandLine(interfaces::Node &node, std::string &strResult, const std::string &strCommand, std::string *const pstrFilteredOut=nullptr, const WalletModel *wallet_model=nullptr)
virtual int getNumBlocks()=0
Get num blocks.
virtual bool disconnectById(NodeId id)=0
Disconnect node by id.
void showEvent(QShowEvent *event) override
void cmdRequest(const QString &command, const WalletModel *wallet_model)
QCompleter * autoCompleter
virtual int64_t getTotalBytesSent()=0
Get total bytes sent.
Top-level interface for a bitcoin node (bitcoind process).
void setNumBlocks(int count, const QDateTime &blockDate, double nVerificationProgress, bool headers)
Set number of blocks and last block date shown in the UI.
void showBanTableContextMenu(const QPoint &point)
Show custom context menu on Bans tab.
void keyPressEvent(QKeyEvent *) override
void hideEvent(QHideEvent *event) override
virtual bool eventFilter(QObject *obj, QEvent *event) override
QString formatFullVersion() const