Bitcoin Core  0.18.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(int type = Type) : QTreeWidgetItem(type) {}
35  explicit CCoinControlWidgetItem(QTreeWidgetItem *parent, int type = Type) : QTreeWidgetItem(parent, type) {}
36 
37  bool operator<(const QTreeWidgetItem &other) const;
38 };
39 
40 
41 class CoinControlDialog : public QDialog
42 {
43  Q_OBJECT
44 
45 public:
46  explicit CoinControlDialog(const PlatformStyle *platformStyle, QWidget *parent = nullptr);
48 
49  void setModel(WalletModel *model);
50 
51  // static because also called from sendcoinsdialog
52  static void updateLabels(WalletModel*, QDialog*);
53 
54  static QList<CAmount> payAmounts;
55  static CCoinControl *coinControl();
57 
58 private:
59  Ui::CoinControlDialog *ui;
62  Qt::SortOrder sortOrder;
63 
64  QMenu *contextMenu;
65  QTreeWidgetItem *contextMenuItem;
67  QAction *lockAction;
68  QAction *unlockAction;
69 
71 
72  void sortView(int, Qt::SortOrder);
73  void updateView();
74 
75  enum
76  {
77  COLUMN_CHECKBOX = 0,
83  };
84 
85  enum
86  {
87  TxHashRole = Qt::UserRole,
88  VOutRole
89  };
90 
91  friend class CCoinControlWidgetItem;
92 
93 private Q_SLOTS:
94  void showMenu(const QPoint &);
95  void copyAmount();
96  void copyLabel();
97  void copyAddress();
98  void copyTransactionHash();
99  void lockCoin();
100  void unlockCoin();
101  void clipboardQuantity();
102  void clipboardAmount();
103  void clipboardFee();
104  void clipboardAfterFee();
105  void clipboardBytes();
106  void clipboardLowOutput();
107  void clipboardChange();
108  void radioTreeMode(bool);
109  void radioListMode(bool);
110  void viewItemChanged(QTreeWidgetItem*, int);
111  void headerSectionClicked(int);
112  void buttonBoxClicked(QAbstractButton*);
113  void buttonSelectAllClicked();
114  void updateLabelLocked();
115 };
116 
117 #endif // BITCOIN_QT_COINCONTROLDIALOG_H
const PlatformStyle * platformStyle
CCoinControlWidgetItem(QTreeWidget *parent, int type=Type)
Coin Control Features.
Definition: coincontrol.h:19
static QList< CAmount > payAmounts
QAction * copyTransactionHashAction
Ui::CoinControlDialog * ui
bool operator<(const CNetAddr &a, const CNetAddr &b)
Definition: netaddress.cpp:361
static bool fSubtractFeeFromAmount
QTreeWidgetItem * contextMenuItem
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:125
CCoinControlWidgetItem(QTreeWidgetItem *parent, int type=Type)
Qt::SortOrder sortOrder
CCoinControlWidgetItem(int type=Type)
WalletModel * model