diff options
author | Philip Kaufmann <phil.kaufmann@t-online.de> | 2013-08-24 15:07:17 +0200 |
---|---|---|
committer | Philip Kaufmann <phil.kaufmann@t-online.de> | 2013-08-29 10:38:51 +0200 |
commit | bdd0c59ab0b412b3e8595bd95f635f975e22bb85 (patch) | |
tree | 3c54fa2eedf564de1a90cbfb2158b9ecc5dcb9ff /src/qt/sendcoinsdialog.cpp | |
parent | ff33a3470dd1d1446549d02609c991c0490e0fdf (diff) |
Bitcoin-Qt: fixes for using display unit from options
- extend PaymentServer with setOptionsModel() and rework initNetManager()
to make use of that
- fix all other places in the code to use display unit from options and no
hard-coded unit
Diffstat (limited to 'src/qt/sendcoinsdialog.cpp')
-rw-r--r-- | src/qt/sendcoinsdialog.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 9086f6614e..e3fec61046 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -63,12 +63,12 @@ SendCoinsDialog::~SendCoinsDialog() void SendCoinsDialog::on_sendButton_clicked() { + if(!model || !model->getOptionsModel()) + return; + QList<SendCoinsRecipient> recipients; bool valid = true; - if(!model) - return; - for(int i = 0; i < ui->entries->count(); ++i) { SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget()); @@ -94,7 +94,7 @@ void SendCoinsDialog::on_sendButton_clicked() QStringList formatted; foreach(const SendCoinsRecipient &rcp, recipients) { - QString amount = BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, rcp.amount); + QString amount = BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), rcp.amount); if (rcp.authenticatedMerchant.isEmpty()) { QString address = rcp.address; @@ -158,7 +158,7 @@ void SendCoinsDialog::on_sendButton_clicked() case WalletModel::AmountWithFeeExceedsBalance: QMessageBox::warning(this, tr("Send Coins"), tr("The total exceeds your balance when the %1 transaction fee is included."). - arg(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, sendstatus.fee)), + arg(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), sendstatus.fee)), QMessageBox::Ok, QMessageBox::Ok); break; case WalletModel::DuplicateAddress: @@ -338,18 +338,14 @@ void SendCoinsDialog::setBalance(qint64 balance, qint64 unconfirmedBalance, qint { Q_UNUSED(unconfirmedBalance); Q_UNUSED(immatureBalance); - if(!model || !model->getOptionsModel()) - return; - int unit = model->getOptionsModel()->getDisplayUnit(); - ui->labelBalance->setText(BitcoinUnits::formatWithUnit(unit, balance)); + if(model && model->getOptionsModel()) + { + ui->labelBalance->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), balance)); + } } void SendCoinsDialog::updateDisplayUnit() { - if(model && model->getOptionsModel()) - { - // Update labelBalance with the current balance and the current unit - ui->labelBalance->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), model->getBalance())); - } + setBalance(model->getBalance(), 0, 0); } |