feather/src/wizard/PageSetPassword.cpp
2022-02-10 11:26:41 +01:00

47 lines
1.3 KiB
C++

// SPDX-License-Identifier: BSD-3-Clause
// SPDX-FileCopyrightText: 2020-2022 The Monero Project
#include "PageSetPassword.h"
#include "ui_PageSetPassword.h"
#include "WalletWizard.h"
PageSetPassword::PageSetPassword(WizardFields *fields, QWidget *parent)
: QWizardPage(parent)
, ui(new Ui::PageSetPassword)
, m_fields(fields)
{
ui->setupUi(this);
this->setFinalPage(true);
QPixmap pixmap = QPixmap(":/assets/images/lock.png");
ui->icon->setPixmap(pixmap.scaledToWidth(32, Qt::SmoothTransformation));
connect(ui->line_password, &QLineEdit::textChanged, [this]{
this->completeChanged();
});
connect(ui->line_confirmPassword, &QLineEdit::textChanged, [this]{
this->completeChanged();
});
this->setButtonText(QWizard::FinishButton, "Create/Open wallet");
}
void PageSetPassword::initializePage() {
this->setTitle(m_fields->modeText);
ui->line_password->setText("");
ui->line_confirmPassword->setText("");
}
bool PageSetPassword::validatePage() {
m_fields->password = ui->line_password->text();
emit createWallet();
return true;
}
int PageSetPassword::nextId() const {
return -1;
}
bool PageSetPassword::isComplete() const {
return ui->line_password->text() == ui->line_confirmPassword->text();
}