qt, refactor: Drop redundant checks of walletModel

The walletModel member is set in the WalletView constructor now.
This commit is contained in:
Hennadii Stepanov 2021-08-07 18:13:27 +03:00
parent 404373bc6a
commit ca0e680bdc
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

View File

@ -122,14 +122,15 @@ void WalletView::setClientModel(ClientModel *_clientModel)
overviewPage->setClientModel(_clientModel); overviewPage->setClientModel(_clientModel);
sendCoinsPage->setClientModel(_clientModel); sendCoinsPage->setClientModel(_clientModel);
if (walletModel) walletModel->setClientModel(_clientModel); walletModel->setClientModel(_clientModel);
} }
void WalletView::processNewTransaction(const QModelIndex& parent, int start, int /*end*/) void WalletView::processNewTransaction(const QModelIndex& parent, int start, int /*end*/)
{ {
// Prevent balloon-spam when initial block download is in progress // Prevent balloon-spam when initial block download is in progress
if (!walletModel || !clientModel || clientModel->node().isInitialBlockDownload()) if (!clientModel || clientModel->node().isInitialBlockDownload()) {
return; return;
}
TransactionTableModel *ttm = walletModel->getTransactionTableModel(); TransactionTableModel *ttm = walletModel->getTransactionTableModel();
if (!ttm || ttm->processingQueuedTransactions()) if (!ttm || ttm->processingQueuedTransactions())
@ -204,8 +205,6 @@ void WalletView::showOutOfSyncWarning(bool fShow)
void WalletView::encryptWallet() void WalletView::encryptWallet()
{ {
if(!walletModel)
return;
AskPassphraseDialog dlg(AskPassphraseDialog::Encrypt, this); AskPassphraseDialog dlg(AskPassphraseDialog::Encrypt, this);
dlg.setModel(walletModel); dlg.setModel(walletModel);
dlg.exec(); dlg.exec();
@ -242,8 +241,6 @@ void WalletView::changePassphrase()
void WalletView::unlockWallet() void WalletView::unlockWallet()
{ {
if(!walletModel)
return;
// Unlock wallet when requested by wallet model // Unlock wallet when requested by wallet model
if (walletModel->getEncryptionStatus() == WalletModel::Locked) if (walletModel->getEncryptionStatus() == WalletModel::Locked)
{ {
@ -255,17 +252,11 @@ void WalletView::unlockWallet()
void WalletView::usedSendingAddresses() void WalletView::usedSendingAddresses()
{ {
if(!walletModel)
return;
GUIUtil::bringToFront(usedSendingAddressesPage); GUIUtil::bringToFront(usedSendingAddressesPage);
} }
void WalletView::usedReceivingAddresses() void WalletView::usedReceivingAddresses()
{ {
if(!walletModel)
return;
GUIUtil::bringToFront(usedReceivingAddressesPage); GUIUtil::bringToFront(usedReceivingAddressesPage);
} }