You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sendcoinsdialog.h 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. // Copyright (c) 2011-2016 The Starwels developers
  2. // Distributed under the MIT software license, see the accompanying
  3. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
  4. #ifndef STARWELS_QT_SENDCOINSDIALOG_H
  5. #define STARWELS_QT_SENDCOINSDIALOG_H
  6. #include "walletmodel.h"
  7. #include <QDialog>
  8. #include <QMessageBox>
  9. #include <QString>
  10. #include <QTimer>
  11. class ClientModel;
  12. class PlatformStyle;
  13. class SendCoinsEntry;
  14. class SendCoinsRecipient;
  15. namespace Ui {
  16. class SendCoinsDialog;
  17. }
  18. QT_BEGIN_NAMESPACE
  19. class QUrl;
  20. QT_END_NAMESPACE
  21. /** Dialog for sending starwelss */
  22. class SendCoinsDialog : public QDialog
  23. {
  24. Q_OBJECT
  25. public:
  26. explicit SendCoinsDialog(const PlatformStyle *platformStyle, QWidget *parent = 0);
  27. ~SendCoinsDialog();
  28. void setClientModel(ClientModel *clientModel);
  29. void setModel(WalletModel *model);
  30. /** 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).
  31. */
  32. QWidget *setupTabChain(QWidget *prev);
  33. void setAddress(const QString &address);
  34. void pasteEntry(const SendCoinsRecipient &rv);
  35. bool handlePaymentRequest(const SendCoinsRecipient &recipient);
  36. public Q_SLOTS:
  37. void clear();
  38. void reject();
  39. void accept();
  40. SendCoinsEntry *addEntry();
  41. void updateTabsAndLabels();
  42. void setBalance(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance,
  43. const CAmount& watchOnlyBalance, const CAmount& watchUnconfBalance, const CAmount& watchImmatureBalance);
  44. private:
  45. Ui::SendCoinsDialog *ui;
  46. ClientModel *clientModel;
  47. WalletModel *model;
  48. bool fNewRecipientAllowed;
  49. bool fFeeMinimized;
  50. const PlatformStyle *platformStyle;
  51. // Process WalletModel::SendCoinsReturn and generate a pair consisting
  52. // of a message and message flags for use in Q_EMIT message().
  53. // Additional parameter msgArg can be used via .arg(msgArg).
  54. void processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg = QString());
  55. void minimizeFeeSection(bool fMinimize);
  56. void updateFeeMinimizedLabel();
  57. // Update the passed in CCoinControl with state from the GUI
  58. void updateCoinControlState(CCoinControl& ctrl);
  59. private Q_SLOTS:
  60. void on_sendButton_clicked();
  61. void on_buttonChooseFee_clicked();
  62. void on_buttonMinimizeFee_clicked();
  63. void removeEntry(SendCoinsEntry* entry);
  64. void updateDisplayUnit();
  65. void coinControlFeatureChanged(bool);
  66. void coinControlButtonClicked();
  67. void coinControlChangeChecked(int);
  68. void coinControlChangeEdited(const QString &);
  69. void coinControlUpdateLabels();
  70. void coinControlClipboardQuantity();
  71. void coinControlClipboardAmount();
  72. void coinControlClipboardFee();
  73. void coinControlClipboardAfterFee();
  74. void coinControlClipboardBytes();
  75. void coinControlClipboardLowOutput();
  76. void coinControlClipboardChange();
  77. void setMinimumFee();
  78. void updateFeeSectionControls();
  79. void updateMinFeeLabel();
  80. void updateSmartFeeLabel();
  81. Q_SIGNALS:
  82. // Fired when a message should be reported to the user
  83. void message(const QString &title, const QString &message, unsigned int style);
  84. };
  85. #define SEND_CONFIRM_DELAY 3
  86. class SendConfirmationDialog : public QMessageBox
  87. {
  88. Q_OBJECT
  89. public:
  90. SendConfirmationDialog(const QString &title, const QString &text, int secDelay = SEND_CONFIRM_DELAY, QWidget *parent = 0);
  91. int exec();
  92. private Q_SLOTS:
  93. void countDown();
  94. void updateYesButton();
  95. private:
  96. QAbstractButton *yesButton;
  97. QTimer countDownTimer;
  98. int secDelay;
  99. };
  100. #endif // STARWELS_QT_SENDCOINSDIALOG_H