-
Notifications
You must be signed in to change notification settings - Fork 37.7k
qt: Add privacy to the Overview page #16432
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
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
@hebasto Would you mind posting before/after screenshots? |
Done. |
src/qt/bitcoinamountlabel.cpp
Outdated
{ | ||
if (privacy && cache.isEmpty()) { | ||
cache = text(); | ||
QLabel::setText("h-i-d-d-e-n"); |
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 a fence of #
translates better.
Couldn't this use BitcoinUnits::format(unit, 0).replace("0", "#") + unit.shortName()
(or whatever is used right now), so that the UI doesn't reflow the columns on every toggle?
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.
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 a fence of # translates better.
Done.
... so that the UI doesn't reflow the columns on every toggle?
This requires a monospaced font.
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.
This requires a monospaced font.
Done.
25bd216
to
ea89169
Compare
Concept ACK, definitely prefer the |
The screenshot on OP has been updated. |
Can it use a fixed number/string of |
Thanks for working on this! Not sure if clicking on the actual amount label is the right way to activate this (may confuse user who lacks understanding the "hidden"-concept). Plus, should it not also cover the "Recent transactions"-list amounts? I would say ideally, once enabled, the values in the transaction list should also be "hidden". |
Concept ACK. Not so sure about the approach as it requires too much wiring. I'm testing a different approach and I'll give feedback if it's worth it. |
Agree with @jonasschnelli, I initially thought of having a toggle somewhere (in the status bar for instance) as well a menu option. Something for a follow up. |
bc75b05
to
a65a2be
Compare
Done. The screenshot on OP has been updated. |
@jonasschnelli Thank you for your review.
It seems very intuitive ;) (also there is an example of usage in Wasabi)
Agree. I'd leave this improvement for the following PRs. |
That's the way "lurking wife mode" of Wasabi Wallet, which is basically the same, is activated. I think Bitcoin is already hard enough for newcomers, so unnecessary reinventing the wheel should be avoided, if possible, so that users get similar experience using different wallets. Unless there are clear benefits in doing so, of course. But probably some message about privacy / stealth mode being activated and how to turn it back off would not hurt. |
src/qt/bitcoinamountlabel.cpp
Outdated
integer_part = QString(integer_part.size() - 1, ' ') + mask; | ||
QString fractional_part = parts.last(); | ||
fractional_part = fractional_part.replace(QRegularExpression("\\d"), mask); | ||
QLabel::setText(integer_part + '.' + fractional_part); |
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.
Just looked at how Wasabi did this and they just replace any amounts, addresses, labels everywhere with a fixed number of #'s. IMO "#########" even looks better than "#.########" and it's less lines of code, all this block could be just replaced with
cache = text();
QLabel::setText("#########");`
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.
Unfortunately, this will cause the UI to reflow the columns on every toggle (see @MarcoFalke's comment).
Concept ACK |
a65a2be
to
0241a18
Compare
Fixed two bugs:
|
Had a quick test. Functionality works as described. I might just be seeing things, but the monospace font looks a bit weird no macOS, don't think that has to be any sort of blocker though. @promag Are you still working on a different approach, or happy with this PR now? |
ACK 22c16fd |
I've tried alternatives - basically tried filtering paint events if the widget had amounts or even extend QStyle - but didn't like at the end. Currently I think this PR can be improved, I'll review shortly. |
Looks like the build is failing:
|
0241a18
to
90c7f4f
Compare
Works as intended. I like the concept but think it should be implemented more radical (maybe in follow up PRs?).
|
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.
Rather than cloaking the text we want to hide (which seems problematic so long as we base it on the real hidden value), how about simply setting the background colour to the text colour?
This should work without regexp
|
Updated 908b014 -> 8d75115 (pr16432.21 -> pr16432.22, diff):
|
Tested ACK 8d75115 Changes since last review:
|
We shouldn't be assuming or breaking with any window or font size... Is this a bug? |
@luke-jr Good question. My description was imprecise. When the GUI window was at its smallest size, the message wasn't truncated per se but required navigating horizontally using the window scroll bar to see the last word. |
Tested ACK 8d75115 |
8d75115 qt: Add privacy feature to Overview page (Hennadii Stepanov) 73d8ef7 qt: Add BitcoinUnits::formatWithPrivacy() function (Hennadii Stepanov) Pull request description: This PR allows to hide/reveal values on the Overviewpage by checking/unchecking Menu->Settings-> Mask Values Closes bitcoin#16407 Privacy mode is OFF (the default behavior):  Privacy mode is ON:  ACKs for top commit: jonatack: Tested ACK 8d75115 jonasschnelli: Tested ACK 8d75115 Tree-SHA512: 42f396d5bf0d343b306fb7e925f86f66b3fc3a257af370a812f4be181b5269298f9b23bd8a3ce25ab61de92908c4018d8c2dc8591d11bc58d79c4eb7206fc6ec
Github-Pull: bitcoin#16432 Rebased-From: 3ea6baa
Github-Pull: bitcoin#16432 Rebased-From: ea1fb69
…ormat 198fff8 GUI: Define MAX_DIGITS_BTC for magic number in BitcoinUnits::format (Luke Dashjr) Pull request description: A magic number snuck in with bitcoin/bitcoin#16432 ACKs for top commit: hebasto: ACK 198fff8, I have reviewed the code and it looks OK, I agree it can be merged. kristapsk: utACK 198fff8 Tree-SHA512: 78dc23c2ae61bac41e5e34eebf57274599cb2ebb0b18d46e8a3228d42b256a1bc9bb17091c748f0f692ef1c4c241cfbd3e30a12bcd12222a234c1a9547ebe786
67f2631 gui: Add monospaced font settings (Hennadii Stepanov) 22e0114 qt: Choose monospaced font in C++ code rather in `*.ui` file (Hennadii Stepanov) 623de12 qt: Make GUIUtil::fixedPitchFont aware of embedded font (Hennadii Stepanov) 89e4219 gui: Add Roboto Mono font (Hennadii Stepanov) Pull request description: Qt does not guarantee that the actual applied font matches to the requested one. It was noted (bitcoin/bitcoin#16432 (comment)): > the monospace font looks a bit weird no macOS ... because it is _not_ monospaced. Also some discrepancies I've noted on Windows while testing Qt 5.15 ([#19716](bitcoin/bitcoin#19716)). Of course, we could check the actual font with `QFontInfo`, and try to choose another font. But this PR suggests to just embed a monospaced font, and get the GUI look (partially) independent from a platform. [Roboto Mono](https://fonts.google.com/specimen/Roboto+Mono) was chosen after discussion with Bitcoin Design community, and due to its [Apache License, Version 2.0](https://fonts.google.com/specimen/Roboto+Mono#license). Changes are scoped to the Overview page only. --- Screenshots on macOS 10.15.6 (images are simulated by code patching): - master (ca30d34)  - this PR (3fdd5b6)  --- More screenshots added after #79 (comment): - Linux Mint 20.1 + Cinnamon DE  - Windows 10 (with depends)  - macOS Big Sur (with depends)  ACKs for top commit: laanwj: Tested ACK 67f2631 Tree-SHA512: a59775570b8ce314669ede50a0b69f53e8a47a41e7eea428835013240f0ce9afcff6e4c258895455b56806417ed877e5b7a9522f1904e95a5f435db8ccf6078c
Summary: > This PR allows to hide/reveal values on the Overviewpage by checking/unchecking Menu->Settings-> Mask Values This is a backport of [[bitcoin/bitcoin#16432 | core#16432]] [1/2] bitcoin/bitcoin@73d8ef7 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D9919
Summary: This is a backport of [[bitcoin/bitcoin#16432 | core#16432]] [2/2] bitcoin/bitcoin@8d75115 Depends on D9919 Test Plan: `ninja && src/qt/bitcoin-qt` Toggle the privacy option with Shift + Ctrl + M or through the menu. Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Subscribers: majcosta Differential Revision: https://reviews.bitcoinabc.org/D9920
Summary: I noticed while backporting [[bitcoin/bitcoin#16432 | core#16432]] that there are some leftover instances of BCH in default values for widgets. Test Plan: I don't know how to test this, those values are probably reinitialized in the code before the widgets are even visible, else we would have noticed the wrong "BCH" unit in the past. I just compiled and ran `bitcoin-qt` to make sure everything works and looks normal. Check that there aren't any occurences of BCH left: ` grep BCH src/qt/forms/*.ui` Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Subscribers: majcosta Differential Revision: https://reviews.bitcoinabc.org/D9921
Current Behavior: "Mask values" mode is off each launch and must be manually re-enabled. Solution: This mode should persist across restarts of bitcoin-qt by being saved in Expected Behavior: If I shutdown Bitcoin core with it on, I'd expect it to be on when I restart and vice versa. |
This PR allows to hide/reveal values on the Overviewpage by checking/unchecking Menu->Settings-> Mask Values
Closes #16407
Privacy mode is OFF (the default behavior):

Privacy mode is ON:
