|
10 | 10 | #include <qt/guiconstants.h> |
11 | 11 | #include <qt/guiutil.h> |
12 | 12 | #include <qt/modaloverlay.h> |
| 13 | +#include <qt/netwatch.h> |
13 | 14 | #include <qt/networkstyle.h> |
14 | 15 | #include <qt/notificator.h> |
15 | 16 | #include <qt/openuridialog.h> |
@@ -233,6 +234,7 @@ BitcoinGUI::~BitcoinGUI() |
233 | 234 | MacDockIconHandler::cleanup(); |
234 | 235 | #endif |
235 | 236 |
|
| 237 | + delete NetWatch; |
236 | 238 | delete rpcConsole; |
237 | 239 | } |
238 | 240 |
|
@@ -328,6 +330,9 @@ void BitcoinGUI::createActions() |
328 | 330 | m_load_psbt_clipboard_action = new QAction(tr("Load PSBT from clipboard..."), this); |
329 | 331 | m_load_psbt_clipboard_action->setStatusTip(tr("Load Partially Signed Bitcoin Transaction from clipboard")); |
330 | 332 |
|
| 333 | + m_show_netwatch_action = new QAction(tr("&Watch network activity"), this); |
| 334 | + m_show_netwatch_action->setStatusTip(tr("Open p2p network watching window")); |
| 335 | + |
331 | 336 | openRPCConsoleAction = new QAction(tr("Node window"), this); |
332 | 337 | openRPCConsoleAction->setStatusTip(tr("Open node debugging and diagnostic console")); |
333 | 338 | // initially disable the debug window menu item |
@@ -372,6 +377,7 @@ void BitcoinGUI::createActions() |
372 | 377 | connect(optionsAction, &QAction::triggered, this, &BitcoinGUI::optionsClicked); |
373 | 378 | connect(toggleHideAction, &QAction::triggered, this, &BitcoinGUI::toggleHidden); |
374 | 379 | connect(showHelpMessageAction, &QAction::triggered, this, &BitcoinGUI::showHelpMessageClicked); |
| 380 | + connect(m_show_netwatch_action, &QAction::triggered, this, &BitcoinGUI::showNetWatch); |
375 | 381 | connect(openRPCConsoleAction, &QAction::triggered, this, &BitcoinGUI::showDebugWindow); |
376 | 382 | // prevents an open debug window from becoming stuck/unusable on client shutdown |
377 | 383 | connect(quitAction, &QAction::triggered, rpcConsole, &QWidget::hide); |
@@ -520,6 +526,8 @@ void BitcoinGUI::createMenuBar() |
520 | 526 | window_menu->addAction(usedReceivingAddressesAction); |
521 | 527 | } |
522 | 528 |
|
| 529 | + window_menu->addAction(m_show_netwatch_action); |
| 530 | + |
523 | 531 | window_menu->addSeparator(); |
524 | 532 | for (RPCConsole::TabTypes tab_type : rpcConsole->tabs()) { |
525 | 533 | QAction* tab_action = window_menu->addAction(rpcConsole->tabTitle(tab_type)); |
@@ -600,6 +608,10 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH |
600 | 608 | // Show progress dialog |
601 | 609 | connect(_clientModel, &ClientModel::showProgress, this, &BitcoinGUI::showProgress); |
602 | 610 |
|
| 611 | + if (NetWatch) { |
| 612 | + NetWatch->setClientModel(_clientModel); |
| 613 | + } |
| 614 | + |
603 | 615 | rpcConsole->setClientModel(_clientModel, tip_info->block_height, tip_info->block_time, tip_info->verification_progress); |
604 | 616 |
|
605 | 617 | updateProxyIcon(); |
@@ -629,6 +641,9 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH |
629 | 641 | trayIconMenu->clear(); |
630 | 642 | } |
631 | 643 | // Propagate cleared model to child objects |
| 644 | + if (NetWatch) { |
| 645 | + NetWatch->setClientModel(nullptr); |
| 646 | + } |
632 | 647 | rpcConsole->setClientModel(nullptr); |
633 | 648 | #ifdef ENABLE_WALLET |
634 | 649 | if (walletFrame) |
@@ -831,6 +846,15 @@ void BitcoinGUI::aboutClicked() |
831 | 846 | dlg.exec(); |
832 | 847 | } |
833 | 848 |
|
| 849 | +void BitcoinGUI::showNetWatch() |
| 850 | +{ |
| 851 | + if (!NetWatch) { |
| 852 | + NetWatch = new GuiNetWatch(platformStyle, m_network_style); |
| 853 | + NetWatch->setClientModel(clientModel); |
| 854 | + } |
| 855 | + GUIUtil::bringToFront(NetWatch); |
| 856 | +} |
| 857 | + |
834 | 858 | void BitcoinGUI::showDebugWindow() |
835 | 859 | { |
836 | 860 | GUIUtil::bringToFront(rpcConsole); |
@@ -1165,6 +1189,9 @@ void BitcoinGUI::closeEvent(QCloseEvent *event) |
1165 | 1189 | { |
1166 | 1190 | if(!clientModel->getOptionsModel()->getMinimizeOnClose()) |
1167 | 1191 | { |
| 1192 | + if (NetWatch) { |
| 1193 | + NetWatch->close(); |
| 1194 | + } |
1168 | 1195 | // close rpcConsole in case it was open to make some space for the shutdown window |
1169 | 1196 | rpcConsole->close(); |
1170 | 1197 |
|
@@ -1361,6 +1388,9 @@ void BitcoinGUI::detectShutdown() |
1361 | 1388 | { |
1362 | 1389 | if (m_node.shutdownRequested()) |
1363 | 1390 | { |
| 1391 | + if (NetWatch) { |
| 1392 | + NetWatch->hide(); |
| 1393 | + } |
1364 | 1394 | if(rpcConsole) |
1365 | 1395 | rpcConsole->hide(); |
1366 | 1396 | qApp->quit(); |
|
0 commit comments