Bitcoin ABC  0.24.7
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
SendCoinsDialog::coinControlClipboardAmount
void coinControlClipboardAmount()
Definition: sendcoinsdialog.cpp:825
SendCoinsDialog::on_buttonChooseFee_clicked
void on_buttonChooseFee_clicked()
Definition: sendcoinsdialog.cpp:715
SendCoinsDialog::updateCoinControlState
void updateCoinControlState(CCoinControl &ctrl)
Definition: sendcoinsdialog.cpp:771
SendCoinsDialog::fNewRecipientAllowed
bool fNewRecipientAllowed
Definition: sendcoinsdialog.h:70
count
static int count
Definition: tests.c:41
SendConfirmationDialog
Definition: sendcoinsdialog.h:121
SendCoinsDialog::coinsSent
void coinsSent(const uint256 &txid)
WalletModel
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:47
SEND_CONFIRM_DELAY
#define SEND_CONFIRM_DELAY
Definition: sendcoinsdialog.h:119
walletmodel.h
CCoinControl
Coin Control Features.
Definition: coincontrol.h:21
SendCoinsDialog::updateNumberOfBlocks
void updateNumberOfBlocks(int count, const QDateTime &blockDate, double nVerificationProgress, bool headers, SynchronizationState sync_state)
Definition: sendcoinsdialog.cpp:781
SendCoinsDialog::coinControlFeatureChanged
void coinControlFeatureChanged(bool)
Definition: sendcoinsdialog.cpp:866
SendCoinsDialog::coinControlButtonClicked
void coinControlButtonClicked()
Definition: sendcoinsdialog.cpp:878
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="Send", QWidget *parent=nullptr)
Definition: sendcoinsdialog.cpp:995
SendCoinsDialog::on_sendButton_clicked
void on_sendButton_clicked()
Definition: sendcoinsdialog.cpp:394
SendCoinsDialog::addEntry
SendCoinsEntry * addEntry()
Definition: sendcoinsdialog.cpp:529
SendCoinsDialog::useAvailableBalance
void useAvailableBalance(SendCoinsEntry *entry)
Definition: sendcoinsdialog.cpp:724
SendCoinsDialog::~SendCoinsDialog
~SendCoinsDialog()
Definition: sendcoinsdialog.cpp:212
SendCoinsDialog::clientModel
ClientModel * clientModel
Definition: sendcoinsdialog.h:66
SendCoinsDialog::updateDisplayUnit
void updateDisplayUnit()
Definition: sendcoinsdialog.cpp:645
SendCoinsDialog::coinControlClipboardAfterFee
void coinControlClipboardAfterFee()
Definition: sendcoinsdialog.cpp:839
SendCoinsRecipient
Definition: sendcoinsrecipient.h:23
SendCoinsDialog::updateFeeMinimizedLabel
void updateFeeMinimizedLabel()
Definition: sendcoinsdialog.cpp:755
interfaces::WalletBalances
Collection of wallet balances.
Definition: wallet.h:351
SendConfirmationDialog::confirmButtonText
QString confirmButtonText
Definition: sendcoinsdialog.h:141
SendCoinsDialog::handlePaymentRequest
bool handlePaymentRequest(const SendCoinsRecipient &recipient)
Definition: sendcoinsdialog.cpp:627
SendCoinsDialog::m_current_transaction
std::unique_ptr< WalletModelTransaction > m_current_transaction
Definition: sendcoinsdialog.h:69
SendCoinsDialog
Dialog for sending bitcoins.
Definition: sendcoinsdialog.h:31
SendConfirmationDialog::secDelay
int secDelay
Definition: sendcoinsdialog.h:140
SendCoinsDialog::minimizeFeeSection
void minimizeFeeSection(bool fMinimize)
Definition: sendcoinsdialog.cpp:705
SendCoinsDialog::setBalance
void setBalance(const interfaces::WalletBalances &balances)
Definition: sendcoinsdialog.cpp:633
SendCoinsDialog::setAddress
void setAddress(const QString &address)
Definition: sendcoinsdialog.cpp:588
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:574
uint256
256-bit opaque blob.
Definition: uint256.h:127
SendCoinsDialog::platformStyle
const PlatformStyle * platformStyle
Definition: sendcoinsdialog.h:72
SendCoinsDialog::PrepareSendText
bool PrepareSendText(QString &question_string, QString &informative_text, QString &detailed_text)
Definition: sendcoinsdialog.cpp:222
SendCoinsDialog::coinControlClipboardBytes
void coinControlClipboardBytes()
Definition: sendcoinsdialog.cpp:847
SendCoinsDialog::ui
Ui::SendCoinsDialog * ui
Definition: sendcoinsdialog.h:65
SendCoinsDialog::updateTabsAndLabels
void updateTabsAndLabels()
Definition: sendcoinsdialog.cpp:556
SendCoinsDialog::m_coin_control
std::unique_ptr< CCoinControl > m_coin_control
Definition: sendcoinsdialog.h:68
SendCoinsDialog::coinControlClipboardChange
void coinControlClipboardChange()
Definition: sendcoinsdialog.cpp:858
ClientModel
Model for Bitcoin network client.
Definition: clientmodel.h:36
Ui
Definition: addressbookpage.h:14
SendConfirmationDialog::countDown
void countDown()
Definition: sendcoinsdialog.cpp:1022
SendCoinsDialog::pasteEntry
void pasteEntry(const SendCoinsRecipient &rv)
Definition: sendcoinsdialog.cpp:605
SendConfirmationDialog::exec
int exec() override
Definition: sendcoinsdialog.cpp:1016
SendCoinsDialog::model
WalletModel * model
Definition: sendcoinsdialog.h:67
SendCoinsDialog::setClientModel
void setClientModel(ClientModel *clientModel)
Definition: sendcoinsdialog.cpp:137
SendCoinsDialog::coinControlClipboardLowOutput
void coinControlClipboardLowOutput()
Definition: sendcoinsdialog.cpp:853
SendConfirmationDialog::updateYesButton
void updateYesButton()
Definition: sendcoinsdialog.cpp:1031
SendCoinsDialog::setModel
void setModel(WalletModel *model)
Definition: sendcoinsdialog.cpp:146
SendCoinsDialog::SendCoinsDialog
SendCoinsDialog(const PlatformStyle *platformStyle, WalletModel *model, QWidget *parent=nullptr)
Definition: sendcoinsdialog.cpp:35
SendConfirmationDialog::yesButton
QAbstractButton * yesButton
Definition: sendcoinsdialog.h:138
SendCoinsDialog::coinControlChangeChecked
void coinControlChangeChecked(int)
Definition: sendcoinsdialog.cpp:885
WalletModel::SendCoinsReturn
Definition: walletmodel.h:91
SendCoinsDialog::message
void message(const QString &title, const QString &message, unsigned int style)
SendCoinsDialog::updateFeeSectionControls
void updateFeeSectionControls()
Definition: sendcoinsdialog.cpp:746
SendCoinsDialog::coinControlClipboardFee
void coinControlClipboardFee()
Definition: sendcoinsdialog.cpp:831
SendCoinsDialog::coinControlChangeEdited
void coinControlChangeEdited(const QString &)
Definition: sendcoinsdialog.cpp:898
SendCoinsEntry
A single entry in the dialog for sending bitcoins.
Definition: sendcoinsentry.h:28
SendCoinsDialog::coinControlUpdateLabels
void coinControlUpdateLabels()
Definition: sendcoinsdialog.cpp:958
SendCoinsDialog::removeEntry
void removeEntry(SendCoinsEntry *entry)
Definition: sendcoinsdialog.cpp:561
SendCoinsDialog::fFeeMinimized
bool fFeeMinimized
Definition: sendcoinsdialog.h:71
SynchronizationState
SynchronizationState
Current sync state passed to tip changed callbacks.
Definition: validation.h:130
SendCoinsDialog::clear
void clear()
Definition: sendcoinsdialog.cpp:503
SendCoinsDialog::accept
void accept() override
Definition: sendcoinsdialog.cpp:525
PlatformStyle
Definition: platformstyle.h:13
SendCoinsDialog::processSendCoinsReturn
void processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg=QString())
Definition: sendcoinsdialog.cpp:651
SendCoinsDialog::updateSmartFeeLabel
void updateSmartFeeLabel()
Definition: sendcoinsdialog.cpp:791
SendCoinsDialog::coinControlClipboardQuantity
void coinControlClipboardQuantity()
Definition: sendcoinsdialog.cpp:820
SendCoinsDialog::on_buttonMinimizeFee_clicked
void on_buttonMinimizeFee_clicked()
Definition: sendcoinsdialog.cpp:719
SendConfirmationDialog::countDownTimer
QTimer countDownTimer
Definition: sendcoinsdialog.h:139
SendCoinsDialog::reject
void reject() override
Definition: sendcoinsdialog.cpp:521