Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
fix eventlog color
Browse files Browse the repository at this point in the history
  • Loading branch information
MPIBR-tushevg committed Dec 21, 2018
1 parent 8d8ff91 commit a110da9
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 12 deletions.
8 changes: 5 additions & 3 deletions BrainATUMtome/eventlog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,28 @@ void EventLog::addMessageToBoard(const QString &message, QBrush brush)
{
QTextCharFormat textFormat = this->currentCharFormat();
textFormat.setForeground(brush);
this->setCurrentCharFormat(textFormat);
//this->setCurrentCharFormat(textFormat);
this->mergeCurrentCharFormat(textFormat);
this->appendPlainText(message);
this->verticalScrollBar()->setValue(this->verticalScrollBar()->maximum());
}


void EventLog::on_log(EventLogType type, const QString &message)
{
auto brush = QBrush();
QBrush brush = QBrush(Qt::SolidPattern);

if (type == EventLogType::Notify) {
brush.setColor(Qt::black);
}
else if (type == EventLogType::Log) {
else if (type == EventLogType::Respond) {
brush.setColor(Qt::gray);
}
else if (type == EventLogType::Warn) {
brush.setColor(Qt::red);
}


QString logMessage = message;
if (m_useTimestamp) {
QString timestamp = QDateTime::currentDateTime().toString("[yyyyMMdd hh:mm:ss]");
Expand Down
4 changes: 3 additions & 1 deletion BrainATUMtome/eventlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
#include <QScrollBar>
#include <QDateTime>

#include <QDebug>

enum class EventLogType {Notify, Log, Warn};

enum class EventLogType {Notify, Respond, Warn};

class EventLog : public QPlainTextEdit
{
Expand Down
35 changes: 33 additions & 2 deletions BrainATUMtome/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@ MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
m_epos_velocity_lower(0),
m_epos_velocity_upper(0)
m_epos_velocity_upper(0),
m_microtome_cuttingSpeed(0),
m_microtome_returnSpeed(0),
m_microtome_feedStep(0),
m_microtome_sections(0),
m_microtome_advanceRemaining(0)
{
ui->setupUi(this);

connect(ui->radioButton_epos_lower_off, &QRadioButton::toggled, this, &MainWindow::on_eposLowerToggled);
connect(ui->radioButton_epos_lower_ccw, &QRadioButton::toggled, this, &MainWindow::on_eposLowerToggled);
connect(ui->radioButton_epos_lower_cw, &QRadioButton::toggled, this, &MainWindow::on_eposLowerToggled);


}

Expand All @@ -18,7 +27,29 @@ MainWindow::~MainWindow()
}


void MainWindow::on_groupBox_epos_tension_toggled(bool arg1)
void MainWindow::on_eposLowerToggled(bool checked)
{
if (!checked)
return;

emit ui->spinBox_epos_lower_velocity->editingFinished();

if (ui->radioButton_epos_lower_off->isChecked()) {
ui->widget_board->on_log(EventLogType::Notify, "LOWER OFF");
m_epos_velocity_lower = 0;
}
else if (ui->radioButton_epos_lower_ccw->isChecked()) {
ui->widget_board->on_log(EventLogType::Notify, "LOWER CCW");
}
else if (ui->radioButton_epos_lower_cw->isChecked()) {
ui->widget_board->on_log(EventLogType::Notify, "LOWER CW");
m_epos_velocity_lower = -m_epos_velocity_lower;
}

ui->widget_board->on_log(EventLogType::Respond, "EPOS :: velocity lower " + QString::number(m_epos_velocity_lower));
}

void MainWindow::on_spinBox_epos_lower_velocity_editingFinished()
{
m_epos_velocity_lower = ui->spinBox_epos_lower_velocity->value();
}
17 changes: 11 additions & 6 deletions BrainATUMtome/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <QMainWindow>
#include <QDebug>

#include "eventlog.h"

namespace Ui {
class MainWindow;
}
Expand All @@ -16,17 +18,20 @@ class MainWindow : public QMainWindow
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();

private slots:



void on_groupBox_epos_tension_toggled(bool arg1);

private:
Ui::MainWindow *ui;
int m_epos_velocity_lower;
int m_epos_velocity_upper;
int m_microtome_cuttingSpeed;
int m_microtome_returnSpeed;
int m_microtome_feedStep;
int m_microtome_sections;
int m_microtome_advanceRemaining;

private slots:
void on_eposLowerToggled(bool checked);

void on_spinBox_epos_lower_velocity_editingFinished();

signals:
void uirequest_epos_velocity(int motorid, int velocity);
Expand Down

0 comments on commit a110da9

Please sign in to comment.