44 lines
1002 B
C++
44 lines
1002 B
C++
#pragma once
|
|
#include <QColor>
|
|
#include <QMap>
|
|
#include <QWidget>
|
|
|
|
class QLabel;
|
|
class QPushButton;
|
|
|
|
class LightsPanel : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit LightsPanel(QWidget *parent = nullptr);
|
|
|
|
void setRnpCount(int count);
|
|
void reset();
|
|
|
|
signals:
|
|
void commandRequested(const QString &cmd);
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent *event) override;
|
|
void mousePressEvent(QMouseEvent *event) override;
|
|
|
|
private:
|
|
int segmentAt(const QPointF &pos) const;
|
|
void sendLedCommand(int panel, const QColor &color);
|
|
void pickColor();
|
|
void updateSendBtn();
|
|
|
|
int m_count = 0;
|
|
int m_selected = -1;
|
|
QColor m_ledColor = QColor(255, 0, 0);
|
|
|
|
QMap<int, QColor> m_panelColors;
|
|
|
|
QLabel *m_statusLabel = nullptr;
|
|
QLabel *m_selectedLabel = nullptr;
|
|
QPushButton *m_colorBtn = nullptr;
|
|
QPushButton *m_sendBtn = nullptr;
|
|
QPushButton *m_sendAllBtn = nullptr;
|
|
QPushButton *m_clearAllBtn = nullptr;
|
|
};
|