21 #include <QApplication> 24 #include <QHBoxLayout> 26 #include <QPushButton> 27 #include <QVBoxLayout> 31 platformStyle(_platformStyle),
35 QHBoxLayout *walletFrameLayout =
new QHBoxLayout(
this);
36 setContentsMargins(0,0,0,0);
37 walletStack =
new QStackedWidget(
this);
38 walletFrameLayout->setContentsMargins(0,0,0,0);
39 walletFrameLayout->addWidget(walletStack);
42 QGroupBox* no_wallet_group =
new QGroupBox(walletStack);
43 QVBoxLayout* no_wallet_layout =
new QVBoxLayout(no_wallet_group);
45 QLabel *noWallet =
new QLabel(tr(
"No wallet has been loaded.\nGo to File > Open Wallet to load a wallet.\n- OR -"));
46 noWallet->setAlignment(Qt::AlignCenter);
47 no_wallet_layout->addWidget(noWallet, 0, Qt::AlignHCenter | Qt::AlignBottom);
50 QPushButton* create_wallet_button =
new QPushButton(tr(
"Create a new wallet"), walletStack);
52 no_wallet_layout->addWidget(create_wallet_button, 0, Qt::AlignHCenter | Qt::AlignTop);
53 no_wallet_group->setLayout(no_wallet_layout);
55 walletStack->addWidget(no_wallet_group);
65 i.value()->setClientModel(_clientModel);
79 if (current_wallet_view) {
80 walletView->setCurrentIndex(current_wallet_view->currentIndex());
97 if (view_about_to_hide) {
98 QSizePolicy sp = view_about_to_hide->sizePolicy();
99 sp.setHorizontalPolicy(QSizePolicy::Ignored);
100 view_about_to_hide->setSizePolicy(sp);
107 QSizePolicy sp = walletView->sizePolicy();
108 sp.setHorizontalPolicy(QSizePolicy::Preferred);
109 walletView->setSizePolicy(sp);
110 walletView->updateGeometry();
128 QMap<WalletModel*, WalletView*>::const_iterator i;
146 QMap<WalletModel*, WalletView*>::const_iterator i;
148 i.value()->showOutOfSyncWarning(fShow);
153 QMap<WalletModel*, WalletView*>::const_iterator i;
155 i.value()->gotoOverviewPage();
160 QMap<WalletModel*, WalletView*>::const_iterator i;
162 i.value()->gotoHistoryPage();
167 QMap<WalletModel*, WalletView*>::const_iterator i;
169 i.value()->gotoReceiveCoinsPage();
174 QMap<WalletModel*, WalletView*>::const_iterator i;
176 i.value()->gotoSendCoinsPage(addr);
195 std::vector<unsigned char> data;
197 if (from_clipboard) {
198 std::string raw = QApplication::clipboard()->text().toStdString();
204 data = std::move(*result);
207 tr(
"Load Transaction Data"), QString(),
208 tr(
"Partially Signed Transaction (*.psbt)"),
nullptr);
209 if (filename.isEmpty())
return;
214 std::ifstream in{filename.toLocal8Bit().data(), std::ios::binary};
215 data.assign(std::istreambuf_iterator<char>{in}, {});
218 std::string b64_str{data.begin(), data.end()};
219 b64_str.erase(b64_str.find_last_not_of(
" \t\n\r\f\v") + 1);
221 if (b64_dec.has_value()) {
222 data = b64_dec.value();
234 dlg->openWithPSBT(psbtx);
bool handlePaymentRequest(const SendCoinsRecipient &recipient)
WalletModel * currentWalletModel() const
QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut)
Get open filename, convenience wrapper for QFileDialog::getOpenFileName.
void gotoVerifyMessageTab(QString addr="")
Show Sign/Verify Message dialog and switch to verify message tab.
void createWalletButtonClicked()
Dialog showing transaction details.
void usedSendingAddresses()
Show used sending addresses.
ClientModel * clientModel
std::streampos GetFileSize(const char *path, std::streamsize max)
Get the size of a file by scanning it.
void changePassphrase()
Change encrypted wallet passphrase.
void setCurrentWallet(WalletModel *wallet_model)
QMap< WalletModel *, WalletView * > mapWalletViews
void usedReceivingAddresses()
Show used receiving addresses.
QStackedWidget * walletStack
A version of CTransaction with the PSBT format.
void ShowModalDialogAsynchronously(QDialog *dialog)
Shows a QDialog instance asynchronously, and deletes it on close.
WalletFrame(const PlatformStyle *platformStyle, QWidget *parent)
void showOutOfSyncWarning(bool fShow)
void gotoHistoryPage()
Switch to history (transactions) page.
void gotoOverviewPage()
Switch to overview (home) page.
void usedReceivingAddresses()
Show used receiving addresses.
void setClientModel(ClientModel *clientModel)
void gotoVerifyMessageTab(QString addr="")
Show Sign/Verify Message dialog and switch to verify message tab.
std::optional< std::vector< unsigned char > > DecodeBase64(std::string_view str)
WalletView * currentWalletView() const
const std::streamsize MAX_FILE_SIZE_PSBT
void unlockWallet()
Ask for passphrase to unlock wallet temporarily.
void message(const QString &title, const QString &message, unsigned int style)
void changePassphrase()
Change encrypted wallet passphrase.
Model for Bitcoin network client.
void unlockWallet()
Ask for passphrase to unlock wallet temporarily.
void gotoSignMessageTab(QString addr="")
Show Sign/Verify Message dialog and switch to sign message tab.
void backupWallet()
Backup the wallet.
bool handlePaymentRequest(const SendCoinsRecipient &recipient)
void gotoOverviewPage()
Switch to overview (home) page.
const PlatformStyle * platformStyle
void gotoSendCoinsPage(QString addr="")
Switch to send coins page.
void encryptWallet()
Encrypt the wallet.
void gotoReceiveCoinsPage()
Switch to receive coins page.
void gotoSignMessageTab(QString addr="")
Show Sign/Verify Message dialog and switch to sign message tab.
Interface to Bitcoin wallet from Qt view code.
WalletModel * getWalletModel() const noexcept
Span< const std::byte > MakeByteSpan(V &&v) noexcept
void setClientModel(ClientModel *clientModel)
Set the client model.
void encryptWallet()
Encrypt the wallet.
void backupWallet()
Backup the wallet.
bool addView(WalletView *walletView)
void removeWallet(WalletModel *wallet_model)
void gotoLoadPSBT(bool from_clipboard=false)
Load Partially Signed Bitcoin Transaction.
bool DecodeRawPSBT(PartiallySignedTransaction &psbt, Span< const std::byte > tx_data, std::string &error)
Decode a raw (binary blob) PSBT into a PartiallySignedTransaction.
Overview ("home") page widget.
void usedSendingAddresses()
Show used sending addresses.
void showOutOfSyncWarning(bool fShow)