PIVX Core  5.6.99
P2P Digital Currency
faqwidget.cpp
Go to the documentation of this file.
1 // Copyright (c) 2019-2022 The PIVX 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 #if defined(HAVE_CONFIG_H)
6 #include "config/pivx-config.h"
7 #endif
8 
10 #include "qt/settings/forms/ui_faqwidget.h"
11 
12 #include "mnmodel.h"
13 #include "qtutils.h"
14 
15 #include <QScrollBar>
16 #include <QMetaObject>
17 
19  QDialog(parent),
20  ui(new Ui::SettingsFaqWidget)
21 {
22  ui->setupUi(this);
23  this->setStyleSheet(parent->styleSheet());
24 
25 #ifdef Q_OS_MAC
26  ui->container->load("://bg-welcome");
27  setCssProperty(ui->container, "container-welcome-no-image");
28 #else
29  setCssProperty(ui->container, "container-welcome");
30 #endif
31  setCssProperty(ui->labelTitle, "text-title-faq");
32  setCssProperty(ui->labelWebLink, "text-content-white");
33 
34  // Content
36  ui->labelNumber_Intro,
37  ui->labelNumber_UnspendablePIV,
38  ui->labelNumber_Stake,
39  ui->labelNumber_Support,
40  ui->labelNumber_Masternode,
41  ui->labelNumber_MNController
42  }, "container-number-faq");
43 
45  ui->labelSubtitle_Intro,
46  ui->labelSubtitle_UnspendablePIV,
47  ui->labelSubtitle_Stake,
48  ui->labelSubtitle_Support,
49  ui->labelSubtitle_Masternode,
50  ui->labelSubtitle_MNController
51  }, "text-subtitle-faq");
52 
53 
55  ui->labelContent_Intro,
56  ui->labelContent_UnspendablePIV,
57  ui->labelContent_Stake,
58  ui->labelContent_Support,
59  ui->labelContent_Masternode,
60  ui->labelContent_MNController
61  }, "text-content-faq");
62 
63 
65  ui->pushButton_Intro,
66  ui->pushButton_UnspendablePIV,
67  ui->pushButton_Stake,
68  ui->pushButton_Support,
69  ui->pushButton_Masternode,
70  ui->pushButton_MNController
71  }, "btn-faq-options");
72 
73  ui->labelContent_Support->setOpenExternalLinks(true);
74 
75  // Set FAQ content strings
76  QString introContent = formatFAQContent(
78  tr("PIVX is a form of digital online money using blockchain technology "
79  "that can be easily transferred globally, instantly, and with near "
80  "zero fees. PIVX incorporates market leading security & "
81  "privacy and is also the first PoS (Proof of Stake) Cryptocurrency "
82  "to implement Sapling(SHIELD), a zk-SNARKs based privacy protocol.")) +
84  tr("PIVX utilizes a Proof of Stake (PoS) consensus system algorithm, "
85  "allowing all owners of PIVX to participate in earning block rewards "
86  "while securing the network with full node wallets, as well as to "
87  "run Masternodes to create and vote on proposals.")));
88  ui->labelContent_Intro->setText(introContent);
89 
90  QString unspendablePIVContent = formatFAQContent(
92  tr("Newly received PIVX requires 6 confirmations on the network "
93  "to become eligible for spending which can take ~6 minutes.")) +
95  tr("Your PIVX wallet also needs to be completely synchronized "
96  "to see and spend balances on the network.")));
97  ui->labelContent_UnspendablePIV->setText(unspendablePIVContent);
98 
99  QString stakeContent = formatFAQContent(
101  formatFAQListItem(tr("Make sure your wallet is completely synchronized and you are using the latest release.")) +
102  formatFAQListItem(tr("You must have a balance of PIVX with a minimum of 600 confirmations.")) +
103  formatFAQListItem(tr("Your wallet must stay online and be unlocked for staking purposes.")) +
104  formatFAQListItem(tr("Once all those steps are followed staking should be enabled."))) +
106  tr("You can see the status of staking in the wallet by mousing over the "
107  "package icon in the row on the top left of the wallet interface. The "
108  "package will be lit up and will state \"Staking Enabled\" to indicate "
109  "it is staking. Using the command line interface (%1); the command %2 "
110  "will confirm that staking is active.")
111  .arg("pivx-cli", "<span style=\"font-style:italic\">getstakingstatus</span>")));
112  ui->labelContent_Stake->setText(stakeContent);
113 
114  QString supportContent = formatFAQContent(
116  tr("We have support channels in most of our official chat groups, for example %1")
117  .arg("<a style='color: #b088ff' href='https://discord.PIVX.org'>" + tr("#support in our Discord") + "</a>.")));
118  ui->labelContent_Support->setText(supportContent);
119 
120  QString masternodeContent = formatFAQContent(
122  tr("A masternode is a computer running a full node %1 wallet with a "
123  "requirement of %2 secured collateral to provide extra services "
124  "to the network and in return, receive a portion of the block reward "
125  "regularly. These services include:")
126  .arg(PACKAGE_NAME)
129  formatFAQListItem(tr("A decentralized governance (Proposal Voting)")) +
130  formatFAQListItem(tr("A decentralized budgeting system (Treasury)")) +
131  formatFAQListItem(tr("Validation of transactions within each block")) +
132  formatFAQListItem(tr("Act as an additional full node in the network")))) +
134  tr("For providing such services, masternodes are also paid a certain portion "
135  "of reward for each block. This can serve as a passive income to the "
136  "masternode owners minus their running cost.")) +
138  tr("Masternode Perks:") +
140  formatFAQListItem(tr("Participate in PIVX Governance")) +
141  formatFAQListItem(tr("Earn Masternode Rewards")) +
142  formatFAQListItem(tr("Commodity option for future sale")) +
143  formatFAQListItem(tr("Help secure the PIVX network")))) +
145  tr("Requirements:") +
147  formatFAQListItem(tr("%1 per single Masternode instance")
149  formatFAQListItem(tr("Must be stored in a core wallet")) +
150  formatFAQListItem(tr("Need dedicated IP address")) +
151  formatFAQListItem(tr("Masternode wallet to remain online")))));
152  ui->labelContent_Masternode->setText(masternodeContent);
153 
154  QString mNControllerContent = formatFAQContent(
156  tr("A Masternode Controller wallet is where the %1 collateral "
157  "can reside during a Controller-Remote masternode setup. It is a wallet "
158  "that can activate the remote masternode wallet(s) and allows you to keep "
159  "your collateral coins offline while the remote masternode remains online.")
161  ui->labelContent_MNController->setText(mNControllerContent);
162 
163 
164  // Exit button
165  setCssProperty(ui->pushButtonExit, "btn-faq-exit");
166 
167  // Web Link
168  setCssProperty(ui->pushButtonWebLink, "btn-faq-web");
169  setCssProperty(ui->containerButtons, "container-faq-buttons");
170 
171  // Buttons
172  connect(ui->pushButtonExit, &QPushButton::clicked, this, &SettingsFaqWidget::close);
173  connect(ui->pushButton_Intro, &QPushButton::clicked, [this](){onFaqClicked(ui->widget_Intro);});
174  connect(ui->pushButton_UnspendablePIV, &QPushButton::clicked, [this](){onFaqClicked(ui->widget_UnspendablePIV);});
175  connect(ui->pushButton_Stake, &QPushButton::clicked, [this](){onFaqClicked(ui->widget_Stake);});
176  connect(ui->pushButton_Support, &QPushButton::clicked, [this](){onFaqClicked(ui->widget_Support);});
177  connect(ui->pushButton_Masternode, &QPushButton::clicked, [this](){onFaqClicked(ui->widget_Masternode);});
178  connect(ui->pushButton_MNController, &QPushButton::clicked, [this](){onFaqClicked(ui->widget_MNController);});
179 
180  if (parent)
182 }
183 
184 void SettingsFaqWidget::showEvent(QShowEvent *event)
185 {
186  QPushButton* btn = getButtons()[section];
187  QMetaObject::invokeMethod(btn, "setChecked", Qt::QueuedConnection, Q_ARG(bool, true));
188  QMetaObject::invokeMethod(btn, "clicked", Qt::QueuedConnection);
189 }
190 
192 {
193  section = _section;
194 }
195 
196 void SettingsFaqWidget::onFaqClicked(const QWidget* const widget)
197 {
198  ui->scrollAreaFaq->verticalScrollBar()->setValue(widget->y());
199 }
200 
201 void SettingsFaqWidget::windowResizeEvent(QResizeEvent* event)
202 {
203  QWidget* w = qobject_cast<QWidget*>(parent());
204  this->resize(w->width(), w->height());
205  this->move(QPoint(0, 0));
206 }
207 
208 std::vector<QPushButton*> SettingsFaqWidget::getButtons()
209 {
210  return {
211  ui->pushButton_Intro,
212  ui->pushButton_UnspendablePIV,
213  ui->pushButton_Stake,
214  ui->pushButton_Support,
215  ui->pushButton_Masternode,
216  ui->pushButton_MNController
217  };
218 }
219 
221 {
222  delete ui;
223 }
224 
225 
CAmount getMNCollateralRequiredAmount()
Definition: mnmodel.cpp:200
PIVX GUI main class.
Definition: pivxgui.h:46
void windowResizeEvent(QResizeEvent *event)
std::vector< QPushButton * > getButtons()
Definition: faqwidget.cpp:208
static QString formatFAQUnorderedList(const QString &str)
Definition: faqwidget.h:63
Section section
Definition: faqwidget.h:42
static QString formatFAQContent(const QString &str)
Definition: faqwidget.h:48
void onFaqClicked(const QWidget *const widget)
Definition: faqwidget.cpp:196
void windowResizeEvent(QResizeEvent *event)
Definition: faqwidget.cpp:201
SettingsFaqWidget(PIVXGUI *parent, MNModel *_model)
Definition: faqwidget.cpp:18
void setSection(Section _section)
Definition: faqwidget.cpp:191
void showEvent(QShowEvent *event) override
Definition: faqwidget.cpp:184
static QString formatFAQParagraph(const QString &str)
Definition: faqwidget.h:53
static QString formatFAQOrderedList(const QString &str)
Definition: faqwidget.h:58
Ui::SettingsFaqWidget * ui
Definition: faqwidget.h:41
static QString formatFAQListItem(const QString &str)
Definition: faqwidget.h:68
QString formatBalance(CAmount amount, int nDisplayUnit, bool isZpiv)
Definition: guiutil.cpp:119
#define PACKAGE_NAME
Definition: pivx-config.h:366
void setCssProperty(std::initializer_list< QWidget * > args, const QString &value)
Definition: qtutils.cpp:334