diff --git a/src/activities/money/ActivityInfo.qml b/src/activities/money/ActivityInfo.qml index cc2d37f07..d782af737 100644 --- a/src/activities/money/ActivityInfo.qml +++ b/src/activities/money/ActivityInfo.qml @@ -1,41 +1,41 @@ /* GCompris - ActivityInfo.qml * * Copyright (C) 2015 Bruno Coudoin * * 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 ActivityInfo { name: "money/Money.qml" difficulty: 2 icon: "money/money.svg" author: "Bruno Coudoin <bruno.coudoin@gcompris.net>" demo: false //: Activity title title: qsTr("Money") //: Help title description: qsTr("Practice money usage") // intro: "Click or tap on the money to pay." //: Help goal goal: qsTr("You must buy the different items and give the exact price. At higher levels, several items are displayed, and you must first calculate the total price.") //: Help prerequisite prerequisite: qsTr("Can count") //: Help manual manual: qsTr("Click or tap on the coins or paper money at the bottom of the screen to pay. If you want to remove a coin or note, click or tap on it on the upper screen area.") credit: "" section: "math money measures" createdInVersion: 0 - levels: "1,2" + levels: "1,2,3" } diff --git a/src/activities/money/MoneyCore.qml b/src/activities/money/MoneyCore.qml index 287906595..ba76b8cdd 100644 --- a/src/activities/money/MoneyCore.qml +++ b/src/activities/money/MoneyCore.qml @@ -1,270 +1,270 @@ /* GCompris - MoneyCore.qml * * Copyright (C) 2014 Bruno Coudoin * * Authors: * Bruno Coudoin (GTK+ version) * Bruno Coudoin (Qt Quick port) * * 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 "../../core" import "money.js" as Activity ActivityBase { id: activity onStart: focus = true onStop: {} property var dataset pageComponent: Image { id: background anchors.fill: parent source: Activity.url + "/background.svg" sourceSize.width: parent.width signal start signal stop Component.onCompleted: { activity.start.connect(start) activity.stop.connect(stop) } // Add here the QML items you need to access in javascript QtObject { id: items property Item main: activity.main property alias background: background property GCSfx audioEffects: activity.audioEffects property alias answerModel: answerArea.pocketModel property alias pocketModel: pocketArea.pocketModel property alias store: store property alias instructions: instructions property alias tux: tux property var levels: activity.datasetLoader.item.data property alias tuxMoney: tuxMoney property alias bar: bar property alias bonus: bonus property int itemIndex + property int pocketRows property var selectedArea property alias pocket: pocketArea.answer property alias answer: answerArea.answer } onStart: { Activity.start(items, dataset) } onStop: { Activity.stop() } Column { id: columnLayout spacing: 10 x: parent.width * 0.05 y: parent.height * 0.05 width: parent.width * 0.9 property int nbColumns: 5 - property int nbLines: 2 + property int nbLines: items.pocketRows property int itemWidth: Math.min(width / nbColumns - 10 - 10 / nbColumns, parent.height * 0.4 / nbLines - 10 - 10 / nbLines) property int itemHeight: itemWidth * 0.59 // === The Answer Area === MoneyArea { id: answerArea onTransaction: Activity.unpay(index) } // === The Store Area === property int nbStoreColumns: activity.dataset === "BACK_WITHOUT_CENTS" || activity.dataset === "BACK_WITH_CENTS" ? store.model.length + 1 : store.model.length //tempSpace is a workaround to replace instructionsArea.realHeight that is freezing with Qt-5.9.1 property int tempSpace: bar.level === 1 ? 140 + columnLayout.spacing : 0 property int itemStoreWidth: Math.min((columnLayout.width - storeAreaFlow.spacing * nbStoreColumns) / nbStoreColumns, (parent.height - answerArea.height - pocketArea.height - bar.height) * 0.8) - tempSpace property int itemStoreHeight: itemStoreWidth Rectangle { id: storeArea - height: (columnLayout.itemStoreHeight + 10) + height: columnLayout.itemStoreHeight + 10 width: columnLayout.width color: "#55333333" border.color: "black" border.width: 2 radius: 5 - Flow { id: storeAreaFlow anchors.topMargin: 4 anchors.bottomMargin: 4 anchors.leftMargin: 20 anchors.rightMargin: 20 anchors.fill: parent spacing: 40 add: Transition { NumberAnimation { properties: "x" from: parent.width * 0.05 duration: 300 } } Image { id: tux visible: activity.dataset === "BACK_WITHOUT_CENTS" || activity.dataset === "BACK_WITH_CENTS" source: Activity.url + "/tux.svg" sourceSize.height: columnLayout.itemStoreHeight sourceSize.width: columnLayout.itemStoreHeight Repeater { id: tuxMoney Image { source: modelData.img sourceSize.height: columnLayout.itemStoreHeight * 0.4 x: tux.x + index * 20 y: tux.y + tux.height / 2 + index * 20 } } } Repeater { id: store Image { source: modelData.img sourceSize.height: columnLayout.itemStoreHeight sourceSize.width: columnLayout.itemStoreHeight GCText { text: modelData.price fontSize: 16 font.weight: Font.DemiBold style: Text.Outline styleColor: "black" color: "white" anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top anchors.topMargin: index % 2 == 0 ? 0 : parent.height - height } } } } } // == The instructions Area == Rectangle { id: instructionsArea height: instructions.height width: columnLayout.width color: "#55333333" border.color: "black" border.width: 2 radius: 5 anchors.topMargin: 4 anchors.bottomMargin: 4 anchors.leftMargin: 10 anchors.rightMargin: 10 visible: bar.level === 1 property int realHeight: bar.level === 1 ? height + columnLayout.spacing : 0 GCText { id: instructions horizontalAlignment: Text.AlignHCenter width: columnLayout.width height: columnLayout.height / 6 wrapMode: Text.WordWrap fontSizeMode: Text.Fit } } // === The Pocket Area === MoneyArea { id: pocketArea onTransaction: Activity.pay(index) } } Keys.onPressed: { if(event.key === Qt.Key_Tab) { if(items.selectedArea.count !== 0 && items.itemIndex !== -1) items.selectedArea.itemAt(items.itemIndex).selected = false if(items.selectedArea == items.pocket) { items.selectedArea = items.answer } else { items.selectedArea = items.pocket } items.itemIndex = 0 } if(items.selectedArea.count !== 0) { if(items.itemIndex >= 0) items.selectedArea.itemAt(items.itemIndex).selected = false if(event.key === Qt.Key_Right) { if(items.itemIndex != (items.selectedArea.count-1)) items.itemIndex++ else items.itemIndex = 0 } if(event.key === Qt.Key_Left) { if(items.itemIndex > 0) items.itemIndex-- else items.itemIndex = items.selectedArea.count-1 } if([Qt.Key_Space, Qt.Key_Enter, Qt.Key_Return].indexOf(event.key) != -1 && items.itemIndex !== -1 ) { if(items.selectedArea == items.pocket) Activity.pay(items.itemIndex) else Activity.unpay(items.itemIndex) if(items.itemIndex > 0) items.itemIndex-- } } if(items.selectedArea.count !== 0 && items.itemIndex !== -1) items.selectedArea.itemAt(items.itemIndex).selected = true } DialogHelp { id: dialogHelp onClose: home() } Bar { id: bar content: BarEnumContent { value: help | home | level } onHelpClicked: { displayDialog(dialogHelp) } onPreviousLevelClicked: Activity.previousLevel() onNextLevelClicked: Activity.nextLevel() onHomeClicked: activity.home() } Bonus { id: bonus Component.onCompleted: win.connect(Activity.nextLevel) } } } diff --git a/src/activities/money/money.js b/src/activities/money/money.js index 7d21674a4..54bb16a15 100644 --- a/src/activities/money/money.js +++ b/src/activities/money/money.js @@ -1,244 +1,247 @@ /* GCompris - money.js * * Copyright (C) 2014 Bruno Coudoin * * Authors: * Bruno Coudoin (GTK+ version) * Bruno Coudoin (Qt Quick port) * * 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 . */ .pragma library .import "qrc:/gcompris/src/core/core.js" as Core .import GCompris 1.0 as GCompris .import "moneyConstants.js" as Constants var url = "qrc:/gcompris/src/activities/money/resource/" // We create 3 prices categories to make the game more realistic. // List of images to use in the game (cheap objects) var currentLevel var numberOfLevel var dataset var items var centsMode var backMode var priceTotal function start(items_, datasetName) { items = items_ dataset = items.levels switch(datasetName) { case "WITHOUT_CENTS": centsMode = false backMode = false break case "WITH_CENTS": centsMode = true backMode = false break case "BACK_WITHOUT_CENTS": centsMode = false backMode = true break case "BACK_WITH_CENTS": centsMode = true backMode = true break } currentLevel = 0 numberOfLevel = dataset.length initLevel() } function stop() { } function initLevel() { items.bar.level = currentLevel + 1 items.answerModel.clear() items.pocketModel.clear() var data = dataset[currentLevel] + + items.pocketRows = (data.pocket.length > 10) ? 3 : 2 var pocket = Core.shuffle(data.pocket) + for (var i in pocket) items.pocketModel.append(pocket[i]) // fill up the store in a random way var storeModel = new Array() priceTotal = Math.floor(data.minPrice + Math.random() * (data.maxPrice - data.minPrice)) var priceCounter = 0 for(var i = 0; i < data.numberOfItem; i++) { var price if(i < data.numberOfItem - 1) // Calc a random price for each item based on the previous prices price = Math.floor((centsMode ? 0 : 1) + Math.random() * - ((priceTotal - priceCounter) / data.numberOfItem)) + (2 * (priceTotal - priceCounter) / data.numberOfItem)) else // Put the remaining missing price on the last item price = priceTotal - priceCounter var cents = 0 if(centsMode) { if(currentLevel === 0) cents += 0.10 + Math.floor(Math.random() * 9) / 10 else cents += 0.01 + Math.floor(Math.random() * 9) / 100 priceTotal += cents price += cents } var locale = GCompris.ApplicationSettings.locale if(locale == "system") { locale = Qt.locale().name == "C" ? "en_US" : Qt.locale().name } var priceText = Number(price).toLocaleCurrencyString(Qt.locale(locale)) if(!centsMode) { // Strip floating part priceText = priceText.replace((/.00/), "") } storeModel.push({img: getRandomObject(price), price: priceText}) priceCounter += price } items.store.model = storeModel if(!backMode) { items.instructions.text = qsTr("Click on the coins or paper money at the bottom of the screen to pay." + " If you want to remove a coin or note, click on it on the upper screen area.") } else { var tuxMoney switch(data.paid) { case 5: tuxMoney = [Constants.moneyItems.MONEY_PAPER_5E] break case 10: tuxMoney = [Constants.moneyItems.MONEY_PAPER_10E] break case 20: tuxMoney = [Constants.moneyItems.MONEY_PAPER_20E] break case 30: tuxMoney = [Constants.moneyItems.MONEY_PAPER_20E, Constants.moneyItems.MONEY_PAPER_10E] break case 40: tuxMoney = [Constants.moneyItems.MONEY_PAPER_20E, Constants.moneyItems.MONEY_PAPER_20E] break case 50: tuxMoney = [Constants.moneyItems.MONEY_PAPER_50E] break case 100: tuxMoney = [Constants.moneyItems.MONEY_PAPER_50E, Constants.moneyItems.MONEY_PAPER_50E] break } items.tuxMoney.model = tuxMoney var tuxTotal = 0 for(var i=0; i < tuxMoney.length; i++) tuxTotal += tuxMoney[i].val var locale = GCompris.ApplicationSettings.locale if(locale == "system") { locale = Qt.locale().name == "C" ? "en_US" : Qt.locale().name } var priceText = Number(tuxTotal).toLocaleCurrencyString(Qt.locale(locale)) if(!centsMode) { // Strip floating part priceText = priceText.replace((/.00/), "") } /* The money sign is inserted based on the current locale */ items.instructions.text = qsTr("Tux just bought some items in your shop.\n" + "He gives you %1, please give back his change.") .arg(priceText) } //Keyboard reset items.itemIndex = -1 items.selectedArea = items.pocket } // Given a price return a random object function getRandomObject(price) { var list if(price < 5) list = Constants.cheapObjects else if(price < 10) list = Constants.normalObjects else list = Constants.expensiveObjects return list[Math.floor(Math.random() * list.length)] } function checkAnswer() { var paid = 0 for (var i = 0; i < items.answerModel.count; ++i) paid += items.answerModel.get(i).val paid = paid.toFixed(2) if(!backMode) { if(paid === priceTotal.toFixed(2)) items.bonus.good("flower") } else { if(paid === (dataset[currentLevel].paid - priceTotal).toFixed(2)) items.bonus.good("flower") } } function pay(index) { items.audioEffects.play(url + "money1.wav") // Add it to the anwser items.answerModel.append(items.pocketModel.get(index)) // Remove it from the pocket items.pocketModel.remove(index, 1) checkAnswer() } function unpay(index) { items.audioEffects.play(url + "money2.wav") // Add it to the pocket items.pocketModel.append(items.answerModel.get(index)) // Remove it from the Answer items.answerModel.remove(index, 1) checkAnswer() } function nextLevel() { if(numberOfLevel <= ++currentLevel ) { currentLevel = 0 } initLevel(); } function previousLevel() { if(--currentLevel < 0) { currentLevel = numberOfLevel - 1 } initLevel(); } diff --git a/src/activities/money/resource/1/Data.qml b/src/activities/money/resource/1/Data.qml index 00de727cb..ca106bd26 100644 --- a/src/activities/money/resource/1/Data.qml +++ b/src/activities/money/resource/1/Data.qml @@ -1,106 +1,106 @@ /* 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" import "../../../money/moneyConstants.js" as Constants Dataset { - objective: qsTr("Learn how to pay up to 10 euros") + objective: qsTr("Learn how to pay up to 10 units") property var moneyItems: Constants.moneyItems data: [ { "numberOfItem": 1, "minPrice": 1, "maxPrice": 4, "pocket": [ moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 1, "minPrice": 1, "maxPrice": 5, "pocket": [ moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 1, "minPrice": 1, "maxPrice": 6, "pocket": [ moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 1, "minPrice": 1, "maxPrice": 7, "pocket": [ moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 1, "minPrice": 1, "maxPrice": 8, "pocket": [ moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 1, "minPrice": 1, "maxPrice": 9, "pocket": [ moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 1, "minPrice": 1, "maxPrice": 10, "pocket": [ moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E ] } ] } diff --git a/src/activities/money/resource/2/Data.qml b/src/activities/money/resource/2/Data.qml index 291cfcea8..622612836 100644 --- a/src/activities/money/resource/2/Data.qml +++ b/src/activities/money/resource/2/Data.qml @@ -1,180 +1,179 @@ /* 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" import "../../../money/moneyConstants.js" as Constants Dataset { - objective: qsTr("Learn how to pay up to 100 euros") + objective: qsTr("Learn how to pay up to 100 units") property var moneyItems: Constants.moneyItems data: [ { "numberOfItem": 1, "minPrice": 3, "maxPrice": 10, "pocket": [ moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 1, "minPrice": 10, "maxPrice": 20, "pocket": [ moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { - "numberOfItem": 2, + "numberOfItem": 1, "minPrice": 20, "maxPrice": 30, "pocket": [ moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { - "numberOfItem": 2, + "numberOfItem": 1, "minPrice": 30, - "maxPrice": 40, + "maxPrice": 60, "pocket": [ moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { - "numberOfItem": 3, - "minPrice": 40, - "maxPrice": 50, + "numberOfItem": 1, + "minPrice": 60, + "maxPrice": 100, "pocket": [ - moneyItems.MONEY_COIN_2E, - moneyItems.MONEY_COIN_1E, - moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, - moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_PAPER_20E, - moneyItems.MONEY_COIN_1E + moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_PAPER_5E ] }, { "numberOfItem": 3, - "minPrice": 50, - "maxPrice": 60, + "minPrice": 10, + "maxPrice": 20, "pocket": [ moneyItems.MONEY_PAPER_10E, - moneyItems.MONEY_PAPER_20E, - moneyItems.MONEY_COIN_2E, - moneyItems.MONEY_PAPER_20E, + moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 4, - "minPrice": 60, - "maxPrice": 70, + "minPrice": 20, + "maxPrice": 30, "pocket": [ - moneyItems.MONEY_PAPER_50E, - moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { - "numberOfItem": 4, - "minPrice": 70, - "maxPrice": 80, + "numberOfItem": 5, + "minPrice": 30, + "maxPrice": 60, "pocket": [ - moneyItems.MONEY_PAPER_50E, - moneyItems.MONEY_PAPER_20E, + moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { - "numberOfItem": 4, - "minPrice": 50, + "numberOfItem": 6, + "minPrice": 60, "maxPrice": 100, - "pocket": [ + "pocket": [ moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E ] } ] } diff --git a/src/activities/money/resource/3/Data.qml b/src/activities/money/resource/3/Data.qml new file mode 100644 index 000000000..4dbb91035 --- /dev/null +++ b/src/activities/money/resource/3/Data.qml @@ -0,0 +1,283 @@ +/* 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" +import "../../../money/moneyConstants.js" as Constants + +Dataset { + objective: qsTr("Learn how to pay up to 1000 units") + property var moneyItems: Constants.moneyItems + data: [ + { + "numberOfItem": 1, + "minPrice": 10, + "maxPrice": 100, + "pocket": [ + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_20E, + moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_COIN_1E + ] + }, + { + "numberOfItem": 1, + "minPrice": 200, + "maxPrice": 400, + "pocket": [ + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_20E, + moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_COIN_1E + ] + }, + { + "numberOfItem": 1, + "minPrice": 400, + "maxPrice": 600, + "pocket": [ + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_20E, + moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_COIN_1E + ] + }, + { + "numberOfItem": 1, + "minPrice": 600, + "maxPrice": 800, + "pocket": [ + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_COIN_1E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_COIN_1E, + moneyItems.MONEY_COIN_1E + ] + }, + { + "numberOfItem": 1, + "minPrice": 800, + "maxPrice": 1000, + "pocket": [ + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_COIN_1E, + moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_COIN_1E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_PAPER_20E, + moneyItems.MONEY_COIN_1E + ] + }, + { + "numberOfItem": 3, + "minPrice": 10, + "maxPrice": 100, + "pocket": [ + moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_PAPER_20E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_PAPER_20E, + moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_COIN_1E, + moneyItems.MONEY_COIN_1E, + moneyItems.MONEY_COIN_1E + ] + }, + { + "numberOfItem": 4, + "minPrice": 100, + "maxPrice": 200, + "pocket": [ + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_20E, + moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_COIN_1E, + moneyItems.MONEY_COIN_1E, + moneyItems.MONEY_COIN_1E + ] + }, + { + "numberOfItem": 5, + "minPrice": 200, + "maxPrice": 400, + "pocket": [ + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_20E, + moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_COIN_1E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_COIN_1E, + moneyItems.MONEY_COIN_1E + ] + }, + { + "numberOfItem": 6, + "minPrice": 400, + "maxPrice": 600, + "pocket": [ + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_COIN_1E, + moneyItems.MONEY_COIN_1E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_20E, + moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_PAPER_5E + ] + }, + { + "numberOfItem": 7, + "minPrice": 600, + "maxPrice": 1000, + "pocket": [ + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_10E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_COIN_1E, + moneyItems.MONEY_COIN_1E, + moneyItems.MONEY_COIN_2E, + moneyItems.MONEY_PAPER_50E, + moneyItems.MONEY_PAPER_20E, + moneyItems.MONEY_PAPER_5E + ] + } + ] +}