mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-10 15:46:48 -04:00

764bfe4cba
[psbt] add file size limit (Sjors Provoost)1cd8dc2556
[gui] load PSBT (Sjors Provoost)f6895301f7
[gui] save PSBT to file (Sjors Provoost)1d05a9d80b
Move DEFAULT_MAX_RAW_TX_FEE_RATE to node/transaction.h (Sjors Provoost)86e22d23bb
[util] GetFileSize (Sjors Provoost)6ab3aad9a5
[gui] send dialog: split on_sendButton_clicked (Sjors Provoost) Pull request description: This adds: * a dialog after Create Unsigned, which lets you save a PSBT file in binary format, e.g. to an SD card * a "Load PSBT" menu entry lets you pick a PSBT file. We broadcast the transaction if complete ## Save flow <img width="482" alt="Schermafbeelding 2020-01-04 om 20 39 34" src="https://user-images.githubusercontent.com/10217/71765684-ba60d580-2f32-11ea-8dea-0c4398eb6e15.png"> <img width="287" alt="Schermafbeelding 2020-01-04 om 20 40 35" src="https://user-images.githubusercontent.com/10217/71765677-a0bf8e00-2f32-11ea-8172-12dfd34a89f3.png"> <img width="594" alt="Schermafbeelding 2020-01-04 om 20 41 12" src="https://user-images.githubusercontent.com/10217/71765681-aa48f600-2f32-11ea-8e2c-c4f6bf9f5309.png"> <img width="632" alt="Schermafbeelding 2020-01-04 om 20 41 28" src="https://user-images.githubusercontent.com/10217/71765691-d19fc300-2f32-11ea-97ff-70f5dd59987a.png"> By default the file name contains the destination address(es) and amount(s). We only use the binary format for files, in order to avoid compatibility hell. If we do want to add base64 file format support, we should use a different extension for that (`.psbt64`?). ## Load flow Select a file: <img width="649" alt="Schermafbeelding 2020-01-04 om 21 08 57" src="https://user-images.githubusercontent.com/10217/71766089-2ba28780-2f37-11ea-875d-074794b5707d.png"> Offer to send if complete: <img width="308" alt="Schermafbeelding 2020-01-04 om 21 09 06" src="https://user-images.githubusercontent.com/10217/71766088-2a715a80-2f37-11ea-807d-394c8b840c59.png"> Tell user if signatures are missing, offer to copy to clipboard: <img width="308" alt="Schermafbeelding 2020-01-04 om 21 15 57" src="https://user-images.githubusercontent.com/10217/71766115-702e2300-2f37-11ea-9f62-a6ede499c0fa.png"> Incomplete for another reason: <img width="309" alt="Schermafbeelding 2020-01-04 om 21 07 51" src="https://user-images.githubusercontent.com/10217/71766090-2c3b1e00-2f37-11ea-8a22-6188377b67a1.png"> ACKs for top commit: instagibbs: re-ACK764bfe4cba
achow101: ACK764bfe4cba
jb55: Tested ACK764bfe4cba
jonatack: ACK764bfe4c
promag: Code review ACK764bfe4cba
. Tree-SHA512: d284ed6895f3a271fb8ff879aac388ad217ddc13f72074725608e1c3d6d90650f6dc9e9e254479544dd71fc111516b02c8ff92158153208dc40fb2726b37d063
132 lines
4.4 KiB
C++
132 lines
4.4 KiB
C++
// Copyright (c) 2011-2020 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_QT_WALLETVIEW_H
|
|
#define BITCOIN_QT_WALLETVIEW_H
|
|
|
|
#include <amount.h>
|
|
|
|
#include <QStackedWidget>
|
|
|
|
class ClientModel;
|
|
class OverviewPage;
|
|
class PlatformStyle;
|
|
class ReceiveCoinsDialog;
|
|
class SendCoinsDialog;
|
|
class SendCoinsRecipient;
|
|
class TransactionView;
|
|
class WalletModel;
|
|
class AddressBookPage;
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
class QModelIndex;
|
|
class QProgressDialog;
|
|
QT_END_NAMESPACE
|
|
|
|
/*
|
|
WalletView class. This class represents the view to a single wallet.
|
|
It was added to support multiple wallet functionality. Each wallet gets its own WalletView instance.
|
|
It communicates with both the client and the wallet models to give the user an up-to-date view of the
|
|
current core state.
|
|
*/
|
|
class WalletView : public QStackedWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit WalletView(const PlatformStyle *platformStyle, QWidget *parent);
|
|
~WalletView();
|
|
|
|
/** Set the client model.
|
|
The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic.
|
|
*/
|
|
void setClientModel(ClientModel *clientModel);
|
|
WalletModel *getWalletModel() { return walletModel; }
|
|
/** Set the wallet model.
|
|
The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending
|
|
functionality.
|
|
*/
|
|
void setWalletModel(WalletModel *walletModel);
|
|
|
|
bool handlePaymentRequest(const SendCoinsRecipient& recipient);
|
|
|
|
void showOutOfSyncWarning(bool fShow);
|
|
|
|
private:
|
|
ClientModel *clientModel;
|
|
WalletModel *walletModel;
|
|
|
|
OverviewPage *overviewPage;
|
|
QWidget *transactionsPage;
|
|
ReceiveCoinsDialog *receiveCoinsPage;
|
|
SendCoinsDialog *sendCoinsPage;
|
|
AddressBookPage *usedSendingAddressesPage;
|
|
AddressBookPage *usedReceivingAddressesPage;
|
|
|
|
TransactionView *transactionView;
|
|
|
|
QProgressDialog* progressDialog{nullptr};
|
|
const PlatformStyle *platformStyle;
|
|
|
|
public Q_SLOTS:
|
|
/** Switch to overview (home) page */
|
|
void gotoOverviewPage();
|
|
/** Switch to history (transactions) page */
|
|
void gotoHistoryPage();
|
|
/** Switch to receive coins page */
|
|
void gotoReceiveCoinsPage();
|
|
/** Switch to send coins page */
|
|
void gotoSendCoinsPage(QString addr = "");
|
|
|
|
/** Show Sign/Verify Message dialog and switch to sign message tab */
|
|
void gotoSignMessageTab(QString addr = "");
|
|
/** Show Sign/Verify Message dialog and switch to verify message tab */
|
|
void gotoVerifyMessageTab(QString addr = "");
|
|
/** Load Partially Signed Bitcoin Transaction */
|
|
void gotoLoadPSBT();
|
|
|
|
/** Show incoming transaction notification for new transactions.
|
|
|
|
The new items are those between start and end inclusive, under the given parent item.
|
|
*/
|
|
void processNewTransaction(const QModelIndex& parent, int start, int /*end*/);
|
|
/** Encrypt the wallet */
|
|
void encryptWallet(bool status);
|
|
/** Backup the wallet */
|
|
void backupWallet();
|
|
/** Change encrypted wallet passphrase */
|
|
void changePassphrase();
|
|
/** Ask for passphrase to unlock wallet temporarily */
|
|
void unlockWallet();
|
|
|
|
/** Show used sending addresses */
|
|
void usedSendingAddresses();
|
|
/** Show used receiving addresses */
|
|
void usedReceivingAddresses();
|
|
|
|
/** Re-emit encryption status signal */
|
|
void updateEncryptionStatus();
|
|
|
|
/** Show progress dialog e.g. for rescan */
|
|
void showProgress(const QString &title, int nProgress);
|
|
|
|
/** User has requested more information about the out of sync state */
|
|
void requestedSyncWarningInfo();
|
|
|
|
Q_SIGNALS:
|
|
void transactionClicked();
|
|
void coinsSent();
|
|
/** Fired when a message should be reported to the user */
|
|
void message(const QString &title, const QString &message, unsigned int style);
|
|
/** Encryption status of wallet changed */
|
|
void encryptionStatusChanged();
|
|
/** HD-Enabled status of wallet changed (only possible during startup) */
|
|
void hdEnabledStatusChanged();
|
|
/** Notify that a new transaction appeared */
|
|
void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label, const QString& walletName);
|
|
/** Notify that the out of sync warning icon has been pressed */
|
|
void outOfSyncWarningClicked();
|
|
};
|
|
|
|
#endif // BITCOIN_QT_WALLETVIEW_H
|