diff --git a/src/activities/letter-in-word/Card.qml b/src/activities/letter-in-word/Card.qml --- a/src/activities/letter-in-word/Card.qml +++ b/src/activities/letter-in-word/Card.qml @@ -77,10 +77,10 @@ states: State { - name: "scaled"; when: mouseArea.containsMouse && mouseActive + name: "scaled"; when:selected && mouseActive PropertyChanges { target: cardItem - scale: /*carriageImage.scale * */ 1.2 + scale: /*carriageImage.scale * */ 1.5 z: 2 } } @@ -167,8 +167,9 @@ if (Activity.checkWord(index)) { successAnimation.restart(); particle.burst(30); - textItem.textFound = spelling.replace(RegExp(Activity.currentLetter, "g"), ""+Activity.currentLetter+""); - playWord(); + //textItem.textFound = spelling.replace(RegExp(Activity.currentLetter, "g"), ""+Activity.currentLetter+""); + if(selected) + playWord(); } else { failureAnimation.restart() 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 @@ -195,7 +195,6 @@ interval: 100 Component.onCompleted: { win.connect(Activity.nextSubLevel); - loose.connect(Activity.incorrectSelection); } } @@ -322,6 +321,20 @@ } } + Image { + id: ok + source:"qrc:/gcompris/src/core/resource/bar_ok.svg" + sourceSize.width: wordsView.cellWidth + sourceSize.height: wordsView.cellHeight*0.8 + fillMode: Image.PreserveAspectFit + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: wordsView.bottom + MouseArea { + anchors.fill: parent + onClicked: Activity.checkAnswer() + } + } + JsonParser { id: parser onError: console.error("Click_on_letter: Error parsing JSON: " + msg); 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 @@ -224,36 +224,36 @@ } function checkAnswer() { - var hasWordNotFound = false; + var allCorrectSelected = false var modelEntry; for(var i = 0; i < words.length; i++) { modelEntry = items.wordsModel.get(i); + if(modelEntry.spelling.indexOf(currentLetter) != -1 && modelEntry.selected == true) { + allCorrectSelected = true; + } if(modelEntry.spelling.indexOf(currentLetter) != -1 && modelEntry.selected == false) { - hasWordNotFound = true; + allCorrectSelected = false; + break; + } + if(modelEntry.spelling.indexOf(currentLetter) == -1 && modelEntry.selected == true) { + allCorrectSelected = false; break; } } - if(hasWordNotFound == false) { + if(allCorrectSelected == true) { items.bonus.good("flower"); } + else { + items.audioVoices.append(GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/misc/check_answer.$CA")) + } } function checkWord(index) { var modelEntry = items.wordsModel.get(index); - if(modelEntry.spelling.indexOf(currentLetter) != -1) { + if(items.wordsModel.get(index).selected == true) + items.wordsModel.setProperty(index, "selected", !modelEntry.selected); + else items.wordsModel.setProperty(index, "selected", true); - checkAnswer(); - return true; - } - else { - items.audioVoices.append(GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/misc/check_answer.$CA")) - return false; - } + return true; } -function incorrectSelection() { - incorrectFlag = true; - var quesLen = questions.length; - currentSubLevel--; - nextSubLevel(); -}