Add register group settings items

This commit is contained in:
2023-02-19 04:19:56 +01:00
parent 84669babf2
commit 3c6b2bbe48
7 changed files with 78 additions and 30 deletions

View File

@@ -42,6 +42,8 @@ qt_add_qml_module(applightcontrol
RegisterGroupsSettingsPage.qml RegisterGroupsSettingsPage.qml
RegistersSettingsItem.qml RegistersSettingsItem.qml
IconComboBox.qml IconComboBox.qml
IconsModel.qml
DeviceTypeRegisterTypesModel.qml
) )
set_target_properties(applightcontrol PROPERTIES set_target_properties(applightcontrol PROPERTIES

View File

@@ -0,0 +1,14 @@
import QtQuick
import com.büro
ListModel {
ListElement { text: qsTr('Dummy'); value: DeviceTypeRegisterType.Dummy }
ListElement { text: qsTr('Dimmer'); value: DeviceTypeRegisterType.Dimmer }
ListElement { text: qsTr('Red'); value: DeviceTypeRegisterType.Red }
ListElement { text: qsTr('Green'); value: DeviceTypeRegisterType.Green }
ListElement { text: qsTr('Blue'); value: DeviceTypeRegisterType.Blue }
ListElement { text: qsTr('White'); value: DeviceTypeRegisterType.White }
ListElement { text: qsTr('Strobo'); value: DeviceTypeRegisterType.Strobo }
ListElement { text: qsTr('Shutter'); value: DeviceTypeRegisterType.Shutter }
}

View File

@@ -2,17 +2,10 @@ import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Controls.Material import QtQuick.Controls.Material
import QtQuick.Layouts import QtQuick.Layouts
import Qt.labs.folderlistmodel 2.4
import com.büro 1.0 import com.büro 1.0
ColumnLayout { ColumnLayout {
FolderListModel {
id: iconsModel
folder: "qrc:/lightcontrol/icons/"
showDirs: false
}
Label { Label {
text: qsTr("Device Types Settings") text: qsTr("Device Types Settings")
} }
@@ -99,7 +92,9 @@ ColumnLayout {
valueRole: "fileBaseName" valueRole: "fileBaseName"
iconSourceRole: "fileUrl" iconSourceRole: "fileUrl"
model: iconsModel model: IconsModel {
id: iconsModel
}
currentIndex: listView.currentData ? iconComboBox.indexOfValue(listView.currentData.iconName) : -1 currentIndex: listView.currentData ? iconComboBox.indexOfValue(listView.currentData.iconName) : -1
Component.onCompleted: { Component.onCompleted: {
@@ -108,10 +103,7 @@ ColumnLayout {
}); });
} }
onActivated: { onActivated: if (listView.currentData) listView.currentData.iconName = currentValue; else console.warn('discarded');
console.log(currentValue);
if (listView.currentData) listView.currentData.iconName = currentValue; else console.warn('discarded');
}
} }
Label { text: qsTr("Registers:") } Label { text: qsTr("Registers:") }
RegistersSettingsItem { RegistersSettingsItem {

7
IconsModel.qml Normal file
View File

@@ -0,0 +1,7 @@
import QtQuick
import Qt.labs.folderlistmodel 2.4
FolderListModel {
folder: "qrc:/lightcontrol/icons/"
showDirs: false
}

View File

@@ -27,20 +27,11 @@ ApplicationWindow {
controller: __controller controller: __controller
} }
ListModel {
id: deviceTypeRegisterTypesModel
ListElement { text: qsTr('Dummy'); value: DeviceTypeRegisterType.Dummy }
ListElement { text: qsTr('Dimmer'); value: DeviceTypeRegisterType.Dimmer }
ListElement { text: qsTr('Red'); value: DeviceTypeRegisterType.Red }
ListElement { text: qsTr('Green'); value: DeviceTypeRegisterType.Green }
ListElement { text: qsTr('Blue'); value: DeviceTypeRegisterType.Blue }
ListElement { text: qsTr('White'); value: DeviceTypeRegisterType.White }
ListElement { text: qsTr('Strobo'); value: DeviceTypeRegisterType.Strobo }
ListElement { text: qsTr('Shutter'); value: DeviceTypeRegisterType.Shutter }
}
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.left: parent.left
anchors.top: parent.top
anchors.right: parent.right
anchors.bottom: lampRegistersPanel.top
StatusBar { StatusBar {
Layout.fillWidth: true Layout.fillWidth: true
@@ -97,7 +88,7 @@ ApplicationWindow {
} }
Flickable { Flickable {
id: test id: lampRegistersPanel
z: 98 z: 98
x: 0 x: 0
@@ -108,9 +99,9 @@ ApplicationWindow {
states: State { states: State {
name: "invisible" name: "invisible"
when: !test.active when: !lampRegistersPanel.active
PropertyChanges { PropertyChanges {
target: test target: lampRegistersPanel
y: window.height y: window.height
} }
} }

View File

@@ -1,5 +1,46 @@
import QtQuick import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Material
import QtQuick.Layouts
Item { import com.büro 1.0
ColumnLayout {
property bool needsRegler: true property bool needsRegler: true
Label {
text: qsTr("Register Groups Settings")
}
RowLayout {
//Layout.fillWidth: true
Layout.fillHeight: true
EditableListView {
id: listView
Layout.preferredWidth: 300
Layout.maximumWidth: 300
Layout.fillHeight: true
}
ColumnLayout {
enabled: listView.currentIndex !== -1
GridLayout {
Layout.preferredWidth: 600
Layout.maximumWidth: 600
columns: 2
Label { text: qsTr("Id:") }
SpinBox {
enabled: false
Layout.fillWidth: true
}
}
Item {
Layout.fillHeight: true
}
}
}
} }

View File

@@ -52,7 +52,8 @@ Pane {
} }
ComboBox { ComboBox {
id: comboBox id: comboBox
model: deviceTypeRegisterTypesModel model: DeviceTypeRegisterTypesModel {
}
textRole: "text" textRole: "text"
valueRole: "value" valueRole: "value"