Implement ganged switches
This commit is contained in:
parent
7a6e674756
commit
81e7e1a5b3
3 changed files with 251 additions and 133 deletions
|
|
@ -1,3 +1,5 @@
|
|||
|
||||
|
||||
#ifndef CHANNELWIDGET_H
|
||||
#define CHANNELWIDGET_H
|
||||
|
||||
|
|
@ -11,39 +13,54 @@
|
|||
|
||||
class ChannelWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ChannelWidget(uint16_t deviceSerial, uint16_t channelNumber,
|
||||
std::shared_ptr<struct eismultiplexer> multiplexer,
|
||||
QWidget *parent = nullptr);
|
||||
~ChannelWidget() override;
|
||||
explicit ChannelWidget(uint16_t deviceSerial, uint16_t channelNumber,
|
||||
std::shared_ptr<struct eismultiplexer> multiplexer,
|
||||
QWidget *parent = nullptr);
|
||||
~ChannelWidget() override;
|
||||
|
||||
uint16_t getDeviceSerial() const;
|
||||
uint16_t getChannelNumber() const;
|
||||
bool isChecked() const;
|
||||
uint16_t getDeviceSerial() const;
|
||||
uint16_t getChannelNumber() const;
|
||||
bool isChecked() const;
|
||||
|
||||
signals:
|
||||
void channelAboutToBeTurnedOn(uint16_t deviceSerial, uint16_t channelNumber);
|
||||
// Accessors for MainWindow to populate and access the gang combo
|
||||
QComboBox* getGangCombo() { return &gangcombo; }
|
||||
void setGangedChannel(uint16_t deviceSerial, uint16_t channelNumber);
|
||||
|
||||
public slots:
|
||||
void onOtherChannelStateChanged(uint16_t deviceSerial, uint16_t channelNumber, bool checked);
|
||||
|
||||
private slots:
|
||||
void onChannelToggled(bool checked);
|
||||
void onChannelToggled(bool checked);
|
||||
void onGangComboChanged(int index);
|
||||
|
||||
signals:
|
||||
void channelAboutToBeTurnedOn(uint16_t deviceSerial, uint16_t channelNumber);
|
||||
void channelStateChanged(uint16_t deviceSerial, uint16_t channelNumber, bool checked);
|
||||
|
||||
private:
|
||||
uint16_t deviceSerial;
|
||||
uint16_t channelNumber;
|
||||
std::shared_ptr<struct eismultiplexer> multiplexer;
|
||||
QCheckBox checkbox;
|
||||
QLabel devicelabel;
|
||||
QLabel channellabel;
|
||||
QLabel ganglabel;
|
||||
QComboBox gangcombo;
|
||||
QFrame line;
|
||||
QVBoxLayout vlayout;
|
||||
QHBoxLayout hlayout;
|
||||
QVBoxLayout labellayout;
|
||||
void updateGangCombo();
|
||||
void updateCheckboxState();
|
||||
|
||||
uint16_t deviceSerial;
|
||||
uint16_t channelNumber;
|
||||
std::shared_ptr<struct eismultiplexer> multiplexer;
|
||||
QCheckBox checkbox;
|
||||
QLabel devicelabel;
|
||||
QLabel channellabel;
|
||||
QLabel ganglabel;
|
||||
QComboBox gangcombo;
|
||||
QFrame line;
|
||||
QVBoxLayout vlayout;
|
||||
QHBoxLayout hlayout;
|
||||
QVBoxLayout labellayout;
|
||||
|
||||
// Track the channel this one is ganged to (if any)
|
||||
uint16_t gangedDeviceSerial = 0;
|
||||
uint16_t gangedChannelNumber = 0;
|
||||
};
|
||||
|
||||
#endif // CHANNELWIDGET_H
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue