@@ -77,6 +77,7 @@ const std::string BitcoinGUI::DEFAULT_UIPLATFORM =
7777BitcoinGUI::BitcoinGUI (interfaces::Node& node, const PlatformStyle *_platformStyle, const NetworkStyle *networkStyle, QWidget *parent) :
7878 QMainWindow(parent),
7979 m_node(node),
80+ m_tor_icon{new GUIUtil::ClickableLabel ()},
8081 trayIconMenu{new QMenu ()},
8182 platformStyle (_platformStyle),
8283 m_network_style(networkStyle)
@@ -160,6 +161,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
160161 frameBlocksLayout->addWidget (labelWalletEncryptionIcon);
161162 frameBlocksLayout->addWidget (labelWalletHDStatusIcon);
162163 }
164+ frameBlocksLayout->addWidget (m_tor_icon);
163165 frameBlocksLayout->addWidget (labelProxyIcon);
164166 frameBlocksLayout->addStretch ();
165167 frameBlocksLayout->addWidget (connectionsControl);
@@ -202,6 +204,9 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
202204 connect (labelProxyIcon, &GUIUtil::ClickableLabel::clicked, [this ] {
203205 openOptionsDialogWithTab (OptionsDialog::TAB_NETWORK);
204206 });
207+ connect (m_tor_icon, &GUIUtil::ClickableLabel::clicked, [this ] {
208+ openOptionsDialogWithTab (OptionsDialog::TAB_NETWORK);
209+ });
205210
206211 connect (labelBlocksIcon, &GUIUtil::ClickableLabel::clicked, this , &BitcoinGUI::showModalOverlay);
207212 connect (progressBar, &GUIUtil::ClickableProgressBar::clicked, this , &BitcoinGUI::showModalOverlay);
@@ -893,7 +898,8 @@ void BitcoinGUI::gotoLoadPSBT(bool from_clipboard)
893898
894899void BitcoinGUI::updateNetworkState ()
895900{
896- int count = m_node.peerCount ();
901+ const ConnectionCounts conn_counts = m_node.connectionCounts ();
902+ const int count = conn_counts.all ;
897903 QString icon;
898904 switch (count)
899905 {
@@ -916,8 +922,15 @@ void BitcoinGUI::updateNetworkState()
916922 // Don't word-wrap this (fixed-width) tooltip
917923 tooltip = QString (" <nobr>" ) + tooltip + QString (" </nobr>" );
918924 connectionsControl->setToolTip (tooltip);
919-
920925 connectionsControl->setPixmap (platformStyle->SingleColorIcon (icon).pixmap (STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
926+
927+ if (conn_counts.tor_only ) {
928+ m_tor_icon->setPixmap (platformStyle->SingleColorIcon (" :/icons/tor_connected" ).pixmap (STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
929+ m_tor_icon->setToolTip (tr (" All connections are <b>via Tor</b> only" ));
930+ m_tor_icon->show ();
931+ } else {
932+ m_tor_icon->hide ();
933+ }
921934}
922935
923936void BitcoinGUI::updateHeadersSyncProgressLabel ()
0 commit comments