diff --git a/src/activities/target/ActivityInfo.qml b/src/activities/target/ActivityInfo.qml --- a/src/activities/target/ActivityInfo.qml +++ b/src/activities/target/ActivityInfo.qml @@ -37,4 +37,5 @@ credit: "" section: "math addition arithmetic" createdInVersion: 0 + levels: "1,2,3,4,5" } diff --git a/src/activities/target/Target.qml b/src/activities/target/Target.qml --- a/src/activities/target/Target.qml +++ b/src/activities/target/Target.qml @@ -50,6 +50,7 @@ } Component.onCompleted: { + dialogActivityConfig.initialize() activity.start.connect(start) activity.stop.connect(stop) } @@ -62,6 +63,7 @@ property alias bar: bar property alias bonus: bonus property alias targetModel: targetItem.model + property var levels: activity.datasetLoader.item.data property alias targetItem: targetItem property alias userEntry: userEntry property int currentArrow @@ -164,7 +166,7 @@ userEntry.text += text - if(targetItem.scoreTotal === userEntry.text) + if(targetItem.scoreTotal.toString() === userEntry.text) bonus.good("flower") } @@ -208,18 +210,40 @@ onError: console.log("VirtualKeyboard error: " + msg); } + DialogChooseLevel { + id: dialogActivityConfig + currentActivity: activity.activityInfo + + onSaveData: { + levelFolder = dialogActivityConfig.chosenLevel + currentActivity.currentLevel = dialogActivityConfig.chosenLevel + ApplicationSettings.setCurrentLevel(currentActivity.name, dialogActivityConfig.chosenLevel) + background.start() + home() + } + onClose: { + home() + } + onStartActivity: { + background.start() + } + } + DialogHelp { id: dialogHelp onClose: home() } Bar { id: bar anchors.bottom: keyboard.top - content: BarEnumContent { value: help | home | level } + content: BarEnumContent { value: help | home | level | activityConfig } onHelpClicked: { displayDialog(dialogHelp) } + onActivityConfigClicked: { + displayDialog(dialogActivityConfig) + } onPreviousLevelClicked: Activity.previousLevel() onNextLevelClicked: Activity.nextLevel() onHomeClicked: activity.home() diff --git a/src/activities/target/TargetItem.qml b/src/activities/target/TargetItem.qml --- a/src/activities/target/TargetItem.qml +++ b/src/activities/target/TargetItem.qml @@ -151,6 +151,11 @@ GCText { anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom + width: ApplicationInfo.ratio * 30 + horizontalAlignment: Text.AlignHCenter + font.pointSize: 20 + minimumPointSize: 5 + fontSizeMode: Text.Fit text: score } diff --git a/src/activities/target/resource/1/Data.qml b/src/activities/target/resource/1/Data.qml new file mode 100644 --- /dev/null +++ b/src/activities/target/resource/1/Data.qml @@ -0,0 +1,59 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2019 Akshay Kumar + * + * Authors: + * Akshay 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 QtQuick 2.6 +import GCompris 1.0 +import "../../../../core" + +Dataset { + objective: qsTr("Practice addition on targets with max value 10") + difficulty: 2 + property var colors: [ + "#ff1b00", + "#7edee2", + "#f1f500", + "#3dff00", + "#b7d2d4", + "#6db5ba" + ] + data: [ + [ + {size: 50, color: colors[0], score: 5}, + {size: 100, color: colors[1], score: 4}, + {size: 150, color: colors[2], score: 3}, + {size: 200, color: colors[3], score: 2}, + {size: 250, color: colors[4], score: 1} + ], + [ + {size: 50, color: colors[0], score: 7}, + {size: 100, color: colors[1], score: 5}, + {size: 150, color: colors[2], score: 3}, + {size: 200, color: colors[3], score: 2}, + {size: 250, color: colors[4], score: 1} + ], + [ + {size: 50, color: colors[0], score: 10}, + {size: 100, color: colors[1], score: 7}, + {size: 150, color: colors[2], score: 5}, + {size: 200, color: colors[3], score: 3}, + {size: 250, color: colors[4], score: 2} + ] + ] +} diff --git a/src/activities/target/resource/2/Data.qml b/src/activities/target/resource/2/Data.qml new file mode 100644 --- /dev/null +++ b/src/activities/target/resource/2/Data.qml @@ -0,0 +1,64 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2019 Akshay Kumar + * + * Authors: + * Akshay 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 QtQuick 2.6 +import GCompris 1.0 +import "../../../../core" + +Dataset { + objective: qsTr("Practice addition on targets with max value 50") + difficulty: 3 + property var colors: [ + "#ff1b00", + "#7edee2", + "#f1f500", + "#3dff00", + "#b7d2d4", + "#6db5ba" + ] + data: [ + [ + {size: 50, color: colors[0], score: 20}, + {size: 100, color: colors[1], score: 10}, + {size: 150, color: colors[2], score: 8}, + {size: 200, color: colors[3], score: 4}, + {size: 250, color: colors[4], score: 2}, + {size: 300, color: colors[5], score: 1} + ], + [ + {size: 50, color: colors[0], score: 30}, + {size: 100, color: colors[1], score: 20}, + {size: 150, color: colors[2], score: 10}, + {size: 200, color: colors[3], score: 8}, + {size: 250, color: colors[4], score: 4}, + {size: 300, color: colors[5], score: 2}, + {size: 350, color: colors[5], score: 1} + ], + [ + {size: 50, color: colors[0], score: 50}, + {size: 100, color: colors[1], score: 20}, + {size: 150, color: colors[2], score: 10}, + {size: 200, color: colors[3], score: 8}, + {size: 250, color: colors[4], score: 4}, + {size: 300, color: colors[5], score: 2}, + {size: 350, color: colors[5], score: 1} + ] + ] +} diff --git a/src/activities/target/resource/3/Data.qml b/src/activities/target/resource/3/Data.qml new file mode 100644 --- /dev/null +++ b/src/activities/target/resource/3/Data.qml @@ -0,0 +1,70 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2019 Akshay Kumar + * + * Authors: + * Akshay 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 QtQuick 2.6 +import GCompris 1.0 +import "../../../../core" + +Dataset { + objective: qsTr("Practice addition on targets with max value 500") + difficulty: 4 + property var colors: [ + "#ff1b00", + "#7edee2", + "#f1f500", + "#3dff00", + "#b7d2d4", + "#6db5ba" + ] + data: [ + [ + {size: 50, color: colors[0], score: 100}, + {size: 100, color: colors[1], score: 20}, + {size: 150, color: colors[2], score: 10}, + {size: 200, color: colors[3], score: 8}, + {size: 250, color: colors[4], score: 4}, + {size: 300, color: colors[5], score: 2}, + {size: 350, color: colors[5], score: 1} + ], + [ + {size: 50, color: colors[0], score: 300}, + {size: 100, color: colors[1], score: 100}, + {size: 150, color: colors[2], score: 30}, + {size: 200, color: colors[3], score: 20}, + {size: 250, color: colors[3], score: 10}, + {size: 300, color: colors[4], score: 8}, + {size: 350, color: colors[4], score: 4}, + {size: 400, color: colors[5], score: 2}, + {size: 450, color: colors[5], score: 1}, + ], + [ + {size: 50, color: colors[0], score: 500}, + {size: 100, color: colors[1], score: 300}, + {size: 150, color: colors[2], score: 100}, + {size: 200, color: colors[2], score: 30}, + {size: 250, color: colors[3], score: 20}, + {size: 300, color: colors[3], score: 10}, + {size: 350, color: colors[4], score: 8}, + {size: 400, color: colors[4], score: 4}, + {size: 450, color: colors[5], score: 2}, + {size: 450, color: colors[5], score: 1} + ] + ] +} diff --git a/src/activities/target/resource/4/Data.qml b/src/activities/target/resource/4/Data.qml new file mode 100644 --- /dev/null +++ b/src/activities/target/resource/4/Data.qml @@ -0,0 +1,74 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2019 Akshay Kumar + * + * Authors: + * Akshay 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 QtQuick 2.6 +import GCompris 1.0 +import "../../../../core" + +Dataset { + objective: qsTr("Practice addition on targets with max value 50000") + difficulty: 5 + property var colors: [ + "#ff1b00", + "#7edee2", + "#f1f500", + "#3dff00", + "#b7d2d4", + "#6db5ba" + ] + data: [ + [ + {size: 50, color: colors[0], score: 100}, + {size: 100, color: colors[1], score: 20}, + {size: 150, color: colors[2], score: 10}, + {size: 200, color: colors[3], score: 8}, + {size: 250, color: colors[4], score: 4}, + {size: 300, color: colors[5], score: 2}, + {size: 350, color: colors[5], score: 1} + ], + [ + {size: 50, color: colors[0], score: 10000}, + {size: 100, color: colors[1], score: 4000}, + {size: 150, color: colors[1], score: 1000}, + {size: 200, color: colors[2], score: 300}, + {size: 250, color: colors[2], score: 100}, + {size: 300, color: colors[3], score: 30}, + {size: 350, color: colors[3], score: 10}, + {size: 400, color: colors[4], score: 8}, + {size: 450, color: colors[4], score: 4}, + {size: 500, color: colors[5], score: 2}, + {size: 550, color: colors[5], score: 1} + ], + [ + {size: 50, color: colors[0], score: 50000}, + {size: 100, color: colors[1], score: 10000}, + {size: 150, color: colors[1], score: 4000}, + {size: 200, color: colors[2], score: 1000}, + {size: 250, color: colors[2], score: 300}, + {size: 300, color: colors[3], score: 100}, + {size: 350, color: colors[3], score: 30}, + {size: 400, color: colors[4], score: 10}, + {size: 450, color: colors[4], score: 8}, + {size: 500, color: colors[5], score: 4}, + {size: 550, color: colors[5], score: 2}, + {size: 600, color: colors[5], score: 1}, + ] + ] +} diff --git a/src/activities/target/resource/5/Data.qml b/src/activities/target/resource/5/Data.qml new file mode 100644 --- /dev/null +++ b/src/activities/target/resource/5/Data.qml @@ -0,0 +1,78 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2019 Akshay Kumar + * + * Authors: + * Akshay 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 QtQuick 2.6 +import GCompris 1.0 +import "../../../../core" + +Dataset { + objective: qsTr("Practice addition on targets with max value 500000") + difficulty: 6 + property var colors: [ + "#ff1b00", + "#7edee2", + "#f1f500", + "#3dff00", + "#b7d2d4", + "#6db5ba", + "#ffffff" + ] + + data: [ + [ + {size: 50, color: colors[0], score: 100}, + {size: 100, color: colors[1], score: 20}, + {size: 150, color: colors[2], score: 10}, + {size: 200, color: colors[3], score: 8}, + {size: 250, color: colors[4], score: 4}, + {size: 300, color: colors[5], score: 2}, + {size: 350, color: colors[5], score: 1} + ], + [ + {size: 50, color: colors[0], score: 10000}, + {size: 100, color: colors[1], score: 4000}, + {size: 150, color: colors[1], score: 1000}, + {size: 200, color: colors[2], score: 300}, + {size: 250, color: colors[2], score: 100}, + {size: 300, color: colors[3], score: 30}, + {size: 350, color: colors[3], score: 10}, + {size: 400, color: colors[4], score: 8}, + {size: 450, color: colors[4], score: 4}, + {size: 500, color: colors[5], score: 2}, + {size: 550, color: colors[5], score: 1} + ], + [ + {size: 50, color: colors[0], score: 500000}, + {size: 100, color: colors[1], score: 100000}, + {size: 150, color: colors[1], score: 50000}, + {size: 200, color: colors[2], score: 10000}, + {size: 250, color: colors[2], score: 4000}, + {size: 300, color: colors[3], score: 1000}, + {size: 350, color: colors[3], score: 300}, + {size: 400, color: colors[4], score: 100}, + {size: 450, color: colors[4], score: 30}, + {size: 500, color: colors[5], score: 10}, + {size: 550, color: colors[5], score: 8}, + {size: 600, color: colors[6], score: 4}, + {size: 650, color: colors[6], score: 2}, + {size: 700, color: colors[6], score: 1}, + ] + ] +} diff --git a/src/activities/target/target.js b/src/activities/target/target.js --- a/src/activities/target/target.js +++ b/src/activities/target/target.js @@ -24,87 +24,16 @@ var url = "qrc:/gcompris/src/activities/target/resource/" -var colors = [ - "#ff1b00", - "#7edee2", - "#f1f500", - "#3dff00", - "#b7d2d4", - "#6db5ba" - ] - -var levels = [ - [ - {size: 50, color: colors[0], score: 5}, - {size: 100, color: colors[1], score: 4}, - {size: 150, color: colors[2], score: 3}, - {size: 200, color: colors[3], score: 2}, - {size: 250, color: colors[4], score: 1} - ], - [ - {size: 50, color: colors[0], score: 10}, - {size: 100, color: colors[1], score: 5}, - {size: 150, color: colors[2], score: 3}, - {size: 200, color: colors[3], score: 2}, - {size: 250, color: colors[4], score: 1} - ], - [ - {size: 50, color: colors[0], score: 20}, - {size: 100, color: colors[1], score: 10}, - {size: 150, color: colors[2], score: 8}, - {size: 200, color: colors[3], score: 5}, - {size: 250, color: colors[4], score: 3}, - {size: 300, color: colors[5], score: 2} - ], - [ - {size: 50, color: colors[0], score: 30}, - {size: 100, color: colors[1], score: 20}, - {size: 150, color: colors[2], score: 10}, - {size: 200, color: colors[3], score: 5}, - {size: 250, color: colors[4], score: 3}, - {size: 300, color: colors[5], score: 2} - ], - [ - {size: 50, color: colors[0], score: 50}, - {size: 100, color: colors[1], score: 30}, - {size: 150, color: colors[2], score: 20}, - {size: 200, color: colors[3], score: 8}, - {size: 250, color: colors[4], score: 3}, - {size: 300, color: colors[5], score: 2} - ], - [ - {size: 50, color: colors[0], score: 100}, - {size: 100, color: colors[1], score: 50}, - {size: 150, color: colors[2], score: 12}, - {size: 200, color: colors[3], score: 8}, - {size: 250, color: colors[4], score: 3}, - {size: 300, color: colors[5], score: 2} - ], - [ - {size: 50, color: colors[0], score: 500}, - {size: 100, color: colors[1], score: 100}, - {size: 150, color: colors[2], score: 50}, - {size: 200, color: colors[3], score: 15}, - {size: 250, color: colors[4], score: 7}, - {size: 300, color: colors[5], score: 3} - ], - [ - {size: 50, color: colors[0], score: 64}, - {size: 100, color: colors[1], score: 32}, - {size: 150, color: colors[2], score: 16}, - {size: 200, color: colors[3], score: 8}, - {size: 250, color: colors[4], score: 4}, - {size: 300, color: colors[5], score: 2} - ] - ] - +var levels var currentLevel = 0 -var numberOfLevel = levels.length +var numberOfLevel var items function start(items_) { items = items_ currentLevel = 0 + levels = items.levels + numberOfLevel = levels.length items.currentSubLevel = 0 items.numberOfSubLevel = 5 initLevel()