Warning, /education/gcompris/src/activities/digital_electricity/components/DigitalLight.qml is written in an unsupported language. File is not indexed.

0001 /* GCompris - DigitalLight.qml
0002  *
0003  * SPDX-FileCopyrightText: 2016 Pulkit Gupta <pulkitnsit@gmail.com>
0004  *
0005  * Authors:
0006  *   Bruno Coudoin <bruno.coudoin@gcompris.net> (GTK+ version)
0007  *   Pulkit Gupta <pulkitnsit@gmail.com> (Qt Quick port)
0008  *
0009  *   SPDX-License-Identifier: GPL-3.0-or-later
0010  */
0011 import QtQuick 2.12
0012 import GCompris 1.0
0013 import "../digital_electricity.js" as Activity
0014 
0015 ElectricalComponent {
0016     id: digitalLight
0017     terminalSize: 0.25
0018     noOfInputs: 1
0019     noOfOutputs: 0
0020 
0021     information: qsTr("A digital light is used to check the output of other digital components. It turns " +
0022                       "green if the input is 1, and turns red if the input is 0.")
0023 
0024     truthTable: []
0025 
0026     property alias inputTerminals: inputTerminals
0027 
0028     Repeater {
0029         id: inputTerminals
0030         model: 1
0031         delegate: inputTerminal
0032         Component {
0033             id: inputTerminal
0034             TerminalPoint {
0035                 posX: 0.1
0036                 posY: 0.5
0037                 type: "In"
0038             }
0039         }
0040     }
0041 
0042     function updateOutput(wireVisited) {
0043         if(inputTerminals.itemAt(0).value == 1)
0044             imgSrc = "DigitalLightOn.svg"
0045         else
0046             imgSrc = "DigitalLightOff.svg"
0047     }
0048 }