first commit
This commit is contained in:
40
widgets/devicestatuswidget.h
Normal file
40
widgets/devicestatuswidget.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user