4343#include < QAction>
4444#include < QApplication>
4545#include < QComboBox>
46+ #include < QCursor>
4647#include < QDateTime>
4748#include < QDragEnterEvent>
4849#include < QListWidget>
@@ -199,9 +200,6 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
199200 // Subscribe to notifications from core
200201 subscribeToCoreSignals ();
201202
202- connect (connectionsControl, &GUIUtil::ClickableLabel::clicked, [this ] {
203- m_node.setNetworkActive (!m_node.getNetworkActive ());
204- });
205203 connect (labelProxyIcon, &GUIUtil::ClickableLabel::clicked, [this ] {
206204 openOptionsDialogWithTab (OptionsDialog::TAB_NETWORK );
207205 });
@@ -581,7 +579,10 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
581579 createTrayIconMenu ();
582580
583581 // Keep up to date with client
584- updateNetworkState ();
582+ setNetworkActive (m_node.getNetworkActive ());
583+ connect (connectionsControl, &GUIUtil::ClickableLabel::clicked, [this ] {
584+ GUIUtil::PopupMenu (m_network_context_menu, QCursor::pos ());
585+ });
585586 connect (_clientModel, &ClientModel::numConnectionsChanged, this , &BitcoinGUI::setNumConnections);
586587 connect (_clientModel, &ClientModel::networkActiveChanged, this , &BitcoinGUI::setNetworkActive);
587588
@@ -900,14 +901,18 @@ void BitcoinGUI::updateNetworkState()
900901 QString tooltip;
901902
902903 if (m_node.getNetworkActive ()) {
903- tooltip = tr (" %n active connection(s) to %1 network" , " " , count).arg (" Liquid" ) + QString (" .<br>" ) + tr (" Click to disable network activity." );
904+ // : A substring of the tooltip.
905+ tooltip = tr (" %n active connection(s) to %1 network" , " " , count).arg (" Liquid" );
904906 } else {
905- tooltip = tr (" Network activity disabled." ) + QString (" <br>" ) + tr (" Click to enable network activity again." );
907+ // : A substring of the tooltip.
908+ tooltip = tr (" Network activity disabled." );
906909 icon = " :/icons/network_disabled" ;
907910 }
908911
909912 // Don't word-wrap this (fixed-width) tooltip
910- tooltip = QString (" <nobr>" ) + tooltip + QString (" </nobr>" );
913+ tooltip = QLatin1String (" <nobr>" ) + tooltip + QLatin1String (" <br>" ) +
914+ // : A substring of the tooltip. "More actions" are available via the context menu.
915+ tr (" Click for more actions." ) + QLatin1String (" </nobr>" );
911916 connectionsControl->setToolTip (tooltip);
912917
913918 connectionsControl->setThemedPixmap (icon, STATUSBAR_ICONSIZE , STATUSBAR_ICONSIZE );
@@ -918,9 +923,24 @@ void BitcoinGUI::setNumConnections(int count)
918923 updateNetworkState ();
919924}
920925
921- void BitcoinGUI::setNetworkActive (bool networkActive )
926+ void BitcoinGUI::setNetworkActive (bool network_active )
922927{
923928 updateNetworkState ();
929+ m_network_context_menu->clear ();
930+ m_network_context_menu->addAction (
931+ // : A context menu item. The "Peers tab" is an element of the "Node window".
932+ tr (" Show Peers tab" ),
933+ [this ] {
934+ rpcConsole->setTabFocus (RPCConsole::TabTypes::PEERS );
935+ showDebugWindow ();
936+ });
937+ m_network_context_menu->addAction (
938+ network_active ?
939+ // : A context menu item.
940+ tr (" Disable network activity" ) :
941+ // : A context menu item. The network activity was disabled previously.
942+ tr (" Enable network activity" ),
943+ [this , new_state = !network_active] { m_node.setNetworkActive (new_state); });
924944}
925945
926946void BitcoinGUI::updateHeadersSyncProgressLabel ()
0 commit comments