41 lines
895 B
C++
41 lines
895 B
C++
#ifndef DEVICESTATUSWIDGET_H
|
|
#define DEVICESTATUSWIDGET_H
|
|
|
|
#include <QWidget>
|
|
#include <QLabel>
|
|
#include <QVector>
|
|
|
|
struct ChannelStatus
|
|
{
|
|
QString name;
|
|
bool connected;
|
|
QString type; // input, output
|
|
};
|
|
|
|
class DeviceStatusWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit DeviceStatusWidget(QWidget *parent = nullptr);
|
|
~DeviceStatusWidget();
|
|
|
|
void setChannelStatus(int channel, bool connected);
|
|
void updateChannels(const QVector<ChannelStatus> &channels);
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent *event) override;
|
|
void resizeEvent(QResizeEvent *event) override;
|
|
|
|
private:
|
|
void setupUI();
|
|
void drawCableDiagram(QPainter &painter);
|
|
void drawChannelIndicator(QPainter &painter, int x, int y,
|
|
const QString &label, bool connected);
|
|
|
|
QVector<ChannelStatus> m_channels;
|
|
QVector<QLabel *> m_channelLabels;
|
|
};
|
|
|
|
#endif // DEVICESTATUSWIDGET_H
|