Merge #17937: gui: Remove WalletView and BitcoinGUI circular dependency
cb8a86d9f9
gui: Remove WalletView and BitcoinGUI circular dependency (João Barbosa)ac3d10777d
gui: Add transactionClicked and coinsSent signals to WalletView (João Barbosa) Pull request description: Essentially moves the code in `WalletView::setBitcoinGUI` to the only caller. Two new signals are added beforehand in the first commit so that the connections in `WalletFrame` are all from the wallet view. ACKs for top commit: hebasto: ACKcb8a86d9f9
, tested on Linux Mint 19.3. jonasschnelli: utACKcb8a86d9f9
Tree-SHA512: 250316cd3689e51c8cded9ccd75963c836dcafa6db25d684f2aa691dea9738895f9140793e0f925784909e39f8257f7e1c7d611e8bd6d6634e1a50333f4ddb1e
This commit is contained in:
commit
f05c1ac444
4 changed files with 12 additions and 31 deletions
|
@ -46,7 +46,6 @@ bool WalletFrame::addWallet(WalletModel *walletModel)
|
||||||
if (mapWalletViews.count(walletModel) > 0) return false;
|
if (mapWalletViews.count(walletModel) > 0) return false;
|
||||||
|
|
||||||
WalletView *walletView = new WalletView(platformStyle, this);
|
WalletView *walletView = new WalletView(platformStyle, this);
|
||||||
walletView->setBitcoinGUI(gui);
|
|
||||||
walletView->setClientModel(clientModel);
|
walletView->setClientModel(clientModel);
|
||||||
walletView->setWalletModel(walletModel);
|
walletView->setWalletModel(walletModel);
|
||||||
walletView->showOutOfSyncWarning(bOutOfSync);
|
walletView->showOutOfSyncWarning(bOutOfSync);
|
||||||
|
@ -62,6 +61,14 @@ bool WalletFrame::addWallet(WalletModel *walletModel)
|
||||||
mapWalletViews[walletModel] = walletView;
|
mapWalletViews[walletModel] = walletView;
|
||||||
|
|
||||||
connect(walletView, &WalletView::outOfSyncWarningClicked, this, &WalletFrame::outOfSyncWarningClicked);
|
connect(walletView, &WalletView::outOfSyncWarningClicked, this, &WalletFrame::outOfSyncWarningClicked);
|
||||||
|
connect(walletView, &WalletView::transactionClicked, gui, &BitcoinGUI::gotoHistoryPage);
|
||||||
|
connect(walletView, &WalletView::coinsSent, gui, &BitcoinGUI::gotoHistoryPage);
|
||||||
|
connect(walletView, &WalletView::message, [this](const QString& title, const QString& message, unsigned int style) {
|
||||||
|
gui->message(title, message, style);
|
||||||
|
});
|
||||||
|
connect(walletView, &WalletView::encryptionStatusChanged, gui, &BitcoinGUI::updateWalletStatus);
|
||||||
|
connect(walletView, &WalletView::incomingTransaction, gui, &BitcoinGUI::incomingTransaction);
|
||||||
|
connect(walletView, &WalletView::hdEnabledStatusChanged, gui, &BitcoinGUI::updateWalletStatus);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include <qt/addressbookpage.h>
|
#include <qt/addressbookpage.h>
|
||||||
#include <qt/askpassphrasedialog.h>
|
#include <qt/askpassphrasedialog.h>
|
||||||
#include <qt/bitcoingui.h>
|
|
||||||
#include <qt/clientmodel.h>
|
#include <qt/clientmodel.h>
|
||||||
#include <qt/guiutil.h>
|
#include <qt/guiutil.h>
|
||||||
#include <qt/optionsmodel.h>
|
#include <qt/optionsmodel.h>
|
||||||
|
@ -65,11 +64,13 @@ WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent):
|
||||||
addWidget(receiveCoinsPage);
|
addWidget(receiveCoinsPage);
|
||||||
addWidget(sendCoinsPage);
|
addWidget(sendCoinsPage);
|
||||||
|
|
||||||
|
connect(overviewPage, &OverviewPage::transactionClicked, this, &WalletView::transactionClicked);
|
||||||
// Clicking on a transaction on the overview pre-selects the transaction on the transaction history page
|
// Clicking on a transaction on the overview pre-selects the transaction on the transaction history page
|
||||||
connect(overviewPage, &OverviewPage::transactionClicked, transactionView, static_cast<void (TransactionView::*)(const QModelIndex&)>(&TransactionView::focusTransaction));
|
connect(overviewPage, &OverviewPage::transactionClicked, transactionView, static_cast<void (TransactionView::*)(const QModelIndex&)>(&TransactionView::focusTransaction));
|
||||||
|
|
||||||
connect(overviewPage, &OverviewPage::outOfSyncWarningClicked, this, &WalletView::requestedSyncWarningInfo);
|
connect(overviewPage, &OverviewPage::outOfSyncWarningClicked, this, &WalletView::requestedSyncWarningInfo);
|
||||||
|
|
||||||
|
connect(sendCoinsPage, &SendCoinsDialog::coinsSent, this, &WalletView::coinsSent);
|
||||||
// Highlight transaction after send
|
// Highlight transaction after send
|
||||||
connect(sendCoinsPage, &SendCoinsDialog::coinsSent, transactionView, static_cast<void (TransactionView::*)(const uint256&)>(&TransactionView::focusTransaction));
|
connect(sendCoinsPage, &SendCoinsDialog::coinsSent, transactionView, static_cast<void (TransactionView::*)(const uint256&)>(&TransactionView::focusTransaction));
|
||||||
|
|
||||||
|
@ -86,32 +87,6 @@ WalletView::~WalletView()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void WalletView::setBitcoinGUI(BitcoinGUI *gui)
|
|
||||||
{
|
|
||||||
if (gui)
|
|
||||||
{
|
|
||||||
// Clicking on a transaction on the overview page simply sends you to transaction history page
|
|
||||||
connect(overviewPage, &OverviewPage::transactionClicked, gui, &BitcoinGUI::gotoHistoryPage);
|
|
||||||
|
|
||||||
// Navigate to transaction history page after send
|
|
||||||
connect(sendCoinsPage, &SendCoinsDialog::coinsSent, gui, &BitcoinGUI::gotoHistoryPage);
|
|
||||||
|
|
||||||
// Receive and report messages
|
|
||||||
connect(this, &WalletView::message, [gui](const QString &title, const QString &message, unsigned int style) {
|
|
||||||
gui->message(title, message, style);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Pass through encryption status changed signals
|
|
||||||
connect(this, &WalletView::encryptionStatusChanged, gui, &BitcoinGUI::updateWalletStatus);
|
|
||||||
|
|
||||||
// Pass through transaction notifications
|
|
||||||
connect(this, &WalletView::incomingTransaction, gui, &BitcoinGUI::incomingTransaction);
|
|
||||||
|
|
||||||
// Connect HD enabled state signal
|
|
||||||
connect(this, &WalletView::hdEnabledStatusChanged, gui, &BitcoinGUI::updateWalletStatus);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void WalletView::setClientModel(ClientModel *_clientModel)
|
void WalletView::setClientModel(ClientModel *_clientModel)
|
||||||
{
|
{
|
||||||
this->clientModel = _clientModel;
|
this->clientModel = _clientModel;
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
|
|
||||||
class BitcoinGUI;
|
|
||||||
class ClientModel;
|
class ClientModel;
|
||||||
class OverviewPage;
|
class OverviewPage;
|
||||||
class PlatformStyle;
|
class PlatformStyle;
|
||||||
|
@ -39,7 +38,6 @@ public:
|
||||||
explicit WalletView(const PlatformStyle *platformStyle, QWidget *parent);
|
explicit WalletView(const PlatformStyle *platformStyle, QWidget *parent);
|
||||||
~WalletView();
|
~WalletView();
|
||||||
|
|
||||||
void setBitcoinGUI(BitcoinGUI *gui);
|
|
||||||
/** Set the client model.
|
/** Set the client model.
|
||||||
The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic.
|
The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic.
|
||||||
*/
|
*/
|
||||||
|
@ -115,6 +113,8 @@ public Q_SLOTS:
|
||||||
void requestedSyncWarningInfo();
|
void requestedSyncWarningInfo();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
void transactionClicked();
|
||||||
|
void coinsSent();
|
||||||
/** Fired when a message should be reported to the user */
|
/** Fired when a message should be reported to the user */
|
||||||
void message(const QString &title, const QString &message, unsigned int style);
|
void message(const QString &title, const QString &message, unsigned int style);
|
||||||
/** Encryption status of wallet changed */
|
/** Encryption status of wallet changed */
|
||||||
|
|
|
@ -14,7 +14,6 @@ EXPECTED_CIRCULAR_DEPENDENCIES=(
|
||||||
"policy/fees -> txmempool -> policy/fees"
|
"policy/fees -> txmempool -> policy/fees"
|
||||||
"qt/addresstablemodel -> qt/walletmodel -> qt/addresstablemodel"
|
"qt/addresstablemodel -> qt/walletmodel -> qt/addresstablemodel"
|
||||||
"qt/bitcoingui -> qt/walletframe -> qt/bitcoingui"
|
"qt/bitcoingui -> qt/walletframe -> qt/bitcoingui"
|
||||||
"qt/bitcoingui -> qt/walletview -> qt/bitcoingui"
|
|
||||||
"qt/clientmodel -> qt/peertablemodel -> qt/clientmodel"
|
"qt/clientmodel -> qt/peertablemodel -> qt/clientmodel"
|
||||||
"qt/recentrequeststablemodel -> qt/walletmodel -> qt/recentrequeststablemodel"
|
"qt/recentrequeststablemodel -> qt/walletmodel -> qt/recentrequeststablemodel"
|
||||||
"qt/sendcoinsdialog -> qt/walletmodel -> qt/sendcoinsdialog"
|
"qt/sendcoinsdialog -> qt/walletmodel -> qt/sendcoinsdialog"
|
||||||
|
|
Loading…
Reference in a new issue