-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- built-in http server - beta phase removed for script functionality - board calibration can be applied from the software - channels are no longer fixed to 1 & 2
- Loading branch information
Showing
50 changed files
with
3,847 additions
and
1,257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#include "drs4blinkinglight.h" | ||
#include "ui_drs4blinkinglight.h" | ||
|
||
DRS4BlinkingLight::DRS4BlinkingLight(QWidget *parent) : | ||
QWidget(parent), | ||
ui(new Ui::DRS4BlinkingLight) { | ||
ui->setupUi(this); | ||
} | ||
|
||
DRS4BlinkingLight::~DRS4BlinkingLight() { | ||
DDELETE_SAFETY(ui); | ||
} | ||
|
||
void DRS4BlinkingLight::setActive(bool active, const QString &msg, int interval) { | ||
if (active) { | ||
ui->frame_light->start(interval); | ||
ui->label_msg->setText(msg); | ||
ui->label_msg->setStyleSheet("color: green"); | ||
} | ||
else { | ||
ui->frame_light->stop(); | ||
ui->label_msg->setText(msg); | ||
ui->label_msg->setStyleSheet("color: red"); | ||
} | ||
} | ||
|
||
void DRS4BlinkingLight::resizeEvent(QResizeEvent *event) { | ||
const int newHeight = ui->label_msg->geometry().height(); | ||
|
||
ui->frame_light->setMaximumSize(newHeight, newHeight); | ||
ui->frame_light->setMinimumSize(newHeight, newHeight); | ||
|
||
QWidget::resizeEvent(event); | ||
} | ||
|
||
void DRS4BlinkingLight::mouseReleaseEvent(QMouseEvent *event) { | ||
emit clicked(); | ||
|
||
QWidget::mouseReleaseEvent(event); | ||
} | ||
|
||
DRS4CircleFrame::DRS4CircleFrame(QWidget *parent) : | ||
QFrame(parent) { | ||
m_pen_active.setBrush(QBrush(Qt::darkGreen)); | ||
m_pen_transparent.setBrush(Qt::transparent); | ||
m_pen_inactive.setBrush(Qt::red); | ||
|
||
m_pen = m_pen_transparent; | ||
} | ||
|
||
DRS4CircleFrame::~DRS4CircleFrame() {} | ||
|
||
void DRS4CircleFrame::start(int interval) { | ||
connect(&m_timer, SIGNAL(timeout()), this, SLOT(blink())); | ||
|
||
m_timer.setInterval(interval); | ||
m_timer.start(); | ||
|
||
m_pen = m_pen_active; | ||
|
||
update(); | ||
} | ||
|
||
void DRS4CircleFrame::stop() { | ||
m_timer.stop(); | ||
disconnect(&m_timer, SIGNAL(timeout()), this, SLOT(blink())); | ||
|
||
m_pen = m_pen_inactive; | ||
|
||
update(); | ||
} | ||
|
||
void DRS4CircleFrame::blink() { | ||
if (m_pen == m_pen_active) | ||
m_pen = m_pen_transparent; | ||
else | ||
m_pen = m_pen_active; | ||
|
||
update(); | ||
} | ||
|
||
void DRS4CircleFrame::paintEvent(QPaintEvent *event) { | ||
QPainter painter(this); | ||
painter.setPen(m_pen); | ||
painter.setBrush(m_pen.brush()); | ||
|
||
const int radius = qMin(geometry().height()*0.5, geometry().width()*0.5); | ||
|
||
painter.drawEllipse(geometry().width()*0.5, geometry().height()*0.5, radius-1, radius-1); | ||
|
||
QFrame::paintEvent(event); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#ifndef DRS4BLINKINGLIGHT_H | ||
#define DRS4BLINKINGLIGHT_H | ||
|
||
#include <QWidget> | ||
#include <QFrame> | ||
#include <QPaintEvent> | ||
#include <QResizeEvent> | ||
#include <QMouseEvent> | ||
#include <QPen> | ||
#include <QTimer> | ||
|
||
#include "dversion.h" | ||
#include "DLib.h" | ||
|
||
namespace Ui { | ||
class DRS4BlinkingLight; | ||
} | ||
|
||
class DRS4CircleFrame : public QFrame { | ||
Q_OBJECT | ||
|
||
public: | ||
explicit DRS4CircleFrame(QWidget *parent = DNULLPTR); | ||
virtual ~DRS4CircleFrame(); | ||
|
||
public slots: | ||
void start(int interval); | ||
void stop(); | ||
|
||
private slots: | ||
void blink(); | ||
|
||
protected: | ||
virtual void paintEvent(QPaintEvent *event); | ||
|
||
private: | ||
QPen m_pen; | ||
QPen m_pen_active; | ||
QPen m_pen_transparent; | ||
QPen m_pen_inactive; | ||
|
||
QTimer m_timer; | ||
}; | ||
|
||
class DRS4BlinkingLight : public QWidget { | ||
Q_OBJECT | ||
|
||
public: | ||
explicit DRS4BlinkingLight(QWidget *parent = DNULLPTR); | ||
virtual ~DRS4BlinkingLight(); | ||
|
||
public slots: | ||
void setActive(bool active, const QString& msg = "your message", int interval = 500); | ||
|
||
protected: | ||
virtual void resizeEvent(QResizeEvent *event); | ||
virtual void mouseReleaseEvent(QMouseEvent *event); | ||
|
||
signals: | ||
void clicked(); | ||
|
||
private: | ||
Ui::DRS4BlinkingLight *ui; | ||
}; | ||
|
||
#endif // DRS4BLINKINGLIGHT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>DRS4BlinkingLight</class> | ||
<widget class="QWidget" name="DRS4BlinkingLight"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>266</width> | ||
<height>80</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Form</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item> | ||
<layout class="QHBoxLayout" name="horizontalLayout"> | ||
<item> | ||
<widget class="DRS4CircleFrame" name="frame_light"> | ||
<property name="frameShape"> | ||
<enum>QFrame::NoFrame</enum> | ||
</property> | ||
<property name="frameShadow"> | ||
<enum>QFrame::Plain</enum> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QLabel" name="label_msg"> | ||
<property name="font"> | ||
<font> | ||
<weight>75</weight> | ||
<bold>true</bold> | ||
</font> | ||
</property> | ||
<property name="text"> | ||
<string>TextLabel</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
</layout> | ||
</widget> | ||
<customwidgets> | ||
<customwidget> | ||
<class>DRS4CircleFrame</class> | ||
<extends>QFrame</extends> | ||
<header location="global">GUI/drs4blinkinglight.h</header> | ||
<container>1</container> | ||
</customwidget> | ||
</customwidgets> | ||
<resources/> | ||
<connections/> | ||
</ui> |
Oops, something went wrong.