-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add access to the Peers tab from the network icon #309
Conversation
418dd58
to
1f208f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK a7f5ea5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK a7f5ea5
Tested on macOS 11.3 Qt 5.15.2, Also tested with -disablewallet=1
.
This is ok to merge as-is. But, wanted to document how I think this should be changed around as part of a follow-up.
The 'Peers Tab' is for seeing your connected Peers and interacting with them, such as banning or disconnecting a peer.
The idea of "Disabling Network Activity" should be tied to the 'Network Traffic Tab' not the 'Peers Tab'. This means we could add a "Disable Network Activity" button to the Network Traffic tab and a 'Network Traffic' widget next to the 'Connection Count' widget. Pressing this 'Network Traffic' widget would open the 'Network Traffic' tab where the user has the option of disabling network activity.
@Sjors Do you mind looking into this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK a7f5ea5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested ACK a7f5ea5.
src/qt/bitcoingui.cpp
Outdated
updateNetworkState(); | ||
setNetworkActive(m_node.getNetworkActive()); | ||
connect(connectionsControl, &GUIUtil::ClickableLabel::clicked, [this] { | ||
m_network_context_menu->exec(QCursor::pos()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QMenu::exec
is blocking. If you want to keep this approach then you could declare a local QMenu
instance instead - this way you can ditch the class member and the call to .clear()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if a key combo was added to this functionality... COMMAND + OPTION |
For switching to the Peers tab we already have the Ctrl+P shortcut. |
I'm not even sure such shortcut is a good idea at all. Could accidentally hit that, the same that has happened to more with that icon without this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-ACK d29ea72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK d29ea72.
Not fond of the approach though. It seems it would be enough to update the menu item text on BitcoinGUI::updateNetworkState()
instead of QMenu::clear()
+ QMenu::addAction()
and the slot would just query the current network state.
It also seems more elegant to just call BitcoinGUI::updateNetworkState()
in BitcoinGUI::setClientModel
which already calls m_node.getNetworkActive()
.
Worth noting that when the toggle action is triggered it calls m_node.setNetworkActive()
which results in destroying that same action due to QMenu::clear()
.
Don't mind my feedback, it's just another way of implementing the feature, thanks for adding the feature and addressing my previous comment.
re-ACK d29ea72 |
Many thanks for your valuable review and feedback!
Do you mind having a look at https://github.com/hebasto/gui/commits/210511-pr309-alt? |
This PR add a small context menu to the network activity icon that provides an access to the Peers tab:
Closes #93.