From c7040ce37187b628d228057938c9cc2453738063 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Thu, 16 Feb 2023 00:47:00 +0100 Subject: [PATCH] Add master sliders --- CMakeLists.txt | 1 + DmxSlider.qml | 8 +++ HomePage.qml | 131 +++++++++++++++++++++++++++++++---------- LightControlWindow.qml | 2 + LightSliderPane.qml | 30 +++++++--- dmxcontroller.cpp | 49 +++++++++++---- lightproject.cpp | 11 ++++ 7 files changed, 180 insertions(+), 52 deletions(-) create mode 100644 DmxSlider.qml diff --git a/CMakeLists.txt b/CMakeLists.txt index a5cbead..c1c243b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,7 @@ qt_add_qml_module(applightcontrol DeviceTypesSettingsPage.qml DevicesSettingsPage.qml Vector3DField.qml + DmxSlider.qml ) set_target_properties(applightcontrol PROPERTIES diff --git a/DmxSlider.qml b/DmxSlider.qml new file mode 100644 index 0000000..72ecd42 --- /dev/null +++ b/DmxSlider.qml @@ -0,0 +1,8 @@ +import QtQuick.Controls.Material + +Slider { + from: 0 + to: 255 + snapMode: Slider.SnapAlways + stepSize: 1 +} diff --git a/HomePage.qml b/HomePage.qml index 4fa2c31..8086db3 100644 --- a/HomePage.qml +++ b/HomePage.qml @@ -4,13 +4,104 @@ import QtQuick.Layouts import com.büro 1.0 -RowLayout { - Item { - Layout.fillWidth: true - Layout.fillHeight: true +Item { + id: homePage - Flow { - anchors.fill: parent + property alias masterDimmer: masterDimmer.value + property alias masterRed: masterRed.value + property alias masterGreen: masterGreen.value + property alias masterBlue: masterBlue.value + property alias masterWhite: masterWhite.value + + Button { + anchors.top: parent.top + anchors.right: parent.right + width: 100 + height: 100 + + text: qsTr('Settings') + + onClicked: stackview.push(settingsPage) + + Component { + id: settingsPage + + SettingsPage { + } + } + } + + ColumnLayout { + anchors.fill: parent + + GridLayout { + Layout.fillWidth: true + + columns: 2 + + Label { + text: qsTr("Alle Dimmer:") + } + + DmxSlider { + id: masterDimmer + } + + Label { + text: qsTr("Alle Rot:") + } + + DmxSlider { + id: masterRed + } + + Label { + text: qsTr("Alle Grün:") + } + + DmxSlider { + id: masterGreen + } + + Label { + text: qsTr("Alle Blau:") + } + + DmxSlider { + id: masterBlue + } + + Label { + text: qsTr("Alle Weiß:") + } + + DmxSlider { + id: masterWhite + } + } + + Item { + Layout.fillWidth: true + Layout.fillHeight: true + } + } + + Flickable { + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + + height: 300 + + contentWidth: theFlow.width + contentHeight: theFlow.height + + flickableDirection: Flickable.HorizontalFlick + + RowLayout { + id: theFlow + + height: parent.height spacing: 5 @@ -20,33 +111,11 @@ RowLayout { delegate: LightSliderPane { light: model - height: 250 + //Layout.fillHeight: true + + height: theFlow.height } } } } - - ColumnLayout { - Layout.preferredWidth: 100 - Layout.fillHeight: true - - Button { - Layout.preferredHeight: 100 - - text: qsTr('Settings') - - onClicked: stackview.push(settingsPage) - - Component { - id: settingsPage - - SettingsPage { - } - } - } - - Item { - Layout.fillHeight: true - } - } } diff --git a/LightControlWindow.qml b/LightControlWindow.qml index f2ed752..0dc7058 100644 --- a/LightControlWindow.qml +++ b/LightControlWindow.qml @@ -34,6 +34,8 @@ ApplicationWindow { Material.elevation: 6 + z: 999 + RowLayout { anchors.fill: parent diff --git a/LightSliderPane.qml b/LightSliderPane.qml index 9e0145f..d771e87 100644 --- a/LightSliderPane.qml +++ b/LightSliderPane.qml @@ -6,14 +6,12 @@ import QtQuick.VirtualKeyboard import com.büro 1.0 - Pane { property variant light Material.elevation: 6 ColumnLayout { - anchors.fill: parent Label { @@ -43,19 +41,35 @@ Pane { horizontalAlignment: Text.AlignHCenter } - Slider { + DmxSlider { id: slider Layout.fillWidth: true Layout.fillHeight: true orientation: Qt.Vertical - from: 0 - to: 255 - - snapMode: Slider.SnapAlways - stepSize: 1 onValueChanged: __controller.setChannel(registerAddress, value) + + Binding on value { + value: homePage.masterDimmer + when: model.registerType === DeviceTypeRegisterType.Dimmer + } + Binding on value { + value: homePage.masterRed + when: model.registerType === DeviceTypeRegisterType.Red + } + Binding on value { + value: homePage.masterGreen + when: model.registerType === DeviceTypeRegisterType.Green + } + Binding on value { + value: homePage.masterBlue + when: model.registerType === DeviceTypeRegisterType.Blue + } + Binding on value { + value: homePage.masterWhite + when: model.registerType === DeviceTypeRegisterType.White + } } Label { diff --git a/dmxcontroller.cpp b/dmxcontroller.cpp index 53c0b02..a34e7ae 100644 --- a/dmxcontroller.cpp +++ b/dmxcontroller.cpp @@ -31,25 +31,48 @@ DmxController::DmxController(QObject *parent) : }, { .id=2, - .name="RGB Strahler" + .name="RGB Strahler", + .registers { + DeviceTypeRegisterConfig { .type = DeviceTypeRegisterType::Red }, + DeviceTypeRegisterConfig { .type = DeviceTypeRegisterType::Green }, + DeviceTypeRegisterConfig { .type = DeviceTypeRegisterType::Blue } + } }, { .id=3, - .name="Nebelmaschine" + .name="Nebelmaschine", + .registers { + DeviceTypeRegisterConfig { .type = DeviceTypeRegisterType::Dimmer } + } } }, .devices { - { .id=0, .name="Lampe 1", .deviceTypeId=1, .address=32, .position{1,0,0} }, - { .id=1, .name="Lampe 2", .deviceTypeId=1, .address=0, .position{2,0,0} }, - { .id=2, .name="Lampe 3", .deviceTypeId=1, .address=7, .position{3,0,0} }, - { .id=3, .name="Lampe 4", .deviceTypeId=1, .address=14 }, - { .id=4, .name="Moving Head 1", .deviceTypeId=0, .address=40 }, - { .id=5, .name="Moving Head 2", .deviceTypeId=0, .address=43 }, - { .id=6, .name="Moving Head 3", .deviceTypeId=0, .address=46 }, - { .id=7, .name="Moving Head 4", .deviceTypeId=0, .address=49 }, - { .id=8, .name="Test 1", .deviceTypeId=2, .address=70 }, - { .id=9, .name="Test 2", .deviceTypeId=2, .address=72 }, - { .id=10, .name="Nebelmaschine", .deviceTypeId=3, .address=80 } + { .id=0, .name="Test 1", .deviceTypeId=1, .address=32, .position{1,0,0} }, + { .id=1, .name="Lampe 1", .deviceTypeId=2, .address=1, .position{2,0,0} }, + { .id=1, .name="Lampe 2", .deviceTypeId=2, .address=4, .position{2,0,0} }, + { .id=2, .name="Lampe 3", .deviceTypeId=2, .address=7, .position{3,0,0} }, + { .id=3, .name="Lampe 4", .deviceTypeId=2, .address=10 }, + { .id=4, .name="Lampe 5", .deviceTypeId=2, .address=13 }, + { .id=5, .name="Lampe 6", .deviceTypeId=2, .address=16 }, + { .id=6, .name="Lampe 7", .deviceTypeId=2, .address=19 }, + { .id=7, .name="Lampe 8", .deviceTypeId=2, .address=22 }, + { .id=8, .name="Lampe 9", .deviceTypeId=2, .address=25 }, + { .id=9, .name="Lampe 10", .deviceTypeId=2, .address=28 }, + { .id=1, .name="Lampe 11", .deviceTypeId=2, .address=31 }, + { .id=1, .name="Lampe 12", .deviceTypeId=2, .address=34 }, + { .id=2, .name="Lampe 13", .deviceTypeId=2, .address=37 }, + { .id=3, .name="Lampe 14", .deviceTypeId=2, .address=40 }, + { .id=4, .name="Lampe 15", .deviceTypeId=2, .address=43 }, + { .id=5, .name="Lampe 16", .deviceTypeId=2, .address=46 }, + { .id=6, .name="Lampe 17", .deviceTypeId=2, .address=49 }, + { .id=7, .name="Lampe 18", .deviceTypeId=2, .address=52 }, + { .id=8, .name="Lampe 19", .deviceTypeId=2, .address=55 }, + { .id=9, .name="Lampe 20", .deviceTypeId=2, .address=58 }, + { .id=10, .name="Nebelmaschine", .deviceTypeId=3, .address=90 }, + { .id=11, .name="Moving Head 1", .deviceTypeId=0, .address=40 }, + { .id=12, .name="Moving Head 2", .deviceTypeId=0, .address=43 }, + { .id=13, .name="Moving Head 3", .deviceTypeId=0, .address=46 }, + { .id=14, .name="Moving Head 4", .deviceTypeId=0, .address=49 } } } { diff --git a/lightproject.cpp b/lightproject.cpp index ace1530..c98e0ef 100644 --- a/lightproject.cpp +++ b/lightproject.cpp @@ -1 +1,12 @@ #include "lightproject.h" + +#include +#include + +namespace { +void registerDenShit() +{ + qmlRegisterUncreatableMetaObject(hilfe::staticMetaObject, "com.büro", 1, 0, "DeviceTypeRegisterType", "lass es du depp"); +} +} +Q_COREAPP_STARTUP_FUNCTION(registerDenShit)