diff --git a/doorlockd/client/mainwindow.cpp b/doorlockd/client/mainwindow.cpp index a24336d..255731e 100644 --- a/doorlockd/client/mainwindow.cpp +++ b/doorlockd/client/mainwindow.cpp @@ -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")); } diff --git a/doorlockd/client/mainwindow.h b/doorlockd/client/mainwindow.h index 1d12270..1a67547 100644 --- a/doorlockd/client/mainwindow.h +++ b/doorlockd/client/mainwindow.h @@ -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 diff --git a/doorlockd/client/mainwindow.ui b/doorlockd/client/mainwindow.ui index d424384..bf281a8 100644 --- a/doorlockd/client/mainwindow.ui +++ b/doorlockd/client/mainwindow.ui @@ -52,21 +52,7 @@ - - - TextLabel - - - - - - - Qt::Vertical - - - - - + TextLabel diff --git a/doorlockd/images/led-green-off.png b/doorlockd/images/led-green-off.png deleted file mode 100644 index cc2171a..0000000 Binary files a/doorlockd/images/led-green-off.png and /dev/null differ diff --git a/doorlockd/images/led-green-on.png b/doorlockd/images/led-green.png similarity index 100% rename from doorlockd/images/led-green-on.png rename to doorlockd/images/led-green.png diff --git a/doorlockd/images/led-red-off.png b/doorlockd/images/led-red-off.png deleted file mode 100644 index dec27b5..0000000 Binary files a/doorlockd/images/led-red-off.png and /dev/null differ diff --git a/doorlockd/images/led-red-on.png b/doorlockd/images/led-red.png similarity index 100% rename from doorlockd/images/led-red-on.png rename to doorlockd/images/led-red.png