1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-12-22 10:24:26 +01:00

Improved GUI

This commit is contained in:
Ralf Ramsauer 2015-10-11 19:54:42 +02:00
parent d504b191d5
commit ac0c5f3dba
2 changed files with 34 additions and 0 deletions

View File

@ -26,6 +26,7 @@ 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()));
QString statusMessage("");
const auto &doormsg = msg.doormessage(); const auto &doormsg = msg.doormessage();
@ -34,9 +35,12 @@ void MainWindow::setClientmessage(const Clientmessage &msg)
if (_oldMessage.isOpen() if (_oldMessage.isOpen()
&& !msg.isOpen() && !msg.isOpen()
&& !doormsg.isLockButton) { && !doormsg.isLockButton) {
// regular close
statusMessage = "Bye bye. See you next time!";
_soundLock.playAsync(); _soundLock.playAsync();
} else if (!_oldMessage.isOpen() && msg.isOpen()) { } else if (!_oldMessage.isOpen() && msg.isOpen()) {
// regular open // regular open
statusMessage = "Come in! Happy hacking!";
_soundUnlock.playAsync(); _soundUnlock.playAsync();
} else { } else {
// no change // no change
@ -44,9 +48,12 @@ void MainWindow::setClientmessage(const Clientmessage &msg)
if (doormsg.isEmergencyUnlock) { if (doormsg.isEmergencyUnlock) {
_soundEmergencyUnlock.playAsync(); _soundEmergencyUnlock.playAsync();
statusMessage = "!! EMERGENCY UNLOCK !!";
} else if (doormsg.isLockButton) { } else if (doormsg.isLockButton) {
_soundLockButton.playAsync(); _soundLockButton.playAsync();
statusMessage = "!! LOCK BUTTON !!";
} else if (doormsg.isUnlockButton) { } else if (doormsg.isUnlockButton) {
statusMessage = "!! UNLOCK BUTTON !!";
if (msg.isOpen()) { if (msg.isOpen()) {
_soundZonk.playAsync(); _soundZonk.playAsync();
} else { } else {
@ -54,6 +61,8 @@ void MainWindow::setClientmessage(const Clientmessage &msg)
} }
} }
ui->message->setText(statusMessage);
_oldMessage = msg; _oldMessage = msg;
} }

View File

@ -73,6 +73,31 @@
</property> </property>
</spacer> </spacer>
</item> </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> <item>
<widget class="QLabel" name="tokenLabel"> <widget class="QLabel" name="tokenLabel">
<property name="font"> <property name="font">