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
d504b191d5
commit
ac0c5f3dba
@ -26,6 +26,7 @@ void MainWindow::setClientmessage(const Clientmessage &msg)
|
||||
{
|
||||
ui->qrwidget->setQRData(msg.token());
|
||||
ui->tokenLabel->setText(QString::fromStdString(msg.token()));
|
||||
QString statusMessage("");
|
||||
|
||||
const auto &doormsg = msg.doormessage();
|
||||
|
||||
@ -34,9 +35,12 @@ void MainWindow::setClientmessage(const Clientmessage &msg)
|
||||
if (_oldMessage.isOpen()
|
||||
&& !msg.isOpen()
|
||||
&& !doormsg.isLockButton) {
|
||||
// regular close
|
||||
statusMessage = "Bye bye. See you next time!";
|
||||
_soundLock.playAsync();
|
||||
} else if (!_oldMessage.isOpen() && msg.isOpen()) {
|
||||
// regular open
|
||||
statusMessage = "Come in! Happy hacking!";
|
||||
_soundUnlock.playAsync();
|
||||
} else {
|
||||
// no change
|
||||
@ -44,9 +48,12 @@ void MainWindow::setClientmessage(const Clientmessage &msg)
|
||||
|
||||
if (doormsg.isEmergencyUnlock) {
|
||||
_soundEmergencyUnlock.playAsync();
|
||||
statusMessage = "!! EMERGENCY UNLOCK !!";
|
||||
} else if (doormsg.isLockButton) {
|
||||
_soundLockButton.playAsync();
|
||||
statusMessage = "!! LOCK BUTTON !!";
|
||||
} else if (doormsg.isUnlockButton) {
|
||||
statusMessage = "!! UNLOCK BUTTON !!";
|
||||
if (msg.isOpen()) {
|
||||
_soundZonk.playAsync();
|
||||
} else {
|
||||
@ -54,6 +61,8 @@ void MainWindow::setClientmessage(const Clientmessage &msg)
|
||||
}
|
||||
}
|
||||
|
||||
ui->message->setText(statusMessage);
|
||||
|
||||
_oldMessage = msg;
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,31 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="QLabel" name="message">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>28</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="tokenLabel">
|
||||
<property name="font">
|
||||
|
Loading…
Reference in New Issue
Block a user