diff --git a/src/plugins/score-plugin-protocols/Protocols/Artnet/ArtnetProtocolSettingsWidget.cpp b/src/plugins/score-plugin-protocols/Protocols/Artnet/ArtnetProtocolSettingsWidget.cpp index beeac140c7..e568e35948 100644 --- a/src/plugins/score-plugin-protocols/Protocols/Artnet/ArtnetProtocolSettingsWidget.cpp +++ b/src/plugins/score-plugin-protocols/Protocols/Artnet/ArtnetProtocolSettingsWidget.cpp @@ -1108,6 +1108,53 @@ class FixtureTreeView : public QTreeView } }; +enum class LEDMode +{ + RGB, + RGBW, + BGR, + BGRW, + Lightness +}; + +class AddLEDStripDialog : public QDialog +{ +public: + AddLEDStripDialog(ArtnetProtocolSettingsWidget& parent) + : QDialog{&parent} + , m_name{this} + , m_buttons{ + QDialogButtonBox::StandardButton::Ok + | QDialogButtonBox::StandardButton::Cancel, + this} + { + this->setLayout(&m_layout); + m_layout.addLayout(&m_buttonsLayout); + + m_buttonsLayout.addRow(tr("Name"), &m_name); + m_buttonsLayout.addRow(tr("Count"), &m_ledCount); + m_buttonsLayout.addRow(tr("Mode"), &m_ledMode); + + m_layout.addStretch(2); + m_layout.addWidget(&m_buttons); + + m_ledCount.setRange(1, 65535); + m_ledMode.addItems({"RGB", "RGBW", "BGR", "BGRW", "Lightness"}); + } + + int leds() const noexcept { return m_ledCount.value(); } + LEDMode mode() const noexcept + { + return static_cast(m_ledMode.currentIndex()); + } + + QVBoxLayout m_layout; + QFormLayout m_buttonsLayout; + State::AddressFragmentLineEdit m_name; + QSpinBox m_ledCount; + QComboBox m_ledMode; + QDialogButtonBox m_buttons; +}; class AddFixtureDialog : public QDialog { public: @@ -1275,6 +1322,7 @@ ArtnetProtocolSettingsWidget::ArtnetProtocolSettingsWidget(QWidget* parent) auto btns = new QHBoxLayout; m_addFixture = new QPushButton{"Add a fixture"}; + m_addLEDStrip = new QPushButton{"Add a LED strip"}; m_rmFixture = new QPushButton{"Remove selected fixture"}; btns->addWidget(m_addFixture); btns->addWidget(m_rmFixture); @@ -1292,6 +1340,18 @@ ArtnetProtocolSettingsWidget::ArtnetProtocolSettingsWidget(QWidget* parent) } } }); + connect(m_addLEDStrip, &QPushButton::clicked, this, [this] { + auto dial = new AddLEDStripDialog{*this}; + if(dial->exec() == QDialog::Accepted) + { + // auto fixt = dial->fixture(); + // if(!fixt.fixtureName.isEmpty() && !fixt.controls.empty()) + // { + // m_fixtures.push_back(fixt); + // updateTable(); + // } + } + }); connect(m_rmFixture, &QPushButton::clicked, this, [this] { ossia::flat_set rows_to_remove; for(auto item : m_fixturesWidget->selectedItems()) diff --git a/src/plugins/score-plugin-protocols/Protocols/Artnet/ArtnetProtocolSettingsWidget.hpp b/src/plugins/score-plugin-protocols/Protocols/Artnet/ArtnetProtocolSettingsWidget.hpp index 679813a356..cc0be192e1 100644 --- a/src/plugins/score-plugin-protocols/Protocols/Artnet/ArtnetProtocolSettingsWidget.hpp +++ b/src/plugins/score-plugin-protocols/Protocols/Artnet/ArtnetProtocolSettingsWidget.hpp @@ -40,6 +40,7 @@ class ArtnetProtocolSettingsWidget final : public Device::ProtocolSettingsWidget QRadioButton* m_sink{}; QTableWidget* m_fixturesWidget{}; QPushButton* m_addFixture{}; + QPushButton* m_addLEDStrip{}; QPushButton* m_rmFixture{}; std::vector m_fixtures; };