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