Skip to content

Commit 4a66dd1

Browse files
committed
[GUI] Master node screen improvements:
* In-wallet FAQ MN controller explanation. * MN controller creation dialog data validation + code cleanup. * MN info code refactor + cleanup.
1 parent 0e8eff1 commit 4a66dd1

File tree

9 files changed

+249
-93
lines changed

9 files changed

+249
-93
lines changed

src/qt/pivx/forms/masternodeswidget.ui

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,13 @@
257257
<widget class="QPushButton" name="pushButtonSave">
258258
<property name="minimumSize">
259259
<size>
260-
<width>200</width>
260+
<width>280</width>
261261
<height>50</height>
262262
</size>
263263
</property>
264264
<property name="maximumSize">
265265
<size>
266-
<width>200</width>
266+
<width>280</width>
267267
<height>50</height>
268268
</size>
269269
</property>
@@ -309,6 +309,16 @@
309309
</property>
310310
</widget>
311311
</item>
312+
<item>
313+
<widget class="OptionButton" name="btnAboutController" native="true">
314+
<property name="minimumSize">
315+
<size>
316+
<width>0</width>
317+
<height>50</height>
318+
</size>
319+
</property>
320+
</widget>
321+
</item>
312322
<item>
313323
<spacer name="verticalSpacer_5">
314324
<property name="orientation">

src/qt/pivx/forms/mninfodialog.ui

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
<x>0</x>
88
<y>0</y>
99
<width>574</width>
10-
<height>680</height>
10+
<height>700</height>
1111
</rect>
1212
</property>
1313
<property name="minimumSize">
1414
<size>
1515
<width>574</width>
16-
<height>455</height>
16+
<height>470</height>
1717
</size>
1818
</property>
1919
<property name="windowTitle">
@@ -207,7 +207,7 @@ background:transparent;
207207
<x>0</x>
208208
<y>0</y>
209209
<width>570</width>
210-
<height>576</height>
210+
<height>596</height>
211211
</rect>
212212
</property>
213213
<property name="autoFillBackground">
@@ -534,28 +534,53 @@ background:transparent;
534534
</widget>
535535
</item>
536536
<item>
537-
<widget class="QWidget" name="contentConfirmations" native="true">
538-
<layout class="QHBoxLayout" name="horizontalLayout_8" stretch="0,1">
537+
<widget class="QWidget" name="contentExport" native="true">
538+
<layout class="QHBoxLayout" name="horizontalLayout_8" stretch="0,1,0">
539539
<property name="leftMargin">
540540
<number>0</number>
541541
</property>
542542
<item>
543-
<widget class="QLabel" name="labelConfirmations">
543+
<widget class="QLabel" name="labelExport">
544544
<property name="maximumSize">
545545
<size>
546546
<width>16777215</width>
547547
<height>16777215</height>
548548
</size>
549549
</property>
550550
<property name="text">
551-
<string>Confirmations:</string>
551+
<string>Export Master Node:</string>
552552
</property>
553553
</widget>
554554
</item>
555555
<item>
556-
<widget class="QLabel" name="textConfirmations">
556+
<widget class="QLabel" name="textExport">
557+
<property name="styleSheet">
558+
<string notr="true">margin-top: 13.5px;</string>
559+
</property>
560+
<property name="text">
561+
<string>pivx.conf required data to initialize the Master Node will be exported to your clipboard.</string>
562+
</property>
563+
<property name="wordWrap">
564+
<bool>true</bool>
565+
</property>
566+
</widget>
567+
</item>
568+
<item>
569+
<widget class="QPushButton" name="pushExport">
570+
<property name="minimumSize">
571+
<size>
572+
<width>34</width>
573+
<height>34</height>
574+
</size>
575+
</property>
576+
<property name="maximumSize">
577+
<size>
578+
<width>34</width>
579+
<height>34</height>
580+
</size>
581+
</property>
557582
<property name="text">
558-
<string>12</string>
583+
<string/>
559584
</property>
560585
</widget>
561586
</item>

src/qt/pivx/masternodeswidget.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,14 @@ MasterNodesWidget::MasterNodesWidget(PIVXGUI *parent) :
9494
setCssSubtitleScreen(ui->labelSubtitle1);
9595

9696
/* Buttons */
97-
ui->pushButtonSave->setText(tr("Create Master Node"));
97+
ui->pushButtonSave->setText(tr("Create Master Node Controller"));
9898
setCssBtnPrimary(ui->pushButtonSave);
9999

100100
/* Options */
101101
ui->btnAbout->setTitleClassAndText("btn-title-grey", "What is a Master Node?");
102102
ui->btnAbout->setSubTitleClassAndText("text-subtitle", "FAQ explaining what Master Nodes are");
103+
ui->btnAboutController->setTitleClassAndText("btn-title-grey", "What is a Controller?");
104+
ui->btnAboutController->setSubTitleClassAndText("text-subtitle", "FAQ explaining what is a Master Node Controller");
103105

104106
setCssProperty(ui->listMn, "container");
105107
ui->listMn->setItemDelegate(delegate);
@@ -116,6 +118,7 @@ MasterNodesWidget::MasterNodesWidget(PIVXGUI *parent) :
116118
connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(onCreateMNClicked()));
117119
connect(ui->listMn, SIGNAL(clicked(QModelIndex)), this, SLOT(onMNClicked(QModelIndex)));
118120
connect(ui->btnAbout, &OptionButton::clicked, [this](){window->openFAQ(9);});
121+
connect(ui->btnAboutController, &OptionButton::clicked, [this](){window->openFAQ(10);});
119122
}
120123

121124
void MasterNodesWidget::showEvent(QShowEvent *event){

src/qt/pivx/masternodewizarddialog.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "optionsmodel.h"
99
#include <QFile>
1010
#include <QIntValidator>
11+
#include <QRegExpValidator>
1112

1213
MasterNodeWizardDialog::MasterNodeWizardDialog(WalletModel *model, QWidget *parent) :
1314
QDialog(parent),
@@ -46,6 +47,7 @@ MasterNodeWizardDialog::MasterNodeWizardDialog(WalletModel *model, QWidget *pare
4647

4748
ui->lineEditName->setPlaceholderText(tr("e.g user_masternode"));
4849
initCssEditLine(ui->lineEditName);
50+
ui->lineEditName->setValidator(new QRegExpValidator(QRegExp("^[A-Za-z0-9]+"), ui->lineEditName));
4951

5052
// Frame 4
5153
setCssProperty(ui->labelTitle4, "text-title-dialog");
@@ -59,6 +61,12 @@ MasterNodeWizardDialog::MasterNodeWizardDialog(WalletModel *model, QWidget *pare
5961
initCssEditLine(ui->lineEditPort);
6062
ui->stackedWidget->setCurrentIndex(pos);
6163
ui->lineEditPort->setValidator(new QIntValidator(0, 9999999, ui->lineEditPort));
64+
if(walletModel->isTestnet()){
65+
ui->lineEditPort->setEnabled(false);
66+
ui->lineEditPort->setText("51474");
67+
} else {
68+
ui->lineEditPort->setText("51472");
69+
}
6270

6371
// Confirm icons
6472
ui->stackedIcon1->addWidget(icConfirm1);
@@ -120,8 +128,10 @@ void MasterNodeWizardDialog::onNextClicked(){
120128

121129
// No empty names accepted.
122130
if (ui->lineEditName->text().isEmpty()) {
131+
setCssEditLine(ui->lineEditName, false, true);
123132
return;
124133
}
134+
setCssEditLine(ui->lineEditName, true, true);
125135

126136
ui->stackedWidget->setCurrentIndex(2);
127137
ui->pushName4->setChecked(false);

src/qt/pivx/mninfodialog.cpp

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,37 +18,20 @@ MnInfoDialog::MnInfoDialog(QWidget *parent) :
1818
ui->setupUi(this);
1919
this->setStyleSheet(parent->styleSheet());
2020
setCssProperty(ui->frame, "container-dialog");
21-
// Title
2221
ui->labelTitle->setText(tr("Master Node Information"));
2322
setCssProperty(ui->labelTitle, "text-title-dialog");
24-
// Labels
25-
setCssTextBodyDialog({ui->labelAmount, ui->labelSend, ui->labelInputs, ui->labelFee, ui->labelId, ui->labelSize, ui->labelConfirmations});
23+
setCssTextBodyDialog({ui->labelAmount, ui->labelSend, ui->labelInputs, ui->labelFee, ui->labelId, ui->labelSize, ui->labelExport});
2624
setCssProperty({ui->labelDivider1, ui->labelDivider4, ui->labelDivider5, ui->labelDivider6, ui->labelDivider7, ui->labelDivider8, ui->labelDivider9}, "container-divider");
27-
setCssTextBodyDialog({ui->textAmount, ui->textAddress, ui->textInputs, ui->textStatus, ui->textId, ui->textSize, ui->textConfirmations});
28-
setCssProperty(ui->pushCopy, "ic-copy-big");
29-
setCssProperty(ui->pushCopyId, "ic-copy-big");
25+
setCssTextBodyDialog({ui->textAmount, ui->textAddress, ui->textInputs, ui->textStatus, ui->textId, ui->textSize, ui->textExport});
26+
setCssProperty({ui->pushCopy, ui->pushCopyId}, "ic-copy-big");
3027
setCssProperty(ui->btnEsc, "ic-close");
31-
ui->contentConfirmations->setVisible(false);
28+
ui->contentExport->setVisible(false);
3229
ui->labelDivider7->setVisible(false);
3330
ui->contentSize->setVisible(false);
3431
ui->labelDivider5->setVisible(false);
3532
connect(ui->btnEsc, SIGNAL(clicked()), this, SLOT(close()));
36-
connect(ui->pushCopy, &QPushButton::clicked, [this](){
37-
GUIUtil::setClipboard(txId);
38-
SnackBar *snackBar = new SnackBar(nullptr, this);
39-
snackBar->setText(tr("Master Node public key copied"));
40-
snackBar->resize(this->width(), snackBar->height());
41-
openDialog(snackBar, this);
42-
snackBar->deleteLater();
43-
});
44-
connect(ui->pushCopyId, &QPushButton::clicked, [this](){
45-
GUIUtil::setClipboard(pubKey);
46-
SnackBar *snackBar = new SnackBar(nullptr, this);
47-
snackBar->setText(tr("Collateral tx id copied"));
48-
snackBar->resize(this->width(), snackBar->height());
49-
openDialog(snackBar, this);
50-
snackBar->deleteLater();
51-
});
33+
connect(ui->pushCopy, &QPushButton::clicked, [this](){ copyInform(txId, "Master Node public key copied"); });
34+
connect(ui->pushCopyId, &QPushButton::clicked, [this](){ copyInform(pubKey, "Collateral tx id copied"); });
5235
}
5336

5437
void MnInfoDialog::setData(QString pubKey, QString name, QString address, QString txId, QString outputIndex, QString status){
@@ -69,7 +52,15 @@ void MnInfoDialog::setData(QString pubKey, QString name, QString address, QStrin
6952
ui->textStatus->setText(status);
7053
}
7154

72-
MnInfoDialog::~MnInfoDialog()
73-
{
55+
void MnInfoDialog::copyInform(QString& copyStr, QString message){
56+
GUIUtil::setClipboard(copyStr);
57+
SnackBar *snackBar = new SnackBar(nullptr, this);
58+
snackBar->setText(tr(message.toStdString().c_str()));
59+
snackBar->resize(this->width(), snackBar->height());
60+
openDialog(snackBar, this);
61+
snackBar->deleteLater();
62+
}
63+
64+
MnInfoDialog::~MnInfoDialog(){
7465
delete ui;
7566
}

src/qt/pivx/mninfodialog.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ class MnInfoDialog : public QDialog
2929
WalletModel *model = nullptr;
3030
QString txId;
3131
QString pubKey;
32+
bool exportMN = false;
33+
34+
void copyInform(QString& copyStr, QString message);
3235
};
3336

3437
#endif // MNINFODIALOG_H

0 commit comments

Comments
 (0)