diff --git a/src/activities/letter-in-word/LetterInWord.qml b/src/activities/letter-in-word/LetterInWord.qml --- a/src/activities/letter-in-word/LetterInWord.qml +++ b/src/activities/letter-in-word/LetterInWord.qml @@ -24,6 +24,7 @@ import QtQuick 2.6 import QtGraphicalEffects 1.0 +import QtQuick.Controls 1.5 import GCompris 1.0 import "../../core" import "letter-in-word.js" as Activity @@ -65,6 +66,8 @@ property alias bar: bar property alias background: background property alias wordsModel: wordsModel + property string mode: "normal" + property bool reduceWords: false property GCAudio audioVoices: activity.audioVoices property alias parser: parser property alias animateX: animateX @@ -91,6 +94,10 @@ animateX.restart(); } + ExclusiveGroup{ + id: configOptions + } + DialogActivityConfig { id: dialogActivityConfig currentActivity: activity @@ -107,7 +114,36 @@ Column { id: column spacing: 10 - width: parent.width + width: dialogActivityConfig.width + height: dialogActivityConfig.height + property alias easyMode: easyMode + property alias normalMode: normalMode + + GCDialogCheckBox { + id: easyMode + width: column.width - 50 + text: qsTr("Reduce Visible Words to 5") + checked: (items.mode == "easy") ? true : false + exclusiveGroup: configOptions + onCheckedChanged: { + if (easyMode.checked){ + items.reduceWords = true + } + } + } + + GCDialogCheckBox { + id: normalMode + width: column.width - 50 + text: qsTr("Get All Available Words") + checked: (items.mode == "normal") ? true : false + exclusiveGroup: configOptions + onCheckedChanged: { + if (normalMode.checked){ + items.reduceWords = false + } + } + } Flow { spacing: 5 @@ -125,6 +161,11 @@ onClose: home() onLoadData: { + if(dataToSave && dataToSave["mode"]){ + items.mode = dataToSave["mode"] + console.log("Mode: " + items.mode); + } + if(dataToSave && dataToSave["locale"]) { background.locale = dataToSave["locale"]; } @@ -137,7 +178,12 @@ if(newLocale.indexOf('.') != -1) { newLocale = newLocale.substring(0, newLocale.indexOf('.')) } - dataToSave = {"locale": newLocale } + dataToSave = {"locale": newLocale} + items.mode = items.reduceWords ? "easy" : "normal"; + dataToSave["mode"] = items.mode + + console.log("Mode: " + items.mode) + Activity.initLevel() background.locale = newLocale; @@ -220,10 +266,13 @@ GCText { id: questionItem - anchors.right: planeText.right - anchors.rightMargin: 2 * plane.width / 3 - anchors.verticalCenter: planeText.verticalCenter - anchors.bottomMargin: 10 * ApplicationInfo.ratio + anchors { + right: planeText.right + rightMargin: 2 * plane.width / 3 + //Turned this off as the letter was going out of the banner + //verticalCenter: planeText.verticalCenter + bottomMargin: 10 * ApplicationInfo.ratio + } fontSize: hugeSize font.weight: Font.DemiBold color: "#2a2a2a" diff --git a/src/activities/letter-in-word/letter-in-word.js b/src/activities/letter-in-word/letter-in-word.js --- a/src/activities/letter-in-word/letter-in-word.js +++ b/src/activities/letter-in-word/letter-in-word.js @@ -89,8 +89,8 @@ var level = levels[currentLevel]; words = Lang.getLessonWords(dataset, level); Core.shuffle(words); - var limit = Math.min(11, words.length) - words = words.slice(0, limit) + var limit = items.mode === "easy" ? Math.min(5, words.length) : Math.min(11, words.length); + words = words.slice(0, limit); frequency = calculateFrequency(); var tempQuestions = generateQuestions(); maxSubLevel = tempQuestions.length;