Skip to content

Conversation

achow101
Copy link
Member

The mask values option is memory only. If a user has enabled this option, it's reasonable to expect that they would want to have it enabled on the next start.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 24, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK jarolrod, RandyMcMillan, pablomartin4btc, john-moffett
Concept ACK instagibbs, hernanmarino, kristapsk

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@jarolrod jarolrod added Feature UX All about "how to get things done" labels Jan 24, 2023
@instagibbs
Copy link
Contributor

concept ACK, this is better for sure

The mask values option is memory only. If a user has enabled this
option, it's reasonable to expect that they would want to have it
enabled on the next start.
Copy link
Member

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 4de02de

Had been on my list to-do for a while. I agree with this, a follow-up could be to have a setting that would make it so that you'd have to unlock the wallet (if it's encrypted) in order to unmask values.

@RandyMcMillan
Copy link
Contributor

tACK 4de02de

Obfuscating the amounts in the Transactions panel based on this user preference may be a good follow up to this change.
Screen Shot 2023-01-23 at 10 24 26 PM

Copy link
Contributor

@hernanmarino hernanmarino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK , persisting this value seems like the natural option

@hebasto hebasto changed the title qt: Persist Mask Values option Persist Mask Values option Feb 2, 2023
@hebasto
Copy link
Member

hebasto commented Feb 2, 2023

The mask values option is memory only. If a user has enabled this option, it's reasonable to expect that they would want to have it enabled on the next start.

It would be nice to have some words about how this PR differs from #655.

@achow101
Copy link
Member Author

achow101 commented Feb 2, 2023

It would be nice to have some words about how this PR differs from #655.

Hmm, didn't realize that PR existed.

The difference is that this PR uses OptionsModel and follows the pattern used for all of our other settings rather than writing to QSettings directly.

@jarolrod
Copy link
Member

jarolrod commented Feb 3, 2023

I agree with the direction this takes over the other pr's approach

Copy link
Contributor

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested ACK 4de02de.

Verified that file Bitcoin-Qt.conf gets written with line mask_values=true.

This PR fixed issue #652.

Copy link
Contributor

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, it set's the value to false in the config file when the check is unticked.

I agree with the follow-ups (@jarolrod & @RandyMcMillan).

@kristapsk
Copy link
Contributor

Concept ACK

Copy link
Contributor

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 4de02de

Obfuscating the amounts in the Transactions panel based on this user preference may be a good follow up to this change.

I have done it on PR #708.

Copy link
Contributor

@john-moffett john-moffett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 4de02de

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of raw "mask_values" literals, suggesting to update the SettingName() function:

--- a/src/qt/optionsmodel.cpp
+++ b/src/qt/optionsmodel.cpp
@@ -54,6 +54,7 @@ static const char* SettingName(OptionsModel::OptionID option)
     case OptionsModel::ProxyPortTor: return "onion";
     case OptionsModel::ProxyUseTor: return "onion";
     case OptionsModel::Language: return "lang";
+    case OptionsModel::MaskValues: return "mask_values";
     default: throw std::logic_error(strprintf("GUI option %i has no corresponding node setting.", option));
     }
 }

and use its return value.

UPD. It seems @ryanofsky has a different opinion, so feel free to ignore this comment.

@@ -647,6 +647,8 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
// initialize the disable state of the tray icon with the current value in the model.
trayIcon->setVisible(optionsModel->getShowTrayIcon());
}

m_mask_values_action->setChecked(_clientModel->getOptionsModel()->getOption(OptionsModel::OptionID::MaskValues).toBool());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
m_mask_values_action->setChecked(_clientModel->getOptionsModel()->getOption(OptionsModel::OptionID::MaskValues).toBool());
m_mask_values_action->setChecked(optionsModel->getMaskValues());

accompanied with

--- a/src/qt/optionsmodel.h
+++ b/src/qt/optionsmodel.h
@@ -98,6 +98,7 @@ public:
     bool getSubFeeFromAmount() const { return m_sub_fee_from_amount; }
     bool getEnablePSBTControls() const { return m_enable_psbt_controls; }
     const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; }
+    bool getMaskValues() const { return m_mask_values; }
 
     /* Explicit setters */
     void SetPruneTargetGB(int prune_target_gb);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @ryanofsky was recommending to remove the case from the SettingsName due to its purpose of mapping OptionsModel to command line options but to add OptionsModel::MaksValues (or leave in this case as @achow101 already added them) to setOption and getOption.

The implementation of the getter looks simpler but then you would need to add the setter too to make it consistent and revert the above (remove the case from setOption and getOption).

Perhaps as a follow-up we could check the model consistent with either solution for the rest of settings (?).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'll leave this as is since it's consistent with most of the other settings which use the generic function with the enum.

@@ -647,6 +647,8 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
// initialize the disable state of the tray icon with the current value in the model.
trayIcon->setVisible(optionsModel->getShowTrayIcon());
}

m_mask_values_action->setChecked(_clientModel->getOptionsModel()->getOption(OptionsModel::OptionID::MaskValues).toBool());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, you could just use OptionsModel::MaskValues without the OptionID, is this an issue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an issue, will change if I need to retouch.

@achow101
Copy link
Member Author

achow101 commented Feb 9, 2023

Instead of raw "mask_values" literals, suggesting to update the SettingName() function:
...
UPD. It seems @ryanofsky has a different opinion, so feel free to ignore this comment.

Originally I had done that, but was looking into how that function is used and decided that adding the option there doesn't make sense. It looks like SettingName() is used to map settings that also appear on the command line or in the bitcoin.conf, and the mask_values does not.

@hebasto hebasto merged commit 1313b90 into bitcoin-core:master Feb 9, 2023
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Feb 10, 2023
4de02de qt: Persist Mask Values option (Andrew Chow)

Pull request description:

  The mask values option is memory only. If a user has enabled this option, it's reasonable to expect that they would want to have it enabled on the next start.

ACKs for top commit:
  RandyMcMillan:
    tACK bitcoin-core/gui@4de02de
  jarolrod:
    tACK 4de02de
  pablomartin4btc:
    > tACK [4de02de](bitcoin-core/gui@4de02de)
  john-moffett:
    tACK 4de02de

Tree-SHA512: 247deb78df4911516625bf8b25d752feb480ce30eb31335cf9baeb07b7c6c225fcc37d5c45de62d6e6895ec10c7eefabb15527e3c9723a3b8ddda1e12ebbf46b
hebasto added a commit that referenced this pull request Mar 14, 2023
4492de1 qt: mask values on transactions view (pablomartin4btc)

Pull request description:

  Currently the mask values option (Settings menu->Mask values) hides the wallet balances shown on the Overview page including the recent transactions list from the right panel but it doesn't hide the amounts from the transaction view.

  ![mask values - hiding wallet balances on overview tab but not on transactions tab](https://user-images.githubusercontent.com/110166421/216876325-56a68006-1be0-4b3f-b1e2-a0575c377cf5.gif)

  This enhancement has been mentioned on PR #701 as a [desirable follow-up](#701 (comment)).

  First approach was to hide the amounts on the  transactions view when mask values option is checked:

  ![mask values - hiding amounts on transactions tab](https://user-images.githubusercontent.com/110166421/216876440-0ff1a2ec-2ef2-405c-8b62-e4a94b9221cc.gif)

  But later on as reviewer **furszy** recommended, I've disabled the Transaction tab directly and switch to the Overview tab if the mask values option is set, check the new screenshots in the [comment below](#708 (comment)).

ACKs for top commit:
  achow101:
    ACK 4492de1
  furszy:
    ACK 4492de1
  hernanmarino:
    ACK 4492de1

Tree-SHA512: 94c04064cde456ab916cb91fc4619353cf4c8ef0e92aa1522a6b2c18a8d0fa641db9fddac04c2e1a290128879db598a9dfc4a0003dcf6e3413543908ada95afb
@bitcoin-core bitcoin-core locked and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Feature UX All about "how to get things done"
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants