Bitcoin Core  0.20.99
P2P Digital Currency
coincontroldialog.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2018 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 <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 class CCoinControl;
23 
24 namespace Ui {
25  class CoinControlDialog;
26 }
27 
28 #define ASYMP_UTF8 "\xE2\x89\x88"
29 
30 class CCoinControlWidgetItem : public QTreeWidgetItem
31 {
32 public:
33  explicit CCoinControlWidgetItem(QTreeWidget *parent, int type = Type) : QTreeWidgetItem(parent, type) {}
34  explicit CCoinControlWidgetItem(QTreeWidgetItem *parent, int type = Type) : QTreeWidgetItem(parent, type) {}
35 
36  bool operator<(const QTreeWidgetItem &other) const override;
37 };
38 
39 
40 class CoinControlDialog : public QDialog
41 {
42  Q_OBJECT
43 
44 public:
45  explicit CoinControlDialog(CCoinControl& coin_control, WalletModel* model, const PlatformStyle *platformStyle, QWidget *parent = nullptr);
47 
48  // static because also called from sendcoinsdialog
49  static void updateLabels(CCoinControl& m_coin_control, WalletModel*, QDialog*);
50 
51  static QList<CAmount> payAmounts;
53 
54 private:
55  Ui::CoinControlDialog *ui;
59  Qt::SortOrder sortOrder;
60 
61  QMenu *contextMenu;
62  QTreeWidgetItem *contextMenuItem;
64  QAction *lockAction;
65  QAction *unlockAction;
66 
68 
69  void sortView(int, Qt::SortOrder);
70  void updateView();
71 
72  enum
73  {
74  COLUMN_CHECKBOX = 0,
80  };
81 
82  enum
83  {
84  TxHashRole = Qt::UserRole,
85  VOutRole
86  };
87 
88  friend class CCoinControlWidgetItem;
89 
90 private Q_SLOTS:
91  void showMenu(const QPoint &);
92  void copyAmount();
93  void copyLabel();
94  void copyAddress();
95  void copyTransactionHash();
96  void lockCoin();
97  void unlockCoin();
98  void clipboardQuantity();
99  void clipboardAmount();
100  void clipboardFee();
101  void clipboardAfterFee();
102  void clipboardBytes();
103  void clipboardLowOutput();
104  void clipboardChange();
105  void radioTreeMode(bool);
106  void radioListMode(bool);
107  void viewItemChanged(QTreeWidgetItem*, int);
108  void headerSectionClicked(int);
109  void buttonBoxClicked(QAbstractButton*);
110  void buttonSelectAllClicked();
111  void updateLabelLocked();
112 };
113 
114 #endif // BITCOIN_QT_COINCONTROLDIALOG_H
const PlatformStyle * platformStyle
CCoinControl & m_coin_control
CCoinControlWidgetItem(QTreeWidget *parent, int type=Type)
Coin Control Features.
Definition: coincontrol.h:22
static QList< CAmount > payAmounts
QAction * copyTransactionHashAction
Ui::CoinControlDialog * ui
bool operator<(const CNetAddr &a, const CNetAddr &b)
Definition: netaddress.cpp:375
static bool fSubtractFeeFromAmount
QTreeWidgetItem * contextMenuItem
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:51
CCoinControlWidgetItem(QTreeWidgetItem *parent, int type=Type)
Qt::SortOrder sortOrder
WalletModel * model