receivecoinsdialog.h raw
1 // Copyright (c) 2011-present 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_RECEIVECOINSDIALOG_H
6 #define BITCOIN_QT_RECEIVECOINSDIALOG_H
7
8 #include <qt/guiutil.h>
9
10 #include <QDialog>
11 #include <QHeaderView>
12 #include <QItemSelection>
13 #include <QKeyEvent>
14 #include <QMenu>
15 #include <QPoint>
16 #include <QVariant>
17
18 class PlatformStyle;
19 class WalletModel;
20
21 namespace Ui {
22 class ReceiveCoinsDialog;
23 }
24
25 QT_BEGIN_NAMESPACE
26 class QModelIndex;
27 QT_END_NAMESPACE
28
29 /** Dialog for requesting payment of bitcoins */
30 class ReceiveCoinsDialog : public QDialog
31 {
32 Q_OBJECT
33
34 public:
35 enum ColumnWidths {
36 DATE_COLUMN_WIDTH = 130,
37 LABEL_COLUMN_WIDTH = 120,
38 AMOUNT_MINIMUM_COLUMN_WIDTH = 180,
39 MINIMUM_COLUMN_WIDTH = 130
40 };
41
42 explicit ReceiveCoinsDialog(const PlatformStyle *platformStyle, QWidget *parent = nullptr);
43 ~ReceiveCoinsDialog();
44
45 void setModel(WalletModel *model);
46
47 public Q_SLOTS:
48 void clear();
49 void reject() override;
50 void accept() override;
51
52 private:
53 Ui::ReceiveCoinsDialog *ui;
54 WalletModel* model{nullptr};
55 QMenu *contextMenu;
56 QAction* copyLabelAction;
57 QAction* copyMessageAction;
58 QAction* copyAmountAction;
59 const PlatformStyle *platformStyle;
60
61 QModelIndex selectedRow();
62 void copyColumnToClipboard(int column);
63
64 private Q_SLOTS:
65 void on_receiveButton_clicked();
66 void on_showRequestButton_clicked();
67 void on_removeRequestButton_clicked();
68 void on_recentRequestsView_doubleClicked(const QModelIndex &index);
69 void recentRequestsView_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
70 void updateDisplayUnit();
71 void showMenu(const QPoint &point);
72 void copyURI();
73 void copyAddress();
74 void copyLabel();
75 void copyMessage();
76 void copyAmount();
77 };
78
79 #endif // BITCOIN_QT_RECEIVECOINSDIALOG_H
80