aboutsummaryrefslogtreecommitdiff
path: root/src/qt/optionsmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/optionsmodel.cpp')
-rw-r--r--src/qt/optionsmodel.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp
index 896170975e..d72a0e9e91 100644
--- a/src/qt/optionsmodel.cpp
+++ b/src/qt/optionsmodel.cpp
@@ -1,4 +1,5 @@
#include "optionsmodel.h"
+#include "bitcoinunits.h"
#include "headers.h"
@@ -6,8 +7,12 @@
OptionsModel::OptionsModel(CWallet *wallet, QObject *parent) :
QAbstractListModel(parent),
- wallet(wallet)
+ wallet(wallet),
+ nDisplayUnit(BitcoinUnits::BTC)
{
+ // Read our specific settings from the wallet db
+ CWalletDB walletdb(wallet->strWalletFile);
+ walletdb.ReadSetting("nDisplayUnit", nDisplayUnit);
}
int OptionsModel::rowCount(const QModelIndex & parent) const
@@ -37,6 +42,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
return QVariant(QString::fromStdString(addrProxy.ToStringPort()));
case Fee:
return QVariant(nTransactionFee);
+ case DisplayUnit:
+ return QVariant(nDisplayUnit);
default:
return QVariant();
}
@@ -108,6 +115,12 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
walletdb.WriteSetting("nTransactionFee", nTransactionFee);
}
break;
+ case DisplayUnit: {
+ int unit = value.toInt();
+ nDisplayUnit = unit;
+ walletdb.WriteSetting("nDisplayUnit", nDisplayUnit);
+ emit displayUnitChanged(unit);
+ }
default:
break;
}
@@ -131,3 +144,8 @@ bool OptionsModel::getMinimizeOnClose()
{
return fMinimizeOnClose;
}
+
+int OptionsModel::getDisplayUnit()
+{
+ return nDisplayUnit;
+}