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 @@ -64,9 +65,9 @@ property Item main: activity.main property alias bar: bar property alias background: background - property alias wordsModel: wordsModel - property bool reduceWords: false + 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 @@ -93,6 +94,10 @@ animateX.restart(); } + ExclusiveGroup{ + id: configOptions + } + DialogActivityConfig { id: dialogActivityConfig currentActivity: activity @@ -119,17 +124,12 @@ width: column.width - 50 text: qsTr("Reduce Visible Words to 5") checked: (items.mode == "easy") ? true : false - onCheckedChanged: { - if(easyMode.checked) { + exclusiveGroup: configOptions + onCheckedChanged: { + if (easyMode.checked){ items.mode = "easy" - items.reduceWords = true } - else{ - items.mode = "normal" - items.reduceWords = false - } - normalMode.checked = !easyMode.checked - } + } } GCDialogCheckBox { @@ -137,16 +137,11 @@ width: column.width - 50 text: qsTr("Get All Available Words") checked: (items.mode == "normal") ? true : false + exclusiveGroup: configOptions onCheckedChanged: { - if(normalMode.checked) { + if (normalMode.checked){ items.mode = "normal" - items.reduceWords = false } - else{ - items.mode = "easy" - items.reduceWords = true - } - easyMode.checked = !normalMode.checked } } @@ -168,8 +163,8 @@ onLoadData: { if(dataToSave && dataToSave["mode"]){ items.mode = dataToSave["mode"] - console.log(items.mode + " mode loaded") - //Activity.initLevel() + items.reduceWords = items.mode == "easy" ? true : false + console.log("Mode: " + items.mode); } if(dataToSave && dataToSave["locale"]) { @@ -185,8 +180,11 @@ newLocale = newLocale.substring(0, newLocale.indexOf('.')) } dataToSave = {"locale": newLocale} + items.reduceWords = items.mode == "easy" ? true : false dataToSave["mode"] = items.mode - console.log(items.mode + " mode saved") + + console.log("Mode: " + items.mode) + Activity.initLevel() background.locale = newLocale; 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 @@ -88,8 +88,9 @@ if (currentSubLevel == 0 && !incorrectFlag) { var level = levels[currentLevel]; words = Lang.getLessonWords(dataset, level); - Core.shuffle(words); + Core.shuffle(words); var limit = items.reduceWords ? Math.min(5, words.length) : Math.min(11, words.length); + console.log("limit:" + limit + " changed"); words = words.slice(0, limit); frequency = calculateFrequency(); var tempQuestions = generateQuestions();