21#include <QApplication>
31 platformStyle(_platformStyle),
32 m_size_hint(
OverviewPage{platformStyle, nullptr}.sizeHint())
35 QHBoxLayout *walletFrameLayout =
new QHBoxLayout(
this);
36 setContentsMargins(0,0,0,0);
38 walletFrameLayout->setContentsMargins(0,0,0,0);
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);
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);
282 return qobject_cast<WalletView*>(
walletStack->currentWidget());
Model for Bitcoin network client.
Overview ("home") page widget.
Dialog showing transaction details.
bool addView(WalletView *walletView)
void changePassphrase()
Change encrypted wallet passphrase.
WalletModel * currentWalletModel() const
void gotoHistoryPage()
Switch to history (transactions) page.
void unlockWallet()
Ask for passphrase to unlock wallet temporarily.
void gotoSignMessageTab(QString addr="")
Show Sign/Verify Message dialog and switch to sign message tab.
WalletView * currentWalletView() const
void gotoOverviewPage()
Switch to overview (home) page.
ClientModel * clientModel
void gotoSendCoinsPage(QString addr="")
Switch to send coins page.
void removeWallet(WalletModel *wallet_model)
void setClientModel(ClientModel *clientModel)
void backupWallet()
Backup the wallet.
QStackedWidget * walletStack
void usedSendingAddresses()
Show used sending addresses.
void createWalletButtonClicked()
void encryptWallet()
Encrypt the wallet.
void usedReceivingAddresses()
Show used receiving addresses.
void message(const QString &title, const QString &message, unsigned int style)
void setCurrentWallet(WalletModel *wallet_model)
bool handlePaymentRequest(const SendCoinsRecipient &recipient)
QMap< WalletModel *, WalletView * > mapWalletViews
void gotoLoadPSBT(bool from_clipboard=false)
Load Partially Signed Bitcoin Transaction.
WalletFrame(const PlatformStyle *platformStyle, QWidget *parent)
void showOutOfSyncWarning(bool fShow)
void gotoReceiveCoinsPage()
Switch to receive coins page.
void gotoVerifyMessageTab(QString addr="")
Show Sign/Verify Message dialog and switch to verify message tab.
Interface to Bitcoin wallet from Qt view code.
void gotoVerifyMessageTab(QString addr="")
Show Sign/Verify Message dialog and switch to verify message tab.
bool handlePaymentRequest(const SendCoinsRecipient &recipient)
void changePassphrase()
Change encrypted wallet passphrase.
void setClientModel(ClientModel *clientModel)
Set the client model.
WalletModel * getWalletModel() const noexcept
void gotoSignMessageTab(QString addr="")
Show Sign/Verify Message dialog and switch to sign message tab.
void usedSendingAddresses()
Show used sending addresses.
void encryptWallet()
Encrypt the wallet.
void backupWallet()
Backup the wallet.
void unlockWallet()
Ask for passphrase to unlock wallet temporarily.
void gotoOverviewPage()
Switch to overview (home) page.
void usedReceivingAddresses()
Show used receiving addresses.
void showOutOfSyncWarning(bool fShow)
std::streampos GetFileSize(const char *path, std::streamsize max)
Get the size of a file by scanning it.
void ShowModalDialogAsynchronously(QDialog *dialog)
Shows a QDialog instance asynchronously, and deletes it on close.
QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut)
Get open filename, convenience wrapper for QFileDialog::getOpenFileName.
bool DecodeRawPSBT(PartiallySignedTransaction &psbt, Span< const std::byte > tx_data, std::string &error)
Decode a raw (binary blob) PSBT into a PartiallySignedTransaction.
const std::streamsize MAX_FILE_SIZE_PSBT
Span< const std::byte > MakeByteSpan(V &&v) noexcept
A version of CTransaction with the PSBT format.
std::optional< std::vector< unsigned char > > DecodeBase64(std::string_view str)