-
Notifications
You must be signed in to change notification settings - Fork 13
/
mainwindow.cpp
32 lines (27 loc) · 1.28 KB
/
mainwindow.cpp
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
#include "mainwindow.h"
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
setWindowTitle("五笔/拼音 密码生成器");
centralWidget = new QWidget(this);
vBox = new QVBoxLayout(centralWidget);
pwdControl = new PasswordControl();
pwdGen = new PasswordGenerator(this);
wordSepView = new WordSepView();
pwdView = new PasswordView();
entropyView = new EntropyView();
connect(pwdControl, &PasswordControl::lengthChanged, pwdGen, &PasswordGenerator::setLength);
connect(pwdControl, &PasswordControl::typeChanged, pwdGen, &PasswordGenerator::setType);
connect(pwdControl, &PasswordControl::request, pwdGen, &PasswordGenerator::generatePassword);
connect(pwdGen, &PasswordGenerator::passwordChanged, pwdView, &PasswordView::displayPassword);
connect(pwdGen, &PasswordGenerator::passwordChanged, wordSepView, &WordSepView::displayPassword);
connect(pwdGen, &PasswordGenerator::passwordChanged, entropyView, &EntropyView::displayEntInfo);
vBox->addWidget(pwdControl,0,Qt::AlignCenter);
vBox->addWidget(wordSepView);
vBox->addWidget(pwdView);
vBox->addWidget(entropyView);
setCentralWidget(centralWidget);
pwdControl->setDefault();
pwdGen->generatePassword();
adjustSize();
setFixedHeight(height());
}