Kstars

Property.qml
1// SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4import QtQuick 2.6
5import QtQuick.Window 2.2
6import QtQuick.Layouts 1.2
7import QtQuick.Controls 2.0
8import "../../constants"
9import TelescopeLiteEnums 1.0
10
11ColumnLayout {
12 id: columnProp
13
14 Layout.fillHeight: true
15 width: parentTab == null ? 0 : parentTab.width
16
17 property string deviceName: ""
18 property string propName: ""
19 property string label: ""
20 property Item parentTab
21 property ComboBox comboBox: null
22 property Flow buttonRow: null
23
24 KSLed {
25 id: led
26 deviceName: columnProp.deviceName
27 propName: columnProp.propName
28 label: columnProp.label
29
30 Component.onCompleted: {
31 syncLEDProperty()
32 }
33 }
34
35 Rectangle {
36 id: separator
37 height: Num.dp
38 color: "grey"
39 Layout.fillWidth: true
40 }
41
42 Connections {
43 target: ClientManagerLite
44 onNewLEDState: {
45 if(columnProp.deviceName == deviceName) {
46 if(columnProp.propName == propName) {
47 led.syncLEDProperty()
48 }
49 }
50 }
51 onCreateINDIButton: {
52 if(columnProp.deviceName == deviceName) {
53 if(columnProp.propName == propName) {
54 if(buttonRow == null) {
55 var buttonRowComp = Qt.createComponent("KSButtonsSwitchRow.qml");
56 buttonRow = buttonRowComp.createObject(columnProp)
57 buttonRow.deviceName = deviceName
58 buttonRow.propName = propName
59 buttonRow.exclusive = exclusive
60 buttonRow.width = Qt.binding(function() { return parentTab.width })
61 }
62 buttonRow.addButton(propText, switchName, checked, enabled)
63 }
64 }
65 }
66 onCreateINDIRadio: {
67 if(columnProp.deviceName == deviceName) {
68 if(columnProp.propName == propName) {
69 if(buttonRow == null) {
70 var buttonRowComp = Qt.createComponent("KSButtonsSwitchRow.qml");
71 buttonRow = buttonRowComp.createObject(columnProp)
72 buttonRow.deviceName = deviceName
73 buttonRow.propName = propName
74 buttonRow.exclusive = exclusive
75 buttonRow.checkBox = true
76 buttonRow.width = Qt.binding(function() { return parentTab.width })
77 }
78 buttonRow.addCheckBox(propText, switchName, checked, enabled)
79 }
80 }
81 }
82 onCreateINDIMenu: {
83 if(columnProp.deviceName == deviceName) {
84 if(columnProp.propName == propName) {
85 if(comboBox == null) {
86 var CBoxComponent = Qt.createComponent("KSComboBox.qml");
87 comboBox = CBoxComponent.createObject(columnProp)
88 comboBox.deviceName = deviceName
89 comboBox.propName = propName
90 comboBox.textRole = "text"
91 }
92 comboBox.model.append({"text": switchLabel, "name": switchName})
93 if(isSelected) {
94 comboBox.currentIndex = comboBox.model.length - 1
95 }
96 }
97 }
98 }
99
100 onCreateINDIText: {
101 if(columnProp.deviceName == deviceName) {
102 if(columnProp.propName == propName) {
103 var indiTextComp = Qt.createComponent("KSINDIText.qml");
104 var indiText = indiTextComp.createObject(columnProp)
105 indiText.addField(false, deviceName, propName, fieldName, propText, write)
106 indiText.propLabel = propLabel
107 //indiText.width = Qt.binding(function() { return parentTab.width })
108 }
109 }
110 }
111 onCreateINDINumber: {
112 if(columnProp.deviceName == deviceName) {
113 if(columnProp.propName == propName) {
114 var indiNumComp = Qt.createComponent("KSINDIText.qml");
115 var indiNum = indiNumComp.createObject(columnProp)
116 indiNum.addField(true, deviceName, propName, numberName, propText, write)
117 indiNum.propLabel = propLabel
118 }
119 }
120 }
121 onCreateINDILight: {
122 if(columnProp.deviceName == deviceName) {
123 if(columnProp.propName == propName) {
124 var lightComp = Qt.createComponent("KSLed.qml")
125 var light = lightComp.createObject(columnProp)
126 light.deviceName = deviceName
127 light.propName = propName
128 light.label = label
129 light.name = name
130 light.syncLEDLight()
131 }
132 }
133 }
134 }
135}
QString name(StandardAction id)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.