1 // Copyright (c) 2011-2015 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 CCoinControlWidgetItem : public QTreeWidgetItem 32 { 33 public: QTreeWidgetItem(parent,type)34 CCoinControlWidgetItem(QTreeWidget *parent, int type = Type) : QTreeWidgetItem(parent, type) {} QTreeWidgetItem(type)35 CCoinControlWidgetItem(int type = Type) : QTreeWidgetItem(type) {} QTreeWidgetItem(parent,type)36 CCoinControlWidgetItem(QTreeWidgetItem *parent, int type = Type) : QTreeWidgetItem(parent, type) {} 37 38 bool operator<(const QTreeWidgetItem &other) const; 39 }; 40 41 42 class CoinControlDialog : public QDialog 43 { 44 Q_OBJECT 45 46 public: 47 explicit CoinControlDialog(const PlatformStyle *platformStyle, QWidget *parent = 0); 48 ~CoinControlDialog(); 49 50 void setModel(WalletModel *model); 51 52 // static because also called from sendcoinsdialog 53 static void updateLabels(WalletModel*, QDialog*); 54 static QString getPriorityLabel(double dPriority, double mempoolEstimatePriority); 55 56 static QList<CAmount> payAmounts; 57 static CCoinControl *coinControl; 58 static bool fSubtractFeeFromAmount; 59 60 private: 61 Ui::CoinControlDialog *ui; 62 WalletModel *model; 63 int sortColumn; 64 Qt::SortOrder sortOrder; 65 66 QMenu *contextMenu; 67 QTreeWidgetItem *contextMenuItem; 68 QAction *copyTransactionHashAction; 69 QAction *lockAction; 70 QAction *unlockAction; 71 72 const PlatformStyle *platformStyle; 73 74 void sortView(int, Qt::SortOrder); 75 void updateView(); 76 77 enum 78 { 79 COLUMN_CHECKBOX = 0, 80 COLUMN_AMOUNT, 81 COLUMN_LABEL, 82 COLUMN_ADDRESS, 83 COLUMN_DATE, 84 COLUMN_CONFIRMATIONS, 85 COLUMN_PRIORITY, 86 COLUMN_TXHASH, 87 COLUMN_VOUT_INDEX, 88 }; 89 friend class CCoinControlWidgetItem; 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 clipboardPriority(); 105 void clipboardLowOutput(); 106 void clipboardChange(); 107 void radioTreeMode(bool); 108 void radioListMode(bool); 109 void viewItemChanged(QTreeWidgetItem*, int); 110 void headerSectionClicked(int); 111 void buttonBoxClicked(QAbstractButton*); 112 void buttonSelectAllClicked(); 113 void updateLabelLocked(); 114 }; 115 116 #endif // BITCOIN_QT_COINCONTROLDIALOG_H 117