Warning, /education/gcompris/src/activities/morse_code/MorseMap.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - MorseMap.qml 0002 * 0003 * SPDX-FileCopyrightText: 2022 Johnny Jazeix <jazeix@gmail.com> 0004 * 0005 * Authors: 0006 * Arkit Vora <arkitvora123@gmail.com> (Original version in Braille activity) 0007 * Johnny Jazeix <jazeix@gmail.com> 0008 * 0009 * SPDX-License-Identifier: GPL-3.0-or-later 0010 */ 0011 import QtQuick 2.12 0012 import GCompris 1.0 0013 import "../../core" 0014 0015 Rectangle { 0016 id: morseMap 0017 color: "#808080" 0018 border.color: "black" 0019 border.width: 1 0020 z: 1000 0021 property bool isDialog: true 0022 signal close 0023 signal start 0024 signal stop 0025 0026 Keys.onPressed: { 0027 if(event.key === Qt.Key_Space || event.key === Qt.Key_Escape) { 0028 close(); 0029 } 0030 } 0031 0032 onStart: { 0033 morseMap.forceActiveFocus(); 0034 activity.Keys.enabled = false; 0035 } 0036 0037 onClose: { 0038 activity.Keys.enabled = true; 0039 activity.resetFocus(); 0040 } 0041 0042 // The back button 0043 Image { 0044 id: cancel 0045 source: "qrc:/gcompris/src/activities/braille_alphabets/resource/back.svg" 0046 fillMode: Image.PreserveAspectFit 0047 anchors.right: parent.right 0048 anchors.top: parent.top 0049 smooth: true 0050 sourceSize.width: 60 * ApplicationInfo.ratio 0051 anchors.margins: 10 0052 SequentialAnimation { 0053 id: anim 0054 running: true 0055 loops: Animation.Infinite 0056 NumberAnimation { 0057 target: cancel 0058 property: "rotation" 0059 from: -10; to: 10 0060 duration: 500 0061 easing.type: Easing.InOutQuad 0062 } 0063 NumberAnimation { 0064 target: cancel 0065 property: "rotation" 0066 from: 10; to: -10 0067 duration: 500 0068 easing.type: Easing.InOutQuad 0069 } 0070 } 0071 MouseArea { 0072 anchors.fill: parent 0073 onClicked: close() 0074 } 0075 } 0076 0077 Flickable { 0078 id: flick 0079 anchors.top: cancel.bottom 0080 anchors.bottom: parent.bottom 0081 anchors.left: parent.left 0082 anchors.right: parent.right 0083 contentWidth: parent.width 0084 contentHeight: (grid.height + grid2.height) * 1.1 0085 flickableDirection: Flickable.VerticalFlick 0086 clip: true 0087 0088 Flow { 0089 id: grid 0090 width: parent.width * 0.9 0091 anchors { 0092 top: parent.top 0093 topMargin: 10 * ApplicationInfo.ratio 0094 horizontalCenter: parent.horizontalCenter 0095 } 0096 spacing: 5 * ApplicationInfo.ratio 0097 0098 Repeater { 0099 id: cardRepeater 0100 model: [ 0101 "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", 0102 "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", 0103 "U", "V", "W", "X", "Y", "Z" 0104 ] 0105 0106 Column { 0107 width: 50 * ApplicationInfo.ratio 0108 0109 Rectangle { 0110 id: rect 0111 width: parent.width 0112 height: width * 0.6 0113 border.width: 3 0114 border.color: "black" 0115 color: "white" 0116 0117 GCText { 0118 id: ins 0119 text: morseConverter.alpha2morse(modelData).replace(/\./g, items.middleDot) 0120 style: Text.Outline 0121 styleColor: "white" 0122 color: "black" 0123 fontSize: regularSize 0124 fontSizeMode: Text.Fit 0125 horizontalAlignment: Text.AlignHCenter 0126 verticalAlignment: Text.AlignVCenter 0127 width: parent.width 0128 height: parent.height 0129 anchors.centerIn: parent 0130 } 0131 } 0132 GCText { 0133 id: text 0134 text: modelData 0135 font.weight: Font.DemiBold 0136 style: Text.Outline 0137 styleColor: "black" 0138 color: "white" 0139 fontSize: Math.max(Math.min(parent.width * 0.2, 24), 12) 0140 anchors.horizontalCenter: rect.horizontalCenter 0141 } 0142 } 0143 } 0144 } 0145 0146 Flow { 0147 id: grid2 0148 width: parent.width * 0.9 0149 anchors { 0150 top: grid.bottom 0151 topMargin: 10 * ApplicationInfo.ratio 0152 horizontalCenter: parent.horizontalCenter 0153 } 0154 spacing: 5 * ApplicationInfo.ratio 0155 0156 Repeater { 0157 id: cardRepeater2 0158 model: [ 0159 "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" 0160 ] 0161 0162 Column { 0163 width: 50 * ApplicationInfo.ratio 0164 0165 Rectangle { 0166 id: rect2 0167 width: parent.width 0168 height: width * 0.6 0169 border.width: 3 0170 border.color: "black" 0171 color: "white" 0172 0173 GCText { 0174 id: ins2 0175 text: morseConverter.alpha2morse(modelData).replace(/\./g, items.middleDot) 0176 style: Text.Outline 0177 styleColor: "white" 0178 color: "black" 0179 fontSize: regularSize 0180 fontSizeMode: Text.Fit 0181 horizontalAlignment: Text.AlignHCenter 0182 verticalAlignment: Text.AlignVCenter 0183 width: parent.width 0184 height: parent.height 0185 anchors.centerIn: parent 0186 } 0187 } 0188 GCText { 0189 id: text2 0190 text: modelData 0191 font.weight: Font.DemiBold 0192 style: Text.Outline 0193 styleColor: "black" 0194 color: "white" 0195 fontSize: Math.max(Math.min(parent.width * 0.2, 24), 12) 0196 anchors.horizontalCenter: rect2.horizontalCenter 0197 } 0198 } 0199 } 0200 } 0201 } 0202 }