-
Notifications
You must be signed in to change notification settings - Fork 41
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
Introducing an improved IP Address and Port input control in ProxySettings component #391
Introducing an improved IP Address and Port input control in ProxySettings component #391
Conversation
a4f4263
to
fe547af
Compare
src/qml/components/ProxySettings.qml
Outdated
onEditingFinished: { | ||
defaultProxy.forceActiveFocus() | ||
if (isValidIPPort(text)) { |
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.
I think it might be a good idea to encapsulate the validation logic in the IPAddressValueInput component itself. I think one possible way to do that is to add a Connections element to onEditingFinished signal in the IPAddressValueInput definition so the validation can't be overridden. Then just expose a bool for if the input is valid or not.
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.
Ok, it makes sense, I'll try to do that. Thanks!
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.
Updated it with the Connection
element and removed the onEditingFinished
from IPAddressValueInput
, please let me know what you think.
Just tested on Android mobile. This is a nice update. I don't think the input field needs to turn orange when it goes from disabled to enabled state (by toggling the line above). Also interesting how the "Enable" title briefly turns orange when tapping. Feels a bit surprising and unnecessary. I think the title could just remain white. The copy for the Tor proxy is too confusing still.
Can we remove that second line? |
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.
aefd53b
to
7994009
Compare
Making the option switches work to enable and disable the IP Address and Port fields (Proxy and Tor - ValueInput) accordingly to the user's intentions.
7994009
to
7893dfb
Compare
I've incorrectly used a different The new
|
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.
Noticed some missing pieces and a bug in initial state. I left comments and suggested changes. Wrong actionItem type was used and showErrorText needed to be connected to the loadedItem.validInput property that you added.
It seems I did something wrong when I updated the 1st commit. I'll correct it in a bit with your |
7893dfb
to
c294e59
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.
Sorry, you've found another bug in the code, the Tor IP input points to the Default Proxy one. I'll fix it immediately.
The |
c294e59
to
6b2621e
Compare
|
I understand your point, but for me I'd prefer that behavior. The few users who use this and enter it will only enter it rarely. (in contrast to maybe regularly manually typing in a BTC address, then yes such behavior might be annoying.)
no, the above was.
yes I'd say to leave it, as user intent was to enter something else |
6b2621e is a bit glitchy when hovering proxysettings.webm |
Ok, let me update that. It would be also good to see others reviewers takes on this. |
Thanks, I'll investigate what's going on. |
Adding a new improved ValueInput control to handle both IP address and port values combined in the same field with the correct visual formatting (255.255.255.255:65535). In this iteration, validation for this control is implemented using both a function within the control itself focused solely on ensuring correct formatting and a simple regex validator for the valid input characters. Future versions will see integration with network model classes, enabling parsing of IP addresses and ports and additional checks, such as those outlined in doc/p2p-bad-ports.md.
6b2621e
to
d47bc1a
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 d47bc1a
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 d47bc1a
Tested on macOS M1, very nice! One thing I would change:
I feel like this is redundant here a bit, and Tor proxy description says it all |
Follow-up from bitcoin-core#391 (comment). Removing redundant Tor Proxy description from the top Default Proxy label.
Follow-up from bitcoin-core#391 (comment). Removing redundant Tor Proxy description from the top Default Proxy header label. Rewording Tor Proxy description to be consistent with the top header label.
… - Follow-up #391 d558b05 qml, component: Fix labelling on ProxySettings (pablomartin4btc) Pull request description: This is a follow-up from #391 (comment). <details> <summary>Currently/ <code>main</code> branch screenshot.</summary> ![Screenshot from 2024-04-07 23-00-31](https://github.com/bitcoin-core/gui-qml/assets/110166421/ffb86641-9f98-46d0-98d4-3c7ffd826d4e) </details> <details> <summary> This PR branch screenshot.</summary> ![image](https://github.com/bitcoin-core/gui-qml/assets/110166421/279abc03-8417-4345-bb21-06a7ff53eae6) </details> ACKs for top commit: GBKS: tACK d558b05 D33r-Gee: tACK d558b05 Tree-SHA512: b849bf2addafeac85e645281be162cf22d2f34da613f3da3fcef42377546a33e1b19beacb66660e06bc2e55b6b3c10bae08cf0ecdafb1e470fb8d44b040b6ff0
This was overlooked in bitcoin-core#391.
@GBKS could you please comment on this? If you agree on where the validation takes place at the moment? Otherwise we might have to update it in #430. Many thanks! |
Adding a new improved
ValueInput
control to handle bothIP
address and port values combined in the same field (as it was designed forQML
, currentQT
project have them separately) with the correct visual formatting (255.255.255.255:65535
).In order to add/ change the
IP
address and port value, user needs to enable the fields (currently inmain
branch this doesn't work and this PR fixes it). Currently theIP
address and port input fields don't allow more than 5 digits and this PR also correct it so the user can enter a completeIP
address and port value.If an invalid
IP
address (e.g.127.0.:9050
) and/ or port (e.g.127.0.0.1:
) are entered an error message will be shown as we do in other fields.Current
master
/main
branch screenshot.Current master branch in
QT
repo (just for reference).This PRs branch screenshot.
Design in Figma.
Implementation details:
In this iteration, validation for this control is implemented using both a function within the control itself focused solely on ensuring correct formatting and a simple regex validator for the valid input characters.
Future versions will see integration with network model classes, enabling parsing of IP addresses and ports
and additional checks, such as those outlined in
doc/p2p-bad-ports.md
.Note:
Persistence/ wiring of the settings and creating the proper network connection thru the Proxy will be performed in a different PR, the idea is to isolate UI experience/ testing in case we need to make changes on that aspect separately and we concentrate on the functionality behind later.