summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-11-17 20:44:16 +0100
committerZach Hilman <zachhilman@gmail.com>2018-11-18 16:53:47 +0100
commit56cf5b7b17cd87f4a23bd45ae661762ce1fda5d1 (patch)
treeb5a91d110ae92844596e1bf70206984db330f204
parentsoftware_keyboard: Push all data over all channels on dialog completion (diff)
downloadyuzu-56cf5b7b17cd87f4a23bd45ae661762ce1fda5d1.tar
yuzu-56cf5b7b17cd87f4a23bd45ae661762ce1fda5d1.tar.gz
yuzu-56cf5b7b17cd87f4a23bd45ae661762ce1fda5d1.tar.bz2
yuzu-56cf5b7b17cd87f4a23bd45ae661762ce1fda5d1.tar.lz
yuzu-56cf5b7b17cd87f4a23bd45ae661762ce1fda5d1.tar.xz
yuzu-56cf5b7b17cd87f4a23bd45ae661762ce1fda5d1.tar.zst
yuzu-56cf5b7b17cd87f4a23bd45ae661762ce1fda5d1.zip
-rw-r--r--src/yuzu/applets/software_keyboard.cpp11
-rw-r--r--src/yuzu/applets/software_keyboard.h1
2 files changed, 11 insertions, 1 deletions
diff --git a/src/yuzu/applets/software_keyboard.cpp b/src/yuzu/applets/software_keyboard.cpp
index 83b9c320b..efefb1f99 100644
--- a/src/yuzu/applets/software_keyboard.cpp
+++ b/src/yuzu/applets/software_keyboard.cpp
@@ -47,7 +47,7 @@ QtSoftwareKeyboardDialog::QtSoftwareKeyboardDialog(
layout = new QVBoxLayout;
header_label = new QLabel(QString::fromStdU16String(parameters.header_text));
- header_label->setFont({header_label->font().family(), 12, QFont::Bold});
+ header_label->setFont({header_label->font().family(), 11, QFont::Bold});
if (header_label->text().isEmpty())
header_label->setText(tr("Enter text:"));
@@ -59,6 +59,10 @@ QtSoftwareKeyboardDialog::QtSoftwareKeyboardDialog(
guide_label = new QLabel(QString::fromStdU16String(parameters.guide_text));
guide_label->setHidden(parameters.guide_text.empty());
+ length_label = new QLabel(QStringLiteral("0/%1").arg(parameters.max_length));
+ length_label->setAlignment(Qt::AlignRight);
+ length_label->setFont({length_label->font().family(), 8});
+
line_edit = new QLineEdit;
line_edit->setValidator(new QtSoftwareKeyboardValidator(parameters));
line_edit->setMaxLength(static_cast<int>(parameters.max_length));
@@ -67,6 +71,10 @@ QtSoftwareKeyboardDialog::QtSoftwareKeyboardDialog(
parameters.cursor_at_beginning ? 0 : static_cast<int>(parameters.initial_text.size()));
line_edit->setEchoMode(parameters.password ? QLineEdit::Password : QLineEdit::Normal);
+ connect(line_edit, &QLineEdit::textChanged, this, [this](const QString& text) {
+ length_label->setText(QStringLiteral("%1/%2").arg(text.size()).arg(parameters.max_length));
+ });
+
buttons = new QDialogButtonBox;
buttons->addButton(tr("Cancel"), QDialogButtonBox::RejectRole);
buttons->addButton(parameters.submit_text.empty()
@@ -79,6 +87,7 @@ QtSoftwareKeyboardDialog::QtSoftwareKeyboardDialog(
layout->addWidget(header_label);
layout->addWidget(sub_label);
layout->addWidget(guide_label);
+ layout->addWidget(length_label);
layout->addWidget(line_edit);
layout->addWidget(buttons);
setLayout(layout);
diff --git a/src/yuzu/applets/software_keyboard.h b/src/yuzu/applets/software_keyboard.h
index 8d56f5db2..73f56714f 100644
--- a/src/yuzu/applets/software_keyboard.h
+++ b/src/yuzu/applets/software_keyboard.h
@@ -47,6 +47,7 @@ private:
QLabel* header_label;
QLabel* sub_label;
QLabel* guide_label;
+ QLabel* length_label;
QLineEdit* line_edit;
QVBoxLayout* layout;