Warning, /education/gcompris/src/activities/renewable_energy/Wind.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - wind.qml 0002 * 0003 * SPDX-FileCopyrightText: 2015 Sagar Chand Agarwal <atomsagar@gmail.com> 0004 * SPDX-FileCopyrightText: 2022 Timothée Giet <animtim@gmail.com> 0005 * 0006 * Authors: 0007 * Bruno Coudoin <bruno.coudoin@gcompris.net> (GTK+ version) 0008 * Sagar Chand Agarwal <atomsagar@gmail.com> (Qt Quick port) 0009 * Timothée Giet <animtim@gmail.com> (Big refactoring) 0010 * 0011 * SPDX-License-Identifier: GPL-3.0-or-later 0012 */ 0013 import QtQuick 2.12 0014 import GCompris 1.0 0015 import "../../core" 0016 0017 Item { 0018 id: wind 0019 property alias power: windTransformer.power 0020 0021 function stop() { 0022 windTimer.stop() 0023 cloud.started = false 0024 windTransformer.started = false 0025 } 0026 0027 function stopTimer() { 0028 windTimer.stop(); 0029 } 0030 0031 Image { 0032 id: cloud 0033 opacity: 1 0034 source: activity.url + "wind/cloud_quiet.svg" 0035 width: parent.width * 0.225 0036 sourceSize.width: width 0037 fillMode: Image.PreserveAspectFit 0038 anchors { 0039 left: parent.left 0040 top: parent.top 0041 topMargin: parent.width * 0.02 0042 leftMargin: parent.width * 0.764 0043 } 0044 property bool started: false 0045 MouseArea { 0046 anchors.fill: parent 0047 onClicked: { 0048 cloud.started = true 0049 windTimer.restart() 0050 } 0051 } 0052 } 0053 0054 Image { 0055 id: cloudActive 0056 source: activity.url + "wind/cloud_blowing.svg" 0057 visible: cloud.started 0058 anchors.fill: cloud 0059 sourceSize.width: width 0060 fillMode: Image.PreserveAspectFit 0061 } 0062 0063 Timer { 0064 id: windTimer 0065 interval: 30000 0066 running: false 0067 repeat: false 0068 onTriggered: cloud.started = false 0069 } 0070 0071 Image { 0072 source: activity.url + (windTurbine.power ? "wind/wind_on.svg" : "wind/wind_off.svg") 0073 width: parent.width * 0.119 0074 sourceSize.width: width 0075 fillMode: Image.PreserveAspectFit 0076 anchors { 0077 top: parent.top 0078 left: parent.left 0079 topMargin: parent.width * 0.199 0080 leftMargin: parent.width * 0.733 0081 } 0082 } 0083 0084 Image { 0085 source: activity.url + (windTransformer.power ? "wind/wind_power_on.svg" : "wind/wind_power_off.svg") 0086 width: parent.width * 0.065 0087 sourceSize.width: width 0088 fillMode: Image.PreserveAspectFit 0089 anchors { 0090 top: parent.top 0091 left: parent.left 0092 topMargin: parent.width * 0.28 0093 leftMargin: parent.width * 0.699 0094 } 0095 } 0096 0097 Image { 0098 id: windTransformer 0099 source: activity.url + "transformer_off.svg" 0100 width: parent.width * 0.05 0101 sourceSize.width: width 0102 fillMode: Image.PreserveAspectFit 0103 anchors { 0104 top: parent.top 0105 left: parent.left 0106 topMargin: parent.width * 0.241 0107 leftMargin: parent.width * 0.726 0108 } 0109 property bool started: false 0110 property int power: started ? windTurbine.power : 0 0111 MouseArea { 0112 anchors.centerIn: parent 0113 // Size the area for a touch screen 0114 width: parent.width * 1.2 0115 height: parent.height * 1.2 0116 enabled: parent.visible 0117 onClicked: { 0118 parent.started = !parent.started 0119 } 0120 } 0121 } 0122 0123 Image { 0124 id: windTransformerOn 0125 source: activity.url + "transformer_on" 0126 visible: windTransformer.started 0127 anchors.fill: windTransformer 0128 sourceSize.width: width 0129 fillMode: Image.PreserveAspectFit 0130 } 0131 0132 Rectangle { 0133 width: windvoltage.width * 1.1 0134 height: windvoltage.height * 1.1 0135 border.color: items.produceColorBorder 0136 radius: 5 0137 color: items.produceColor 0138 anchors { 0139 bottom: windTransformer.verticalCenter 0140 right: windTransformer.left 0141 } 0142 GCText { 0143 id: windvoltage 0144 anchors.centerIn: parent 0145 text: wind.power.toString() + "W" 0146 fontSize: smallSize * 0.5 0147 } 0148 } 0149 0150 // Wind turbines 0151 WindTurbine { 0152 id: windTurbine 0153 width: parent.width * 0.054 0154 anchors { 0155 top: parent.top 0156 left: parent.left 0157 topMargin: parent.width * 0.126 0158 leftMargin: parent.width * 0.734 0159 } 0160 z: 55 0161 duration: 3200 0162 property int power: cloud.started ? 1500 : 0 0163 } 0164 WindTurbine { 0165 id: windTurbine2 0166 width: parent.width * 0.054 0167 anchors { 0168 top: parent.top 0169 left: parent.left 0170 topMargin: parent.width * 0.138 0171 leftMargin: parent.width * 0.778 0172 } 0173 z: 54 0174 duration: 3500 0175 } 0176 WindTurbine { 0177 id: windTurbine3 0178 width: parent.width * 0.054 0179 anchors { 0180 top: parent.top 0181 left: parent.left 0182 topMargin: parent.width * 0.15 0183 leftMargin: parent.width * 0.822 0184 } 0185 z: 53 0186 duration: 3100 0187 } 0188 }