Pool Video Switch v2
Software video switch for distributed remote display in a lecture environment
sessionnamewindow.cpp
Go to the documentation of this file.
1 /*
2  # Copyright (c) 2009 - OpenSLX Project, Computer Center University of Freiburg
3  #
4  # This program is free software distributed under the GPL version 2.
5  # See http://openslx.org/COPYING
6  #
7  # If you have any feedback please consult http://openslx.org/feedback and
8  # send your suggestions, praise, or complaints to [email protected]
9  #
10  # General information about OpenSLX can be found at http://openslx.org/
11  # -----------------------------------------------------------------------------
12  */
13 
14 #include "sessionnamewindow.h"
15 #include "ui_sessionnamewindow.h"
16 #include "../serverapp/serverapp.h"
17 #include "../numerickeyboard/numerickeyboard.h"
18 #include "../../shared/util.h"
19 
20 #include <QCloseEvent>
21 
23  : QDialog(parent)
24  , ui(new Ui::SessionName)
25 {
26  ui->setupUi(this);
27  connect(ui->bboxOkCancel, &QDialogButtonBox::accepted, this, &SessionNameWindow::onOkClicked);
28  connect(ui->bboxOkCancel, &QDialogButtonBox::rejected, this, &SessionNameWindow::close);
29  connect(ui->cmdRandom, &QPushButton::clicked, this, &SessionNameWindow::onGenerateRandomName);
30 
31  /* add a virtual numeric keyboard */
32  auto *keyboard = new NumericKeyboard();
33  ui->keyboard_placeholder->addWidget(keyboard);
36 
37 }
38 
40 {
41  delete ui;
42 }
43 
44 void SessionNameWindow::show(const QString& name)
45 {
46  ui->lineEditName->setText(name);
47  ui->lineEditName->setFocus();
48  this->showNormal();
49 }
50 
51 /*
52  * Overridden methods
53  */
54 
55 void SessionNameWindow::closeEvent(QCloseEvent *e)
56 {
57  e->ignore();
58  this->hide();
59 }
60 
61 /*
62  * Slots
63  */
64 
66 {
67  serverApp->setSessionName(ui->lineEditName->text());
68  emit updateSessionName();
69  this->hide();
70 }
71 
73 {
74  ui->lineEditName->setText(QString::number(slxrand() % 9000 + 1000));
75 }
76 
79 {
80  QString text = ui->lineEditName->text();
81  ui->lineEditName->setText(text.left(text.length() - 1));
82 
83 }
86 {
87  QString text = ui->lineEditName->text();
88  ui->lineEditName->setText(text + QString::number(i));
89 }
90 
void onDigitDelete()
deletes the last digit of the saved sessionname
void updateSessionName()
#define serverApp
Definition: serverapp.h:31
~SessionNameWindow() override
void digitTyped(int)
void onDigitTyped(int)
appends the digit to the session name
#define slxrand()
Definition: util.h:19
void show(const QString &name)
SessionNameWindow(QWidget *parent=nullptr)
void closeEvent(QCloseEvent *e) override
Ui::SessionName * ui