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