Bitcoin ABC  0.24.7
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(QTreeWidgetItem *parent, int type = Type)
36  : QTreeWidgetItem(parent, type) {}
37 
38  bool operator<(const QTreeWidgetItem &other) const override;
39 };
40 
41 class CoinControlDialog : public QDialog {
42  Q_OBJECT
43 
44 public:
45  explicit CoinControlDialog(CCoinControl &coin_control, WalletModel *model,
47  QWidget *parent = nullptr);
49 
50  // static because also called from sendcoinsdialog
52  QDialog *);
53 
54  static QList<Amount> payAmounts;
56 
57 private:
58  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 {
82  };
83 
84  enum { TxIdRole = Qt::UserRole, VOutRole };
85 
86  friend class CCoinControlWidgetItem;
87 
88  static COutPoint buildOutPoint(const QTreeWidgetItem *item);
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
CoinControlDialog::unlockAction
QAction * unlockAction
Definition: coincontroldialog.h:68
CoinControlDialog::lockCoin
void lockCoin()
Definition: coincontroldialog.cpp:292
CoinControlDialog::platformStyle
const PlatformStyle * platformStyle
Definition: coincontroldialog.h:70
CoinControlDialog::viewItemChanged
void viewItemChanged(QTreeWidgetItem *, int)
Definition: coincontroldialog.cpp:406
WalletModel
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:47
CoinControlDialog::showMenu
void showMenu(const QPoint &)
Definition: coincontroldialog.cpp:225
CoinControlDialog::updateView
void updateView()
Definition: coincontroldialog.cpp:653
CCoinControlWidgetItem::CCoinControlWidgetItem
CCoinControlWidgetItem(QTreeWidget *parent, int type=Type)
Definition: coincontroldialog.h:33
CCoinControl
Coin Control Features.
Definition: coincontrol.h:21
CoinControlDialog
Definition: coincontroldialog.h:41
CoinControlDialog::m_coin_control
CCoinControl & m_coin_control
Definition: coincontroldialog.h:59
CoinControlDialog::sortColumn
int sortColumn
Definition: coincontroldialog.h:61
CoinControlDialog::clipboardChange
void clipboardChange()
Definition: coincontroldialog.cpp:353
CoinControlDialog::updateLabels
static void updateLabels(CCoinControl &m_coin_control, WalletModel *, QDialog *)
Definition: coincontroldialog.cpp:442
CoinControlDialog::radioListMode
void radioListMode(bool)
Definition: coincontroldialog.cpp:399
CoinControlDialog::model
WalletModel * model
Definition: coincontroldialog.h:60
CoinControlDialog::headerSectionClicked
void headerSectionClicked(int)
Definition: coincontroldialog.cpp:369
CoinControlDialog::clipboardLowOutput
void clipboardLowOutput()
Definition: coincontroldialog.cpp:348
CoinControlDialog::copyTransactionHashAction
QAction * copyTransactionHashAction
Definition: coincontroldialog.h:66
CoinControlDialog::copyLabel
void copyLabel()
Definition: coincontroldialog.cpp:264
CoinControlDialog::fSubtractFeeFromAmount
static bool fSubtractFeeFromAmount
Definition: coincontroldialog.h:55
CoinControlDialog::buttonSelectAllClicked
void buttonSelectAllClicked()
Definition: coincontroldialog.cpp:199
CoinControlDialog::sortView
void sortView(int, Qt::SortOrder)
Definition: coincontroldialog.cpp:361
CoinControlDialog::copyTransactionHash
void copyTransactionHash()
Definition: coincontroldialog.cpp:286
CoinControlDialog::contextMenuItem
QTreeWidgetItem * contextMenuItem
Definition: coincontroldialog.h:65
CoinControlDialog::clipboardAmount
void clipboardAmount()
Definition: coincontroldialog.cpp:320
CoinControlDialog::buttonBoxClicked
void buttonBoxClicked(QAbstractButton *)
Definition: coincontroldialog.cpp:191
CoinControlDialog::clipboardAfterFee
void clipboardAfterFee()
Definition: coincontroldialog.cpp:334
CCoinControlWidgetItem::CCoinControlWidgetItem
CCoinControlWidgetItem(QTreeWidgetItem *parent, int type=Type)
Definition: coincontroldialog.h:35
CoinControlDialog::clipboardBytes
void clipboardBytes()
Definition: coincontroldialog.cpp:342
CoinControlDialog::~CoinControlDialog
~CoinControlDialog()
Definition: coincontroldialog.cpp:181
CoinControlDialog::updateLabelLocked
void updateLabelLocked()
Definition: coincontroldialog.cpp:431
CoinControlDialog::lockAction
QAction * lockAction
Definition: coincontroldialog.h:67
CoinControlDialog::CoinControlDialog
CoinControlDialog(CCoinControl &coin_control, WalletModel *model, const PlatformStyle *platformStyle, QWidget *parent=nullptr)
Definition: coincontroldialog.cpp:48
CCoinControlWidgetItem::operator<
bool operator<(const QTreeWidgetItem &other) const override
Definition: coincontroldialog.cpp:37
CoinControlDialog::unlockCoin
void unlockCoin()
Definition: coincontroldialog.cpp:306
CoinControlDialog::ui
Ui::CoinControlDialog * ui
Definition: coincontroldialog.h:58
CCoinControlWidgetItem
Definition: coincontroldialog.h:31
Ui
Definition: addressbookpage.h:14
CoinControlDialog::clipboardQuantity
void clipboardQuantity()
Definition: coincontroldialog.cpp:315
CoinControlDialog::TxIdRole
@ TxIdRole
Definition: coincontroldialog.h:84
CoinControlDialog::COLUMN_DATE
@ COLUMN_DATE
Definition: coincontroldialog.h:80
CoinControlDialog::payAmounts
static QList< Amount > payAmounts
Definition: coincontroldialog.h:54
CoinControlDialog::COLUMN_AMOUNT
@ COLUMN_AMOUNT
Definition: coincontroldialog.h:77
CoinControlDialog::radioTreeMode
void radioTreeMode(bool)
Definition: coincontroldialog.cpp:392
CoinControlDialog::contextMenu
QMenu * contextMenu
Definition: coincontroldialog.h:64
CoinControlDialog::COLUMN_ADDRESS
@ COLUMN_ADDRESS
Definition: coincontroldialog.h:79
CoinControlDialog::copyAddress
void copyAddress()
Definition: coincontroldialog.cpp:275
CoinControlDialog::copyAmount
void copyAmount()
Definition: coincontroldialog.cpp:258
COutPoint
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:22
CoinControlDialog::COLUMN_CHECKBOX
@ COLUMN_CHECKBOX
Definition: coincontroldialog.h:76
CoinControlDialog::sortOrder
Qt::SortOrder sortOrder
Definition: coincontroldialog.h:62
CoinControlDialog::COLUMN_LABEL
@ COLUMN_LABEL
Definition: coincontroldialog.h:78
PlatformStyle
Definition: platformstyle.h:13
CoinControlDialog::clipboardFee
void clipboardFee()
Definition: coincontroldialog.cpp:326
CoinControlDialog::VOutRole
@ VOutRole
Definition: coincontroldialog.h:84
amount.h
CoinControlDialog::buildOutPoint
static COutPoint buildOutPoint(const QTreeWidgetItem *item)
Definition: coincontroldialog.cpp:647
CoinControlDialog::COLUMN_CONFIRMATIONS
@ COLUMN_CONFIRMATIONS
Definition: coincontroldialog.h:81