Bitcoin Core  22.99.0
P2P Digital Currency
sendcoinsdialog.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2020 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 {
33  Q_OBJECT
34 
35 public:
36  explicit SendCoinsDialog(const PlatformStyle *platformStyle, QWidget *parent = nullptr);
38 
40  void setModel(WalletModel *model);
41 
44  QWidget *setupTabChain(QWidget *prev);
45 
46  void setAddress(const QString &address);
47  void pasteEntry(const SendCoinsRecipient &rv);
48  bool handlePaymentRequest(const SendCoinsRecipient &recipient);
49 
50 public Q_SLOTS:
51  void clear();
52  void reject() override;
53  void accept() override;
55  void updateTabsAndLabels();
56  void setBalance(const interfaces::WalletBalances& balances);
57 
58 Q_SIGNALS:
59  void coinsSent(const uint256& txid);
60 
61 private:
62  Ui::SendCoinsDialog *ui;
65  std::unique_ptr<CCoinControl> m_coin_control;
66  std::unique_ptr<WalletModelTransaction> m_current_transaction;
70 
71  // Process WalletModel::SendCoinsReturn and generate a pair consisting
72  // of a message and message flags for use in Q_EMIT message().
73  // Additional parameter msgArg can be used via .arg(msgArg).
74  void processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg = QString());
75  void minimizeFeeSection(bool fMinimize);
76  // Format confirmation message
77  bool PrepareSendText(QString& question_string, QString& informative_text, QString& detailed_text);
80 
81 private Q_SLOTS:
82  void sendButtonClicked(bool checked);
85  void removeEntry(SendCoinsEntry* entry);
87  void updateDisplayUnit();
88  void coinControlFeatureChanged(bool);
90  void coinControlChangeChecked(int);
91  void coinControlChangeEdited(const QString &);
101  void updateNumberOfBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool headers, SynchronizationState sync_state);
102  void updateSmartFeeLabel();
103 
104 Q_SIGNALS:
105  // Fired when a message should be reported to the user
106  void message(const QString &title, const QString &message, unsigned int style);
107 };
108 
109 
110 #define SEND_CONFIRM_DELAY 3
111 
112 class SendConfirmationDialog : public QMessageBox
113 {
114  Q_OBJECT
115 
116 public:
117  SendConfirmationDialog(const QString& title, const QString& text, const QString& informative_text = "", const QString& detailed_text = "", int secDelay = SEND_CONFIRM_DELAY, const QString& confirmText = "", QWidget* parent = nullptr);
118  int exec() override;
119 
120 private Q_SLOTS:
121  void countDown();
122  void updateYesButton();
123 
124 private:
125  QAbstractButton *yesButton;
127  int secDelay;
129 };
130 
131 #endif // BITCOIN_QT_SENDCOINSDIALOG_H
SendCoinsDialog::coinControlClipboardAmount
void coinControlClipboardAmount()
Definition: sendcoinsdialog.cpp:867
SendCoinsDialog::on_buttonChooseFee_clicked
void on_buttonChooseFee_clicked()
Definition: sendcoinsdialog.cpp:751
SendCoinsDialog::fNewRecipientAllowed
bool fNewRecipientAllowed
Definition: sendcoinsdialog.h:67
count
static int count
Definition: tests.c:41
SendConfirmationDialog
Definition: sendcoinsdialog.h:112
SendCoinsDialog::coinsSent
void coinsSent(const uint256 &txid)
WalletModel
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:51
SEND_CONFIRM_DELAY
#define SEND_CONFIRM_DELAY
Definition: sendcoinsdialog.h:110
walletmodel.h
CCoinControl
Coin Control Features.
Definition: coincontrol.h:23
SendCoinsDialog::updateNumberOfBlocks
void updateNumberOfBlocks(int count, const QDateTime &blockDate, double nVerificationProgress, bool headers, SynchronizationState sync_state)
Definition: sendcoinsdialog.cpp:823
SendCoinsDialog::coinControlFeatureChanged
void coinControlFeatureChanged(bool)
Definition: sendcoinsdialog.cpp:903
SendCoinsDialog::coinControlButtonClicked
void coinControlButtonClicked()
Definition: sendcoinsdialog.cpp:915
SendCoinsDialog::updateCoinControlState
void updateCoinControlState()
Definition: sendcoinsdialog.cpp:808
SendCoinsDialog::addEntry
SendCoinsEntry * addEntry()
Definition: sendcoinsdialog.cpp:564
SendCoinsDialog::useAvailableBalance
void useAvailableBalance(SendCoinsEntry *entry)
Definition: sendcoinsdialog.cpp:762
SendCoinsDialog::~SendCoinsDialog
~SendCoinsDialog()
Definition: sendcoinsdialog.cpp:234
SendCoinsDialog::clientModel
ClientModel * clientModel
Definition: sendcoinsdialog.h:63
SendCoinsDialog::updateDisplayUnit
void updateDisplayUnit()
Definition: sendcoinsdialog.cpp:689
SendCoinsDialog::sendButtonClicked
void sendButtonClicked(bool checked)
Definition: sendcoinsdialog.cpp:391
SendCoinsDialog::coinControlClipboardAfterFee
void coinControlClipboardAfterFee()
Definition: sendcoinsdialog.cpp:879
SendCoinsRecipient
Definition: sendcoinsrecipient.h:19
SendCoinsDialog::updateFeeMinimizedLabel
void updateFeeMinimizedLabel()
Definition: sendcoinsdialog.cpp:796
interfaces::WalletBalances
Collection of wallet balances.
Definition: wallet.h:352
SendConfirmationDialog::confirmButtonText
QString confirmButtonText
Definition: sendcoinsdialog.h:128
SendCoinsDialog::handlePaymentRequest
bool handlePaymentRequest(const SendCoinsRecipient &recipient)
Definition: sendcoinsdialog.cpp:666
SendCoinsDialog::m_current_transaction
std::unique_ptr< WalletModelTransaction > m_current_transaction
Definition: sendcoinsdialog.h:66
SendCoinsDialog
Dialog for sending bitcoins.
Definition: sendcoinsdialog.h:31
SendConfirmationDialog::secDelay
int secDelay
Definition: sendcoinsdialog.h:127
SendCoinsDialog::minimizeFeeSection
void minimizeFeeSection(bool fMinimize)
Definition: sendcoinsdialog.cpp:741
SendCoinsDialog::setBalance
void setBalance(const interfaces::WalletBalances &balances)
Definition: sendcoinsdialog.cpp:674
SendCoinsDialog::setAddress
void setAddress(const QString &address)
Definition: sendcoinsdialog.cpp:622
SendCoinsDialog::setupTabChain
QWidget * setupTabChain(QWidget *prev)
Set up the tab chain manually, as Qt messes up the tab chain by default in some cases (issue https://...
Definition: sendcoinsdialog.cpp:606
uint256
256-bit opaque blob.
Definition: uint256.h:124
SendCoinsDialog::platformStyle
const PlatformStyle * platformStyle
Definition: sendcoinsdialog.h:69
SendCoinsDialog::PrepareSendText
bool PrepareSendText(QString &question_string, QString &informative_text, QString &detailed_text)
Definition: sendcoinsdialog.cpp:245
SendCoinsDialog::coinControlClipboardBytes
void coinControlClipboardBytes()
Definition: sendcoinsdialog.cpp:885
SendCoinsDialog::ui
Ui::SendCoinsDialog * ui
Definition: sendcoinsdialog.h:62
SendCoinsDialog::updateTabsAndLabels
void updateTabsAndLabels()
Definition: sendcoinsdialog.cpp:587
SendCoinsDialog::m_coin_control
std::unique_ptr< CCoinControl > m_coin_control
Definition: sendcoinsdialog.h:65
SendCoinsDialog::coinControlClipboardChange
void coinControlClipboardChange()
Definition: sendcoinsdialog.cpp:897
ClientModel
Model for Bitcoin network client.
Definition: clientmodel.h:47
Ui
Definition: addressbookpage.h:14
SendConfirmationDialog::countDown
void countDown()
Definition: sendcoinsdialog.cpp:1058
SendCoinsDialog::pasteEntry
void pasteEntry(const SendCoinsRecipient &rv)
Definition: sendcoinsdialog.cpp:642
SendConfirmationDialog::exec
int exec() override
Definition: sendcoinsdialog.cpp:1051
SendCoinsDialog::model
WalletModel * model
Definition: sendcoinsdialog.h:64
SendCoinsDialog::SendCoinsDialog
SendCoinsDialog(const PlatformStyle *platformStyle, QWidget *parent=nullptr)
Definition: sendcoinsdialog.cpp:57
SendCoinsDialog::setClientModel
void setClientModel(ClientModel *clientModel)
Definition: sendcoinsdialog.cpp:136
SendCoinsDialog::coinControlClipboardLowOutput
void coinControlClipboardLowOutput()
Definition: sendcoinsdialog.cpp:891
SendConfirmationDialog::updateYesButton
void updateYesButton()
Definition: sendcoinsdialog.cpp:1069
SendCoinsDialog::setModel
void setModel(WalletModel *model)
Definition: sendcoinsdialog.cpp:145
SendConfirmationDialog::yesButton
QAbstractButton * yesButton
Definition: sendcoinsdialog.h:125
SendCoinsDialog::coinControlChangeChecked
void coinControlChangeChecked(int)
Definition: sendcoinsdialog.cpp:923
WalletModel::SendCoinsReturn
Definition: walletmodel.h:90
SendCoinsDialog::message
void message(const QString &title, const QString &message, unsigned int style)
SendCoinsDialog::updateFeeSectionControls
void updateFeeSectionControls()
Definition: sendcoinsdialog.cpp:784
SendCoinsDialog::coinControlClipboardFee
void coinControlClipboardFee()
Definition: sendcoinsdialog.cpp:873
SendCoinsDialog::coinControlChangeEdited
void coinControlChangeEdited(const QString &)
Definition: sendcoinsdialog.cpp:938
SendCoinsEntry
A single entry in the dialog for sending bitcoins.
Definition: sendcoinsentry.h:28
SendCoinsDialog::coinControlUpdateLabels
void coinControlUpdateLabels()
Definition: sendcoinsdialog.cpp:992
SendCoinsDialog::removeEntry
void removeEntry(SendCoinsEntry *entry)
Definition: sendcoinsdialog.cpp:593
SendCoinsDialog::fFeeMinimized
bool fFeeMinimized
Definition: sendcoinsdialog.h:68
SynchronizationState
SynchronizationState
Current sync state passed to tip changed callbacks.
Definition: validation.h:102
SendCoinsDialog::clear
void clear()
Definition: sendcoinsdialog.cpp:534
SendCoinsDialog::accept
void accept() override
Definition: sendcoinsdialog.cpp:559
PlatformStyle
Definition: platformstyle.h:13
SendCoinsDialog::processSendCoinsReturn
void processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg=QString())
Definition: sendcoinsdialog.cpp:696
SendCoinsDialog::updateSmartFeeLabel
void updateSmartFeeLabel()
Definition: sendcoinsdialog.cpp:829
SendConfirmationDialog::SendConfirmationDialog
SendConfirmationDialog(const QString &title, const QString &text, const QString &informative_text="", const QString &detailed_text="", int secDelay=SEND_CONFIRM_DELAY, const QString &confirmText="", QWidget *parent=nullptr)
Definition: sendcoinsdialog.cpp:1033
SendCoinsDialog::coinControlClipboardQuantity
void coinControlClipboardQuantity()
Definition: sendcoinsdialog.cpp:861
SendCoinsDialog::on_buttonMinimizeFee_clicked
void on_buttonMinimizeFee_clicked()
Definition: sendcoinsdialog.cpp:756
SendConfirmationDialog::countDownTimer
QTimer countDownTimer
Definition: sendcoinsdialog.h:126
SendCoinsDialog::reject
void reject() override
Definition: sendcoinsdialog.cpp:554