Skip to content

Commit

Permalink
Implement MaskValues state support in optionsModel
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescowens committed Nov 29, 2021
1 parent b98dbaf commit fbcb66d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/qt/optionsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ void OptionsModel::Init()
fConfirmOnClose = settings.value("fConfirmOnClose", false).toBool();
fCoinControlFeatures = settings.value("fCoinControlFeatures", false).toBool();
fLimitTxnDisplay = settings.value("fLimitTxnDisplay", false).toBool();
fMaskValues = settings.value("fMaskValues", false).toBool();
limitTxnDate = settings.value("limitTxnDate", QDate()).toDate();
nReserveBalance = settings.value("nReserveBalance").toLongLong();
language = settings.value("language", "").toString();
Expand Down Expand Up @@ -133,6 +134,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
return QVariant(fCoinControlFeatures);
case LimitTxnDisplay:
return QVariant(fLimitTxnDisplay);
case MaskValues:
return QVariant(fMaskValues);
case LimitTxnDate:
return QVariant(limitTxnDate);
case DisableUpdateCheck:
Expand Down Expand Up @@ -268,6 +271,11 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
settings.setValue("fLimitTxnDisplay", fLimitTxnDisplay);
emit LimitTxnDisplayChanged(fLimitTxnDisplay);
break;
case MaskValues:
fMaskValues = value.toBool();
settings.setValue("fMaskValues", fMaskValues);
emit MaskValuesChanged(fMaskValues);
break;
case LimitTxnDate:
limitTxnDate = value.toDate();
settings.setValue("limitTxnDate", limitTxnDate);
Expand Down Expand Up @@ -347,6 +355,11 @@ bool OptionsModel::getLimitTxnDisplay()
return fLimitTxnDisplay;
}

bool OptionsModel::getMaskValues()
{
return fMaskValues;
}

QDate OptionsModel::getLimitTxnDate()
{
return limitTxnDate;
Expand Down Expand Up @@ -423,6 +436,11 @@ void OptionsModel::setCurrentStyle(QString theme)
setData(QAbstractItemModel::createIndex(WalletStylesheet, 0), theme, Qt::EditRole);
}

void OptionsModel::setMaskValues(bool privacy_mode)
{
setData(QAbstractItemModel::createIndex(MaskValues, 0), privacy_mode, Qt::EditRole);
}

QString OptionsModel::getDataDir()
{
return dataDir;
Expand Down
5 changes: 5 additions & 0 deletions src/qt/optionsmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class OptionsModel : public QAbstractListModel
StakingEfficiency, // double
MinStakeSplitValue, // int
ContractChangeToInput, // bool
MaskValues, // bool
OptionIDRowCount
};

Expand All @@ -67,6 +68,7 @@ class OptionsModel : public QAbstractListModel
bool getDisplayAddresses();
bool getCoinControlFeatures();
bool getLimitTxnDisplay();
bool getMaskValues();
QDate getLimitTxnDate();
int64_t getLimitTxnDateTime();
QString getLanguage() { return language; }
Expand All @@ -75,6 +77,7 @@ class OptionsModel : public QAbstractListModel

/* Explicit setters */
void setCurrentStyle(QString theme);
void setMaskValues(bool privacy_mode);
void toggleCoinControlFeatures();

private:
Expand All @@ -89,6 +92,7 @@ class OptionsModel : public QAbstractListModel
bool fConfirmOnClose;
bool fCoinControlFeatures;
bool fLimitTxnDisplay;
bool fMaskValues;
QDate limitTxnDate;
QString language;
QString walletStylesheet;
Expand All @@ -99,6 +103,7 @@ class OptionsModel : public QAbstractListModel
void reserveBalanceChanged(qint64);
void coinControlFeaturesChanged(bool);
void LimitTxnDisplayChanged(bool);
void MaskValuesChanged(bool);
void walletStylesheetChanged(QString);
};

Expand Down

0 comments on commit fbcb66d

Please sign in to comment.