22// Distributed under the MIT software license, see the accompanying
33// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44
5- #include < qt/proposalwizard .h>
6- #include < qt/forms/ui_proposalwizard .h>
5+ #include < qt/proposalcreate .h>
6+ #include < qt/forms/ui_proposalcreate .h>
77
88#include < governance/object.h>
99#include < governance/validators.h>
3131
3232#include < algorithm>
3333
34- ProposalWizard::ProposalWizard (WalletModel* walletModel, QWidget* parent) :
34+ ProposalCreate::ProposalCreate (WalletModel* walletModel, QWidget* parent) :
3535 QDialog(parent),
3636 m_walletModel(walletModel),
37- m_ui(new Ui::ProposalWizard )
37+ m_ui(new Ui::ProposalCreate )
3838{
3939 m_ui->setupUi (this );
4040 m_ui->labelError ->setStyleSheet (GUIUtil::getThemedStyleQString (GUIUtil::ThemedStyle::TS_ERROR));
@@ -70,33 +70,33 @@ ProposalWizard::ProposalWizard(WalletModel* walletModel, QWidget* parent) :
7070 // Initialize total amount display (formatted with current unit)
7171 updateDisplayUnit ();
7272
73- connect (m_ui->btnViewJson , &QPushButton::clicked, this , &ProposalWizard ::onViewJson);
74- connect (m_ui->btnViewPayload , &QPushButton::clicked, this , &ProposalWizard ::onViewPayload);
75- connect (m_ui->editName , &QLineEdit::textChanged, this , &ProposalWizard ::validateFields);
76- connect (m_ui->editUrl , &QLineEdit::textChanged, this , &ProposalWizard ::validateFields);
77- connect (m_ui->editPayAddr , &QLineEdit::textChanged, this , &ProposalWizard ::validateFields);
78- connect (m_ui->spinPayments , QOverload<int >::of (&QSpinBox::valueChanged), this , &ProposalWizard ::updateLabels);
79- connect (m_ui->paymentAmount , &BitcoinAmountField::valueChanged, this , &ProposalWizard ::updateLabels);
80- connect (m_ui->paymentAmount , &BitcoinAmountField::valueChanged, this , &ProposalWizard ::validateFields);
81- connect (m_ui->btnCreate , &QPushButton::clicked, this , &ProposalWizard ::onCreate);
73+ connect (m_ui->btnViewJson , &QPushButton::clicked, this , &ProposalCreate ::onViewJson);
74+ connect (m_ui->btnViewPayload , &QPushButton::clicked, this , &ProposalCreate ::onViewPayload);
75+ connect (m_ui->editName , &QLineEdit::textChanged, this , &ProposalCreate ::validateFields);
76+ connect (m_ui->editUrl , &QLineEdit::textChanged, this , &ProposalCreate ::validateFields);
77+ connect (m_ui->editPayAddr , &QLineEdit::textChanged, this , &ProposalCreate ::validateFields);
78+ connect (m_ui->spinPayments , QOverload<int >::of (&QSpinBox::valueChanged), this , &ProposalCreate ::updateLabels);
79+ connect (m_ui->paymentAmount , &BitcoinAmountField::valueChanged, this , &ProposalCreate ::updateLabels);
80+ connect (m_ui->paymentAmount , &BitcoinAmountField::valueChanged, this , &ProposalCreate ::validateFields);
81+ connect (m_ui->btnCreate , &QPushButton::clicked, this , &ProposalCreate ::onCreate);
8282
8383 // Update fee labels on display unit change
8484 if (m_walletModel && m_walletModel->getOptionsModel ()) {
8585 connect (m_walletModel->getOptionsModel (), &OptionsModel::displayUnitChanged, this ,
86- &ProposalWizard ::updateDisplayUnit);
86+ &ProposalCreate ::updateDisplayUnit);
8787 }
8888
8989 GUIUtil::disableMacFocusRect (this );
9090 GUIUtil::updateFonts ();
9191 setFixedSize (size ());
9292}
9393
94- ProposalWizard ::~ProposalWizard ()
94+ ProposalCreate ::~ProposalCreate ()
9595{
9696 delete m_ui;
9797}
9898
99- void ProposalWizard ::buildJsonAndHex ()
99+ void ProposalCreate ::buildJsonAndHex ()
100100{
101101 const int64_t multiplier = std::numeric_limits<int64_t >::max () / std::max<int64_t >(1 , m_target_spacing);
102102
@@ -139,7 +139,7 @@ void ProposalWizard::buildJsonAndHex()
139139 m_hex = QString::fromStdString (HexStr (json));
140140}
141141
142- void ProposalWizard ::onViewJson ()
142+ void ProposalCreate ::onViewJson ()
143143{
144144 buildJsonAndHex ();
145145 const QString html = QString (" <code style=\" white-space: pre-wrap;\" >%1</code>" ).arg (m_json.toHtmlEscaped ());
@@ -150,7 +150,7 @@ void ProposalWizard::onViewJson()
150150 dlg->show ();
151151}
152152
153- void ProposalWizard ::onViewPayload ()
153+ void ProposalCreate ::onViewPayload ()
154154{
155155 buildJsonAndHex ();
156156 const QString html = QString (" <code style=\" word-wrap: break-word;\" >%1</code>" ).arg (m_hex.toHtmlEscaped ());
@@ -161,7 +161,7 @@ void ProposalWizard::onViewPayload()
161161 dlg->show ();
162162}
163163
164- void ProposalWizard ::onCreate ()
164+ void ProposalCreate ::onCreate ()
165165{
166166 // Validate fields first
167167 if (m_ui->editName ->text ().trimmed ().isEmpty () || m_ui->editUrl ->text ().trimmed ().isEmpty () ||
@@ -216,7 +216,7 @@ void ProposalWizard::onCreate()
216216 accept (); // Close the wizard
217217}
218218
219- void ProposalWizard ::updateLabels ()
219+ void ProposalCreate ::updateLabels ()
220220{
221221 if (m_walletModel && m_walletModel->getOptionsModel ()) {
222222 const auto unit = m_walletModel->getOptionsModel ()->getDisplayUnit ();
@@ -235,15 +235,15 @@ void ProposalWizard::updateLabels()
235235 }
236236}
237237
238- void ProposalWizard ::updateDisplayUnit ()
238+ void ProposalCreate ::updateDisplayUnit ()
239239{
240240 if (m_walletModel && m_walletModel->getOptionsModel ()) {
241241 m_ui->paymentAmount ->setDisplayUnit (m_walletModel->getOptionsModel ()->getDisplayUnit ());
242242 }
243243 updateLabels ();
244244}
245245
246- void ProposalWizard ::validateFields ()
246+ void ProposalCreate ::validateFields ()
247247{
248248 if (m_ui->editName ->text ().trimmed ().isEmpty () && m_ui->editUrl ->text ().trimmed ().isEmpty () &&
249249 m_ui->editPayAddr ->text ().trimmed ().isEmpty () && m_ui->paymentAmount ->value () == 0 )
0 commit comments