1/* GCompris - DigitalLight.qml 2 * 3 * SPDX-FileCopyrightText: 2016 Pulkit Gupta <pulkitnsit@gmail.com> 4 * 5 * Authors: 6 * Bruno Coudoin <bruno.coudoin@gcompris.net> (GTK+ version) 7 * Pulkit Gupta <pulkitnsit@gmail.com> (Qt Quick port) 8 * 9 * SPDX-License-Identifier: GPL-3.0-or-later 10 */ 11import QtQuick 2.9 12import GCompris 1.0 13import "../digital_electricity.js" as Activity 14 15ElectricalComponent { 16 id: digitalLight 17 terminalSize: 0.25 18 noOfInputs: 1 19 noOfOutputs: 0 20 21 information: qsTr("A digital light is used to check the output of other digital components. It turns " + 22 "green if the input is 1, and turns red if the input is 0.") 23 24 truthTable: [] 25 26 property alias inputTerminals: inputTerminals 27 28 Repeater { 29 id: inputTerminals 30 model: 1 31 delegate: inputTerminal 32 Component { 33 id: inputTerminal 34 TerminalPoint { 35 posX: 0.1 36 posY: 0.5 37 type: "In" 38 } 39 } 40 } 41 42 function updateOutput(wireVisited) { 43 if(inputTerminals.itemAt(0).value == 1) 44 imgSrc = "DigitalLightOn.svg" 45 else 46 imgSrc = "DigitalLightOff.svg" 47 } 48} 49