Bitcoin ABC  0.22.13
P2P Digital Currency
coincontroldialog.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_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 class COutPoint;
24 
25 namespace Ui {
26 class CoinControlDialog;
27 }
28 
29 #define ASYMP_UTF8 "\xE2\x89\x88"
30 
31 class CCoinControlWidgetItem : public QTreeWidgetItem {
32 public:
33  explicit CCoinControlWidgetItem(QTreeWidget *parent, int type = Type)
34  : QTreeWidgetItem(parent, type) {}
35  explicit CCoinControlWidgetItem(int type = Type) : QTreeWidgetItem(type) {}
36  explicit CCoinControlWidgetItem(QTreeWidgetItem *parent, int type = Type)
37  : QTreeWidgetItem(parent, type) {}
38 
39  bool operator<(const QTreeWidgetItem &other) const override;
40 };
41 
42 class CoinControlDialog : public QDialog {
43  Q_OBJECT
44 
45 public:
46  explicit CoinControlDialog(const PlatformStyle *platformStyle,
47  QWidget *parent = nullptr);
49 
50  void setModel(WalletModel *model);
51 
52  // static because also called from sendcoinsdialog
53  static void updateLabels(WalletModel *, QDialog *);
54 
55  static QList<Amount> payAmounts;
56  static CCoinControl *coinControl();
58 
59 private:
60  Ui::CoinControlDialog *ui;
63  Qt::SortOrder sortOrder;
64 
65  QMenu *contextMenu;
66  QTreeWidgetItem *contextMenuItem;
68  QAction *lockAction;
69  QAction *unlockAction;
70 
72 
73  void sortView(int, Qt::SortOrder);
74  void updateView();
75 
76  enum {
77  COLUMN_CHECKBOX = 0,
83  };
84 
85  enum { TxIdRole = Qt::UserRole, VOutRole };
86 
87  friend class CCoinControlWidgetItem;
88 
89  static COutPoint buildOutPoint(const QTreeWidgetItem *item);
90 
91 private Q_SLOTS:
92  void showMenu(const QPoint &);
93  void copyAmount();
94  void copyLabel();
95  void copyAddress();
96  void copyTransactionHash();
97  void lockCoin();
98  void unlockCoin();
99  void clipboardQuantity();
100  void clipboardAmount();
101  void clipboardFee();
102  void clipboardAfterFee();
103  void clipboardBytes();
104  void clipboardLowOutput();
105  void clipboardChange();
106  void radioTreeMode(bool);
107  void radioListMode(bool);
108  void viewItemChanged(QTreeWidgetItem *, int);
109  void headerSectionClicked(int);
110  void buttonBoxClicked(QAbstractButton *);
111  void buttonSelectAllClicked();
112  void updateLabelLocked();
113 };
114 
115 #endif // BITCOIN_QT_COINCONTROLDIALOG_H
const PlatformStyle * platformStyle
static QList< Amount > payAmounts
CCoinControlWidgetItem(QTreeWidget *parent, int type=Type)
Coin Control Features.
Definition: coincontrol.h:19
QAction * copyTransactionHashAction
Ui::CoinControlDialog * ui
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:22
bool operator<(const CNetAddr &a, const CNetAddr &b)
Definition: netaddress.cpp:372
static bool fSubtractFeeFromAmount
QTreeWidgetItem * contextMenuItem
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:47
CCoinControlWidgetItem(QTreeWidgetItem *parent, int type=Type)
Qt::SortOrder sortOrder
CCoinControlWidgetItem(int type=Type)
WalletModel * model