diff --git a/src/qt/walletview.h b/src/qt/walletview.h --- a/src/qt/walletview.h +++ b/src/qt/walletview.h @@ -26,14 +26,13 @@ class QProgressDialog; QT_END_NAMESPACE -/* - WalletView class. This class represents the view to a single wallet. - It was added to support multiple wallet functionality. Each wallet gets its - own WalletView instance. - It communicates with both the client and the wallet models to give the user an - up-to-date view of the - current core state. -*/ +/** + * WalletView class. This class represents the view to a single wallet. + * It was added to support multiple wallet functionality. Each wallet gets its + * own WalletView instance. + * It communicates with both the client and the wallet models to give the user + * an up-to-date view of the current core state. + */ class WalletView : public QStackedWidget { Q_OBJECT @@ -43,16 +42,17 @@ ~WalletView(); void setBitcoinGUI(BitcoinGUI *gui); - /** Set the client model. - The client model represents the part of the core that communicates with - the P2P network, and is wallet-agnostic. - */ + /** + * Set the client model. + * The client model represents the part of the core that communicates with + * the P2P network, and is wallet-agnostic. + */ void setClientModel(ClientModel *clientModel); - /** Set the wallet model. - The wallet model represents a bitcoin wallet, and offers access to the - list of transactions, address book and sending - functionality. - */ + /** + * Set the wallet model. + * The wallet model represents a bitcoin wallet, and offers access to the + * list of transactions, address book and sending functionality. + */ void setWalletModel(WalletModel *walletModel); bool handlePaymentRequest(const SendCoinsRecipient &recipient); @@ -90,13 +90,13 @@ /** Show Sign/Verify Message dialog and switch to verify message tab */ void gotoVerifyMessageTab(QString addr = ""); - /** Show incoming transaction notification for new transactions. - - The new items are those between start and end inclusive, under the given - parent item. - */ - void processNewTransaction(const QModelIndex &parent, int start, - int /*end*/); + /** + * Show incoming transaction notification for new transactions. + * + * The new items are those between start and end inclusive, under the given + * parent item. + */ + void processNewTransaction(const QModelIndex &parent, int start, int end); /** Encrypt the wallet */ void encryptWallet(bool status); /** Backup the wallet */ diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -167,13 +167,16 @@ } void WalletView::processNewTransaction(const QModelIndex &parent, int start, - int /*end*/) { + int end) { // Prevent balloon-spam when initial block download is in progress - if (!walletModel || !clientModel || clientModel->inInitialBlockDownload()) + if (!walletModel || !clientModel || clientModel->inInitialBlockDownload()) { return; + } TransactionTableModel *ttm = walletModel->getTransactionTableModel(); - if (!ttm || ttm->processingQueuedTransactions()) return; + if (!ttm || ttm->processingQueuedTransactions()) { + return; + } QString date = ttm->index(start, TransactionTableModel::Date, parent) .data() @@ -192,7 +195,7 @@ Q_EMIT incomingTransaction(date, walletModel->getOptionsModel()->getDisplayUnit(), - Amount(amount), type, address, label); + int64_t(amount) * SATOSHI, type, address, label); } void WalletView::gotoOverviewPage() { @@ -210,7 +213,9 @@ void WalletView::gotoSendCoinsPage(QString addr) { setCurrentWidget(sendCoinsPage); - if (!addr.isEmpty()) sendCoinsPage->setAddress(addr); + if (!addr.isEmpty()) { + sendCoinsPage->setAddress(addr); + } } void WalletView::gotoSignMessageTab(QString addr) { @@ -221,7 +226,9 @@ signVerifyMessageDialog->setModel(walletModel); signVerifyMessageDialog->showTab_SM(true); - if (!addr.isEmpty()) signVerifyMessageDialog->setAddress_SM(addr); + if (!addr.isEmpty()) { + signVerifyMessageDialog->setAddress_SM(addr); + } } void WalletView::gotoVerifyMessageTab(QString addr) { @@ -232,7 +239,9 @@ signVerifyMessageDialog->setModel(walletModel); signVerifyMessageDialog->showTab_VM(true); - if (!addr.isEmpty()) signVerifyMessageDialog->setAddress_VM(addr); + if (!addr.isEmpty()) { + signVerifyMessageDialog->setAddress_VM(addr); + } } bool WalletView::handlePaymentRequest(const SendCoinsRecipient &recipient) { @@ -248,7 +257,10 @@ } void WalletView::encryptWallet(bool status) { - if (!walletModel) return; + if (!walletModel) { + return; + } + AskPassphraseDialog dlg(status ? AskPassphraseDialog::Encrypt : AskPassphraseDialog::Decrypt, this); @@ -263,7 +275,9 @@ GUIUtil::getSaveFileName(this, tr("Backup Wallet"), QString(), tr("Wallet Data (*.dat)"), nullptr); - if (filename.isEmpty()) return; + if (filename.isEmpty()) { + return; + } if (!walletModel->backupWallet(filename)) { Q_EMIT message( @@ -286,7 +300,10 @@ } void WalletView::unlockWallet() { - if (!walletModel) return; + if (!walletModel) { + return; + } + // Unlock wallet when requested by wallet model if (walletModel->getEncryptionStatus() == WalletModel::Locked) { AskPassphraseDialog dlg(AskPassphraseDialog::Unlock, this); @@ -296,7 +313,9 @@ } void WalletView::usedSendingAddresses() { - if (!walletModel) return; + if (!walletModel) { + return; + } usedSendingAddressesPage->show(); usedSendingAddressesPage->raise(); @@ -304,7 +323,9 @@ } void WalletView::usedReceivingAddresses() { - if (!walletModel) return; + if (!walletModel) { + return; + } usedReceivingAddressesPage->show(); usedReceivingAddressesPage->raise(); @@ -324,8 +345,9 @@ progressDialog->close(); progressDialog->deleteLater(); } - } else if (progressDialog) + } else if (progressDialog) { progressDialog->setValue(nProgress); + } } void WalletView::requestedSyncWarningInfo() {