Bitcoin Core  22.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,
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 clipboardLowOutput();
109  void clipboardChange();
110  void radioTreeMode(bool);
111  void radioListMode(bool);
112  void viewItemChanged(QTreeWidgetItem*, int);
113  void headerSectionClicked(int);
114  void buttonBoxClicked(QAbstractButton*);
115  void buttonSelectAllClicked();
116  void updateLabelLocked();
117 };
118 
119 #endif // BITCOIN_QT_COINCONTROLDIALOG_H
CoinControlDialog::unlockAction
QAction * unlockAction
Definition: coincontroldialog.h:70
CoinControlDialog::lockCoin
void lockCoin()
Definition: coincontroldialog.cpp:245
CoinControlDialog::platformStyle
const PlatformStyle * platformStyle
Definition: coincontroldialog.h:72
CoinControlDialog::payAmounts
static QList< CAmount > payAmounts
Definition: coincontroldialog.h:53
CoinControlDialog::viewItemChanged
void viewItemChanged(QTreeWidgetItem *, int)
Definition: coincontroldialog.cpp:354
WalletModel
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:52
CoinControlDialog::showMenu
void showMenu(const QPoint &)
Definition: coincontroldialog.cpp:176
CoinControlDialog::updateView
void updateView()
Definition: coincontroldialog.cpp:581
CCoinControlWidgetItem::CCoinControlWidgetItem
CCoinControlWidgetItem(QTreeWidget *parent, int type=Type)
Definition: coincontroldialog.h:35
CoinControlDialog
Definition: coincontroldialog.h:42
CoinControlDialog::sortColumn
int sortColumn
Definition: coincontroldialog.h:63
CoinControlDialog::clipboardChange
void clipboardChange()
Definition: coincontroldialog.cpp:304
wallet
Definition: node.h:38
CoinControlDialog::copyTransactionOutpoint
void copyTransactionOutpoint()
Definition: coincontroldialog.cpp:235
CoinControlDialog::radioListMode
void radioListMode(bool)
Definition: coincontroldialog.cpp:347
CoinControlDialog::model
WalletModel * model
Definition: coincontroldialog.h:62
CoinControlDialog::headerSectionClicked
void headerSectionClicked(int)
Definition: coincontroldialog.cpp:319
CoinControlDialog::clipboardLowOutput
void clipboardLowOutput()
Definition: coincontroldialog.cpp:298
CoinControlDialog::copyLabel
void copyLabel()
Definition: coincontroldialog.cpp:217
CoinControlDialog::fSubtractFeeFromAmount
static bool fSubtractFeeFromAmount
Definition: coincontroldialog.h:54
CoinControlDialog::buttonSelectAllClicked
void buttonSelectAllClicked()
Definition: coincontroldialog.cpp:154
CoinControlDialog::sortView
void sortView(int, Qt::SortOrder)
Definition: coincontroldialog.cpp:310
CoinControlDialog::contextMenuItem
QTreeWidgetItem * contextMenuItem
Definition: coincontroldialog.h:67
CoinControlDialog::clipboardAmount
void clipboardAmount()
Definition: coincontroldialog.cpp:274
CoinControlDialog::buttonBoxClicked
void buttonBoxClicked(QAbstractButton *)
Definition: coincontroldialog.cpp:147
CoinControlDialog::clipboardAfterFee
void clipboardAfterFee()
Definition: coincontroldialog.cpp:286
CCoinControlWidgetItem::CCoinControlWidgetItem
CCoinControlWidgetItem(QTreeWidgetItem *parent, int type=Type)
Definition: coincontroldialog.h:36
CoinControlDialog::clipboardBytes
void clipboardBytes()
Definition: coincontroldialog.cpp:292
CoinControlDialog::~CoinControlDialog
~CoinControlDialog()
Definition: coincontroldialog.cpp:136
CoinControlDialog::updateLabelLocked
void updateLabelLocked()
Definition: coincontroldialog.cpp:374
CoinControlDialog::TxHashRole
@ TxHashRole
Definition: coincontroldialog.h:89
CoinControlDialog::lockAction
QAction * lockAction
Definition: coincontroldialog.h:69
CCoinControlWidgetItem::operator<
bool operator<(const QTreeWidgetItem &other) const override
Definition: coincontroldialog.cpp:40
CoinControlDialog::unlockCoin
void unlockCoin()
Definition: coincontroldialog.cpp:258
CoinControlDialog::m_copy_transaction_outpoint_action
QAction * m_copy_transaction_outpoint_action
Definition: coincontroldialog.h:68
CoinControlDialog::ui
Ui::CoinControlDialog * ui
Definition: coincontroldialog.h:60
CCoinControlWidgetItem
Definition: coincontroldialog.h:32
Ui
Definition: addressbookpage.h:14
CoinControlDialog::changeEvent
void changeEvent(QEvent *e) override
Definition: coincontroldialog.cpp:572
CoinControlDialog::clipboardQuantity
void clipboardQuantity()
Definition: coincontroldialog.cpp:268
CoinControlDialog::COLUMN_DATE
@ COLUMN_DATE
Definition: coincontroldialog.h:83
CoinControlDialog::COLUMN_AMOUNT
@ COLUMN_AMOUNT
Definition: coincontroldialog.h:80
CoinControlDialog::updateLabels
static void updateLabels(wallet::CCoinControl &m_coin_control, WalletModel *, QDialog *)
Definition: coincontroldialog.cpp:386
CoinControlDialog::radioTreeMode
void radioTreeMode(bool)
Definition: coincontroldialog.cpp:340
CoinControlDialog::contextMenu
QMenu * contextMenu
Definition: coincontroldialog.h:66
CoinControlDialog::m_coin_control
wallet::CCoinControl & m_coin_control
Definition: coincontroldialog.h:61
CoinControlDialog::COLUMN_ADDRESS
@ COLUMN_ADDRESS
Definition: coincontroldialog.h:82
CoinControlDialog::copyAddress
void copyAddress()
Definition: coincontroldialog.cpp:226
CoinControlDialog::copyAmount
void copyAmount()
Definition: coincontroldialog.cpp:211
CoinControlDialog::CoinControlDialog
CoinControlDialog(wallet::CCoinControl &coin_control, WalletModel *model, const PlatformStyle *platformStyle, QWidget *parent=nullptr)
Definition: coincontroldialog.cpp:47
CoinControlDialog::COLUMN_CHECKBOX
@ COLUMN_CHECKBOX
Definition: coincontroldialog.h:79
CoinControlDialog::sortOrder
Qt::SortOrder sortOrder
Definition: coincontroldialog.h:64
CoinControlDialog::COLUMN_LABEL
@ COLUMN_LABEL
Definition: coincontroldialog.h:81
PlatformStyle
Definition: platformstyle.h:13
CoinControlDialog::clipboardFee
void clipboardFee()
Definition: coincontroldialog.cpp:280
CoinControlDialog::VOutRole
@ VOutRole
Definition: coincontroldialog.h:90
amount.h
wallet::CCoinControl
Coin Control Features.
Definition: coincontrol.h:29
CoinControlDialog::COLUMN_CONFIRMATIONS
@ COLUMN_CONFIRMATIONS
Definition: coincontroldialog.h:84