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
99ddc88c6b
commit
9ac1e22af3
@ -9,8 +9,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
_greenLED(false);
|
||||
_redLED(true);
|
||||
_LED(false);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@ -23,27 +22,13 @@ 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);
|
||||
}
|
||||
_LED(msg.isOpen());
|
||||
}
|
||||
|
||||
void MainWindow::_greenLED(const bool on)
|
||||
void MainWindow::_LED(const bool on)
|
||||
{
|
||||
if (on)
|
||||
ui->greenLED->setPixmap(QPixmap(IMAGE_LOCATION "led-green-on.png"));
|
||||
ui->LED->setPixmap(QPixmap(IMAGE_LOCATION "led-green.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"));
|
||||
ui->LED->setPixmap(QPixmap(IMAGE_LOCATION "led-red.png"));
|
||||
}
|
||||
|
@ -25,8 +25,7 @@ public:
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
||||
void _greenLED(const bool on);
|
||||
void _redLED(const bool on);
|
||||
void _LED(const bool on);
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
@ -52,21 +52,7 @@
|
||||
<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">
|
||||
<widget class="QLabel" name="LED">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Loading…
Reference in New Issue
Block a user