diff --git a/src/activities/memory-enumerate/ActivityInfo.qml b/src/activities/memory-enumerate/ActivityInfo.qml --- a/src/activities/memory-enumerate/ActivityInfo.qml +++ b/src/activities/memory-enumerate/ActivityInfo.qml @@ -36,4 +36,5 @@ credit: "" section: "math numeration" createdInVersion: 0 + levels: "1" } diff --git a/src/activities/memory-enumerate/MemoryEnumerate.qml b/src/activities/memory-enumerate/MemoryEnumerate.qml --- a/src/activities/memory-enumerate/MemoryEnumerate.qml +++ b/src/activities/memory-enumerate/MemoryEnumerate.qml @@ -22,9 +22,7 @@ import QtQuick 2.6 import "../memory" -import "dataset.js" as Dataset MemoryCommon { - dataset: Dataset.get() backgroundImg: "qrc:/gcompris/src/activities/memory/resource/background.svg" } diff --git a/src/activities/memory-enumerate/resource/1/Data.qml b/src/activities/memory-enumerate/resource/1/Data.qml new file mode 100644 --- /dev/null +++ b/src/activities/memory-enumerate/resource/1/Data.qml @@ -0,0 +1,61 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2020 Deepak Kumar + * + * Authors: + * Deepak Kumar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +import GCompris 1.0 +import GCompris 1.0 as GCompris + +Data { + objective: qsTr("Match the numbers up to 2.") + difficulty: 1 + + property var url: "qrc:/gcompris/src/activities/memory-enumerate/resource/" + + property var texts: [ + ["", 0], + ["", 1], + ["", 2], + ] + + property var images: [ + [url + 'math_0.svg', ''], + [url + 'math_1.svg', ''], + [url + 'math_2.svg', ''], + ] + + property var sounds: [ + ["", + GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0030.$CA")], + ["", + GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0031.$CA")], + ["", + GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0032.$CA")] + ] + + data: [ + { // Level 1 + "columns": 2, + "rows": 2, + "texts": texts.slice(0, 3), + "images": images.slice(0, 3), + "sounds": sounds.slice(0, 3) + } + ] +} diff --git a/src/activities/memory-enumerate/resource/2/Data.qml b/src/activities/memory-enumerate/resource/2/Data.qml new file mode 100644 --- /dev/null +++ b/src/activities/memory-enumerate/resource/2/Data.qml @@ -0,0 +1,48 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2018 Johnny Jazeix + * + * Authors: + * Johnny Jazeix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import GCompris 1.0 + +Data { + objective: qsTr("Numbers between 1 and 8") + difficulty: 1 + data: [ + { + "minNumber": 1, + "maxNumber": 1, /* Max number on each domino side */ + "numberOfFish": 3 + }, + { + "minNumber": 1, + "maxNumber": 2, + "numberOfFish": 4 + }, + { + "minNumber": 1, + "maxNumber": 3, + "numberOfFish": 5 + }, + { + "minNumber": 1, + "maxNumber": 4, + "numberOfFish": 5 + } + ] +} diff --git a/src/activities/memory-enumerate/resource/3/Data.qml b/src/activities/memory-enumerate/resource/3/Data.qml new file mode 100644 --- /dev/null +++ b/src/activities/memory-enumerate/resource/3/Data.qml @@ -0,0 +1,48 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2018 Johnny Jazeix + * + * Authors: + * Johnny Jazeix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import GCompris 1.0 + +Data { + objective: qsTr("Numbers between 1 and 8") + difficulty: 1 + data: [ + { + "minNumber": 1, + "maxNumber": 1, /* Max number on each domino side */ + "numberOfFish": 3 + }, + { + "minNumber": 1, + "maxNumber": 2, + "numberOfFish": 4 + }, + { + "minNumber": 1, + "maxNumber": 3, + "numberOfFish": 5 + }, + { + "minNumber": 1, + "maxNumber": 4, + "numberOfFish": 5 + } + ] +} diff --git a/src/activities/memory-enumerate/resource/4/Data.qml b/src/activities/memory-enumerate/resource/4/Data.qml new file mode 100644 --- /dev/null +++ b/src/activities/memory-enumerate/resource/4/Data.qml @@ -0,0 +1,48 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2018 Johnny Jazeix + * + * Authors: + * Johnny Jazeix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import GCompris 1.0 + +Data { + objective: qsTr("Numbers between 1 and 8") + difficulty: 1 + data: [ + { + "minNumber": 1, + "maxNumber": 1, /* Max number on each domino side */ + "numberOfFish": 3 + }, + { + "minNumber": 1, + "maxNumber": 2, + "numberOfFish": 4 + }, + { + "minNumber": 1, + "maxNumber": 3, + "numberOfFish": 5 + }, + { + "minNumber": 1, + "maxNumber": 4, + "numberOfFish": 5 + } + ] +} diff --git a/src/activities/memory-enumerate/resource/5/Data.qml b/src/activities/memory-enumerate/resource/5/Data.qml new file mode 100644 --- /dev/null +++ b/src/activities/memory-enumerate/resource/5/Data.qml @@ -0,0 +1,48 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2018 Johnny Jazeix + * + * Authors: + * Johnny Jazeix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import GCompris 1.0 + +Data { + objective: qsTr("Numbers between 1 and 8") + difficulty: 1 + data: [ + { + "minNumber": 1, + "maxNumber": 1, /* Max number on each domino side */ + "numberOfFish": 3 + }, + { + "minNumber": 1, + "maxNumber": 2, + "numberOfFish": 4 + }, + { + "minNumber": 1, + "maxNumber": 3, + "numberOfFish": 5 + }, + { + "minNumber": 1, + "maxNumber": 4, + "numberOfFish": 5 + } + ] +} diff --git a/src/activities/memory-enumerate/resource/6/Data.qml b/src/activities/memory-enumerate/resource/6/Data.qml new file mode 100644 --- /dev/null +++ b/src/activities/memory-enumerate/resource/6/Data.qml @@ -0,0 +1,48 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2018 Johnny Jazeix + * + * Authors: + * Johnny Jazeix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import GCompris 1.0 + +Data { + objective: qsTr("Numbers between 1 and 8") + difficulty: 1 + data: [ + { + "minNumber": 1, + "maxNumber": 1, /* Max number on each domino side */ + "numberOfFish": 3 + }, + { + "minNumber": 1, + "maxNumber": 2, + "numberOfFish": 4 + }, + { + "minNumber": 1, + "maxNumber": 3, + "numberOfFish": 5 + }, + { + "minNumber": 1, + "maxNumber": 4, + "numberOfFish": 5 + } + ] +} diff --git a/src/activities/memory-enumerate/resource/7/Data.qml b/src/activities/memory-enumerate/resource/7/Data.qml new file mode 100644 --- /dev/null +++ b/src/activities/memory-enumerate/resource/7/Data.qml @@ -0,0 +1,48 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2018 Johnny Jazeix + * + * Authors: + * Johnny Jazeix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import GCompris 1.0 + +Data { + objective: qsTr("Numbers between 1 and 8") + difficulty: 1 + data: [ + { + "minNumber": 1, + "maxNumber": 1, /* Max number on each domino side */ + "numberOfFish": 3 + }, + { + "minNumber": 1, + "maxNumber": 2, + "numberOfFish": 4 + }, + { + "minNumber": 1, + "maxNumber": 3, + "numberOfFish": 5 + }, + { + "minNumber": 1, + "maxNumber": 4, + "numberOfFish": 5 + } + ] +} diff --git a/src/activities/memory-enumerate/resource/8/Data.qml b/src/activities/memory-enumerate/resource/8/Data.qml new file mode 100644 --- /dev/null +++ b/src/activities/memory-enumerate/resource/8/Data.qml @@ -0,0 +1,48 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2018 Johnny Jazeix + * + * Authors: + * Johnny Jazeix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import GCompris 1.0 + +Data { + objective: qsTr("Numbers between 1 and 8") + difficulty: 1 + data: [ + { + "minNumber": 1, + "maxNumber": 1, /* Max number on each domino side */ + "numberOfFish": 3 + }, + { + "minNumber": 1, + "maxNumber": 2, + "numberOfFish": 4 + }, + { + "minNumber": 1, + "maxNumber": 3, + "numberOfFish": 5 + }, + { + "minNumber": 1, + "maxNumber": 4, + "numberOfFish": 5 + } + ] +} diff --git a/src/activities/memory/MemoryCommon.qml b/src/activities/memory/MemoryCommon.qml --- a/src/activities/memory/MemoryCommon.qml +++ b/src/activities/memory/MemoryCommon.qml @@ -51,6 +51,7 @@ property bool keyNavigationVisible: false Component.onCompleted: { + dialogActivityConfig.initialize() activity.start.connect(start) activity.stop.connect(stop) } @@ -66,7 +67,7 @@ property int selectionCount property int tuxScore: tuxScore.text property int playerScore: playerScore.text - property var dataset: activity.dataset + property var levels: activity.datasetLoader.data !== 0 ? activity.datasetLoader.data : activity.dataset property alias containerModel: containerModel property alias grid: grid property bool blockClicks: false @@ -143,13 +144,35 @@ onClose: home() } + DialogChooseLevel { + id: dialogActivityConfig + currentActivity: activity.activityInfo + + onSaveData: { + levelFolder = dialogActivityConfig.chosenLevel + currentActivity.currentLevel = dialogActivityConfig.chosenLevel + ApplicationSettings.setCurrentLevel(currentActivity.name, dialogActivityConfig.chosenLevel) + home() + } + onClose: { + home() + } + onStartActivity: { + background.start() + } + } + + Bar { id: bar - content: BarEnumContent { value: help | home | level } + content: BarEnumContent { value: help | home | level | activityConfig } onHelpClicked: { displayDialog(dialogHelp) } onPreviousLevelClicked: Activity.previousLevel() + onActivityConfigClicked: { + displayDialog(dialogActivityConfig) + } onNextLevelClicked: Activity.nextLevel() onHomeClicked: home() } diff --git a/src/activities/memory/memory.js b/src/activities/memory/memory.js --- a/src/activities/memory/memory.js +++ b/src/activities/memory/memory.js @@ -37,7 +37,7 @@ items = items_ currentLevel = 0 - numberOfLevel = items.dataset.length + numberOfLevel = items.levels.length initLevel() } @@ -54,11 +54,11 @@ items.blockClicks = false // compute the number of cards - var columns = items.dataset[currentLevel].columns - var rows = items.dataset[currentLevel].rows - var images = items.dataset[currentLevel].images - var sounds = items.dataset[currentLevel].sounds - var texts = items.dataset[currentLevel].texts + var columns = items.levels[currentLevel].columns + var rows = items.levels[currentLevel].rows + var images = items.levels[currentLevel].images + var sounds = items.levels[currentLevel].sounds + var texts = items.levels[currentLevel].texts items.columns = columns items.rows = rows nbOfPair = rows * columns / 2