2023-02-18 16:09:51 +01:00
|
|
|
import QtQuick
|
2023-02-19 04:19:56 +01:00
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Controls.Material
|
|
|
|
import QtQuick.Layouts
|
2023-02-18 16:09:51 +01:00
|
|
|
|
2023-02-21 20:28:53 +01:00
|
|
|
import scheincommander
|
2023-02-19 04:19:56 +01:00
|
|
|
|
|
|
|
ColumnLayout {
|
2023-02-18 16:09:51 +01:00
|
|
|
property bool needsRegler: true
|
2023-02-19 04:19:56 +01:00
|
|
|
|
|
|
|
Label {
|
2023-02-22 23:18:09 +01:00
|
|
|
text: qsTr("Presets Settings")
|
2023-02-19 04:19:56 +01:00
|
|
|
}
|
|
|
|
RowLayout {
|
2023-03-04 19:13:23 +01:00
|
|
|
Layout.fillWidth: true
|
2023-02-19 04:19:56 +01:00
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
EditableListView {
|
2023-03-04 19:13:23 +01:00
|
|
|
id: presetsListView
|
2023-02-19 04:19:56 +01:00
|
|
|
|
2023-03-04 19:13:23 +01:00
|
|
|
Layout.fillWidth: true
|
2023-02-19 04:19:56 +01:00
|
|
|
Layout.fillHeight: true
|
2023-02-19 20:14:36 +01:00
|
|
|
|
2023-02-22 23:18:09 +01:00
|
|
|
model: PresetsModel {
|
2023-03-04 19:13:23 +01:00
|
|
|
id: presetsModel
|
2023-02-19 20:14:36 +01:00
|
|
|
controller: __controller
|
|
|
|
}
|
2023-02-19 21:22:45 +01:00
|
|
|
|
2023-03-04 19:13:23 +01:00
|
|
|
onAddClicked: (index) => { const newIndex = index < 0 ? 0 : index + 1; if (presetsModel.insertRow(newIndex)) currentIndex = newIndex; else console.warn('failed'); }
|
2023-02-19 21:22:45 +01:00
|
|
|
onRemoveClicked: (index) => {
|
|
|
|
const dialog = dialogComponent.createObject(Overlay.overlay);
|
|
|
|
dialog.index = index;
|
|
|
|
dialog.open();
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: dialogComponent
|
|
|
|
|
|
|
|
Dialog {
|
|
|
|
property int index
|
|
|
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
standardButtons: DialogButtonBox.Yes | DialogButtonBox.Cancel
|
|
|
|
modal: true
|
|
|
|
title: qsTr('Confirmation')
|
|
|
|
|
2023-03-04 20:19:10 +01:00
|
|
|
onAccepted: if (!presetsModel.removeRow(index)) console.warn('failed');
|
2023-02-19 21:22:45 +01:00
|
|
|
|
|
|
|
Label {
|
|
|
|
id: textContainer
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
horizontalAlignment: Qt.AlignLeft
|
|
|
|
verticalAlignment: Qt.AlignTop
|
|
|
|
|
|
|
|
text: qsTr('Are you sure you want to remove row %0').arg(index)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-02-19 04:19:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
2023-03-04 20:19:10 +01:00
|
|
|
Layout.preferredWidth: 300
|
|
|
|
Layout.maximumWidth: 300
|
2023-03-04 19:13:23 +01:00
|
|
|
Layout.fillHeight: true
|
2023-02-19 04:19:56 +01:00
|
|
|
|
2023-03-04 19:13:23 +01:00
|
|
|
enabled: presetsListView.currentIndex !== -1
|
2023-02-19 04:19:56 +01:00
|
|
|
|
2023-03-04 19:13:23 +01:00
|
|
|
GridLayout {
|
2023-02-19 04:19:56 +01:00
|
|
|
columns: 2
|
|
|
|
|
|
|
|
Label { text: qsTr("Id:") }
|
|
|
|
SpinBox {
|
|
|
|
enabled: false
|
2023-03-04 19:13:23 +01:00
|
|
|
value: presetsListView.currentData ? presetsListView.currentData.id : -1
|
|
|
|
onValueModified: if (presetsListView.currentData) presetsListView.currentData.id = value; else console.warn('discarded');
|
2023-02-19 20:23:18 +01:00
|
|
|
}
|
|
|
|
Label { text: qsTr("Name:") }
|
|
|
|
TextField {
|
2023-03-04 20:19:10 +01:00
|
|
|
Layout.fillWidth: true
|
2023-03-04 19:13:23 +01:00
|
|
|
text: presetsListView.currentData ? presetsListView.currentData.name : ''
|
|
|
|
onTextEdited: if (presetsListView.currentData) presetsListView.currentData.name = text; else console.warn('discarded');
|
2023-02-19 04:19:56 +01:00
|
|
|
}
|
2023-03-04 23:37:45 +01:00
|
|
|
Label { text: qsTr("MSecsPerStep:") }
|
|
|
|
SpinBox {
|
|
|
|
editable: true
|
|
|
|
to: 999999
|
|
|
|
value: presetsListView.currentData ? presetsListView.currentData.msecsPerStep : -1
|
|
|
|
onValueModified: if (presetsListView.currentData) presetsListView.currentData.msecsPerStep = value; else console.warn('discarded');
|
|
|
|
}
|
2023-02-19 04:19:56 +01:00
|
|
|
}
|
2023-02-20 00:36:55 +01:00
|
|
|
|
2023-03-04 19:13:23 +01:00
|
|
|
Item {
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
|
|
|
}
|
2023-02-20 00:36:55 +01:00
|
|
|
|
2023-03-04 19:13:23 +01:00
|
|
|
EditableListView {
|
2023-03-04 20:44:05 +01:00
|
|
|
id: presetStepsListView
|
|
|
|
|
2023-03-04 20:19:10 +01:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
2023-03-04 19:13:23 +01:00
|
|
|
enabled: presetsListView.currentIndex !== -1
|
|
|
|
|
|
|
|
model: PresetStepsModel {
|
2023-03-04 20:19:10 +01:00
|
|
|
id: presetStepsModel
|
|
|
|
|
2023-03-04 19:13:23 +01:00
|
|
|
controller: __controller
|
|
|
|
presetId: presetsListView.currentData ? presetsListView.currentData.id : -1
|
|
|
|
}
|
2023-03-04 20:19:10 +01:00
|
|
|
|
|
|
|
onAddClicked: (index) => { const newIndex = index < 0 ? 0 : index + 1; if (presetStepsModel.insertRow(newIndex)) currentIndex = newIndex; else console.warn('failed'); }
|
|
|
|
onRemoveClicked: (index) => {
|
|
|
|
const dialog = dialogComponent2.createObject(Overlay.overlay);
|
|
|
|
dialog.index = index;
|
|
|
|
dialog.open();
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: dialogComponent2
|
|
|
|
|
|
|
|
Dialog {
|
|
|
|
property int index
|
|
|
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
standardButtons: DialogButtonBox.Yes | DialogButtonBox.Cancel
|
|
|
|
modal: true
|
|
|
|
title: qsTr('Confirmation')
|
|
|
|
|
|
|
|
onAccepted: if (!presetStepsModel.removeRow(index)) console.warn('failed');
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: textContainer
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
horizontalAlignment: Qt.AlignLeft
|
|
|
|
verticalAlignment: Qt.AlignTop
|
|
|
|
|
|
|
|
text: qsTr('Are you sure you want to remove row %0').arg(index)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-03-04 19:13:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
Layout.fillWidth: true
|
2023-02-20 00:36:55 +01:00
|
|
|
|
2023-03-04 19:13:23 +01:00
|
|
|
RowLayout {
|
2023-03-04 20:44:05 +01:00
|
|
|
enabled: presetStepsListView.currentIndex >= 0
|
|
|
|
|
2023-02-20 00:36:55 +01:00
|
|
|
Button {
|
|
|
|
text: qsTr('Auf Schieberegler\nunten kopieren');
|
2023-03-04 23:37:45 +01:00
|
|
|
onPressed: if (!presetStepsModel.copyToFaders(presetStepsListView.currentIndex)) console.warn('failed')
|
2023-02-20 00:36:55 +01:00
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: qsTr('Von Schieberegler\nunten kopieren');
|
2023-03-04 23:37:45 +01:00
|
|
|
onPressed: if (!presetStepsModel.copyFromFaders(presetStepsListView.currentIndex)) console.warn('failed');
|
2023-02-20 00:36:55 +01:00
|
|
|
}
|
2023-03-03 20:32:27 +01:00
|
|
|
}
|
|
|
|
|
2023-03-04 20:44:05 +01:00
|
|
|
Item {
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
|
|
|
|
|
|
|
PatternMaker {
|
|
|
|
id: patternMaker
|
|
|
|
controller: __controller
|
|
|
|
}
|
|
|
|
|
2023-03-03 20:32:27 +01:00
|
|
|
RowLayout {
|
2023-02-20 00:36:55 +01:00
|
|
|
Button {
|
|
|
|
text: qsTr('Alle auf\n0 setzen');
|
2023-03-05 02:08:44 +01:00
|
|
|
onPressed: patternMaker.setAllFaders(0)
|
2023-02-20 00:36:55 +01:00
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: qsTr('Alle auf\nMaximum setzen');
|
2023-03-05 02:08:44 +01:00
|
|
|
onPressed: patternMaker.setAllFaders(255)
|
2023-02-20 00:36:55 +01:00
|
|
|
}
|
2023-03-03 20:32:27 +01:00
|
|
|
}
|
2023-03-04 19:13:23 +01:00
|
|
|
|
2023-03-03 20:32:27 +01:00
|
|
|
RowLayout {
|
|
|
|
SpinBox {
|
|
|
|
id: nSpinBox
|
|
|
|
Layout.preferredWidth: 120
|
|
|
|
from: 1
|
|
|
|
}
|
2023-02-21 19:51:54 +01:00
|
|
|
|
2023-03-03 20:32:27 +01:00
|
|
|
SpinBox {
|
|
|
|
id: kSpinBox
|
|
|
|
Layout.preferredWidth: 120
|
2023-02-20 22:36:25 +01:00
|
|
|
|
2023-03-03 20:32:27 +01:00
|
|
|
from: 0
|
|
|
|
to: nSpinBox.value - 1
|
|
|
|
}
|
2023-02-20 22:36:25 +01:00
|
|
|
|
2023-03-03 20:32:27 +01:00
|
|
|
ComboBox {
|
|
|
|
id: registerTypeComboBox
|
|
|
|
model: DeviceTypeRegisterTypesModel {
|
2023-02-20 22:36:25 +01:00
|
|
|
}
|
2023-03-03 20:32:27 +01:00
|
|
|
textRole: "text"
|
|
|
|
valueRole: "value"
|
|
|
|
}
|
2023-02-20 22:36:25 +01:00
|
|
|
|
2023-03-03 20:32:27 +01:00
|
|
|
DmxSlider {
|
|
|
|
id: valueSlider
|
2023-02-20 22:36:25 +01:00
|
|
|
}
|
2023-02-20 00:36:55 +01:00
|
|
|
|
2023-03-03 20:32:27 +01:00
|
|
|
Button {
|
|
|
|
text: qsTr('Set')
|
2023-03-04 20:44:05 +01:00
|
|
|
onPressed: patternMaker.setPattern(nSpinBox.value, kSpinBox.value, registerTypeComboBox.currentValue, valueSlider.value)
|
2023-03-03 20:32:27 +01:00
|
|
|
}
|
2023-02-19 04:19:56 +01:00
|
|
|
}
|
2023-03-05 00:20:34 +01:00
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
DoubleSpinBox {
|
|
|
|
id: phaseAdvanceSlider
|
|
|
|
Layout.preferredWidth: 120
|
|
|
|
realFrom: 1
|
|
|
|
realTo: 360
|
|
|
|
realValue: 60
|
|
|
|
}
|
|
|
|
|
2023-03-05 00:32:29 +01:00
|
|
|
SpinBox {
|
|
|
|
id: advanceEveryNLamp
|
|
|
|
Layout.preferredWidth: 120
|
|
|
|
from: 1
|
|
|
|
value: 2
|
|
|
|
}
|
|
|
|
|
2023-03-05 00:20:34 +01:00
|
|
|
SpinBox {
|
|
|
|
id: generateSteps
|
|
|
|
Layout.preferredWidth: 120
|
|
|
|
from: 1
|
|
|
|
to: 1000
|
|
|
|
value: 360
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
2023-03-05 00:47:27 +01:00
|
|
|
text: qsTr('Single')
|
2023-03-05 00:32:29 +01:00
|
|
|
onPressed: patternMaker.setRainbow(0, phaseAdvanceSlider.realValue / 360., advanceEveryNLamp.value)
|
2023-03-05 00:20:34 +01:00
|
|
|
}
|
2023-03-05 01:59:22 +01:00
|
|
|
|
2023-03-05 00:47:27 +01:00
|
|
|
Button {
|
|
|
|
text: qsTr('All Steps')
|
|
|
|
onPressed: {
|
2023-03-05 01:59:22 +01:00
|
|
|
const rowCount = presetStepsModel.rowCount();
|
|
|
|
|
|
|
|
if (rowCount)
|
|
|
|
if (!presetStepsModel.removeRows(0, rowCount)) {
|
|
|
|
console.warn('removeRows failed');
|
|
|
|
return;
|
|
|
|
}
|
2023-03-05 00:47:27 +01:00
|
|
|
|
2023-03-05 01:59:22 +01:00
|
|
|
const steps = generateSteps.value;
|
2023-03-05 00:47:27 +01:00
|
|
|
|
2023-03-05 01:59:22 +01:00
|
|
|
if (!presetStepsModel.insertRows(0, steps)) {
|
2023-03-05 00:47:27 +01:00
|
|
|
console.warn('insertRows failed');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-03-05 01:59:22 +01:00
|
|
|
for (let i = 0; i < steps; i++) {
|
2023-03-05 00:47:27 +01:00
|
|
|
patternMaker.setRainbow((i*1.) / steps , phaseAdvanceSlider.realValue / 360., advanceEveryNLamp.value);
|
2023-03-05 01:59:22 +01:00
|
|
|
|
|
|
|
if (!presetStepsModel.copyFromFaders(i))
|
|
|
|
console.warn('copyFromFaders failed');
|
2023-03-05 00:47:27 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-03-05 00:20:34 +01:00
|
|
|
}
|
2023-02-19 04:19:56 +01:00
|
|
|
}
|
|
|
|
}
|
2023-02-18 16:09:51 +01:00
|
|
|
}
|