Warning, /education/kstars/kstars/kstarslite/qml/indi/modules/KSLed.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.Layouts 1.2
0006 import QtQuick.Controls 2.0
0007 import "../../constants" 1.0
0008 import "../../modules"
0009 
0010 Row {
0011     spacing: 5
0012     id: ledRow
0013     property string deviceName
0014     property string propName
0015     property string label
0016     property string name //Used in Light
0017 
0018     onDeviceNameChanged: {
0019         syncLEDProperty()
0020     }
0021 
0022     onPropNameChanged: {
0023         syncLEDProperty()
0024     }
0025 
0026     function syncLEDProperty() {
0027         led.color = ClientManagerLite.syncLED(ledRow.deviceName, ledRow.propName)
0028     }
0029 
0030     function syncLEDLight() {
0031         led.color = ClientManagerLite.syncLED(ledRow.deviceName, ledRow.propName, ledRow.name)
0032     }
0033 
0034     Connections {
0035         target: ClientManagerLite
0036         onNewINDILight: {
0037             if(ledRow.deviceName == deviceName) {
0038                 if(ledRow.propName == propName) {
0039                     ledRow.syncLEDLight() // We update only Lights here
0040                 }
0041             }
0042         }
0043     }
0044 
0045     Led {
0046         id: led
0047         color: "red"
0048         anchors.verticalCenter: parent.verticalCenter
0049     }
0050 
0051     KSLabel {
0052         text: ledRow.label
0053         anchors.verticalCenter: parent.verticalCenter
0054     }
0055 }