mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user