Warning, /education/kstars/kstars/kstarslite/qml/indi/modules/Property.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick 2.6
0005 import QtQuick.Window 2.2
0006 import QtQuick.Layouts 1.2
0007 import QtQuick.Controls 2.0
0008 import "../../constants"
0009 import TelescopeLiteEnums 1.0
0010 
0011 ColumnLayout {
0012     id: columnProp
0013 
0014     Layout.fillHeight: true
0015     width: parentTab == null ? 0 : parentTab.width
0016 
0017     property string deviceName: ""
0018     property string propName: ""
0019     property string label: ""
0020     property Item parentTab
0021     property ComboBox comboBox: null
0022     property Flow buttonRow: null
0023 
0024     KSLed {
0025         id: led
0026         deviceName: columnProp.deviceName
0027         propName: columnProp.propName
0028         label: columnProp.label
0029 
0030         Component.onCompleted: {
0031             syncLEDProperty()
0032         }
0033     }
0034 
0035     Rectangle {
0036         id: separator
0037         height: Num.dp
0038         color: "grey"
0039         Layout.fillWidth: true
0040     }
0041 
0042     Connections {
0043         target: ClientManagerLite
0044         onNewLEDState: {
0045             if(columnProp.deviceName == deviceName) {
0046                 if(columnProp.propName == propName) {
0047                     led.syncLEDProperty()
0048                 }
0049             }
0050         }
0051         onCreateINDIButton: {
0052             if(columnProp.deviceName == deviceName) {
0053                 if(columnProp.propName == propName) {
0054                     if(buttonRow == null) {
0055                         var buttonRowComp = Qt.createComponent("KSButtonsSwitchRow.qml");
0056                         buttonRow = buttonRowComp.createObject(columnProp)
0057                         buttonRow.deviceName = deviceName
0058                         buttonRow.propName = propName
0059                         buttonRow.exclusive = exclusive
0060                         buttonRow.width = Qt.binding(function() { return parentTab.width })
0061                     }
0062                     buttonRow.addButton(propText, switchName, checked, enabled)
0063                 }
0064             }
0065         }
0066         onCreateINDIRadio: {
0067             if(columnProp.deviceName == deviceName) {
0068                 if(columnProp.propName == propName) {
0069                     if(buttonRow == null) {
0070                         var buttonRowComp = Qt.createComponent("KSButtonsSwitchRow.qml");
0071                         buttonRow = buttonRowComp.createObject(columnProp)
0072                         buttonRow.deviceName = deviceName
0073                         buttonRow.propName = propName
0074                         buttonRow.exclusive = exclusive
0075                         buttonRow.checkBox = true
0076                         buttonRow.width = Qt.binding(function() { return parentTab.width })
0077                     }
0078                     buttonRow.addCheckBox(propText, switchName, checked, enabled)
0079                 }
0080             }
0081         }
0082         onCreateINDIMenu: {
0083             if(columnProp.deviceName == deviceName) {
0084                 if(columnProp.propName == propName) {
0085                     if(comboBox == null) {
0086                         var CBoxComponent = Qt.createComponent("KSComboBox.qml");
0087                         comboBox = CBoxComponent.createObject(columnProp)
0088                         comboBox.deviceName = deviceName
0089                         comboBox.propName = propName
0090                         comboBox.textRole = "text"
0091                     }
0092                     comboBox.model.append({"text": switchLabel, "name": switchName})
0093                     if(isSelected) {
0094                         comboBox.currentIndex = comboBox.model.length - 1
0095                     }
0096                 }
0097             }
0098         }
0099 
0100         onCreateINDIText: {
0101             if(columnProp.deviceName == deviceName) {
0102                 if(columnProp.propName == propName) {
0103                     var indiTextComp = Qt.createComponent("KSINDIText.qml");
0104                     var indiText = indiTextComp.createObject(columnProp)
0105                     indiText.addField(false, deviceName, propName, fieldName, propText, write)
0106                     indiText.propLabel = propLabel
0107                     //indiText.width = Qt.binding(function() { return parentTab.width })
0108                 }
0109             }
0110         }
0111         onCreateINDINumber: {
0112             if(columnProp.deviceName == deviceName) {
0113                 if(columnProp.propName == propName) {
0114                     var indiNumComp = Qt.createComponent("KSINDIText.qml");
0115                     var indiNum = indiNumComp.createObject(columnProp)
0116                     indiNum.addField(true, deviceName, propName, numberName, propText, write)
0117                     indiNum.propLabel = propLabel
0118                 }
0119             }
0120         }
0121         onCreateINDILight: {
0122             if(columnProp.deviceName == deviceName) {
0123                 if(columnProp.propName == propName) {
0124                     var lightComp = Qt.createComponent("KSLed.qml")
0125                     var light = lightComp.createObject(columnProp)
0126                     light.deviceName = deviceName
0127                     light.propName = propName
0128                     light.label = label
0129                     light.name = name
0130                     light.syncLEDLight()
0131                 }
0132             }
0133         }
0134     }
0135 }