Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ QT_MOC_CPP = \
qt/moc_macdockiconhandler.cpp \
qt/moc_macnotificationhandler.cpp \
qt/moc_modaloverlay.cpp \
qt/moc_netwatch.cpp \
qt/moc_notificator.cpp \
qt/moc_openuridialog.cpp \
qt/moc_optionsdialog.cpp \
Expand Down Expand Up @@ -129,6 +130,7 @@ BITCOIN_QT_H = \
qt/macnotificationhandler.h \
qt/macos_appnap.h \
qt/modaloverlay.h \
qt/netwatch.h \
qt/networkstyle.h \
qt/notificator.h \
qt/openuridialog.h \
Expand Down Expand Up @@ -232,6 +234,7 @@ BITCOIN_QT_BASE_CPP = \
qt/initexecutor.cpp \
qt/intro.cpp \
qt/modaloverlay.cpp \
qt/netwatch.cpp \
qt/networkstyle.cpp \
qt/notificator.cpp \
qt/optionsdialog.cpp \
Expand Down
30 changes: 30 additions & 0 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <qt/guiconstants.h>
#include <qt/guiutil.h>
#include <qt/modaloverlay.h>
#include <qt/netwatch.h>
#include <qt/networkstyle.h>
#include <qt/notificator.h>
#include <qt/openuridialog.h>
Expand Down Expand Up @@ -239,6 +240,7 @@ BitcoinGUI::~BitcoinGUI()
MacDockIconHandler::cleanup();
#endif

delete NetWatch;
delete rpcConsole;
}

Expand Down Expand Up @@ -320,6 +322,9 @@ void BitcoinGUI::createActions()
m_load_psbt_clipboard_action = new QAction(tr("Load PSBT from &clipboard…"), this);
m_load_psbt_clipboard_action->setStatusTip(tr("Load Partially Signed Bitcoin Transaction from clipboard"));

m_show_netwatch_action = new QAction(tr("&Watch network activity"), this);
m_show_netwatch_action->setStatusTip(tr("Open p2p network watching window"));

openRPCConsoleAction = new QAction(tr("Node window"), this);
openRPCConsoleAction->setStatusTip(tr("Open node debugging and diagnostic console"));
// initially disable the debug window menu item
Expand Down Expand Up @@ -363,6 +368,7 @@ void BitcoinGUI::createActions()
connect(aboutQtAction, &QAction::triggered, qApp, QApplication::aboutQt);
connect(optionsAction, &QAction::triggered, this, &BitcoinGUI::optionsClicked);
connect(showHelpMessageAction, &QAction::triggered, this, &BitcoinGUI::showHelpMessageClicked);
connect(m_show_netwatch_action, &QAction::triggered, this, &BitcoinGUI::showNetWatch);
connect(openRPCConsoleAction, &QAction::triggered, this, &BitcoinGUI::showDebugWindow);
// prevents an open debug window from becoming stuck/unusable on client shutdown
connect(quitAction, &QAction::triggered, rpcConsole, &QWidget::hide);
Expand Down Expand Up @@ -509,6 +515,8 @@ void BitcoinGUI::createMenuBar()
window_menu->addAction(usedReceivingAddressesAction);
}

window_menu->addAction(m_show_netwatch_action);

window_menu->addSeparator();
for (RPCConsole::TabTypes tab_type : rpcConsole->tabs()) {
QAction* tab_action = window_menu->addAction(rpcConsole->tabTitle(tab_type));
Expand Down Expand Up @@ -591,6 +599,10 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
// Show progress dialog
connect(_clientModel, &ClientModel::showProgress, this, &BitcoinGUI::showProgress);

if (NetWatch) {
NetWatch->setClientModel(_clientModel);
}

rpcConsole->setClientModel(_clientModel, tip_info->block_height, tip_info->block_time, tip_info->verification_progress);

updateProxyIcon();
Expand Down Expand Up @@ -618,6 +630,9 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
trayIconMenu->clear();
}
// Propagate cleared model to child objects
if (NetWatch) {
NetWatch->setClientModel(nullptr);
}
rpcConsole->setClientModel(nullptr);
#ifdef ENABLE_WALLET
if (walletFrame)
Expand Down Expand Up @@ -856,6 +871,15 @@ void BitcoinGUI::aboutClicked()
GUIUtil::ShowModalDialogAsynchronously(dlg);
}

void BitcoinGUI::showNetWatch()
{
if (!NetWatch) {
NetWatch = new GuiNetWatch(platformStyle, m_network_style);
NetWatch->setClientModel(clientModel);
}
GUIUtil::bringToFront(NetWatch);
}

void BitcoinGUI::showDebugWindow()
{
GUIUtil::bringToFront(rpcConsole);
Expand Down Expand Up @@ -1218,6 +1242,9 @@ void BitcoinGUI::closeEvent(QCloseEvent *event)
{
if(!clientModel->getOptionsModel()->getMinimizeOnClose())
{
if (NetWatch) {
NetWatch->close();
}
// close rpcConsole in case it was open to make some space for the shutdown window
rpcConsole->close();

Expand Down Expand Up @@ -1411,6 +1438,9 @@ void BitcoinGUI::detectShutdown()
{
if (m_node.shutdownRequested())
{
if (NetWatch) {
NetWatch->hide();
}
if(rpcConsole)
rpcConsole->hide();
Q_EMIT quitRequested();
Expand Down
4 changes: 4 additions & 0 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <memory>

class ClientModel;
class GuiNetWatch;
class NetworkStyle;
class Notificator;
class OptionsModel;
Expand Down Expand Up @@ -150,6 +151,7 @@ class BitcoinGUI : public QMainWindow
QAction* backupWalletAction = nullptr;
QAction* changePassphraseAction = nullptr;
QAction* aboutQtAction = nullptr;
QAction* m_show_netwatch_action = nullptr;
QAction* openRPCConsoleAction = nullptr;
QAction* openAction = nullptr;
QAction* showHelpMessageAction = nullptr;
Expand All @@ -168,6 +170,7 @@ class BitcoinGUI : public QMainWindow
QSystemTrayIcon* trayIcon = nullptr;
const std::unique_ptr<QMenu> trayIconMenu;
Notificator* notificator = nullptr;
GuiNetWatch* NetWatch = nullptr;
RPCConsole* rpcConsole = nullptr;
HelpMessageDialog* helpMessageDialog = nullptr;
ModalOverlay* modalOverlay = nullptr;
Expand Down Expand Up @@ -293,6 +296,7 @@ public Q_SLOTS:
void optionsClicked();
/** Show about dialog */
void aboutClicked();
void showNetWatch();
/** Show debug window */
void showDebugWindow();
/** Show debug window and set focus to the console */
Expand Down
2 changes: 2 additions & 0 deletions src/qt/guiconstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ static const bool DEFAULT_SPLASHSCREEN = true;

/* Invalid field background style */
#define STYLE_INVALID "background:#FF8080"
/* Background style for active search in NetWatch */
#define STYLE_ACTIVE "background:#80FF80"

/* Transaction list -- unconfirmed transaction */
#define COLOR_UNCONFIRMED QColor(128, 128, 128)
Expand Down
Loading