summaryrefslogtreecommitdiffstats
path: root/src/server/helpwindow/helpwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/helpwindow/helpwindow.cpp')
-rw-r--r--src/server/helpwindow/helpwindow.cpp56
1 files changed, 38 insertions, 18 deletions
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 <QPushButton>
+#include <QBoxLayout>
+#include <QAction>
+#include <QLabel>
-void HelpWindow::onButtonCancel()
+HelpWindow::HelpWindow(const QList<QAction*> &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);
}