MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / WalletView

Method WalletView

src/qt/walletview.cpp:32–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30#include <QVBoxLayout>
31
32WalletView::WalletView(WalletModel* wallet_model, const PlatformStyle* _platformStyle, QWidget* parent)
33 : QStackedWidget(parent),
34 walletModel(wallet_model),
35 platformStyle(_platformStyle)
36{
37 assert(walletModel);
38
39 // Create tabs
40 overviewPage = new OverviewPage(platformStyle);
41 overviewPage->setWalletModel(walletModel);
42
43 transactionsPage = new QWidget(this);
44 QVBoxLayout *vbox = new QVBoxLayout();
45 QHBoxLayout *hbox_buttons = new QHBoxLayout();
46 transactionView = new TransactionView(platformStyle, this);
47 transactionView->setModel(walletModel);
48
49 vbox->addWidget(transactionView);
50 QPushButton *exportButton = new QPushButton(tr("&Export"), this);
51 exportButton->setToolTip(tr("Export the data in the current tab to a file"));
52 if (platformStyle->getImagesOnButtons()) {
53 exportButton->setIcon(platformStyle->SingleColorIcon(":/icons/export"));
54 }
55 hbox_buttons->addStretch();
56 hbox_buttons->addWidget(exportButton);
57 vbox->addLayout(hbox_buttons);
58 transactionsPage->setLayout(vbox);
59
60 receiveCoinsPage = new ReceiveCoinsDialog(platformStyle);
61 receiveCoinsPage->setModel(walletModel);
62
63 sendCoinsPage = new SendCoinsDialog(platformStyle);
64 sendCoinsPage->setModel(walletModel);
65
66 usedSendingAddressesPage = new AddressBookPage(platformStyle, AddressBookPage::ForEditing, AddressBookPage::SendingTab, this);
67 usedSendingAddressesPage->setModel(walletModel->getAddressTableModel());
68
69 usedReceivingAddressesPage = new AddressBookPage(platformStyle, AddressBookPage::ForEditing, AddressBookPage::ReceivingTab, this);
70 usedReceivingAddressesPage->setModel(walletModel->getAddressTableModel());
71
72 addWidget(overviewPage);
73 addWidget(transactionsPage);
74 addWidget(receiveCoinsPage);
75 addWidget(sendCoinsPage);
76
77 connect(overviewPage, &OverviewPage::transactionClicked, this, &WalletView::transactionClicked);
78 // Clicking on a transaction on the overview pre-selects the transaction on the transaction history page
79 connect(overviewPage, &OverviewPage::transactionClicked, transactionView, qOverload<const QModelIndex&>(&TransactionView::focusTransaction));
80
81 connect(overviewPage, &OverviewPage::outOfSyncWarningClicked, this, &WalletView::outOfSyncWarningClicked);
82
83 connect(sendCoinsPage, &SendCoinsDialog::coinsSent, this, &WalletView::coinsSent);
84 // Highlight transaction after send
85 connect(sendCoinsPage, &SendCoinsDialog::coinsSent, transactionView, qOverload<const Txid&>(&TransactionView::focusTransaction));
86
87 // Clicking on "Export" allows to export the transaction list
88 connect(exportButton, &QPushButton::clicked, transactionView, &TransactionView::exportClicked);
89

Callers

nothing calls this directly

Calls 6

setWalletModelMethod · 0.80
getImagesOnButtonsMethod · 0.80
SingleColorIconMethod · 0.80
getAddressTableModelMethod · 0.80
setModelMethod · 0.45

Tested by

no test coverage detected