1
/* GCompris - braille_alphabets.js
3
* Copyright (C) 2014 Arkit Vora <arkitvora123@gmail.com>
6
* Srishti Sethi <srishakatux@gmail.com> (GTK+ version)
7
* Arkit Vora <arkitvora123@gmail.com> (Qt Quick port)
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 3 of the License, or
12
* (at your option) any later version.
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, see <https://www.gnu.org/licenses/>.
23
.import QtQuick 2.6 as Quick
24
.import "qrc:/gcompris/src/core/core.js" as Core
26
var url = "qrc:/gcompris/src/activities/braille_alphabets/resource/"
35
function start(items_, dataset_) {
37
dataset = dataset_.get()
39
numberOfLevel = dataset.length * 2
46
function initLevel() {
47
items.bar.level = currentLevel + 1
48
items.containerModel.clear()
51
switch(currentLevel) {
53
items.instructions = ""
54
items.brailleCodeSeen = true
55
currentDataSet = dataset[0]
58
items.instructions = qsTr("Now it's a little bit harder without the braille map.")
59
items.brailleCodeSeen = false
60
currentDataSet = dataset[0]
63
items.instructions = qsTr("Look at the Braille character map and observe how similar the first and second line are.")
64
items.brailleCodeSeen = true
65
currentDataSet = dataset[1]
68
items.instructions = qsTr("Now it's a little bit harder without the braille map.")
69
items.brailleCodeSeen = false
70
currentDataSet = dataset[1]
73
items.instructions = qsTr("Again, similar as the first line but take care, the 'W' letter was added afterwards.")
74
items.brailleCodeSeen = true
75
currentDataSet = dataset[2]
78
items.instructions = qsTr("Now it's a little bit harder without the braille map.")
79
items.brailleCodeSeen = false
80
currentDataSet = dataset[2]
83
items.instructions = qsTr("This is easy, numbers are the same as letters from A to J.")
84
items.brailleCodeSeen = true
85
currentDataSet = dataset[3]
88
items.instructions = qsTr("Now it's a little bit harder without the braille map.")
89
items.brailleCodeSeen = false
90
currentDataSet = dataset[3]
93
items.instructions = ""
94
items.brailleCodeSeen = true
95
currentDataSet = dataset[4]
98
items.instructions = qsTr("Now it's a little bit harder without the braille map.")
99
items.brailleCodeSeen = false
100
currentDataSet = dataset[4]
104
for(var i = 0; i < currentDataSet.length; ++i) {
105
items.containerModel.append(currentDataSet[i])
108
// Shuffle not to ask the question in the model order
109
currentDataSet = Core.shuffle(currentDataSet)
111
items.score.numberOfSubLevels = currentDataSet.length;
112
items.score.currentSubLevel = 0;
114
items.playableChar.isLetter = currentDataSet[0].letter >= "A" && currentDataSet[0].letter <= "Z"
115
// Trig the next question
116
items.questionItem.opacity = 0.1
117
items.questionItem.opacity = 0
120
function nextLevel() {
121
if(numberOfLevel <= ++currentLevel) {
127
function previousLevel() {
128
if(--currentLevel < 0) {
129
currentLevel = numberOfLevel - 1
134
function nextQuestion() {
135
if(currentDataSet.length <= ++currentQuestion) {
136
items.bonus.good("flower")
138
// Let's not change the question immediately to let the
139
// children see his answer.
140
// We just set the opacity to 0, the questionItem will then grab
141
// the new question by itself
142
items.questionItem.opacity = 0.1
143
items.questionItem.opacity = 0
144
items.score.currentSubLevel ++
148
function getCurrentTextQuestion() {
149
return currentDataSet[currentQuestion].text.arg(getCurrentLetter())
152
function getCurrentLetter() {
153
return currentDataSet[currentQuestion].letter