Skip to content

Commit

Permalink
fixed buttons log
Browse files Browse the repository at this point in the history
  • Loading branch information
Reksotiv committed Oct 26, 2020
1 parent caec173 commit cbe9e5b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
8 changes: 6 additions & 2 deletions widgets/buttonlogical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,16 @@ void ButtonLogical::SetButtonState(bool set_state)
this->setPalette(QPalette(QPalette::Window, QColor(0, 128, 0)));
ui->label_LogicalButtonNumber->setStyleSheet(default_style + "background-color: rgb(0, 128, 0);");

gEnv.pDebugWindow->LogicalButtonState(button_number_ + 1, true);
if (gEnv.pDebugWindow){
gEnv.pDebugWindow->LogicalButtonState(button_number_ + 1, true);
}
} else {
this->setPalette(default_palette);
ui->label_LogicalButtonNumber->setStyleSheet(default_style);

gEnv.pDebugWindow->LogicalButtonState(button_number_ + 1, false);
if (gEnv.pDebugWindow){
gEnv.pDebugWindow->LogicalButtonState(button_number_ + 1, false);
}
}
current_state_ = set_state;
}
Expand Down
16 changes: 10 additions & 6 deletions widgets/debugwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <QFile>
#include <QTextStream>
#include <QDir>

#include "global.h"
#include <QDebug>

DebugWindow::DebugWindow(QWidget *parent) :
Expand Down Expand Up @@ -93,12 +95,14 @@ void DebugWindow::PrintMsg(const QString &msg)

void DebugWindow::LogicalButtonState(int button_number, bool state)
{
if (state){
ui->textBrowser_ButtonsPressLog->insertPlainText(QTime::currentTime().toString() + ": " + tr("Logical button ") + QString::number(button_number) + tr(" pressed") + '\n');
ui->textBrowser_DebugMsg->moveCursor(QTextCursor::End);
} else {
ui->textBrowser_ButtonsUnpressLog->insertPlainText(QTime::currentTime().toString() + ": " + tr("Logical button ") + QString::number(button_number) + tr(" unpressed") + '\n');
ui->textBrowser_DebugMsg->moveCursor(QTextCursor::End);
if (gEnv.pDebugWindow){
if (state){
ui->textBrowser_ButtonsPressLog->insertPlainText(QTime::currentTime().toString() + ": " + tr("Logical button ") + QString::number(button_number) + tr(" pressed") + '\n');
ui->textBrowser_DebugMsg->moveCursor(QTextCursor::End);
} else {
ui->textBrowser_ButtonsUnpressLog->insertPlainText(QTime::currentTime().toString() + ": " + tr("Logical button ") + QString::number(button_number) + tr(" unpressed") + '\n');
ui->textBrowser_DebugMsg->moveCursor(QTextCursor::End);
}
}
}

Expand Down

0 comments on commit cbe9e5b

Please sign in to comment.