From b8afa21fad0e5d3e61deca9678d852efe8afc499 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 22 Sep 2011 19:02:01 +0200 Subject: [PATCH] show balance in sendcoins screen (issue #24) --- src/qt/forms/sendcoinsdialog.ui | 24 ++++++++++++++++++++++++ src/qt/sendcoinsdialog.cpp | 10 ++++++++++ src/qt/sendcoinsdialog.h | 1 + 3 files changed, 35 insertions(+) diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui index 5b30d99e560..fb2fc99bfe8 100644 --- a/src/qt/forms/sendcoinsdialog.ui +++ b/src/qt/forms/sendcoinsdialog.ui @@ -75,6 +75,30 @@ + + + + 3 + + + + + Balance: + + + + + + + 123.456 BTC + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 852d789805e..8954af47425 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -36,6 +36,9 @@ void SendCoinsDialog::setModel(WalletModel *model) entry->setModel(model); } } + + setBalance(model->getBalance(), model->getUnconfirmedBalance()); + connect(model, SIGNAL(balanceChanged(qint64, qint64)), this, SLOT(setBalance(qint64, qint64))); } SendCoinsDialog::~SendCoinsDialog() @@ -241,3 +244,10 @@ void SendCoinsDialog::handleURL(const QUrl *url) } pasteEntry(rv); } + +void SendCoinsDialog::setBalance(qint64 balance, qint64 unconfirmedBalance) +{ + Q_UNUSED(unconfirmedBalance); + int unit = model->getOptionsModel()->getDisplayUnit(); + ui->labelBalance->setText(BitcoinUnits::formatWithUnit(unit, balance)); +} diff --git a/src/qt/sendcoinsdialog.h b/src/qt/sendcoinsdialog.h index 9c56e51811e..a14f99e8b2f 100644 --- a/src/qt/sendcoinsdialog.h +++ b/src/qt/sendcoinsdialog.h @@ -37,6 +37,7 @@ public slots: void accept(); SendCoinsEntry *addEntry(); void updateRemoveEnabled(); + void setBalance(qint64 balance, qint64 unconfirmedBalance); private: Ui::SendCoinsDialog *ui;