Skip to content

Commit 1313b90

Browse files
committed
Merge #701: Persist Mask Values option
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 4de02de jarolrod: tACK 4de02de pablomartin4btc: > tACK [4de02de](4de02de) john-moffett: tACK 4de02de Tree-SHA512: 247deb78df4911516625bf8b25d752feb480ce30eb31335cf9baeb07b7c6c225fcc37d5c45de62d6e6895ec10c7eefabb15527e3c9723a3b8ddda1e12ebbf46b
2 parents af2bd07 + 4de02de commit 1313b90

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

src/qt/bitcoingui.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,8 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
647647
// initialize the disable state of the tray icon with the current value in the model.
648648
trayIcon->setVisible(optionsModel->getShowTrayIcon());
649649
}
650+
651+
m_mask_values_action->setChecked(_clientModel->getOptionsModel()->getOption(OptionsModel::OptionID::MaskValues).toBool());
650652
} else {
651653
if(trayIconMenu)
652654
{

src/qt/optionsmodel.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ bool OptionsModel::Init(bilingual_str& error)
227227
m_use_embedded_monospaced_font = settings.value("UseEmbeddedMonospacedFont").toBool();
228228
Q_EMIT useEmbeddedMonospacedFontChanged(m_use_embedded_monospaced_font);
229229

230+
m_mask_values = settings.value("mask_values", false).toBool();
231+
230232
return true;
231233
}
232234

@@ -435,6 +437,8 @@ QVariant OptionsModel::getOption(OptionID option) const
435437
return SettingToBool(setting(), DEFAULT_LISTEN);
436438
case Server:
437439
return SettingToBool(setting(), false);
440+
case MaskValues:
441+
return m_mask_values;
438442
default:
439443
return QVariant();
440444
}
@@ -612,6 +616,10 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value)
612616
setRestartRequired(true);
613617
}
614618
break;
619+
case MaskValues:
620+
m_mask_values = value.toBool();
621+
settings.setValue("mask_values", m_mask_values);
622+
break;
615623
default:
616624
break;
617625
}

src/qt/optionsmodel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class OptionsModel : public QAbstractListModel
7272
Listen, // bool
7373
Server, // bool
7474
EnablePSBTControls, // bool
75+
MaskValues, // bool
7576
OptionIDRowCount,
7677
};
7778

@@ -120,6 +121,7 @@ class OptionsModel : public QAbstractListModel
120121
bool fCoinControlFeatures;
121122
bool m_sub_fee_from_amount;
122123
bool m_enable_psbt_controls;
124+
bool m_mask_values;
123125

124126
//! In-memory settings for display. These are stored persistently by the
125127
//! bitcoin node but it's also nice to store them in memory to prevent them

src/qt/overviewpage.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ void OverviewPage::handleTransactionClicked(const QModelIndex &index)
173173
void OverviewPage::setPrivacy(bool privacy)
174174
{
175175
m_privacy = privacy;
176+
clientModel->getOptionsModel()->setOption(OptionsModel::OptionID::MaskValues, privacy);
176177
const auto& balances = walletModel->getCachedBalance();
177178
if (balances.balance != -1) {
178179
setBalance(balances);

0 commit comments

Comments
 (0)