Skip to content

Commit

Permalink
[GUI] fix clang warnings in masternodewizarddialog.h/cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
furszy committed Jan 18, 2022
1 parent 2770c6d commit 9e2b5a5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
36 changes: 15 additions & 21 deletions src/qt/pivx/masternodewizarddialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ static inline QString formatHtmlContent(const QString& str) {
return "<html><body>" + str + "</body></html>";
}

static void initBtn(std::initializer_list<QPushButton*> args)
{
QSize BUTTON_SIZE = QSize(22, 22);
for (QPushButton* btn : args) {
btn->setMinimumSize(BUTTON_SIZE);
btn->setMaximumSize(BUTTON_SIZE);
btn->move(0, 0);
btn->show();
btn->raise();
btn->setVisible(false);
}
}

MasterNodeWizardDialog::MasterNodeWizardDialog(WalletModel* model, MNModel* _mnModel, QWidget *parent) :
FocusedDialog(parent),
ui(new Ui::MasterNodeWizardDialog),
Expand Down Expand Up @@ -127,7 +140,6 @@ void MasterNodeWizardDialog::accept()
break;
}
case 1: {

// No empty names accepted.
if (ui->lineEditName->text().isEmpty()) {
setCssEditLine(ui->lineEditName, false, true);
Expand All @@ -141,20 +153,15 @@ void MasterNodeWizardDialog::accept()
ui->pushName1->setChecked(true);
icConfirm3->setVisible(true);
ui->pushNumber4->setChecked(true);
ui->btnBack->setVisible(true);
ui->lineEditIpAddress->setFocus();
break;
}
case 2: {

// No empty address accepted
if (ui->lineEditIpAddress->text().isEmpty()) {
return;
}

icConfirm4->setVisible(true);
ui->btnBack->setVisible(true);
ui->btnBack->setVisible(true);
isOk = createMN();
QDialog::accept();
}
Expand Down Expand Up @@ -260,7 +267,7 @@ void MasterNodeWizardDialog::onBackClicked()
}
}

void MasterNodeWizardDialog::inform(QString text)
void MasterNodeWizardDialog::inform(const QString& text)
{
if (!snackBar)
snackBar = new SnackBar(nullptr, this);
Expand All @@ -269,21 +276,8 @@ void MasterNodeWizardDialog::inform(QString text)
openDialog(snackBar, this);
}

QSize BUTTON_SIZE = QSize(22, 22);
void MasterNodeWizardDialog::initBtn(std::initializer_list<QPushButton*> args)
{
for (QPushButton* btn : args) {
btn->setMinimumSize(BUTTON_SIZE);
btn->setMaximumSize(BUTTON_SIZE);
btn->move(0, 0);
btn->show();
btn->raise();
btn->setVisible(false);
}
}

MasterNodeWizardDialog::~MasterNodeWizardDialog()
{
if (snackBar) delete snackBar;
delete snackBar;
delete ui;
}
5 changes: 2 additions & 3 deletions src/qt/pivx/masternodewizarddialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class MasterNodeWizardDialog : public FocusedDialog, public PWidget::Translator
explicit MasterNodeWizardDialog(WalletModel* walletMode,
MNModel* mnModel,
QWidget *parent = nullptr);
~MasterNodeWizardDialog();
~MasterNodeWizardDialog() override;
void showEvent(QShowEvent *event) override;
QString translate(const char *msg) override { return tr(msg); }

Expand All @@ -49,8 +49,7 @@ private Q_SLOTS:
WalletModel* walletModel{nullptr};
MNModel* mnModel{nullptr};
bool createMN();
void inform(QString text);
void initBtn(std::initializer_list<QPushButton*> args);
void inform(const QString& text);
};

#endif // MASTERNODEWIZARDDIALOG_H

0 comments on commit 9e2b5a5

Please sign in to comment.