PIVX Core  5.6.99
P2P Digital Currency
votedialog.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_VOTEDIALOG_H
6 #define PIVX_QT_VOTEDIALOG_H
7 
8 #include <QDialog>
9 #include <QCheckBox>
10 #include <QProgressBar>
11 
12 #include "governancemodel.h"
13 #include <memory>
14 
15 namespace Ui {
16 class VoteDialog;
17 }
18 
19 struct ProposalInfo;
20 struct VoteInfo;
21 class MNModel;
22 class MnSelectionDialog;
23 class GovernanceModel;
24 class SnackBar;
25 
26 class VoteDialog : public QDialog
27 {
28  Q_OBJECT
29 
30 public:
31  explicit VoteDialog(QWidget *parent, GovernanceModel* _govModel, MNModel* _mnModel);
32  ~VoteDialog();
33 
34  void showEvent(QShowEvent *event) override;
35  void setProposal(const ProposalInfo& prop);
36 
37 public Q_SLOTS:
38  void onAcceptClicked();
39  void onCheckBoxClicked(QCheckBox* checkBox, QProgressBar* progressBar, bool isVoteYes);
40  void onMnSelectionClicked();
41 
42 private:
43  Ui::VoteDialog *ui;
45  MNModel* mnModel{nullptr};
46  SnackBar* snackBar{nullptr};
47 
48  QCheckBox* checkBoxNo{nullptr};
49  QCheckBox* checkBoxYes{nullptr};
50  QProgressBar* progressBarNo{nullptr};
51  QProgressBar* progressBarYes{nullptr};
52 
53  std::unique_ptr<ProposalInfo> proposal;
54  std::vector<VoteInfo> votes;
56  std::vector<std::string> vecSelectedMn;
57 
58  void initVoteCheck(QWidget* container, QCheckBox* checkBox, QProgressBar* progressBar,
59  const QString& text, Qt::LayoutDirection direction, bool isVoteYes);
60 
61  void inform(const QString& text);
62  void updateMnSelectionNum();
63 };
64 
65 #endif // PIVX_QT_VOTEDIALOG_H
std::unique_ptr< ProposalInfo > proposal
Definition: votedialog.h:53
void showEvent(QShowEvent *event) override
Definition: votedialog.cpp:107
void onMnSelectionClicked()
Definition: votedialog.cpp:114
GovernanceModel * govModel
Definition: votedialog.h:44
void updateMnSelectionNum()
Definition: votedialog.cpp:165
std::vector< VoteInfo > votes
Definition: votedialog.h:54
void onAcceptClicked()
Definition: votedialog.cpp:72
QProgressBar * progressBarYes
Definition: votedialog.h:51
QProgressBar * progressBarNo
Definition: votedialog.h:50
MnSelectionDialog * mnSelectionDialog
Definition: votedialog.h:55
void setProposal(const ProposalInfo &prop)
Definition: votedialog.cpp:55
std::vector< std::string > vecSelectedMn
Definition: votedialog.h:56
void initVoteCheck(QWidget *container, QCheckBox *checkBox, QProgressBar *progressBar, const QString &text, Qt::LayoutDirection direction, bool isVoteYes)
Definition: votedialog.cpp:138
QCheckBox * checkBoxYes
Definition: votedialog.h:49
void inform(const QString &text)
Definition: votedialog.cpp:177
SnackBar * snackBar
Definition: votedialog.h:46
void onCheckBoxClicked(QCheckBox *checkBox, QProgressBar *progressBar, bool isVoteYes)
Definition: votedialog.cpp:129
Ui::VoteDialog * ui
Definition: votedialog.h:43
QCheckBox * checkBoxNo
Definition: votedialog.h:48
VoteDialog(QWidget *parent, GovernanceModel *_govModel, MNModel *_mnModel)
Definition: votedialog.cpp:12
MNModel * mnModel
Definition: votedialog.h:45