29 #include <QActionGroup> 30 #include <QFileDialog> 31 #include <QHBoxLayout> 32 #include <QProgressDialog> 33 #include <QPushButton> 34 #include <QVBoxLayout> 38 : QStackedWidget(parent), clientModel(nullptr), walletModel(_walletModel),
39 platformStyle(_platformStyle) {
44 QVBoxLayout *vbox =
new QVBoxLayout();
45 QHBoxLayout *hbox_buttons =
new QHBoxLayout();
48 QPushButton *exportButton =
new QPushButton(tr(
"&Export"),
this);
49 exportButton->setToolTip(
50 tr(
"Export the data in the current tab to a file"));
54 hbox_buttons->addStretch();
55 hbox_buttons->addWidget(exportButton);
56 vbox->addLayout(hbox_buttons);
144 &TransactionTableModel::rowsInserted,
this,
179 QModelIndex index = ttm->
index(start, 0, parent);
187 int64_t(amount) *
SATOSHI, type, address, label,
206 if (!addr.isEmpty()) {
215 signVerifyMessageDialog->setAttribute(Qt::WA_DeleteOnClose);
219 if (!addr.isEmpty()) {
228 signVerifyMessageDialog->setAttribute(Qt::WA_DeleteOnClose);
232 if (!addr.isEmpty()) {
239 this, tr(
"Load Transaction Data"), QString(),
240 tr(
"Partially Signed Transaction (*.psbt)"),
nullptr);
241 if (filename.isEmpty()) {
247 tr(
"PSBT file must be smaller than 100 MiB"),
251 std::ifstream in(filename.toLocal8Bit().data(), std::ios::binary);
252 std::string dataStr(std::istreambuf_iterator<char>{in}, {});
258 tr(
"Unable to decode PSBT file") +
"\n" +
259 QString::fromStdString(error),
265 bool complete =
false;
268 msgBox.setText(
"PSBT");
269 switch (analysis.
next) {
272 msgBox.setInformativeText(
273 "PSBT is incomplete. Copy to clipboard for manual inspection?");
276 msgBox.setInformativeText(
277 "Transaction needs more signatures. Copy to clipboard?");
283 msgBox.setInformativeText(
284 tr(
"Would you like to send this transaction?"));
288 msgBox.setInformativeText(
289 tr(
"There was an unexpected problem processing the PSBT. " 290 "Copy to clipboard for manual inspection?"));
294 msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
295 switch (msgBox.exec()) {
296 case QMessageBox::Yes: {
298 std::string err_string;
307 tr(
"Broadcasted transaction successfully."),
312 QString::fromStdString(err_string),
320 Q_EMIT
message(tr(
"PSBT copied"),
"Copied to clipboard",
325 case QMessageBox::Cancel:
361 tr(
"Wallet Data (*.dat)"),
nullptr);
363 if (filename.isEmpty()) {
370 tr(
"There was an error trying to save the wallet data to %1.")
375 tr(
"Backup Successful"),
376 tr(
"The wallet data was successfully saved to %1.").arg(filename),
417 if (nProgress == 0) {
418 progressDialog =
new QProgressDialog(title, tr(
"Cancel"), 0, 100);
424 }
else if (nProgress == 100) {
std::shared_ptr< const CTransaction > CTransactionRef
QWidget * transactionsPage
void showTab_SM(bool fShow)
Dialog for requesting payment of bitcoins.
void processNewTransaction(const QModelIndex &parent, int start, int end)
Show incoming transaction notification for new transactions.
void setWalletModel(WalletModel *walletModel)
interfaces::Wallet & wallet() const
virtual bool isInitialBlockDownload()=0
Is initial block download.
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.
OverviewPage * overviewPage
TransactionView * transactionView
PSBTAnalysis AnalyzePSBT(PartiallySignedTransaction psbtx)
Provides helpful miscellaneous information about where a PSBT is in the signing workflow.
void usedSendingAddresses()
Show used sending addresses.
void setAddress_VM(const QString &address)
void setModel(AddressTableModel *model)
void changePassphrase()
Change encrypted wallet passphrase.
ClientModel * clientModel
static CTransactionRef MakeTransactionRef()
void focusTransaction(const QModelIndex &)
Ask passphrase twice and encrypt.
PSBTRole next
Which of the BIP 174 roles needs to handle the transaction next.
virtual bool backupWallet(const std::string &filename)=0
Back up wallet.
void requestedSyncWarningInfo()
User has requested more information about the out of sync state.
std::string EncodeBase64(const uint8_t *pch, size_t len)
Holds the results of AnalyzePSBT (miscellaneous information about a PSBT)
WalletModel * walletModel
static constexpr Amount SATOSHI
void showProgress(const QString &title, int nProgress)
QString HtmlEscape(const QString &str, bool fMultiLine)
bool handlePaymentRequest(const SendCoinsRecipient &recipient)
A version of CTransaction with the PSBT format.
Open address book for editing.
Double ended buffer combining vector and stream-like interfaces.
void outOfSyncWarningClicked()
Notify that the out of sync warning icon has been pressed.
const PlatformStyle * platformStyle
AddressTableModel * getAddressTableModel()
void gotoSendCoinsPage(QString addr="")
Switch to send coins page.
bool FinalizeAndExtractPSBT(PartiallySignedTransaction &psbtx, CMutableTransaction &result)
Finalizes a PSBT if possible, and extracts it to a CMutableTransaction if it could be finalized...
void updateEncryptionStatus()
Re-emit encryption status signal.
void outOfSyncWarningClicked()
void bringToFront(QWidget *w)
void gotoLoadPSBT()
Load Partially Signed Bitcoin Transaction.
EncryptionStatus getEncryptionStatus() const
int getDisplayUnit() const
Force blocking, modal message box dialog (not just OS notification)
SendCoinsDialog * sendCoinsPage
void setModel(WalletModel *model)
WalletModel * getWalletModel()
bool processingQueuedTransactions() const
void gotoHistoryPage()
Switch to history (transactions) page.
Amount GetFeePerK() const
Return the fee in satoshis for a size of 1000 bytes.
Ask passphrase and unlock.
void usedReceivingAddresses()
Show used receiving addresses.
void setWalletModel(WalletModel *walletModel)
Set the wallet model.
void setAddress(const QString &address)
void setClientModel(ClientModel *clientModel)
void setClipboard(const QString &str)
static const CFeeRate DEFAULT_MAX_RAW_TX_FEE_RATE
Maximum fee rate for sendrawtransaction and testmempoolaccept RPC calls.
void message(const QString &title, const QString &message, unsigned int style)
Fired when a message should be reported to the user.
Widget showing the transaction list for a wallet, including a filter row.
void message(const QString &title, const QString &message, unsigned int style)
Fired when a message should be reported to the user.
interfaces::Node & node() const
const std::streamsize MAX_FILE_SIZE_PSBT
void unlockWallet()
Ask for passphrase to unlock wallet temporarily.
Dialog for sending bitcoins.
const Config & GetConfig()
void encryptionStatusChanged()
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
QString getWalletName() const
TransactionTableModel * getTransactionTableModel()
Widget that shows a list of sending or receiving addresses.
UI model for the transaction table of a wallet.
void PolishProgressDialog(QProgressDialog *dialog)
Model for Bitcoin network client.
void setModel(WalletModel *model)
void backupWallet()
Backup the wallet.
bool handlePaymentRequest(const SendCoinsRecipient &recipient)
void transactionClicked(const QModelIndex &index)
void gotoOverviewPage()
Switch to overview (home) page.
void incomingTransaction(const QString &date, int unit, const Amount amount, const QString &type, const QString &address, const QString &label, const QString &walletName)
Notify that a new transaction appeared.
void encryptionStatusChanged()
Encryption status of wallet changed.
void showOutOfSyncWarning(bool fShow)
bool DecodeRawPSBT(PartiallySignedTransaction &psbt, const std::string &tx_data, std::string &error)
Decode a raw (binary blob) PSBT into a PartiallySignedTransaction.
AddressBookPage * usedSendingAddressesPage
void setModel(WalletModel *model)
void gotoSignMessageTab(QString addr="")
Show Sign/Verify Message dialog and switch to sign message tab.
Interface to Bitcoin wallet from Qt view code.
static const int PROTOCOL_VERSION
network protocol versioning
void showProgress(const QString &title, int nProgress)
Show progress dialog e.g.
Multifunctional dialog to ask for passphrases.
QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut)
Get save filename, mimics QFileDialog::getSaveFileName, except that it appends a default suffix when ...
A mutable version of CTransaction.
void message(const QString &title, const QString &message, unsigned int style)
virtual NodeContext * context()
Get and set internal node context.
void setClientModel(ClientModel *clientModel)
Set the client model.
Ask passphrase and decrypt wallet.
void setClientModel(ClientModel *clientModel)
Label of address related to transaction.
std::streampos GetFileSize(const char *path, std::streamsize max)
Get the size of a file by scanning it.
void hdEnabledStatusChanged()
HD-Enabled status of wallet changed (only possible during startup)
virtual void abortRescan()=0
Abort a rescan.
Ask old passphrase + new passphrase twice.
void encryptWallet(bool status)
Encrypt the wallet.
QVariant data(const QModelIndex &index, int role) const override
ReceiveCoinsDialog * receiveCoinsPage
void gotoReceiveCoinsPage()
Switch to receive coins page.
WalletView(const PlatformStyle *platformStyle, WalletModel *walletModel, QWidget *parent)
void message(const QString &title, const QString &message, unsigned int style)
void coinsSent(const uint256 &txid)
TransactionError BroadcastTransaction(NodeContext &node, const Config &config, const CTransactionRef tx, std::string &err_string, const Amount max_tx_fee, bool relay, bool wait_callback)
Submit a transaction to the mempool and (optionally) relay it to all P2P peers.
void setModel(WalletModel *model)
bool error(const char *fmt, const Args &... args)
void transactionClicked()
Overview ("home") page widget.
void showOutOfSyncWarning(bool fShow)
QProgressDialog * progressDialog
void showTab_VM(bool fShow)
OptionsModel * getOptionsModel()
Predefined combinations for certain default usage cases.
void setAddress_SM(const QString &address)
AddressBookPage * usedReceivingAddressesPage
void setModel(WalletModel *model)