diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-07-29 14:36:35 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-07-29 14:36:35 +0200 |
commit | ee014e5b10f5f65820ff056311051ff49813b294 (patch) | |
tree | d9c0dd04b021c2c828bf55ba6ff33d93d07b5276 /src/qt/optionsmodel.cpp | |
parent | b5b1d1a66b9f418c9fb293cb1cc3eac09a711c4e (diff) |
Full support for other units, add configuration option for default unit (used when displaying amounts)
Diffstat (limited to 'src/qt/optionsmodel.cpp')
-rw-r--r-- | src/qt/optionsmodel.cpp | 20 |
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; +} |