Merge #12079: Improve prioritisetransaction test coverage
[bitcoinplatinum.git] / src / qt / sendcoinsdialog.h
blob7c27785d12e82ef50bc6798e501151ee4cca6eb1
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>
10 #include <QDialog>
11 #include <QMessageBox>
12 #include <QString>
13 #include <QTimer>
15 class ClientModel;
16 class PlatformStyle;
17 class SendCoinsEntry;
18 class SendCoinsRecipient;
20 namespace Ui {
21 class SendCoinsDialog;
24 QT_BEGIN_NAMESPACE
25 class QUrl;
26 QT_END_NAMESPACE
28 /** Dialog for sending bitcoins */
29 class SendCoinsDialog : public QDialog
31 Q_OBJECT
33 public:
34 explicit SendCoinsDialog(const PlatformStyle *platformStyle, QWidget *parent = 0);
35 ~SendCoinsDialog();
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);
48 public Q_SLOTS:
49 void clear();
50 void reject();
51 void accept();
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);
57 private:
58 Ui::SendCoinsDialog *ui;
59 ClientModel *clientModel;
60 WalletModel *model;
61 bool fNewRecipientAllowed;
62 bool fFeeMinimized;
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);
74 private Q_SLOTS:
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();
93 void setMinimumFee();
94 void updateFeeSectionControls();
95 void updateMinFeeLabel();
96 void updateSmartFeeLabel();
98 Q_SIGNALS:
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
108 Q_OBJECT
110 public:
111 SendConfirmationDialog(const QString &title, const QString &text, int secDelay = SEND_CONFIRM_DELAY, QWidget *parent = 0);
112 int exec();
114 private Q_SLOTS:
115 void countDown();
116 void updateYesButton();
118 private:
119 QAbstractButton *yesButton;
120 QTimer countDownTimer;
121 int secDelay;
124 #endif // BITCOIN_QT_SENDCOINSDIALOG_H