diff --git a/src/activities/gletters/Gletters.qml b/src/activities/gletters/Gletters.qml --- a/src/activities/gletters/Gletters.qml +++ b/src/activities/gletters/Gletters.qml @@ -86,7 +86,8 @@ property Item main: activity.main property Item ourActivity: activity property GCAudio audioVoices: activity.audioVoices - property var levels: activity.datasetLoader.item !== null ? activity.datasetLoader.item.data : undefined + property var levels: activity.datasetLoader.item !== null ? activity.datasetLoader.item.data : null + property var instructionText: "" property alias background: background property alias bar: bar property alias bonus: bonus @@ -105,6 +106,50 @@ } onStop: { Activity.stop() } + //instruction rectangle + Rectangle { + id: instruction + anchors { + top: parent.top + topMargin: 5 + horizontalCenter: parent.horizontalCenter + } + height: instructionTxt.contentHeight * 1.1 + width: Math.max(Math.min(parent.width * 0.8, instructionTxt.text.length * 10), parent.width * 0.3) + opacity: 0.8 + visible: items.levels + radius: 10 + border.width: 2 + z: 10 + border.color: "#DDD" + color: "#373737" + + Behavior on opacity { PropertyAnimation { duration: 200 } } + + //shows/hides the Instruction + MouseArea { + anchors.fill: parent + onClicked: instruction.opacity = instruction.opacity == 0 ? 0.8 : 0 + } + + GCText { + id: instructionTxt + anchors { + top: parent.top + topMargin: 5 + horizontalCenter: parent.horizontalCenter + } + opacity: instruction.opacity + z: instruction.z + fontSize: smallSize + color: "white" + text: items.instructionText + horizontalAlignment: Text.AlignHCenter + width: parent.width * 0.8 + wrapMode: TextEdit.WordWrap + } + } + TextInput { // Helper element to capture composed key events like french รด which // are not available via Keys.onPressed() on linux. Must be diff --git a/src/activities/gletters/gletters.js b/src/activities/gletters/gletters.js --- a/src/activities/gletters/gletters.js +++ b/src/activities/gletters/gletters.js @@ -76,7 +76,7 @@ // register the voices for the locale GCompris.DownloadManager.updateResource(GCompris.DownloadManager.getVoicesResourceForLocale(GCompris.ApplicationInfo.getVoicesLocale(items.locale))); - if(items.levels == undefined) + if(!items.levels) items.wordlist.loadFromFile(GCompris.ApplicationInfo.getLocaleFilePath( items.ourActivity.dataSetUrl + "default-"+locale+".json")); else @@ -95,7 +95,7 @@ } // If not found, we will use the default file items.wordlist.useDefault = true - if(items.levels == undefined) + if(!items.levels) items.wordlist.loadFromFile(GCompris.ApplicationInfo.getLocaleFilePath( items.ourActivity.dataSetUrl + "default-"+localeShort+".json")); else @@ -115,6 +115,8 @@ } function initLevel() { + if(items.levels) + items.instructionText = items.levels[currentLevel].objective items.audioVoices.clearQueue() items.bar.level = currentLevel + 1; wgMaxFallingItems = 3 @@ -416,7 +418,6 @@ + Core.getSoundFilenamForChar(letter))) } - function focusTextInput() { if (!GCompris.ApplicationInfo.isMobile && items && items.textinput) items.textinput.forceActiveFocus(); diff --git a/src/activities/smallnumbers/resource/1/Data.qml b/src/activities/smallnumbers/resource/1/Data.qml --- a/src/activities/smallnumbers/resource/1/Data.qml +++ b/src/activities/smallnumbers/resource/1/Data.qml @@ -23,26 +23,29 @@ import "../../../../core" Dataset { - objective: qsTr("Select number on dice up to 4") + objective: qsTr("Select a number on dice up to 4") difficulty: 1 data: [ { "level" : "1", + "objective" : "Select the number on dice up to 2", "words" : [ "1", "2" ] }, { "level" : "2", + "objective" : "Select the number on dice up to 3", "words" : [ "1", "2", "3", ] }, { "level" : "3", + "objective" : "Select the number on dice up to 4", "words" : [ "1", "2", diff --git a/src/activities/smallnumbers/resource/2/Data.qml b/src/activities/smallnumbers/resource/2/Data.qml --- a/src/activities/smallnumbers/resource/2/Data.qml +++ b/src/activities/smallnumbers/resource/2/Data.qml @@ -23,11 +23,12 @@ import "../../../../core" Dataset { - objective: qsTr("Select number on dice up to 7") + objective: qsTr("Select a number on dice up to 7") difficulty: 2 data: [ { "level" : "1", + "objective" : "Select the number on dice up to 4", "words" : [ "1", "2", @@ -37,6 +38,7 @@ }, { "level" : "2", + "objective" : "Select the number on dice up to 5", "words" : [ "1", "2", @@ -47,6 +49,7 @@ }, { "level" : "3", + "objective" : "Select the number on dice up to 6", "words" : [ "1", "2", @@ -58,6 +61,7 @@ }, { "level" : "4", + "objective" : "Select the number on dice up to 7", "words" : [ "1", "2", diff --git a/src/activities/smallnumbers/resource/3/Data.qml b/src/activities/smallnumbers/resource/3/Data.qml --- a/src/activities/smallnumbers/resource/3/Data.qml +++ b/src/activities/smallnumbers/resource/3/Data.qml @@ -23,11 +23,12 @@ import "../../../../core" Dataset { - objective: qsTr("Select number on dice up to 9") + objective: qsTr("Select a number on dice up to 9") difficulty: 3 data: [ { "level" : "1", + "objective" : "Select the number on dice up to 6", "words" : [ "1", "2", @@ -39,6 +40,7 @@ }, { "level" : "2", + "objective" : "Select the number on dice up to 7", "words" : [ "1", "2", @@ -51,6 +53,7 @@ }, { "level" : "3", + "objective" : "Select the number on dice up to 8", "words" : [ "1", "2", @@ -64,6 +67,7 @@ }, { "level" : "4", + "objective" : "Select the number on dice up to 9", "words" : [ "1", "2", diff --git a/src/activities/smallnumbers2/resource/1/Data.qml b/src/activities/smallnumbers2/resource/1/Data.qml --- a/src/activities/smallnumbers2/resource/1/Data.qml +++ b/src/activities/smallnumbers2/resource/1/Data.qml @@ -23,26 +23,29 @@ import "../../../../core" Dataset { - objective: qsTr("Select number on dominoes up to 4") + objective: qsTr("Select a number on dominoes up to 4") difficulty: 1 data: [ { "level" : "1", + "objective" : "Select the number on dominoes up to 2", "words" : [ "1", "2" ] }, { "level" : "2", + "objective" : "Select the number on dominoes up to 3", "words" : [ "1", "2", "3", ] }, { "level" : "3", + "objective" : "Select the number on dominoes up to 4", "words" : [ "1", "2", diff --git a/src/activities/smallnumbers2/resource/2/Data.qml b/src/activities/smallnumbers2/resource/2/Data.qml --- a/src/activities/smallnumbers2/resource/2/Data.qml +++ b/src/activities/smallnumbers2/resource/2/Data.qml @@ -23,11 +23,12 @@ import "../../../../core" Dataset { - objective: qsTr("Select number on dominoes up to 7") + objective: qsTr("Select a number on dominoes up to 7") difficulty: 2 data: [ { "level" : "1", + "objective" : "Select the number on dominoes up to 4", "words" : [ "1", "2", @@ -37,6 +38,7 @@ }, { "level" : "2", + "objective" : "Select the number on dominoes up to 5", "words" : [ "1", "2", @@ -47,6 +49,7 @@ }, { "level" : "3", + "objective" : "Select the number on dominoes up to 6", "words" : [ "1", "2", @@ -58,6 +61,7 @@ }, { "level" : "4", + "objective" : "Select the number on dominoes up to 7", "words" : [ "1", "2", diff --git a/src/activities/smallnumbers2/resource/3/Data.qml b/src/activities/smallnumbers2/resource/3/Data.qml --- a/src/activities/smallnumbers2/resource/3/Data.qml +++ b/src/activities/smallnumbers2/resource/3/Data.qml @@ -23,11 +23,12 @@ import "../../../../core" Dataset { - objective: qsTr("Select number on dominoes up to 9") + objective: qsTr("Select a number on dominoes up to 9") difficulty: 3 data: [ { "level" : "1", + "objective" : "Select the number on dominoes up to 6", "words" : [ "1", "2", @@ -39,6 +40,7 @@ }, { "level" : "2", + "objective" : "Select the number on dominoes up to 7", "words" : [ "1", "2", @@ -51,6 +53,7 @@ }, { "level" : "3", + "objective" : "Select the number on dominoes up to 8", "words" : [ "1", "2", @@ -64,6 +67,7 @@ }, { "level" : "4", + "objective" : "Select the number on dominoes up to 9", "words" : [ "1", "2",