forked from dashpay/dash
-
Notifications
You must be signed in to change notification settings - Fork 717
/
coldstakingwidget.h
130 lines (109 loc) · 3.78 KB
/
coldstakingwidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// Copyright (c) 2019-2020 The PIVX developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef COLDSTAKINGWIDGET_H
#define COLDSTAKINGWIDGET_H
#include "qt/pivx/pwidget.h"
#include "qt/pivx/furabstractlistitemdelegate.h"
#include "qt/pivx/txviewholder.h"
#include "qt/pivx/tooltipmenu.h"
#include "qt/pivx/sendmultirow.h"
#include "qt/pivx/coldstakingmodel.h"
#include "qt/pivx/contactsdropdown.h"
#include "qt/pivx/addressholder.h"
#include "transactiontablemodel.h"
#include "addresstablemodel.h"
#include "addressfilterproxymodel.h"
#include "coincontroldialog.h"
#include <QAction>
#include <QLabel>
#include <QWidget>
#include <QSpacerItem>
#include <atomic>
class PIVXGUI;
class WalletModel;
class CSDelegationHolder;
namespace Ui {
class ColdStakingWidget;
}
QT_BEGIN_NAMESPACE
class QModelIndex;
QT_END_NAMESPACE
class ColdStakingWidget : public PWidget
{
Q_OBJECT
public:
explicit ColdStakingWidget(PIVXGUI* parent);
~ColdStakingWidget();
void loadWalletModel() override;
void run(int type) override;
void onError(QString error, int type) override;
void showEvent(QShowEvent *event) override;
public Q_SLOTS:
void walletSynced(bool sync);
private Q_SLOTS:
void changeTheme(bool isLightTheme, QString &theme) override;
void handleAddressClicked(const QModelIndex &index);
void handleMyColdAddressClicked(const QModelIndex &rIndex);
void onCoinControlClicked();
void onColdStakeClicked();
void updateDisplayUnit();
void showList(bool show);
void onSendClicked();
void onDelegateSelected(bool delegate);
void onEditClicked();
void onDeleteClicked();
void onCopyClicked();
void onCopyOwnerClicked();
void onAddressCopyClicked();
void onAddressEditClicked();
void onTxArrived(const QString& hash, const bool isCoinStake, const bool isCSAnyType);
void onContactsClicked(bool ownerAdd);
void clearAll();
void onLabelClicked();
void onMyStakingAddressesClicked();
void onOwnerAddressChanged();
void onDelegationsRefreshed();
void onSortChanged(int idx);
void onSortOrderChanged(int idx);
private:
Ui::ColdStakingWidget *ui = nullptr;
FurAbstractListItemDelegate *delegate = nullptr;
FurAbstractListItemDelegate *addressDelegate = nullptr;
TransactionTableModel* txModel = nullptr;
AddressHolder* addressHolder = nullptr;
AddressTableModel* addressTableModel = nullptr;
AddressFilterProxyModel *addressesFilter = nullptr;
ColdStakingModel* csModel = nullptr;
CSDelegationHolder *txHolder = nullptr;
CoinControlDialog *coinControlDialog = nullptr;
QAction *btnOwnerContact = nullptr;
QSpacerItem *spacerDiv = nullptr;
bool isInDelegation = true;
bool isStakingAddressListVisible = false;
ContactsDropdown *menuContacts = nullptr;
TooltipMenu* menu = nullptr;
TooltipMenu* menuAddresses = nullptr;
SendMultiRow *sendMultiRow = nullptr;
bool isShowingDialog = false;
bool isChainSync = false;
bool isContactOwnerSelected{false};
int64_t lastRefreshTime{0};
std::atomic<bool> isLoading;
// Cached index
QModelIndex index;
QModelIndex addressIndex;
// Cached sort type and order
AddressTableModel::ColumnIndex sortType = AddressTableModel::Label;
Qt::SortOrder sortOrder = Qt::AscendingOrder;
int nDisplayUnit{0};
void showAddressGenerationDialog(bool isPaymentRequest);
void onContactsClicked();
void tryRefreshDelegations();
bool refreshDelegations();
void onLabelClicked(QString dialogTitle, const QModelIndex &index, const bool isMyColdStakingAddresses);
void updateStakingTotalLabel();
void sortAddresses();
void setCoinControlPayAmounts();
};
#endif // COLDSTAKINGWIDGET_H