mirror of
https://github.com/binary-kitchen/doorlockd
synced 2024-12-22 10:24:26 +01:00
Improved GUI
This commit is contained in:
parent
70a4b3de03
commit
99ddc88c6b
@ -1,3 +1,5 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
@ -6,6 +8,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
_greenLED(false);
|
||||
_redLED(true);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@ -17,4 +22,28 @@ void MainWindow::setClientmessage(const Clientmessage &msg)
|
||||
{
|
||||
ui->qrwidget->setQRData(msg.token());
|
||||
ui->tokenLabel->setText(QString::fromStdString(msg.token()));
|
||||
|
||||
if (msg.isOpen()) {
|
||||
_greenLED(true);
|
||||
_redLED(false);
|
||||
} else {
|
||||
_greenLED(false);
|
||||
_redLED(true);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::_greenLED(const bool on)
|
||||
{
|
||||
if (on)
|
||||
ui->greenLED->setPixmap(QPixmap(IMAGE_LOCATION "led-green-on.png"));
|
||||
else
|
||||
ui->greenLED->setPixmap(QPixmap(IMAGE_LOCATION "led-green-off.png"));
|
||||
}
|
||||
|
||||
void MainWindow::_redLED(const bool on)
|
||||
{
|
||||
if (on)
|
||||
ui->redLED->setPixmap(QPixmap(IMAGE_LOCATION "led-red-on.png"));
|
||||
else
|
||||
ui->redLED->setPixmap(QPixmap(IMAGE_LOCATION "led-red-off.png"));
|
||||
}
|
||||
|
@ -24,6 +24,9 @@ public:
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
||||
void _greenLED(const bool on);
|
||||
void _redLED(const bool on);
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
@ -49,6 +49,31 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="QLabel" name="greenLED">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="QLabel" name="redLED">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
|
Loading…
Reference in New Issue
Block a user