Line data Source code
1 : // Copyright (c) 2011-2013 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 CTxMemPool;
24 :
25 : namespace Ui {
26 : class CoinControlDialog;
27 : }
28 :
29 : #define ASYMP_UTF8 "\xE2\x89\x88"
30 :
31 : class CoinControlDialog : public QDialog
32 : {
33 0 : Q_OBJECT
34 :
35 : public:
36 : explicit CoinControlDialog(const PlatformStyle *platformStyle, QWidget *parent = 0);
37 : ~CoinControlDialog();
38 :
39 : void setModel(WalletModel *model);
40 :
41 : // static because also called from sendcoinsdialog
42 : static void updateLabels(WalletModel*, QDialog*);
43 : static QString getPriorityLabel(double dPriority, double mempoolEstimatePriority);
44 :
45 : static QList<CAmount> payAmounts;
46 : static CCoinControl *coinControl;
47 : static bool fSubtractFeeFromAmount;
48 :
49 : private:
50 : Ui::CoinControlDialog *ui;
51 : WalletModel *model;
52 : int sortColumn;
53 : Qt::SortOrder sortOrder;
54 :
55 : QMenu *contextMenu;
56 : QTreeWidgetItem *contextMenuItem;
57 : QAction *copyTransactionHashAction;
58 : QAction *lockAction;
59 : QAction *unlockAction;
60 :
61 : const PlatformStyle *platformStyle;
62 :
63 : QString strPad(QString, int, QString);
64 : void sortView(int, Qt::SortOrder);
65 : void updateView();
66 :
67 : enum
68 : {
69 : COLUMN_CHECKBOX,
70 : COLUMN_AMOUNT,
71 : COLUMN_LABEL,
72 : COLUMN_ADDRESS,
73 : COLUMN_DATE,
74 : COLUMN_CONFIRMATIONS,
75 : COLUMN_PRIORITY,
76 : COLUMN_TXHASH,
77 : COLUMN_VOUT_INDEX,
78 : COLUMN_AMOUNT_INT64,
79 : COLUMN_PRIORITY_INT64,
80 : COLUMN_DATE_INT64
81 : };
82 :
83 : // some columns have a hidden column containing the value used for sorting
84 : int getMappedColumn(int column, bool fVisibleColumn = true)
85 : {
86 : if (fVisibleColumn)
87 : {
88 0 : if (column == COLUMN_AMOUNT_INT64)
89 : return COLUMN_AMOUNT;
90 0 : else if (column == COLUMN_PRIORITY_INT64)
91 : return COLUMN_PRIORITY;
92 0 : else if (column == COLUMN_DATE_INT64)
93 : return COLUMN_DATE;
94 : }
95 : else
96 : {
97 0 : if (column == COLUMN_AMOUNT)
98 : return COLUMN_AMOUNT_INT64;
99 0 : else if (column == COLUMN_PRIORITY)
100 : return COLUMN_PRIORITY_INT64;
101 0 : else if (column == COLUMN_DATE)
102 : return COLUMN_DATE_INT64;
103 : }
104 :
105 : return column;
106 : }
107 :
108 : private Q_SLOTS:
109 : void showMenu(const QPoint &);
110 : void copyAmount();
111 : void copyLabel();
112 : void copyAddress();
113 : void copyTransactionHash();
114 : void lockCoin();
115 : void unlockCoin();
116 : void clipboardQuantity();
117 : void clipboardAmount();
118 : void clipboardFee();
119 : void clipboardAfterFee();
120 : void clipboardBytes();
121 : void clipboardPriority();
122 : void clipboardLowOutput();
123 : void clipboardChange();
124 : void radioTreeMode(bool);
125 : void radioListMode(bool);
126 : void viewItemChanged(QTreeWidgetItem*, int);
127 : void headerSectionClicked(int);
128 : void buttonBoxClicked(QAbstractButton*);
129 : void buttonSelectAllClicked();
130 : void updateLabelLocked();
131 : };
132 :
133 : #endif // BITCOIN_QT_COINCONTROLDIALOG_H
|