Bitcoin Core  21.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);
79  // Update the passed in CCoinControl with state from the GUI
81 
82 private Q_SLOTS:
83  void sendButtonClicked(bool checked);
86  void removeEntry(SendCoinsEntry* entry);
88  void updateDisplayUnit();
89  void coinControlFeatureChanged(bool);
91  void coinControlChangeChecked(int);
92  void coinControlChangeEdited(const QString &);
102  void updateNumberOfBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool headers, SynchronizationState sync_state);
103  void updateSmartFeeLabel();
104 
105 Q_SIGNALS:
106  // Fired when a message should be reported to the user
107  void message(const QString &title, const QString &message, unsigned int style);
108 };
109 
110 
111 #define SEND_CONFIRM_DELAY 3
112 
113 class SendConfirmationDialog : public QMessageBox
114 {
115  Q_OBJECT
116 
117 public:
118  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);
119  int exec() override;
120 
121 private Q_SLOTS:
122  void countDown();
123  void updateYesButton();
124 
125 private:
126  QAbstractButton *yesButton;
128  int secDelay;
130 };
131 
132 #endif // BITCOIN_QT_SENDCOINSDIALOG_H
SendCoinsDialog::coinControlClipboardAmount
void coinControlClipboardAmount()
Definition: sendcoinsdialog.cpp:802
SendCoinsDialog::on_buttonChooseFee_clicked
void on_buttonChooseFee_clicked()
Definition: sendcoinsdialog.cpp:686
SendCoinsDialog::updateCoinControlState
void updateCoinControlState(CCoinControl &ctrl)
Definition: sendcoinsdialog.cpp:743
SendCoinsDialog::fNewRecipientAllowed
bool fNewRecipientAllowed
Definition: sendcoinsdialog.h:67
count
static int count
Definition: tests.c:35
SendConfirmationDialog
Definition: sendcoinsdialog.h:113
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:111
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:758
SendCoinsDialog::coinControlFeatureChanged
void coinControlFeatureChanged(bool)
Definition: sendcoinsdialog.cpp:838
SendCoinsDialog::coinControlButtonClicked
void coinControlButtonClicked()
Definition: sendcoinsdialog.cpp:849
SendCoinsDialog::addEntry
SendCoinsEntry * addEntry()
Definition: sendcoinsdialog.cpp:501
SendCoinsDialog::useAvailableBalance
void useAvailableBalance(SendCoinsEntry *entry)
Definition: sendcoinsdialog.cpp:697
SendCoinsDialog::~SendCoinsDialog
~SendCoinsDialog()
Definition: sendcoinsdialog.cpp:223
SendCoinsDialog::clientModel
ClientModel * clientModel
Definition: sendcoinsdialog.h:63
SendCoinsDialog::updateDisplayUnit
void updateDisplayUnit()
Definition: sendcoinsdialog.cpp:624
SendCoinsDialog::sendButtonClicked
void sendButtonClicked(bool checked)
Definition: sendcoinsdialog.cpp:380
SendCoinsDialog::coinControlClipboardAfterFee
void coinControlClipboardAfterFee()
Definition: sendcoinsdialog.cpp:814
SendCoinsRecipient
Definition: sendcoinsrecipient.h:19
SendCoinsDialog::updateFeeMinimizedLabel
void updateFeeMinimizedLabel()
Definition: sendcoinsdialog.cpp:731
interfaces::WalletBalances
Collection of wallet balances.
Definition: wallet.h:349
SendConfirmationDialog::confirmButtonText
QString confirmButtonText
Definition: sendcoinsdialog.h:129
SendCoinsDialog::handlePaymentRequest
bool handlePaymentRequest(const SendCoinsRecipient &recipient)
Definition: sendcoinsdialog.cpp:603
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:128
SendCoinsDialog::minimizeFeeSection
void minimizeFeeSection(bool fMinimize)
Definition: sendcoinsdialog.cpp:676
SendCoinsDialog::setBalance
void setBalance(const interfaces::WalletBalances &balances)
Definition: sendcoinsdialog.cpp:611
SendCoinsDialog::setAddress
void setAddress(const QString &address)
Definition: sendcoinsdialog.cpp:559
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:543
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:234
SendCoinsDialog::coinControlClipboardBytes
void coinControlClipboardBytes()
Definition: sendcoinsdialog.cpp:820
SendCoinsDialog::ui
Ui::SendCoinsDialog * ui
Definition: sendcoinsdialog.h:62
SendCoinsDialog::updateTabsAndLabels
void updateTabsAndLabels()
Definition: sendcoinsdialog.cpp:524
SendCoinsDialog::m_coin_control
std::unique_ptr< CCoinControl > m_coin_control
Definition: sendcoinsdialog.h:65
SendCoinsDialog::coinControlClipboardChange
void coinControlClipboardChange()
Definition: sendcoinsdialog.cpp:832
ClientModel
Model for Bitcoin network client.
Definition: clientmodel.h:46
Ui
Definition: addressbookpage.h:14
SendConfirmationDialog::countDown
void countDown()
Definition: sendcoinsdialog.cpp:992
SendCoinsDialog::pasteEntry
void pasteEntry(const SendCoinsRecipient &rv)
Definition: sendcoinsdialog.cpp:579
SendConfirmationDialog::exec
int exec() override
Definition: sendcoinsdialog.cpp:985
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:826
SendConfirmationDialog::updateYesButton
void updateYesButton()
Definition: sendcoinsdialog.cpp:1003
SendCoinsDialog::setModel
void setModel(WalletModel *model)
Definition: sendcoinsdialog.cpp:145
SendConfirmationDialog::yesButton
QAbstractButton * yesButton
Definition: sendcoinsdialog.h:126
SendCoinsDialog::coinControlChangeChecked
void coinControlChangeChecked(int)
Definition: sendcoinsdialog.cpp:857
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:719
SendCoinsDialog::coinControlClipboardFee
void coinControlClipboardFee()
Definition: sendcoinsdialog.cpp:808
SendCoinsDialog::coinControlChangeEdited
void coinControlChangeEdited(const QString &)
Definition: sendcoinsdialog.cpp:872
SendCoinsEntry
A single entry in the dialog for sending bitcoins.
Definition: sendcoinsentry.h:28
SendCoinsDialog::coinControlUpdateLabels
void coinControlUpdateLabels()
Definition: sendcoinsdialog.cpp:926
SendCoinsDialog::removeEntry
void removeEntry(SendCoinsEntry *entry)
Definition: sendcoinsdialog.cpp:530
SendCoinsDialog::fFeeMinimized
bool fFeeMinimized
Definition: sendcoinsdialog.h:68
SynchronizationState
SynchronizationState
Current sync state passed to tip changed callbacks.
Definition: validation.h:104
SendCoinsDialog::clear
void clear()
Definition: sendcoinsdialog.cpp:471
SendCoinsDialog::accept
void accept() override
Definition: sendcoinsdialog.cpp:496
PlatformStyle
Definition: platformstyle.h:13
SendCoinsDialog::processSendCoinsReturn
void processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg=QString())
Definition: sendcoinsdialog.cpp:631
SendCoinsDialog::updateSmartFeeLabel
void updateSmartFeeLabel()
Definition: sendcoinsdialog.cpp:764
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:967
SendCoinsDialog::coinControlClipboardQuantity
void coinControlClipboardQuantity()
Definition: sendcoinsdialog.cpp:796
SendCoinsDialog::on_buttonMinimizeFee_clicked
void on_buttonMinimizeFee_clicked()
Definition: sendcoinsdialog.cpp:691
SendConfirmationDialog::countDownTimer
QTimer countDownTimer
Definition: sendcoinsdialog.h:127
SendCoinsDialog::reject
void reject() override
Definition: sendcoinsdialog.cpp:491