Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

artnet: initial work towards a led strip ui #1616

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<LEDMode>(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:
Expand Down Expand Up @@ -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);
Expand All @@ -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<int> rows_to_remove;
for(auto item : m_fixturesWidget->selectedItems())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Artnet::Fixture> m_fixtures;
};
Expand Down
Loading