Bitcoin Core  27.99.0
P2P Digital Currency
coincontroldialog.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2021 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_COINCONTROLDIALOG_H
6 #define BITCOIN_QT_COINCONTROLDIALOG_H
7 
8 #include <consensus/amount.h>
9 
10 #include <QAbstractButton>
11 #include <QAction>
12 #include <QDialog>
13 #include <QList>
14 #include <QMenu>
15 #include <QPoint>
16 #include <QString>
17 #include <QTreeWidgetItem>
18 
19 class PlatformStyle;
20 class WalletModel;
21 
22 namespace wallet {
23 class CCoinControl;
24 } // namespace wallet
25 
26 namespace Ui {
27  class CoinControlDialog;
28 }
29 
30 #define ASYMP_UTF8 "\xE2\x89\x88"
31 
32 class CCoinControlWidgetItem : public QTreeWidgetItem
33 {
34 public:
35  explicit CCoinControlWidgetItem(QTreeWidget *parent, int type = Type) : QTreeWidgetItem(parent, type) {}
36  explicit CCoinControlWidgetItem(QTreeWidgetItem *parent, int type = Type) : QTreeWidgetItem(parent, type) {}
37 
38  bool operator<(const QTreeWidgetItem &other) const override;
39 };
40 
41 
42 class CoinControlDialog : public QDialog
43 {
44  Q_OBJECT
45 
46 public:
47  explicit CoinControlDialog(wallet::CCoinControl& coin_control, WalletModel* model, const PlatformStyle *platformStyle, QWidget *parent = nullptr);
49 
50  // static because also called from sendcoinsdialog
52 
53  static QList<CAmount> payAmounts;
55 
56 protected:
57  void changeEvent(QEvent* e) override;
58 
59 private:
60  Ui::CoinControlDialog *ui;
64  Qt::SortOrder sortOrder;
65 
66  QMenu *contextMenu;
67  QTreeWidgetItem *contextMenuItem;
69  QAction *lockAction;
70  QAction *unlockAction;
71 
73 
74  void sortView(int, Qt::SortOrder);
75  void updateView();
76 
77  enum
78  {
85  };
86 
87  enum
88  {
89  TxHashRole = Qt::UserRole,
90  VOutRole
91  };
92 
93  friend class CCoinControlWidgetItem;
94 
95 private Q_SLOTS:
96  void showMenu(const QPoint &);
97  void copyAmount();
98  void copyLabel();
99  void copyAddress();
101  void lockCoin();
102  void unlockCoin();
103  void clipboardQuantity();
104  void clipboardAmount();
105  void clipboardFee();
106  void clipboardAfterFee();
107  void clipboardBytes();
108  void clipboardChange();
109  void radioTreeMode(bool);
110  void radioListMode(bool);
111  void viewItemChanged(QTreeWidgetItem*, int);
112  void headerSectionClicked(int);
113  void buttonBoxClicked(QAbstractButton*);
114  void buttonSelectAllClicked();
115  void updateLabelLocked();
116 };
117 
118 #endif // BITCOIN_QT_COINCONTROLDIALOG_H
CCoinControlWidgetItem(QTreeWidgetItem *parent, int type=Type)
bool operator<(const QTreeWidgetItem &other) const override
CCoinControlWidgetItem(QTreeWidget *parent, int type=Type)
QTreeWidgetItem * contextMenuItem
WalletModel * model
CoinControlDialog(wallet::CCoinControl &coin_control, WalletModel *model, const PlatformStyle *platformStyle, QWidget *parent=nullptr)
const PlatformStyle * platformStyle
void changeEvent(QEvent *e) override
Ui::CoinControlDialog * ui
void sortView(int, Qt::SortOrder)
void showMenu(const QPoint &)
void viewItemChanged(QTreeWidgetItem *, int)
wallet::CCoinControl & m_coin_control
Qt::SortOrder sortOrder
QAction * m_copy_transaction_outpoint_action
static QList< CAmount > payAmounts
static void updateLabels(wallet::CCoinControl &m_coin_control, WalletModel *, QDialog *)
static bool fSubtractFeeFromAmount
void buttonBoxClicked(QAbstractButton *)
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:48
Coin Control Features.
Definition: coincontrol.h:81