@@ -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);
@@ -898,7 +903,8 @@ void BitcoinGUI::gotoLoadPSBT(bool from_clipboard)
898903
899904void BitcoinGUI::updateNetworkState ()
900905{
901- int count = m_node.peerCount ();
906+ const ConnCounts conn_counts = m_node.connectionCounts ();
907+ const int count = conn_counts.all ;
902908 QString icon;
903909 switch (count)
904910 {
@@ -921,8 +927,15 @@ void BitcoinGUI::updateNetworkState()
921927 // Don't word-wrap this (fixed-width) tooltip
922928 tooltip = QString (" <nobr>" ) + tooltip + QString (" </nobr>" );
923929 connectionsControl->setToolTip (tooltip);
924-
925930 connectionsControl->setPixmap (platformStyle->SingleColorIcon (icon).pixmap (STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
931+
932+ if (conn_counts.onion_only ) {
933+ m_tor_icon->setPixmap (platformStyle->SingleColorIcon (" :/icons/tor_connected" ).pixmap (STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
934+ m_tor_icon->setToolTip (tr (" All connections are <b>via Tor</b> only" ));
935+ m_tor_icon->show ();
936+ } else {
937+ m_tor_icon->hide ();
938+ }
926939}
927940
928941void BitcoinGUI::updateHeadersSyncProgressLabel ()
0 commit comments