Bitcoin ABC  0.26.3
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 CCoinControl;
16 class ClientModel;
17 class PlatformStyle;
18 class SendCoinsEntry;
19 class SendCoinsRecipient;
20 enum class SynchronizationState;
21 
22 namespace Ui {
23 class SendCoinsDialog;
24 }
25 
26 QT_BEGIN_NAMESPACE
27 class QUrl;
28 QT_END_NAMESPACE
29 
31 class SendCoinsDialog : public QDialog {
32  Q_OBJECT
33 
34 public:
36  QWidget *parent = nullptr);
38 
40  void setModel(WalletModel *model);
41 
47  QWidget *setupTabChain(QWidget *prev);
48 
49  void setAddress(const QString &address);
50  void pasteEntry(const SendCoinsRecipient &rv);
51  bool handlePaymentRequest(const SendCoinsRecipient &recipient);
52 
53 public Q_SLOTS:
54  void clear();
55  void reject() override;
56  void accept() override;
58  void updateTabsAndLabels();
59  void setBalance(const interfaces::WalletBalances &balances);
60 
61 Q_SIGNALS:
62  void coinsSent(const uint256 &txid);
63 
64 private:
65  Ui::SendCoinsDialog *ui;
68  std::unique_ptr<CCoinControl> m_coin_control;
69  std::unique_ptr<WalletModelTransaction> m_current_transaction;
73 
74  // Process WalletModel::SendCoinsReturn and generate a pair consisting of a
75  // message and message flags for use in Q_EMIT message().
76  // Additional parameter msgArg can be used via .arg(msgArg).
77  void
79  const QString &msgArg = QString());
80  void minimizeFeeSection(bool fMinimize);
81  // Format confirmation message
82  bool PrepareSendText(QString &question_string, QString &informative_text,
83  QString &detailed_text);
85  // Update the passed in CCoinControl with state from the GUI
87 
88 private Q_SLOTS:
89  void on_sendButton_clicked();
92  void removeEntry(SendCoinsEntry *entry);
94  void updateDisplayUnit();
95  void coinControlFeatureChanged(bool);
97  void coinControlChangeChecked(int);
98  void coinControlChangeEdited(const QString &);
108  void updateNumberOfBlocks(int count, const QDateTime &blockDate,
109  double nVerificationProgress, bool headers,
110  SynchronizationState sync_state);
111  void updateSmartFeeLabel();
112 
113 Q_SIGNALS:
114  // Fired when a message should be reported to the user
115  void message(const QString &title, const QString &message,
116  unsigned int style);
117 };
118 
119 #define SEND_CONFIRM_DELAY 3
120 
121 class SendConfirmationDialog : public QMessageBox {
122  Q_OBJECT
123 
124 public:
125  SendConfirmationDialog(const QString &title, const QString &text,
126  const QString &informative_text = "",
127  const QString &detailed_text = "",
129  const QString &confirmText = "Send",
130  QWidget *parent = nullptr);
131  int exec() override;
132 
133 private Q_SLOTS:
134  void countDown();
135  void updateYesButton();
136 
137 private:
138  QAbstractButton *yesButton;
140  int secDelay;
142 };
143 
144 #endif // BITCOIN_QT_SENDCOINSDIALOG_H
Coin Control Features.
Definition: coincontrol.h:21
Model for Bitcoin network client.
Definition: clientmodel.h:36
Dialog for sending bitcoins.
void useAvailableBalance(SendCoinsEntry *entry)
WalletModel * model
ClientModel * clientModel
void coinControlChangeEdited(const QString &)
void coinControlChangeChecked(int)
void coinControlClipboardFee()
void updateNumberOfBlocks(int count, const QDateTime &blockDate, double nVerificationProgress, bool headers, SynchronizationState sync_state)
Ui::SendCoinsDialog * ui
void on_buttonChooseFee_clicked()
void processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg=QString())
void setClientModel(ClientModel *clientModel)
void updateFeeSectionControls()
std::unique_ptr< CCoinControl > m_coin_control
SendCoinsEntry * addEntry()
void pasteEntry(const SendCoinsRecipient &rv)
void updateFeeMinimizedLabel()
void accept() override
const PlatformStyle * platformStyle
void coinControlClipboardQuantity()
void coinControlButtonClicked()
void coinControlClipboardAfterFee()
QWidget * setupTabChain(QWidget *prev)
Set up the tab chain manually, as Qt messes up the tab chain by default in some cases (issue https://...
bool PrepareSendText(QString &question_string, QString &informative_text, QString &detailed_text)
void setModel(WalletModel *model)
void coinControlClipboardLowOutput()
bool handlePaymentRequest(const SendCoinsRecipient &recipient)
SendCoinsDialog(const PlatformStyle *platformStyle, WalletModel *model, QWidget *parent=nullptr)
void setBalance(const interfaces::WalletBalances &balances)
void coinControlClipboardAmount()
void updateCoinControlState(CCoinControl &ctrl)
void setAddress(const QString &address)
void coinControlClipboardChange()
std::unique_ptr< WalletModelTransaction > m_current_transaction
void removeEntry(SendCoinsEntry *entry)
void reject() override
void coinControlClipboardBytes()
void message(const QString &title, const QString &message, unsigned int style)
void coinsSent(const uint256 &txid)
void on_buttonMinimizeFee_clicked()
void coinControlUpdateLabels()
void coinControlFeatureChanged(bool)
void minimizeFeeSection(bool fMinimize)
A single entry in the dialog for sending bitcoins.
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)
QAbstractButton * yesButton
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:47
256-bit opaque blob.
Definition: uint256.h:127
#define SEND_CONFIRM_DELAY
Collection of wallet balances.
Definition: wallet.h:351
static int count
Definition: tests.c:31
SynchronizationState
Current sync state passed to tip changed callbacks.
Definition: validation.h:127