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

0001 /* GCompris - BrailleMap.qml
0002  *
0003  * SPDX-FileCopyrightText: 2014 Arkit Vora <arkitvora123@gmail.com>
0004  *
0005  * Authors:
0006  *   Srishti Sethi <srishakatux@gmail.com> (GTK+ version)
0007  *   Arkit Vora <arkitvora123@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 "../../core"
0014 import "braille_alphabets.js" as Activity
0015 
0016 Rectangle {
0017     id: brailleMap
0018     color: "#808080"
0019     z: 1000
0020     property bool isDialog: true
0021     signal close
0022     signal start
0023     signal stop
0024 
0025     Keys.onPressed: {
0026         if(event.key === Qt.Key_Space || event.key === Qt.Key_Escape) {
0027             close();
0028         }
0029     }
0030 
0031     onStart: {
0032         brailleMap.forceActiveFocus();
0033         activity.Keys.enabled = false;
0034     }
0035 
0036     onClose: {
0037         activity.Keys.enabled = true;
0038         activity.forceActiveFocus();
0039     }
0040 
0041     // The back button
0042     Image {
0043         id: cancel
0044         source: Activity.url + "back.svg"
0045         fillMode: Image.PreserveAspectFit
0046         anchors.right: parent.right
0047         anchors.top: parent.top
0048         smooth: true
0049         sourceSize.width: 60 * ApplicationInfo.ratio
0050         anchors.margins: 10
0051         SequentialAnimation {
0052             id: anim
0053             running: true
0054             loops: Animation.Infinite
0055             NumberAnimation {
0056                 target: cancel
0057                 property: "rotation"
0058                 from: -10; to: 10
0059                 duration: 500
0060                 easing.type: Easing.InOutQuad
0061             }
0062             NumberAnimation {
0063                 target: cancel
0064                 property: "rotation"
0065                 from: 10; to: -10
0066                 duration: 500
0067                 easing.type: Easing.InOutQuad
0068             }
0069         }
0070         MouseArea {
0071             anchors.fill: parent
0072             onClicked: close()
0073         }
0074     }
0075     
0076     Flickable {
0077         id: flick
0078         anchors.top: cancel.bottom
0079         anchors.bottom: parent.bottom
0080         anchors.left: parent.left
0081         anchors.right: parent.right
0082         contentWidth: parent.width
0083         contentHeight: (grid1.height + grid2.height) * 1.1
0084         flickableDirection: Flickable.VerticalFlick
0085         clip: true
0086 
0087         Flow {
0088             id: grid1
0089             width: parent.width * 0.9
0090             anchors {
0091                 top: parent.top
0092                 topMargin: 10 * ApplicationInfo.ratio
0093                 horizontalCenter: parent.horizontalCenter
0094             }
0095             spacing: 5 * ApplicationInfo.ratio
0096 
0097             Repeater {
0098                 id: cardRepeater
0099                 model: [
0100                     "A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
0101                     "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
0102                     "U", "V", "X", "Y", "Z", "", "", "", "", "W"
0103                 ]
0104 
0105                 Column {
0106                     width: (grid1.width - grid1.spacing * 10) / 10
0107 
0108                     Rectangle {
0109                         id: rect1
0110                         width:  parent.width
0111                         height: ins.height
0112                         border.width: ins.thinBorder
0113                         border.color: "#373737"
0114                         color: "#f0f0f0"
0115                         opacity: modelData != "" ? 1 : 0
0116 
0117                         BrailleChar {
0118                             id: ins
0119                             width: parent.width * 0.9
0120                             anchors.centerIn: parent
0121                             clickable: false
0122                             brailleChar: modelData
0123                         }
0124                     }
0125                     GCText {
0126                         id: text1
0127                         text: modelData
0128                         font.weight: Font.DemiBold
0129                         style: Text.Outline
0130                         styleColor: "#373737"
0131                         color: "white"
0132                         fontSize: Math.max(Math.min(parent.width * 0.2, 24), 12)
0133                         anchors {
0134                             horizontalCenter: parent.horizontalCenter
0135                         }
0136                     }
0137                 }
0138             }
0139         }
0140 
0141         Flow {
0142             id: grid2
0143             width : parent.width * 0.9
0144             anchors {
0145                 horizontalCenter: parent.horizontalCenter
0146                 top: grid1.bottom
0147                 topMargin: 10 * ApplicationInfo.ratio
0148             }
0149             spacing: 6
0150 
0151             Repeater {
0152                 id: cardRepeater2
0153                 model: [
0154                     "1", "2", "3", "4", "5", "6", "7", "8", "9", "0",
0155                     "+", "-", "*", "/", "#"
0156                 ]
0157 
0158                 Column {
0159                     width:  (grid1.width - grid1.spacing * 10) / 10
0160 
0161                     Rectangle {
0162                         id: rect2
0163                         width:  parent.width
0164                         height: ins2.height
0165                         border.width: 3
0166                         border.color: "black"
0167                         color: "white"
0168 
0169                         BrailleChar {
0170                             id: ins2
0171                             width: parent.width * 0.9
0172                             anchors.centerIn: parent
0173                             clickable: false
0174                             brailleChar: modelData
0175                         }
0176                     }
0177                     GCText {
0178                         id: text2
0179                         text: modelData
0180                         font.weight: Font.DemiBold
0181                         style: Text.Outline
0182                         styleColor: "black"
0183                         color: "white"
0184                         fontSize: Math.max(Math.min(parent.width * 0.2, 24), 12)
0185                         anchors {
0186                             horizontalCenter: parent.horizontalCenter
0187                         }
0188                     }
0189                 }
0190             }
0191         }
0192     }
0193 }