1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-11-19 13:33:13 +01:00
doorlockd-mirror/doorlockd/client/mainwindow.cpp

35 lines
651 B
C++
Raw Normal View History

2015-10-05 23:59:18 +02:00
#include "config.h"
2015-09-30 15:26:28 +02:00
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QWidget(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
2015-10-05 23:59:18 +02:00
2015-10-06 00:22:35 +02:00
_LED(false);
2015-09-30 15:26:28 +02:00
}
MainWindow::~MainWindow()
{
delete ui;
}
2015-10-02 19:39:47 +02:00
void MainWindow::setClientmessage(const Clientmessage &msg)
2015-09-30 15:26:28 +02:00
{
2015-10-02 19:39:47 +02:00
ui->qrwidget->setQRData(msg.token());
ui->tokenLabel->setText(QString::fromStdString(msg.token()));
2015-10-05 23:59:18 +02:00
2015-10-06 00:22:35 +02:00
_LED(msg.isOpen());
2015-10-05 23:59:18 +02:00
}
2015-10-06 00:22:35 +02:00
void MainWindow::_LED(const bool on)
2015-10-05 23:59:18 +02:00
{
if (on)
2015-10-06 00:22:35 +02:00
ui->LED->setPixmap(QPixmap(IMAGE_LOCATION "led-green.png"));
2015-10-05 23:59:18 +02:00
else
2015-10-06 00:22:35 +02:00
ui->LED->setPixmap(QPixmap(IMAGE_LOCATION "led-red.png"));
2015-09-30 15:26:28 +02:00
}