From 2c8b79b680568a9d104e23b2fad55ef24819ebcc Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 3 Aug 2018 15:30:22 +0200 Subject: [server] Get rid of broken help window ui, generate programatically --- gui/server_normal/help.ui | 613 ----------------------------------- gui/server_normal/mainwindow.ui | 89 +++-- src/server/helpwindow/helpwindow.cpp | 56 +++- src/server/helpwindow/helpwindow.h | 16 +- src/server/mainwindow/mainwindow.cpp | 3 +- 5 files changed, 100 insertions(+), 677 deletions(-) delete mode 100644 gui/server_normal/help.ui diff --git a/gui/server_normal/help.ui b/gui/server_normal/help.ui deleted file mode 100644 index 1bf4d6d..0000000 --- a/gui/server_normal/help.ui +++ /dev/null @@ -1,613 +0,0 @@ - - - Help - - - - 0 - 0 - 603 - 675 - - - - - 400 - 500 - - - - Form - - - - - - QFrame::Box - - - - - - - 54 - 53 - - - - - 53 - 54 - - - - QFrame::NoFrame - - - - - - :/reloadClassroom - - - true - - - - - - - Refresh classroom configuration after choosing the room. - - - false - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - true - - - - - - - - - - QFrame::Panel - - - - QFormLayout::AllNonFixedFieldsGrow - - - Qt::AlignCenter - - - 6 - - - 0 - - - 0 - - - - - - 53 - 54 - - - - - 53 - 54 - - - - QFrame::NoFrame - - - - - - :/lock - - - true - - - - - - - Lock all connected students screens. - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - true - - - - - - - - - - QFrame::Panel - - - - QFormLayout::AllNonFixedFieldsGrow - - - Qt::AlignCenter - - - 0 - - - 0 - - - - - - 53 - 54 - - - - - 53 - 54 - - - - false - - - QFrame::NoFrame - - - - - - :/tutor2all - - - true - - - - - - - Start projection from tutor to all connected students. - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - true - - - - - - - - - - QFrame::Panel - - - - Qt::AlignCenter - - - 0 - - - 0 - - - - - - 53 - 54 - - - - - 53 - 54 - - - - QFrame::NoFrame - - - - - - :/tutor2student - - - true - - - - - - - Start projection from tutor to selected student. - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - true - - - - - - - - - - QFrame::Panel - - - - Qt::AlignCenter - - - 0 - - - 0 - - - - - - 53 - 54 - - - - - 53 - 54 - - - - QFrame::NoFrame - - - - - - :/student2tutor - - - true - - - - - - - Start projection from selected student to tutor. - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - true - - - - - - - - - - QFrame::Panel - - - - Qt::AlignCenter - - - 0 - - - 0 - - - - - - 53 - 54 - - - - - 53 - 54 - - - - QFrame::NoFrame - - - - - - :/student2tutorextension - - - true - - - - - - - Start projection from selected student to tutor and blank all others. - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - true - - - 0 - - - - - - - - - - QFrame::Panel - - - - QFormLayout::AllNonFixedFieldsGrow - - - Qt::AlignCenter - - - 0 - - - 0 - - - - - Set selected client to tutor. - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - true - - - - - - - - 54 - 53 - - - - - 53 - 54 - - - - QFrame::NoFrame - - - - - - :/dozent - - - true - - - - - - - - - - QFrame::Panel - - - QFrame::Plain - - - - - 10 - 0 - 53 - 54 - - - - - 53 - 54 - - - - - 53 - 54 - - - - QFrame::NoFrame - - - - - - :/trash - - - true - - - - - - 70 - 0 - 506 - 54 - - - - Delete selected client - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - true - - - - - - - - QFrame::Panel - - - - Qt::AlignCenter - - - 0 - - - 0 - - - - - - 53 - 54 - - - - - 53 - 54 - - - - QFrame::NoFrame - - - - - - :/reset - - - true - - - - - - - Stop running projections. - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - true - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Cancel - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - diff --git a/gui/server_normal/mainwindow.ui b/gui/server_normal/mainwindow.ui index 1f58ec4..c16d408 100644 --- a/gui/server_normal/mainwindow.ui +++ b/gui/server_normal/mainwindow.ui @@ -160,12 +160,12 @@ QLabel#examModeLabel { :/exit :/exit:/exit - - &Exit - Exit + + Exit + Ctrl+Q @@ -178,11 +178,11 @@ QLabel#examModeLabel { :/lock:/lock - - lock - - Lock or Unlock all Clients + Lock/Unlock all clients + + + This will show a black screen on all connected clients, except the tutor's client. Ctrl+A @@ -193,17 +193,23 @@ QLabel#examModeLabel { :/student2tutor:/student2tutor - + Student's Screen to Tutor + + Stream currently selected client's screen content to the tutor's client. + :/student2tutorextension:/student2tutorextension + + Student's Screen to Tutor, others blanked. + - Student's Screen to Tutor, others blanked + Stream currently selected client's screen content to the tutor's client while showing a locked black screen on all other clients. @@ -211,26 +217,38 @@ QLabel#examModeLabel { :/tutor2student:/tutor2student - + Tutor's Screen to Student + + Stream the tutor's screen contents to the currently selected client. + :/tutor2all:/tutor2all - + Tutor's Screen to Everyone + + Stream the tutor's screen contents to everyone. + - + :/reset:/reset + + Reset + - Stop Projection on every Client + Unlock all clients, stop any running screen content streaming. + + + R @@ -238,11 +256,14 @@ QLabel#examModeLabel { :/dozent:/dozent + + Declare tutor + - SetAsTutor + Declare the currently selected client as tutor. The tutor will be excluded from screen locking and can be used as a fixed source/target for screen content streaming. - - Set current Frame as Tutor + + T @@ -250,12 +271,15 @@ QLabel#examModeLabel { :/trash:/trash - - Delete Client - Delete Client + + Delete currently selected client. Only allowed for disconnected clients. + + + Del + true @@ -265,12 +289,15 @@ QLabel#examModeLabel { :/helpme:/helpme - - Help - Help + + Show this help text. + + + F1 + true @@ -280,11 +307,11 @@ QLabel#examModeLabel { :/reloadClassroom:/reloadClassroom - - Reload Room Configuration - - Reload Room Configuration + Load a new room layout + + + This shows a list of preconfigured rooms which you can load. This will reset the currently shown layout and disconnect all clients. @@ -292,16 +319,20 @@ QLabel#examModeLabel { :/lock-single:/lock-single - + Lock/Unlock single client - - Lock or unlock the selected client + + Lock or unlock the selected client only. + + + L + diff --git a/src/server/helpwindow/helpwindow.cpp b/src/server/helpwindow/helpwindow.cpp index bc04d30..2ae47ee 100644 --- a/src/server/helpwindow/helpwindow.cpp +++ b/src/server/helpwindow/helpwindow.cpp @@ -1,23 +1,43 @@ #include "helpwindow.h" -#include "ui_help.h" -HelpWindow::HelpWindow(QWidget *parent) : - QDialog(parent), ui(new Ui::Help) -{ - ui->setupUi(this); - connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(onButtonCancel())); -} - -HelpWindow::~HelpWindow() -{ - delete ui; -} - -/* - * Slots - */ +#include +#include +#include +#include -void HelpWindow::onButtonCancel() +HelpWindow::HelpWindow(const QList &actions, QWidget *parent) : + QDialog(parent) { - this->hide(); + QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom, this); + layout->setMargin(3); + // Add help items + for (QAction *action : actions) { + if (action->icon().isNull() || action->text().isEmpty()) + continue; + QBoxLayout *rowLayout = new QBoxLayout(QBoxLayout::LeftToRight, nullptr); + QLabel *icon = new QLabel(this); + icon->setPixmap(action->icon().pixmap(55, 55, QIcon::Normal, QIcon::Off)); + rowLayout->addWidget(icon); + QBoxLayout *textLayout = new QBoxLayout(QBoxLayout::TopToBottom, nullptr); + QLabel *headline = new QLabel(action->toolTip(), this); + QFont boldFont = headline->font(); + boldFont.setBold(true); + headline->setFont(boldFont); + textLayout->addWidget(headline); + QLabel *description = new QLabel(action->text(), this); + description->setWordWrap(true); + textLayout->addWidget(description); + textLayout->addStretch(1); + rowLayout->addLayout(textLayout, 1); + layout->addLayout(rowLayout); + } + // Add close button + QPushButton *close = new QPushButton(tr("Close"), this); + QFont bigFont = close->font(); + bigFont.setPointSize(20); + close->setFont(bigFont); + connect(close, SIGNAL(clicked()), this, SLOT(hide())); + layout->addStretch(1); + layout->addWidget(close); + this->setMinimumSize(600, 600); } diff --git a/src/server/helpwindow/helpwindow.h b/src/server/helpwindow/helpwindow.h index 528a4d3..2f0cdcb 100644 --- a/src/server/helpwindow/helpwindow.h +++ b/src/server/helpwindow/helpwindow.h @@ -3,26 +3,12 @@ #include -namespace Ui -{ -class Help; -} - class HelpWindow : public QDialog { Q_OBJECT public: - explicit HelpWindow(QWidget *parent = 0); - ~HelpWindow(); - Ui::Help *ui; - - // void show(); - -private: - -private slots: - void onButtonCancel(); + explicit HelpWindow(const QList &actions, QWidget *parent = nullptr); }; #endif diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 6ff8fc3..17bfdb2 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -78,8 +78,6 @@ MainWindow::MainWindow(QWidget* parent) : _virtRows = 0; _sessionNameWindow = new SessionNameWindow(this); - _helpWindow = new HelpWindow(this); - _helpWindow->setWindowTitle(tr("Help")); _reloadWindow = new ReloadRoomWindow(this); _reloadWindow->setWindowTitle(tr("Reload Room")); ui->setupUi(this); @@ -111,6 +109,7 @@ MainWindow::MainWindow(QWidget* parent) : _dropMarker = new QLabel(ui->frmRoom); _dropMarker->setStyleSheet("background-color: #448; border-radius: 2px;"); _dropMarker->hide(); + _helpWindow = new HelpWindow(ui->toolBar->actions(), this); serverApp->setExam(false); -- cgit v1.2.3-55-g7522