Changeset View
Changeset View
Standalone View
Standalone View
src/qt/walletview.cpp
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | WalletView::WalletView(const PlatformStyle *_platformStyle, | ||||
addWidget(overviewPage); | addWidget(overviewPage); | ||||
addWidget(transactionsPage); | addWidget(transactionsPage); | ||||
addWidget(receiveCoinsPage); | addWidget(receiveCoinsPage); | ||||
addWidget(sendCoinsPage); | addWidget(sendCoinsPage); | ||||
// Clicking on a transaction on the overview pre-selects the transaction on | // Clicking on a transaction on the overview pre-selects the transaction on | ||||
// the transaction history page | // the transaction history page | ||||
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), | connect(overviewPage, &OverviewPage::transactionClicked, transactionView, | ||||
transactionView, SLOT(focusTransaction(QModelIndex))); | static_cast<void (TransactionView::*)(const QModelIndex &)>( | ||||
connect(overviewPage, SIGNAL(outOfSyncWarningClicked()), this, | &TransactionView::focusTransaction)); | ||||
SLOT(requestedSyncWarningInfo())); | |||||
// Highlight transaction after send | connect(overviewPage, &OverviewPage::outOfSyncWarningClicked, this, | ||||
connect(sendCoinsPage, SIGNAL(coinsSent(uint256)), transactionView, | &WalletView::requestedSyncWarningInfo); | ||||
SLOT(focusTransaction(uint256))); | |||||
// Double-clicking on a transaction on the transaction history page shows | // Highlight transaction after send | ||||
// details | connect(sendCoinsPage, &SendCoinsDialog::coinsSent, transactionView, | ||||
connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), | static_cast<void (TransactionView::*)(const uint256 &)>( | ||||
transactionView, SLOT(showDetails())); | &TransactionView::focusTransaction)); | ||||
// Clicking on "Export" allows to export the transaction list | // Clicking on "Export" allows to export the transaction list | ||||
connect(exportButton, SIGNAL(clicked()), transactionView, | connect(exportButton, &QPushButton::clicked, transactionView, | ||||
SLOT(exportClicked())); | &TransactionView::exportClicked); | ||||
// Pass through messages from sendCoinsPage | // Pass through messages from sendCoinsPage | ||||
connect(sendCoinsPage, SIGNAL(message(QString, QString, unsigned int)), | connect(sendCoinsPage, &SendCoinsDialog::message, this, | ||||
this, SIGNAL(message(QString, QString, unsigned int))); | &WalletView::message); | ||||
// Pass through messages from transactionView | // Pass through messages from transactionView | ||||
connect(transactionView, SIGNAL(message(QString, QString, unsigned int)), | connect(transactionView, &TransactionView::message, this, | ||||
this, SIGNAL(message(QString, QString, unsigned int))); | &WalletView::message); | ||||
// Set the model properly. | // Set the model properly. | ||||
setWalletModel(walletModel); | setWalletModel(walletModel); | ||||
} | } | ||||
WalletView::~WalletView() {} | WalletView::~WalletView() {} | ||||
void WalletView::setBitcoinGUI(BitcoinGUI *gui) { | void WalletView::setBitcoinGUI(BitcoinGUI *gui) { | ||||
if (gui) { | if (gui) { | ||||
// Clicking on a transaction on the overview page simply sends you to | // Clicking on a transaction on the overview page simply sends you to | ||||
// transaction history page | // transaction history page | ||||
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), gui, | connect(overviewPage, &OverviewPage::transactionClicked, gui, | ||||
SLOT(gotoHistoryPage())); | &BitcoinGUI::gotoHistoryPage); | ||||
// Navigate to transaction history page after send | // Navigate to transaction history page after send | ||||
connect(sendCoinsPage, SIGNAL(coinsSent(uint256)), gui, | connect(sendCoinsPage, &SendCoinsDialog::coinsSent, gui, | ||||
SLOT(gotoHistoryPage())); | &BitcoinGUI::gotoHistoryPage); | ||||
// Receive and report messages | // Receive and report messages | ||||
connect(this, SIGNAL(message(QString, QString, unsigned int)), gui, | connect( | ||||
SLOT(message(QString, QString, unsigned int))); | this, &WalletView::message, | ||||
[gui](const QString &title, const QString &message, | |||||
unsigned int style) { gui->message(title, message, style); }); | |||||
// Pass through encryption status changed signals | // Pass through encryption status changed signals | ||||
connect(this, SIGNAL(encryptionStatusChanged()), gui, | connect(this, &WalletView::encryptionStatusChanged, gui, | ||||
SLOT(updateWalletStatus())); | &BitcoinGUI::updateWalletStatus); | ||||
// Pass through transaction notifications | // Pass through transaction notifications | ||||
connect(this, | connect(this, &WalletView::incomingTransaction, gui, | ||||
SIGNAL(incomingTransaction(QString, int, Amount, QString, | &BitcoinGUI::incomingTransaction); | ||||
QString, QString, QString)), | |||||
gui, | |||||
SLOT(incomingTransaction(QString, int, Amount, QString, QString, | |||||
QString, QString))); | |||||
// Connect HD enabled state signal | // Connect HD enabled state signal | ||||
connect(this, SIGNAL(hdEnabledStatusChanged()), gui, | connect(this, &WalletView::hdEnabledStatusChanged, gui, | ||||
SLOT(updateWalletStatus())); | &BitcoinGUI::updateWalletStatus); | ||||
} | } | ||||
} | } | ||||
void WalletView::setClientModel(ClientModel *_clientModel) { | void WalletView::setClientModel(ClientModel *_clientModel) { | ||||
this->clientModel = _clientModel; | this->clientModel = _clientModel; | ||||
overviewPage->setClientModel(_clientModel); | overviewPage->setClientModel(_clientModel); | ||||
sendCoinsPage->setClientModel(_clientModel); | sendCoinsPage->setClientModel(_clientModel); | ||||
Show All 9 Lines | void WalletView::setWalletModel(WalletModel *_walletModel) { | ||||
sendCoinsPage->setModel(_walletModel); | sendCoinsPage->setModel(_walletModel); | ||||
usedReceivingAddressesPage->setModel( | usedReceivingAddressesPage->setModel( | ||||
_walletModel ? _walletModel->getAddressTableModel() : nullptr); | _walletModel ? _walletModel->getAddressTableModel() : nullptr); | ||||
usedSendingAddressesPage->setModel( | usedSendingAddressesPage->setModel( | ||||
_walletModel ? _walletModel->getAddressTableModel() : nullptr); | _walletModel ? _walletModel->getAddressTableModel() : nullptr); | ||||
if (_walletModel) { | if (_walletModel) { | ||||
// Receive and pass through messages from wallet model | // Receive and pass through messages from wallet model | ||||
connect(_walletModel, SIGNAL(message(QString, QString, unsigned int)), | connect(_walletModel, &WalletModel::message, this, | ||||
this, SIGNAL(message(QString, QString, unsigned int))); | &WalletView::message); | ||||
// Handle changes in encryption status | // Handle changes in encryption status | ||||
connect(_walletModel, SIGNAL(encryptionStatusChanged()), this, | connect(_walletModel, &WalletModel::encryptionStatusChanged, this, | ||||
SIGNAL(encryptionStatusChanged())); | &WalletView::encryptionStatusChanged); | ||||
updateEncryptionStatus(); | updateEncryptionStatus(); | ||||
// update HD status | // update HD status | ||||
Q_EMIT hdEnabledStatusChanged(); | Q_EMIT hdEnabledStatusChanged(); | ||||
// Balloon pop-up for new transaction | // Balloon pop-up for new transaction | ||||
connect(_walletModel->getTransactionTableModel(), | connect(_walletModel->getTransactionTableModel(), | ||||
SIGNAL(rowsInserted(QModelIndex, int, int)), this, | &TransactionTableModel::rowsInserted, this, | ||||
SLOT(processNewTransaction(QModelIndex, int, int))); | &WalletView::processNewTransaction); | ||||
// Ask for passphrase if needed | // Ask for passphrase if needed | ||||
connect(_walletModel, SIGNAL(requireUnlock()), this, | connect(_walletModel, &WalletModel::requireUnlock, this, | ||||
SLOT(unlockWallet())); | &WalletView::unlockWallet); | ||||
// Show progress dialog | // Show progress dialog | ||||
connect(_walletModel, SIGNAL(showProgress(QString, int)), this, | connect(_walletModel, &WalletModel::showProgress, this, | ||||
SLOT(showProgress(QString, int))); | &WalletView::showProgress); | ||||
} | } | ||||
} | } | ||||
void WalletView::processNewTransaction(const QModelIndex &parent, int start, | void WalletView::processNewTransaction(const QModelIndex &parent, int start, | ||||
int end) { | 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 || | if (!walletModel || !clientModel || | ||||
clientModel->node().isInitialBlockDownload()) { | clientModel->node().isInitialBlockDownload()) { | ||||
▲ Show 20 Lines • Show All 188 Lines • Show Last 20 Lines |