add wifi to setup (#2604)
* add wifi to setup * wifi looks better * move widgets * this looks ok * small fixups * fix relase testspull/2663/head
parent
d00f1692b7
commit
6a2678aae7
15 changed files with 143 additions and 123 deletions
@ -1,56 +0,0 @@ |
||||
#include <QEvent> |
||||
#include <QVBoxLayout> |
||||
#include <QLineEdit> |
||||
#include <QLabel> |
||||
#include <QPushButton> |
||||
|
||||
#include "input_field.hpp" |
||||
#include "keyboard.hpp" |
||||
|
||||
InputField::InputField(QWidget *parent): QWidget(parent) { |
||||
l = new QVBoxLayout(); |
||||
QHBoxLayout *r = new QHBoxLayout(); |
||||
label = new QLabel(this); |
||||
label->setText("password"); |
||||
r->addWidget(label); |
||||
QPushButton* cancel = new QPushButton("cancel"); |
||||
QObject::connect(cancel, SIGNAL(released()), this, SLOT(emitEmpty()));
|
||||
cancel->setFixedHeight(150); |
||||
cancel->setFixedWidth(300); |
||||
r->addWidget(cancel); |
||||
l->addLayout(r); |
||||
l->addSpacing(80); |
||||
|
||||
line = new QLineEdit(""); |
||||
l->addWidget(line); |
||||
l->addSpacing(80); |
||||
|
||||
k = new Keyboard(this); |
||||
QObject::connect(k, SIGNAL(emitButton(QString)), this, SLOT(getText(QString))); |
||||
l->addWidget(k); |
||||
setLayout(l); |
||||
} |
||||
|
||||
void InputField::emitEmpty(){ |
||||
emitText(""); |
||||
line->setText(""); |
||||
} |
||||
void InputField::getText(QString s){ |
||||
if(!QString::compare(s,"⌫")){ |
||||
line->backspace(); |
||||
} |
||||
|
||||
if(!QString::compare(s,"⏎")){ |
||||
emitText(line->text()); |
||||
line->setText(""); |
||||
} |
||||
|
||||
QVector<QString> control_buttons {"⇧", "↑", "ABC", "⏎", "#+=", "⌫", "123"}; |
||||
for(QString c :control_buttons){ |
||||
if(!QString::compare(s, c)){ |
||||
return; |
||||
} |
||||
} |
||||
line->insert(s.left(1)); |
||||
} |
||||
|
@ -0,0 +1,65 @@ |
||||
#include <QPushButton> |
||||
|
||||
#include "input_field.hpp" |
||||
|
||||
InputField::InputField(QWidget *parent): QWidget(parent) { |
||||
layout = new QGridLayout(); |
||||
layout->setSpacing(30); |
||||
|
||||
label = new QLabel(this); |
||||
label->setStyleSheet(R"(font-size: 55px;)"); |
||||
layout->addWidget(label, 0, 0, Qt::AlignVCenter | Qt::AlignLeft); |
||||
layout->setColumnStretch(0, 1); |
||||
|
||||
QPushButton* cancel = new QPushButton("Cancel"); |
||||
cancel->setFixedSize(300, 150); |
||||
cancel->setStyleSheet(R"(padding: 0;)"); |
||||
layout->addWidget(cancel, 0, 1, Qt::AlignVCenter | Qt::AlignRight); |
||||
QObject::connect(cancel, SIGNAL(released()), this, SLOT(emitEmpty())); |
||||
|
||||
// text box
|
||||
line = new QLineEdit(); |
||||
line->setStyleSheet(R"( |
||||
color: black; |
||||
background-color: white; |
||||
font-size: 45px; |
||||
padding: 25px; |
||||
)"); |
||||
layout->addWidget(line, 1, 0, 1, -1); |
||||
|
||||
k = new Keyboard(this); |
||||
QObject::connect(k, SIGNAL(emitButton(QString)), this, SLOT(getText(QString))); |
||||
layout->addWidget(k, 2, 0, 1, -1); |
||||
|
||||
setLayout(layout); |
||||
} |
||||
|
||||
void InputField::setPromptText(QString text) { |
||||
label->setText(text); |
||||
} |
||||
|
||||
void InputField::emitEmpty() { |
||||
emitText(""); |
||||
line->setText(""); |
||||
} |
||||
|
||||
void InputField::getText(QString s) { |
||||
if(!QString::compare(s,"⌫")){ |
||||
line->backspace(); |
||||
} |
||||
|
||||
if(!QString::compare(s,"⏎")){ |
||||
emitText(line->text()); |
||||
line->setText(""); |
||||
} |
||||
|
||||
QVector<QString> control_buttons {"⇧", "↑", "ABC", "⏎", "#+=", "⌫", "123"}; |
||||
for(QString c : control_buttons){ |
||||
if(!QString::compare(s, c)){ |
||||
return; |
||||
} |
||||
} |
||||
|
||||
line->insert(s.left(1)); |
||||
} |
||||
|
Loading…
Reference in new issue