1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-12-22 18:34:25 +01:00

Improved GUI

This commit is contained in:
Ralf Ramsauer 2015-10-06 00:22:35 +02:00
parent 99ddc88c6b
commit 9ac1e22af3
7 changed files with 7 additions and 37 deletions

View File

@ -9,8 +9,7 @@ MainWindow::MainWindow(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
_greenLED(false); _LED(false);
_redLED(true);
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@ -23,27 +22,13 @@ void MainWindow::setClientmessage(const Clientmessage &msg)
ui->qrwidget->setQRData(msg.token()); ui->qrwidget->setQRData(msg.token());
ui->tokenLabel->setText(QString::fromStdString(msg.token())); ui->tokenLabel->setText(QString::fromStdString(msg.token()));
if (msg.isOpen()) { _LED(msg.isOpen());
_greenLED(true);
_redLED(false);
} else {
_greenLED(false);
_redLED(true);
}
} }
void MainWindow::_greenLED(const bool on) void MainWindow::_LED(const bool on)
{ {
if (on) if (on)
ui->greenLED->setPixmap(QPixmap(IMAGE_LOCATION "led-green-on.png")); ui->LED->setPixmap(QPixmap(IMAGE_LOCATION "led-green.png"));
else else
ui->greenLED->setPixmap(QPixmap(IMAGE_LOCATION "led-green-off.png")); ui->LED->setPixmap(QPixmap(IMAGE_LOCATION "led-red.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"));
} }

View File

@ -25,8 +25,7 @@ public:
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
void _greenLED(const bool on); void _LED(const bool on);
void _redLED(const bool on);
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View File

@ -52,21 +52,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item alignment="Qt::AlignHCenter"> <item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="greenLED"> <widget class="QLabel" name="LED">
<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"> <property name="text">
<string>TextLabel</string> <string>TextLabel</string>
</property> </property>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB