1 // Copyright (c) 2011-2017 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.
5 #ifndef BITCOIN_QT_SENDCOINSDIALOG_H
6 #define BITCOIN_QT_SENDCOINSDIALOG_H
8 #include <qt/walletmodel.h>
11 #include <QMessageBox>
18 class SendCoinsRecipient
;
21 class SendCoinsDialog
;
28 /** Dialog for sending bitcoins */
29 class SendCoinsDialog
: public QDialog
34 explicit SendCoinsDialog(const PlatformStyle
*platformStyle
, QWidget
*parent
= 0);
37 void setClientModel(ClientModel
*clientModel
);
38 void setModel(WalletModel
*model
);
40 /** Set up the tab chain manually, as Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907).
42 QWidget
*setupTabChain(QWidget
*prev
);
44 void setAddress(const QString
&address
);
45 void pasteEntry(const SendCoinsRecipient
&rv
);
46 bool handlePaymentRequest(const SendCoinsRecipient
&recipient
);
52 SendCoinsEntry
*addEntry();
53 void updateTabsAndLabels();
54 void setBalance(const CAmount
& balance
, const CAmount
& unconfirmedBalance
, const CAmount
& immatureBalance
,
55 const CAmount
& watchOnlyBalance
, const CAmount
& watchUnconfBalance
, const CAmount
& watchImmatureBalance
);
58 Ui::SendCoinsDialog
*ui
;
59 ClientModel
*clientModel
;
61 bool fNewRecipientAllowed
;
63 const PlatformStyle
*platformStyle
;
65 // Process WalletModel::SendCoinsReturn and generate a pair consisting
66 // of a message and message flags for use in Q_EMIT message().
67 // Additional parameter msgArg can be used via .arg(msgArg).
68 void processSendCoinsReturn(const WalletModel::SendCoinsReturn
&sendCoinsReturn
, const QString
&msgArg
= QString());
69 void minimizeFeeSection(bool fMinimize
);
70 void updateFeeMinimizedLabel();
71 // Update the passed in CCoinControl with state from the GUI
72 void updateCoinControlState(CCoinControl
& ctrl
);
75 void on_sendButton_clicked();
76 void on_buttonChooseFee_clicked();
77 void on_buttonMinimizeFee_clicked();
78 void removeEntry(SendCoinsEntry
* entry
);
79 void useAvailableBalance(SendCoinsEntry
* entry
);
80 void updateDisplayUnit();
81 void coinControlFeatureChanged(bool);
82 void coinControlButtonClicked();
83 void coinControlChangeChecked(int);
84 void coinControlChangeEdited(const QString
&);
85 void coinControlUpdateLabels();
86 void coinControlClipboardQuantity();
87 void coinControlClipboardAmount();
88 void coinControlClipboardFee();
89 void coinControlClipboardAfterFee();
90 void coinControlClipboardBytes();
91 void coinControlClipboardLowOutput();
92 void coinControlClipboardChange();
94 void updateFeeSectionControls();
95 void updateMinFeeLabel();
96 void updateSmartFeeLabel();
99 // Fired when a message should be reported to the user
100 void message(const QString
&title
, const QString
&message
, unsigned int style
);
104 #define SEND_CONFIRM_DELAY 3
106 class SendConfirmationDialog
: public QMessageBox
111 SendConfirmationDialog(const QString
&title
, const QString
&text
, int secDelay
= SEND_CONFIRM_DELAY
, QWidget
*parent
= 0);
116 void updateYesButton();
119 QAbstractButton
*yesButton
;
120 QTimer countDownTimer
;
124 #endif // BITCOIN_QT_SENDCOINSDIALOG_H