Bitcoin Core  0.20.99
P2P Digital Currency
sendcoinsdialog.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2019 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_QT_SENDCOINSDIALOG_H
6 #define BITCOIN_QT_SENDCOINSDIALOG_H
7 
8 #include <qt/walletmodel.h>
9 
10 #include <QDialog>
11 #include <QMessageBox>
12 #include <QString>
13 #include <QTimer>
14 
15 class CCoinControl;
16 class ClientModel;
17 class PlatformStyle;
18 class SendCoinsEntry;
19 class SendCoinsRecipient;
20 
21 namespace Ui {
22  class SendCoinsDialog;
23 }
24 
25 QT_BEGIN_NAMESPACE
26 class QUrl;
27 QT_END_NAMESPACE
28 
30 class SendCoinsDialog : public QDialog
31 {
32  Q_OBJECT
33 
34 public:
35  explicit SendCoinsDialog(const PlatformStyle *platformStyle, QWidget *parent = nullptr);
36  ~SendCoinsDialog();
37 
38  void setClientModel(ClientModel *clientModel);
39  void setModel(WalletModel *model);
40 
43  QWidget *setupTabChain(QWidget *prev);
44 
45  void setAddress(const QString &address);
46  void pasteEntry(const SendCoinsRecipient &rv);
47  bool handlePaymentRequest(const SendCoinsRecipient &recipient);
48 
49 public Q_SLOTS:
50  void clear();
51  void reject() override;
52  void accept() override;
53  SendCoinsEntry *addEntry();
54  void updateTabsAndLabels();
55  void setBalance(const interfaces::WalletBalances& balances);
56 
57 Q_SIGNALS:
58  void coinsSent(const uint256& txid);
59 
60 private:
61  Ui::SendCoinsDialog *ui;
64  std::unique_ptr<CCoinControl> m_coin_control;
65  std::unique_ptr<WalletModelTransaction> m_current_transaction;
69 
70  // Process WalletModel::SendCoinsReturn and generate a pair consisting
71  // of a message and message flags for use in Q_EMIT message().
72  // Additional parameter msgArg can be used via .arg(msgArg).
73  void processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg = QString());
74  void minimizeFeeSection(bool fMinimize);
75  // Format confirmation message
76  bool PrepareSendText(QString& question_string, QString& informative_text, QString& detailed_text);
77  void updateFeeMinimizedLabel();
78  // Update the passed in CCoinControl with state from the GUI
79  void updateCoinControlState(CCoinControl& ctrl);
80 
81 private Q_SLOTS:
82  void on_sendButton_clicked();
83  void on_buttonChooseFee_clicked();
84  void on_buttonMinimizeFee_clicked();
85  void removeEntry(SendCoinsEntry* entry);
86  void useAvailableBalance(SendCoinsEntry* entry);
87  void updateDisplayUnit();
88  void coinControlFeatureChanged(bool);
89  void coinControlButtonClicked();
90  void coinControlChangeChecked(int);
91  void coinControlChangeEdited(const QString &);
92  void coinControlUpdateLabels();
93  void coinControlClipboardQuantity();
94  void coinControlClipboardAmount();
95  void coinControlClipboardFee();
96  void coinControlClipboardAfterFee();
97  void coinControlClipboardBytes();
98  void coinControlClipboardLowOutput();
99  void coinControlClipboardChange();
100  void updateFeeSectionControls();
101  void updateSmartFeeLabel();
102 
103 Q_SIGNALS:
104  // Fired when a message should be reported to the user
105  void message(const QString &title, const QString &message, unsigned int style);
106 };
107 
108 
109 #define SEND_CONFIRM_DELAY 3
110 
111 class SendConfirmationDialog : public QMessageBox
112 {
113  Q_OBJECT
114 
115 public:
116  SendConfirmationDialog(const QString& title, const QString& text, const QString& informative_text = "", const QString& detailed_text = "", int secDelay = SEND_CONFIRM_DELAY, const QString& confirmText = "Send", QWidget* parent = nullptr);
117  int exec() override;
118 
119 private Q_SLOTS:
120  void countDown();
121  void updateYesButton();
122 
123 private:
124  QAbstractButton *yesButton;
126  int secDelay;
128 };
129 
130 #endif // BITCOIN_QT_SENDCOINSDIALOG_H
#define SEND_CONFIRM_DELAY
A single entry in the dialog for sending bitcoins.
Coin Control Features.
Definition: coincontrol.h:22
disconnectpool queuedTx clear()
std::unique_ptr< WalletModelTransaction > m_current_transaction
Ui::SendCoinsDialog * ui
Collection of wallet balances.
Definition: wallet.h:321
ClientModel * clientModel
WalletModel * model
Dialog for sending bitcoins.
Model for Bitcoin network client.
Definition: clientmodel.h:46
256-bit opaque blob.
Definition: uint256.h:120
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:51
const PlatformStyle * platformStyle
std::unique_ptr< CCoinControl > m_coin_control
QAbstractButton * yesButton