MCPcopy Create free account
hub / github.com/ElementsProject/elements / WalletView

Method WalletView

src/qt/walletview.cpp:33–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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