43
43
#include < QAction>
44
44
#include < QApplication>
45
45
#include < QComboBox>
46
+ #include < QCursor>
46
47
#include < QDateTime>
47
48
#include < QDragEnterEvent>
48
49
#include < QListWidget>
@@ -199,9 +200,6 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
199
200
// Subscribe to notifications from core
200
201
subscribeToCoreSignals ();
201
202
202
- connect (connectionsControl, &GUIUtil::ClickableLabel::clicked, [this ] {
203
- m_node.setNetworkActive (!m_node.getNetworkActive ());
204
- });
205
203
connect (labelProxyIcon, &GUIUtil::ClickableLabel::clicked, [this ] {
206
204
openOptionsDialogWithTab (OptionsDialog::TAB_NETWORK);
207
205
});
@@ -586,7 +584,10 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
586
584
createTrayIconMenu ();
587
585
588
586
// Keep up to date with client
589
- updateNetworkState ();
587
+ setNetworkActive (m_node.getNetworkActive ());
588
+ connect (connectionsControl, &GUIUtil::ClickableLabel::clicked, [this ] {
589
+ GUIUtil::PopupMenu (m_network_context_menu, QCursor::pos ());
590
+ });
590
591
connect (_clientModel, &ClientModel::numConnectionsChanged, this , &BitcoinGUI::setNumConnections);
591
592
connect (_clientModel, &ClientModel::networkActiveChanged, this , &BitcoinGUI::setNetworkActive);
592
593
@@ -915,14 +916,18 @@ void BitcoinGUI::updateNetworkState()
915
916
QString tooltip;
916
917
917
918
if (m_node.getNetworkActive ()) {
918
- tooltip = tr (" %n active connection(s) to Bitcoin network" , " " , count) + QString (" .<br>" ) + tr (" Click to disable network activity." );
919
+ // : A substring of the tooltip.
920
+ tooltip = tr (" %n active connection(s) to Bitcoin network." , " " , count);
919
921
} else {
920
- tooltip = tr (" Network activity disabled." ) + QString (" <br>" ) + tr (" Click to enable network activity again." );
922
+ // : A substring of the tooltip.
923
+ tooltip = tr (" Network activity disabled." );
921
924
icon = " :/icons/network_disabled" ;
922
925
}
923
926
924
927
// Don't word-wrap this (fixed-width) tooltip
925
- tooltip = QString (" <nobr>" ) + tooltip + QString (" </nobr>" );
928
+ tooltip = QLatin1String (" <nobr>" ) + tooltip + QLatin1String (" <br>" ) +
929
+ // : A substring of the tooltip. "More actions" are available via the context menu.
930
+ tr (" Click for more actions." ) + QLatin1String (" </nobr>" );
926
931
connectionsControl->setToolTip (tooltip);
927
932
928
933
connectionsControl->setPixmap (platformStyle->SingleColorIcon (icon).pixmap (STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
@@ -933,9 +938,24 @@ void BitcoinGUI::setNumConnections(int count)
933
938
updateNetworkState ();
934
939
}
935
940
936
- void BitcoinGUI::setNetworkActive (bool networkActive )
941
+ void BitcoinGUI::setNetworkActive (bool network_active )
937
942
{
938
943
updateNetworkState ();
944
+ m_network_context_menu->clear ();
945
+ m_network_context_menu->addAction (
946
+ // : A context menu item. The "Peers tab" is an element of the "Node window".
947
+ tr (" Show Peers tab" ),
948
+ [this ] {
949
+ rpcConsole->setTabFocus (RPCConsole::TabTypes::PEERS);
950
+ showDebugWindow ();
951
+ });
952
+ m_network_context_menu->addAction (
953
+ network_active ?
954
+ // : A context menu item.
955
+ tr (" Disable network activity" ) :
956
+ // : A context menu item. The network activity was disabled previously.
957
+ tr (" Enable network activity" ),
958
+ [this , new_state = !network_active] { m_node.setNetworkActive (new_state); });
939
959
}
940
960
941
961
void BitcoinGUI::updateHeadersSyncProgressLabel ()
0 commit comments