forked from MUME/MMapper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathManagePasswordDialog.cpp
More file actions
64 lines (53 loc) · 1.65 KB
/
Copy pathManagePasswordDialog.cpp
File metadata and controls
64 lines (53 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright (C) 2019 The MMapper Authors
#include "ManagePasswordDialog.h"
#include "../global/ConfigConsts-Computed.h"
#include "../global/ConfigEnums.h"
#include "ui_ManagePasswordDialog.h"
#include <QLineEdit>
#include <QPushButton>
ManagePasswordDialog::ManagePasswordDialog(QWidget *parent)
: QDialog(parent)
, ui(new Ui::ManagePasswordDialog)
{
ui->setupUi(this);
if constexpr (CURRENT_PLATFORM == PlatformEnum::Wasm) {
setWindowTitle("Manage Account");
ui->label_2->hide();
ui->accountPassword->hide();
ui->showPassword->hide();
ui->deleteButton->hide();
} else {
connect(ui->showPassword, &QToolButton::toggled, this, [this](bool checked) {
ui->accountPassword->setEchoMode(checked ? QLineEdit::Normal : QLineEdit::Password);
});
connect(ui->deleteButton, &QPushButton::clicked, this, [this]() {
emit sig_deleteRequested();
ui->accountPassword->clear();
ui->deleteButton->setEnabled(false);
});
}
}
ManagePasswordDialog::~ManagePasswordDialog()
{
delete ui;
}
void ManagePasswordDialog::setAccountName(const QString &name)
{
ui->accountName->setText(name);
}
QString ManagePasswordDialog::accountName() const
{
return ui->accountName->text();
}
void ManagePasswordDialog::setPassword(const QString &password)
{
ui->accountPassword->setText(password);
if constexpr (CURRENT_PLATFORM != PlatformEnum::Wasm) {
ui->deleteButton->setEnabled(!password.isEmpty());
}
}
QString ManagePasswordDialog::password() const
{
return ui->accountPassword->text();
}