diff --git a/HomePage.qml b/HomePage.qml index 4de12c6..03d2d9a 100644 --- a/HomePage.qml +++ b/HomePage.qml @@ -2,43 +2,80 @@ import QtQuick import QtQuick.Controls.Material import QtQuick.Layouts +import com.büro 1.0 + RowLayout { Item { Layout.fillWidth: true Layout.fillHeight: true Flow { - anchors.centerIn: parent + anchors.fill: parent + + spacing: 5 Repeater { model: devicesModel - ColumnLayout { - width: 50 - height: 200 + delegate: Pane { + property int deviceAddress: model.address + property int myDeviceTypeId: model.deviceTypeId - Label { - Layout.fillWidth: true - text: index - horizontalAlignment: Text.AlignHCenter - } + Material.elevation: 6 - Slider { - id: slider - Layout.fillWidth: true - Layout.fillHeight: true + //width: 75 + height: 250 - orientation: Qt.Vertical - from: 0 - to: 255 + ColumnLayout { + anchors.fill: parent - onValueChanged: __controller.setChannel(32 + index, value) - } + Label { + Layout.fillWidth: true + text: model.name + horizontalAlignment: Text.AlignHCenter + } - Label { - Layout.fillWidth: true - text: Math.round(slider.value) - horizontalAlignment: Text.AlignHCenter + RowLayout { + Layout.fillWidth: true + Layout.fillHeight: true + + Repeater { + model: DeviceTypeRegistersModel { + controller: __controller + deviceTypeId: myDeviceTypeId + } + + delegate: ColumnLayout { + property int registerAddress: deviceAddress + index + + Layout.fillHeight: true + + Label { + Layout.fillWidth: true + text: model.registerTypeName + horizontalAlignment: Text.AlignHCenter + } + + Slider { + id: slider + Layout.fillWidth: true + Layout.fillHeight: true + + orientation: Qt.Vertical + from: 0 + to: 255 + + onValueChanged: __controller.setChannel(registerAddress, value) + } + + Label { + Layout.fillWidth: true + text: Math.round(slider.value) + horizontalAlignment: Text.AlignHCenter + } + } + } + } } } } diff --git a/dmxcontroller.cpp b/dmxcontroller.cpp index 405bb92..53c0b02 100644 --- a/dmxcontroller.cpp +++ b/dmxcontroller.cpp @@ -103,6 +103,8 @@ bool DmxController::start() void DmxController::setChannel(int channel, int value) { + //qDebug() << channel << value; + Q_ASSERT(channel >= 0 && channel < std::size(buf)); buf[channel] = value; }