Skip to content

Commit 4cda966

Browse files
hebastojagdeep sidhu
authored andcommitted
Merge bitcoin-core/gui#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 bitcoin-core/gui@4de02de jarolrod: tACK 4de02de pablomartin4btc: > tACK [4de02de](bitcoin-core/gui@4de02de) john-moffett: tACK 4de02de Tree-SHA512: 247deb78df4911516625bf8b25d752feb480ce30eb31335cf9baeb07b7c6c225fcc37d5c45de62d6e6895ec10c7eefabb15527e3c9723a3b8ddda1e12ebbf46b
1 parent aa8cb5e commit 4cda966

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

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

@@ -438,6 +440,8 @@ QVariant OptionsModel::getOption(OptionID option) const
438440
return SettingToBool(setting(), DEFAULT_LISTEN);
439441
case Server:
440442
return SettingToBool(setting(), false);
443+
case MaskValues:
444+
return m_mask_values;
441445
default:
442446
return QVariant();
443447
}
@@ -621,6 +625,10 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value)
621625
setRestartRequired(true);
622626
}
623627
break;
628+
case MaskValues:
629+
m_mask_values = value.toBool();
630+
settings.setValue("mask_values", m_mask_values);
631+
break;
624632
default:
625633
break;
626634
}

src/qt/optionsmodel.h

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

@@ -121,6 +122,7 @@ class OptionsModel : public QAbstractListModel
121122
bool fCoinControlFeatures;
122123
bool m_sub_fee_from_amount;
123124
bool m_enable_psbt_controls;
125+
bool m_mask_values;
124126

125127
//! In-memory settings for display. These are stored persistently by the
126128
//! 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);

src/qt/syscoingui.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,8 @@ void SyscoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
673673
// initialize the disable state of the tray icon with the current value in the model.
674674
trayIcon->setVisible(optionsModel->getShowTrayIcon());
675675
}
676+
677+
m_mask_values_action->setChecked(_clientModel->getOptionsModel()->getOption(OptionsModel::OptionID::MaskValues).toBool());
676678
} else {
677679
if(trayIconMenu)
678680
{

0 commit comments

Comments
 (0)