PIVX Core  5.6.99
P2P Digital Currency
mnselectiondialog.h
Go to the documentation of this file.
1 // Copyright (c) 2021 The PIVX Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or https://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef PIVX_QT_MNSELECTIONDIALOG_H
6 #define PIVX_QT_MNSELECTIONDIALOG_H
7 
8 #include <QDialog>
9 #include <map>
10 
11 namespace Ui {
12  class MnSelectionDialog;
13 }
14 
15 class MNModel;
16 class QTreeWidgetItem;
17 class MnInfo;
18 struct VoteInfo;
19 
20 class MnSelectionDialog : public QDialog
21 {
22 Q_OBJECT
23 
24 public:
25  explicit MnSelectionDialog(QWidget *parent);
27 
28  void setModel(MNModel* _mnModel, int minVoteUpdateTimeInSecs);
29  void updateView();
30  // Sets the MNs who already voted for this proposal
31  void setMnVoters(const std::vector<VoteInfo>& _votes);
32  // Return the MNs who are going to vote for this proposal
33  std::vector<std::string> getSelectedMnAlias();
34 
35 public Q_SLOTS:
36  void viewItemChanged(QTreeWidgetItem*, int);
37  void selectAll();
38 
39 private:
40  Ui::MnSelectionDialog *ui;
41  MNModel* mnModel{nullptr};
42  // Consensus param, the minimum time that need to pass
43  // to be able to broadcast another vote with the same MN.
46  // selected MNs alias
47  std::vector<std::string> selectedMnList;
48  // MN alias -> VoteInfo for a certain proposal
49  std::map<std::string, VoteInfo> votes;
50 
51  enum {
56  };
57 
58  void appendItem(QFlags<Qt::ItemFlag> flgCheckbox,
59  QFlags<Qt::ItemFlag> flgTristate,
60  const QString& mnName,
61  const QString& mnStats,
62  VoteInfo* ptrVoteInfo);
63 };
64 
65 #endif // PIVX_QT_MNSELECTIONDIALOG_H
std::vector< std::string > selectedMnList
void viewItemChanged(QTreeWidgetItem *, int)
std::vector< std::string > getSelectedMnAlias()
MnSelectionDialog(QWidget *parent)
void appendItem(QFlags< Qt::ItemFlag > flgCheckbox, QFlags< Qt::ItemFlag > flgTristate, const QString &mnName, const QString &mnStats, VoteInfo *ptrVoteInfo)
Ui::MnSelectionDialog * ui
std::map< std::string, VoteInfo > votes
void setMnVoters(const std::vector< VoteInfo > &_votes)
void setModel(MNModel *_mnModel, int minVoteUpdateTimeInSecs)