From 86ff348f96188e8478665e6f13674c45ff0f3b01 Mon Sep 17 00:00:00 2001 From: Christian Klinger Date: Fri, 22 Apr 2016 12:07:41 +0200 Subject: feature complete --- src/server/sessionnamewindow/sessionnamewindow.cpp | 25 +++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src/server/sessionnamewindow/sessionnamewindow.cpp') diff --git a/src/server/sessionnamewindow/sessionnamewindow.cpp b/src/server/sessionnamewindow/sessionnamewindow.cpp index da67c91..ba67557 100644 --- a/src/server/sessionnamewindow/sessionnamewindow.cpp +++ b/src/server/sessionnamewindow/sessionnamewindow.cpp @@ -18,9 +18,9 @@ #include "sessionnamewindow.h" #include "../numerickeyboard/numerickeyboard.h" #include "../util/global.h" - #include "ui_sessionname.h" + SessionNameWindow::SessionNameWindow(QWidget *parent) : QDialog(parent), ui(new Ui::SessionName) @@ -29,9 +29,12 @@ SessionNameWindow::SessionNameWindow(QWidget *parent) : connect(ui->bboxOkCancel, SIGNAL(accepted()), this, SLOT(onOkClicked())); connect(ui->bboxOkCancel, SIGNAL(rejected()), this, SLOT(close())); connect(ui->cmdRandom, SIGNAL(clicked(bool)), this, SLOT(onGenerateRandomName())); - ui->lineEditName->setFocus(); - initVirtualKeyboard(); + /* add a virtual numeric keyboard */ + NumericKeyboard *keyboard = new NumericKeyboard(); + ui->keyboard_placeholder->addWidget(keyboard); + connect(keyboard, SIGNAL(digitTyped(int)), this, SLOT(onDigitTyped(int))); + connect(keyboard, SIGNAL(digitDelete()), this, SLOT(onDigitDelete())); } @@ -72,9 +75,15 @@ void SessionNameWindow::onGenerateRandomName() ui->lineEditName->setText(QString::number(qrand() % 9000 + 1000)); } -void SessionNameWindow::initVirtualKeyboard() { - /* Just playing around here */ - QLabel *label = new QLabel("hello world"); - NumericKeyboard *keyboard = new NumericKeyboard(); - ui->keyboard_placeholder->addWidget(keyboard); +/** deletes the last digit of the saved sessionname */ +void SessionNameWindow::onDigitDelete() { + QString text = ui->lineEditName->text(); + ui->lineEditName->setText(text.left(text.length() - 1)); + } +/** appends the digit to the session name */ +void SessionNameWindow::onDigitTyped(int i) { + QString text = ui->lineEditName->text(); + ui->lineEditName->setText(text + QString::number(i)); +} + -- cgit v1.2.3-55-g7522