forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathmasternodelist.h
More file actions
118 lines (95 loc) · 3.18 KB
/
Copy pathmasternodelist.h
File metadata and controls
118 lines (95 loc) · 3.18 KB
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
// Copyright (c) 2016-2025 The Dash Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_QT_MASTERNODELIST_H
#define BITCOIN_QT_MASTERNODELIST_H
#include <qt/masternodemodel.h>
#include <QMenu>
#include <QSet>
#include <QSortFilterProxyModel>
#include <QString>
#include <QTimer>
#include <QWidget>
#include <atomic>
#include <memory>
class ClientModel;
class MasternodeFeed;
class WalletModel;
struct MasternodeData;
namespace interfaces {
class MnList;
using MnListPtr = std::shared_ptr<MnList>;
} // namespace interfaces
namespace Ui {
class MasternodeList;
} // namespace Ui
QT_BEGIN_NAMESPACE
class QModelIndex;
class QThread;
QT_END_NAMESPACE
class MasternodeListSortFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
enum class TypeFilter : uint8_t {
All,
Regular,
Evo,
COUNT
};
explicit MasternodeListSortFilterProxyModel(QObject* parent = nullptr) :
QSortFilterProxyModel(parent) {}
void forceInvalidateFilter() { invalidateFilter(); }
void setHideBanned(bool hide) { m_hide_banned = hide; }
void setMyMasternodeHashes(QSet<QString>&& hashes) { m_owned_mns = std::move(hashes); }
void setShowOwnedOnly(bool show) { m_show_owned_only = show; }
void setTypeFilter(TypeFilter type) { m_type_filter = type; }
protected:
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override;
bool lessThan(const QModelIndex& lhs, const QModelIndex& rhs) const override;
private:
bool m_hide_banned{false};
bool m_show_owned_only{false};
QSet<QString> m_owned_mns;
TypeFilter m_type_filter{TypeFilter::All};
};
/** Masternode Manager page widget */
class MasternodeList : public QWidget
{
Q_OBJECT
Ui::MasternodeList* ui;
public:
explicit MasternodeList(QWidget* parent = nullptr);
~MasternodeList() override;
void setClientModel(ClientModel* clientModel);
void setWalletModel(WalletModel* walletModel);
protected:
void changeEvent(QEvent* event) override;
private:
ClientModel* clientModel{nullptr};
MasternodeFeed* m_feed{nullptr};
MasternodeListSortFilterProxyModel* m_proxy_model{nullptr};
MasternodeModel* m_model{nullptr};
QMenu* contextMenuDIP3{nullptr};
WalletModel* walletModel{nullptr};
void setMasternodeList(MasternodeData&& data, QSet<QString>&& owned_mns);
const MasternodeEntry* GetSelectedEntry();
Q_SIGNALS:
void doubleClicked(const QModelIndex&);
private Q_SLOTS:
void copyCollateralOutpoint_clicked();
void copyProTxHash_clicked();
void extraInfoDIP3_clicked();
void filterByCollateralAddress();
void filterByOwnerAddress();
void filterByPayoutAddress();
void filterByVotingAddress();
void on_checkBoxHideBanned_stateChanged(int state);
void on_checkBoxOwned_stateChanged(int state);
void on_comboBoxType_currentIndexChanged(int index);
void on_filterText_textChanged(const QString& strFilterIn);
void showContextMenuDIP3(const QPoint&);
void updateFilteredCount();
void updateMasternodeList();
};
#endif // BITCOIN_QT_MASTERNODELIST_H