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_TRANSACTIONVIEW_H 6 #define BITCOIN_QT_TRANSACTIONVIEW_H 7 8 #include <qt/guiutil.h> 9 10 #include <uint256.h> 11 12 #include <QWidget> 13 #include <QKeyEvent> 14 15 class PlatformStyle; 16 class TransactionFilterProxy; 17 class WalletModel; 18 19 QT_BEGIN_NAMESPACE 20 class QComboBox; 21 class QDateTimeEdit; 22 class QFrame; 23 class QLineEdit; 24 class QMenu; 25 class QModelIndex; 26 class QSignalMapper; 27 class QTableView; 28 QT_END_NAMESPACE 29 30 /** Widget showing the transaction list for a wallet, including a filter row. 31 Using the filter row, the user can view or export a subset of the transactions. 32 */ 33 class TransactionView : public QWidget 34 { 35 Q_OBJECT 36 37 public: 38 explicit TransactionView(const PlatformStyle *platformStyle, QWidget *parent = nullptr); 39 40 void setModel(WalletModel *model); 41 42 // Date ranges for filter 43 enum DateEnum 44 { 45 All, 46 Today, 47 ThisWeek, 48 ThisMonth, 49 LastMonth, 50 ThisYear, 51 Range 52 }; 53 54 enum ColumnWidths { 55 STATUS_COLUMN_WIDTH = 30, 56 WATCHONLY_COLUMN_WIDTH = 23, 57 DATE_COLUMN_WIDTH = 120, 58 TYPE_COLUMN_WIDTH = 113, 59 AMOUNT_MINIMUM_COLUMN_WIDTH = 120, 60 MINIMUM_COLUMN_WIDTH = 23 61 }; 62 63 private: 64 WalletModel *model; 65 TransactionFilterProxy *transactionProxyModel; 66 QTableView *transactionView; 67 68 QComboBox *dateWidget; 69 QComboBox *typeWidget; 70 QComboBox *watchOnlyWidget; 71 QLineEdit *search_widget; 72 QLineEdit *amountWidget; 73 74 QMenu *contextMenu; 75 QSignalMapper *mapperThirdPartyTxUrls; 76 77 QFrame *dateRangeWidget; 78 QDateTimeEdit *dateFrom; 79 QDateTimeEdit *dateTo; 80 QAction *abandonAction; 81 QAction *bumpFeeAction; 82 83 QWidget *createDateRangeWidget(); 84 85 GUIUtil::TableViewLastColumnResizingFixer *columnResizingFixer; 86 87 virtual void resizeEvent(QResizeEvent* event); 88 89 bool eventFilter(QObject *obj, QEvent *event); 90 91 private Q_SLOTS: 92 void contextualMenu(const QPoint &); 93 void dateRangeChanged(); 94 void showDetails(); 95 void copyAddress(); 96 void editLabel(); 97 void copyLabel(); 98 void copyAmount(); 99 void copyTxID(); 100 void copyTxHex(); 101 void copyTxPlainText(); 102 void openThirdPartyTxUrl(QString url); 103 void updateWatchOnlyColumn(bool fHaveWatchOnly); 104 void abandonTx(); 105 void bumpFee(); 106 107 Q_SIGNALS: 108 void doubleClicked(const QModelIndex&); 109 110 /** Fired when a message should be reported to the user */ 111 void message(const QString &title, const QString &message, unsigned int style); 112 113 void bumpedFee(const uint256& txid); 114 115 public Q_SLOTS: 116 void chooseDate(int idx); 117 void chooseType(int idx); 118 void chooseWatchonly(int idx); 119 void changedAmount(); 120 void changedSearch(); 121 void exportClicked(); 122 void focusTransaction(const QModelIndex&); 123 void focusTransaction(const uint256& txid); 124 }; 125 126 #endif // BITCOIN_QT_TRANSACTIONVIEW_H 127