Warning, /education/gcompris/src/activities/morse_code/FirstScreen.qml is written in an unsupported language. File is not indexed.

0001 /* GCompris - FirstScreen.qml
0002  *
0003  * SPDX-FileCopyrightText: 2016 SOURADEEP BARUA <sourad97@gmail.com>
0004  * SPDX-FileCopyrightText: 2022 Johnny Jazeix <jazeix@gmail.com>
0005  *
0006  * Authors:
0007  *   SOURADEEP BARUA <sourad97@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 Image {
0016     id: firstScreen
0017     anchors.fill: parent
0018     fillMode: Image.PreserveAspectCrop
0019     source: "qrc:/gcompris/src/activities/braille_alphabets/resource/intro_bg.svg"
0020     sourceSize.width: width
0021     sourceSize.height: height
0022 
0023     GCText {
0024         id: heading
0025         text: qsTr("Exploring Morse Code")
0026         fontSize: largeSize
0027         fontSizeMode: Text.Fit
0028         horizontalAlignment: Text.AlignHCenter
0029         font.weight: Font.DemiBold
0030         anchors.centerIn: parent.Center
0031         color: "#2a2a2a"
0032         width: parent.width
0033         height: parent.height * 0.10
0034         wrapMode: Text.WordWrap
0035     }
0036 
0037     Image {
0038         id: introChar
0039         source: "qrc:/gcompris/src/activities/morse_code/resource/morseButton.svg"
0040         sourceSize.height: Math.min(parent.height * 0.25, parent.width * 0.25)
0041         fillMode: Image.PreserveAspectFit
0042         anchors {
0043             left: parent.left
0044             leftMargin: 5 * ApplicationInfo.ratio
0045             verticalCenter: bodyText.verticalCenter
0046         }
0047         Behavior on scale { PropertyAnimation { duration: 100 } }
0048         MouseArea {
0049             anchors.fill: parent
0050             hoverEnabled: firstScreen.visible
0051             enabled: firstScreen.visible
0052             onClicked: {
0053                 morseMap.visible = true
0054                 displayDialog(morseMap)
0055             }
0056             onEntered: introChar.scale = 1.1
0057             onExited: introChar.scale = 1
0058         }
0059     }
0060 
0061     GCText {
0062         id: bodyText
0063         z: 1
0064         text: qsTr('Morse code was developed by Samuel Morse. It is a method of transmitting text information as a series of on-off tones, lights, or clicks.') + "\n" +
0065               qsTr('Each Morse code symbol represents either a text character (letter or numeral) or a prosign and is represented by a unique sequence of dots and dashes. ' +
0066                    'The duration of a dash is three times the duration of a dot.' +
0067                    ' To increase the speed of the communication, the code was designed so that the most common letters have the shorter sequences of dots and dashes.' + "\n" +
0068                     'For example, the most common letter in English, the letter "E", has the shortest code, a single dot.')
0069         fontSize: regularSize
0070         fontSizeMode: Text.Fit
0071         font.weight: Font.DemiBold
0072         horizontalAlignment: Text.AlignJustify
0073         anchors {
0074             top: heading.bottom
0075             topMargin: 5 * ApplicationInfo.ratio
0076             right: parent.right
0077             rightMargin: 5 * ApplicationInfo.ratio
0078             left: introChar.right
0079             leftMargin: 5 * ApplicationInfo.ratio
0080         }
0081         color: "#2a2a2a"
0082         width: parent.width - introChar.width - 15 * ApplicationInfo.ratio
0083         height: parent.height * 0.4
0084         wrapMode: Text.WordWrap
0085     }
0086 
0087     GCText {
0088         id: bottomText
0089         z: 2
0090         text: qsTr("When you are ready, click on Tux and we will converse in Morse code.")
0091         fontSize: regularSize
0092         fontSizeMode: Text.Fit
0093         font.weight: Font.Bold
0094         horizontalAlignment: Text.AlignRight
0095         color: "#2a2a2a"
0096         wrapMode:  Text.WordWrap
0097         anchors {
0098             top: bodyText.bottom
0099             topMargin: 10 * ApplicationInfo.ratio
0100             left: parent.left
0101             leftMargin: 10 * ApplicationInfo.ratio
0102         }
0103         height: parent.height * 0.25
0104         width: parent.width * 0.5
0105     }
0106 
0107     Image {
0108         id: introTux
0109         z: 3
0110         source: "qrc:/gcompris/src/activities/braille_alphabets/resource/tux_braille.svg"
0111         fillMode: Image.PreserveAspectFit
0112         sourceSize.width: Math.min(parent.width * 0.2, parent.height * 0.2)
0113         anchors.centerIn: bgTux
0114         Behavior on scale { PropertyAnimation { duration: 100 } }
0115 
0116         MouseArea {
0117             id: tux_click
0118             anchors.fill: parent
0119             hoverEnabled: true
0120             onClicked: {
0121                 firstScreen.visible = false
0122                 keyboard.populateMorse()
0123                 textInput.text = ''
0124             }
0125             onEntered: introTux.scale = 1.1
0126             onExited: introTux.scale = 1
0127         }
0128     }
0129 
0130     Rectangle {
0131         id: bgTux
0132         z: 0
0133         color: "#94c1d2"
0134         width: introTux.width * 1.5
0135         height: introTux.height * 1.1
0136         radius: bgTux.width * 0.5
0137         anchors {
0138             top: bodyText.bottom
0139             topMargin: 10 * ApplicationInfo.ratio
0140             left: bottomText.right
0141             leftMargin: 10 * ApplicationInfo.ratio
0142         }
0143     }
0144 }