diff --git a/src/activities/activities.txt b/src/activities/activities.txt index 1e22120a9..f43c00d36 100644 --- a/src/activities/activities.txt +++ b/src/activities/activities.txt @@ -1,156 +1,157 @@ # The list of activities that will be loaded at GCompris start. # Keep it sorted advanced_colors algebra_by algebra_div algebra_minus algebra_plus algorithm align4 align4-2players alphabet-sequence babymatch babyshapes baby_tangram baby_wordprocessor balancebox ballcatch bargame bargame_2players binary_bulb braille_alphabets braille_fun calendar canal_lock categorization checkers checkers_2players chess chess_2players chess_partyend chronos clickanddraw clickgame click_on_letter click_on_letter_up clockgame color_mix color_mix_light colors crane details digital_electricity drawletters drawnumbers enumerate erase erase_2clic erase_clic explore_farm_animals explore_monuments explore_world_animals explore_world_music family family_find_relative fifteen find_the_day followline football geo-country geography gletters gnumch-equality gnumch-factors gnumch-inequality gnumch-multiples gnumch-primes graph-coloring guesscount guessnumber hangman hanoi hanoi_real hexagon imagename instruments intro_gravity land_safe lang leftright letter-in-word lightsoff louis-braille magic-hat-minus magic-hat-plus maze mazeinvisible mazerelative melody memory memory-case-association memory-case-association-tux memory-enumerate memory-math-add memory-math-add-minus memory-math-add-minus-mult-div memory-math-add-minus-mult-div-tux memory-math-add-minus-tux memory-math-add-tux memory-math-div memory-math-div-tux memory-math-minus memory-math-minus-tux memory-math-mult memory-math-mult-div memory-math-mult-div-tux memory-math-mult-tux memory-sound memory-sound-tux memory-tux memory-wordnumber mining missing-letter money money_back money_back_cents money_cents mosaic nine_men_morris nine_men_morris_2players note_names number_sequence numbers-odd-even +numeration_weights_integer paintings penalty -piano_composition photo_hunter +piano_composition planegame play_piano play_rhythm programmingMaze railroad readingh readingv redraw redraw_symmetrical renewable_energy reversecount roman_numerals scalesboard scalesboard_weight scalesboard_weight_avoirdupois share simplepaint smallnumbers smallnumbers2 solar_system submarine sudoku superbrain tangram target tic_tac_toe tic_tac_toe_2players traffic watercycle wordsgame diff --git a/src/activities/numeration_weights_integer/ActivityInfo.qml b/src/activities/numeration_weights_integer/ActivityInfo.qml new file mode 100644 index 000000000..e81a15ede --- /dev/null +++ b/src/activities/numeration_weights_integer/ActivityInfo.qml @@ -0,0 +1,41 @@ +/* GCompris - ActivityInfo.qml + * + * Copyright (C) 2019 Emmanuel Charruau + * + * 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: "numeration_weights_integer/Numeration_weights_integer.qml" + difficulty: 1 + icon: "numeration_weights_integer/numeration_weights_integer.svg" + author: "Emmanuel Charruau " + demo: true + //: Activity title + title: "Numeration activity" + //: Help title + description: "" + //intro: "put here in comment the text for the intro voice" //? + //: Help goal + goal: "" + //: Help prerequisite + prerequisite: "" + //: Help manual + manual: "" + credit: "" + section: "fun" + createdInVersion: 9800 + levels: "1,2,3" +} diff --git a/src/activities/numeration_weights_integer/CMakeLists.txt b/src/activities/numeration_weights_integer/CMakeLists.txt new file mode 100644 index 000000000..89278c654 --- /dev/null +++ b/src/activities/numeration_weights_integer/CMakeLists.txt @@ -0,0 +1 @@ +GCOMPRIS_ADD_RCC(activities/numeration_weights_integer *.qml *.svg *.js resource/*) diff --git a/src/activities/numeration_weights_integer/NumberClassDragElement.qml b/src/activities/numeration_weights_integer/NumberClassDragElement.qml new file mode 100644 index 000000000..15399c01b --- /dev/null +++ b/src/activities/numeration_weights_integer/NumberClassDragElement.qml @@ -0,0 +1,79 @@ +/* GCompris - NumberClassDragElement.qml + * + * Copyright (C) 2019 Emmanuel Charruau + * + * 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" + +// TODO: make text fitting in Rectangle + +Rectangle { + id: numberClassDragElement + + width: parent.width - parent.width/5 + height: parent.height / 15 + + property int lastX + property int lastY + property int lastZ + + property string name + property bool dragEnabled: true + + Drag.active: numberClassDragElementMouseArea.drag.active + + opacity: dragEnabled ? 1 : 0.5 + + //number of available items + GCText { + id: numberClassElementCaption + + anchors.fill: parent //? here text does not fit in parent + anchors.bottom: parent.bottom + fontSizeMode: Text.Fit + color: "white" + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + text: name + } + + MouseArea { + id: numberClassDragElementMouseArea + anchors.fill: parent + + drag.target: (numberClassDragElement.dragEnabled) ? parent : null + drag.axis: numberClassDragElement.x < parent.width ? Drag.XAxis : Drag.XAndYAxis + Drag.hotSpot.x: width / 2 + Drag.hotSpot.y: height / 2 + + onPressed: { + instruction.hide() + //set the initial position + numberClassDragElement.lastX = numberClassDragElement.x + numberClassDragElement.lastY = numberClassDragElement.y + } + + onReleased: { + parent.Drag.drop() + //set the element to its initial coordinates + numberClassDragElement.x = numberClassDragElement.lastX + numberClassDragElement.y = numberClassDragElement.lastY + } + } +} diff --git a/src/activities/numeration_weights_integer/NumberClassDropArea.qml b/src/activities/numeration_weights_integer/NumberClassDropArea.qml new file mode 100644 index 000000000..6dbf339c7 --- /dev/null +++ b/src/activities/numeration_weights_integer/NumberClassDropArea.qml @@ -0,0 +1,206 @@ +/* GCompris - NumberClassDropArea.qml + * + * Copyright (C) 2019 Emmanuel Charruau + * + * 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 QtQuick.Layouts 1.3 + +import "../../core" +import "numeration_weights_integer.js" as Activity + +Rectangle { + id: numberClassDropArea + + property string className + property var unitColumnWeightImagesArray: ["","","","","","","","",""] //? + property int unitColumnWeightImagesArrayIndex: 0 + property var tenColumnWeightImagesArray: ["","","","","","","","",""] + property int tenColumnWeightImagesArrayIndex: 0 + property var hundredColumnWeightImagesArray: ["","","","","","","","",""] + property int hundredColumnWeightImagesArrayIndex: 0 + property string numberClassDropAreaIndex: index + + property string defaultColor: "darkseagreen" + property string overlapColor: "grey" + + property alias numberWeightsDropAreasRepeaterAlias: numberWeightsDropAreasRepeater + + width: parent.width + height: parent.height - numberClassHeaders.height + + color: "blue" + + ListModel { + id: numberWeightHeadersModel + + ListElement { + weightType: "Hundred" + } + ListElement { + weightType: "Ten" + } + ListElement { + weightType: "Unit" + } + } + + RowLayout { + id: numberWeightsDropAreasRowLayout + + width: parent.width + height: parent.height + spacing: 10 + + Repeater { + id: numberWeightsDropAreasRepeater + model: numberWeightHeadersModel + + + Rectangle { + id: numberWeightDropAreaRectangle + + property string numberWeightDropAreaRectangleIndex: index + property string numberWeightKey: weightType + property alias numberWeightsDropTiles: numberWeightsDropTiles + property alias numberWeightHeaderElement: numberWeightHeaderElement + property string numberWeightType: weightType + + color: "lightsteelblue" + + Layout.fillWidth: true + Layout.fillHeight: true + Layout.minimumWidth: 50 + Layout.preferredWidth: 100 + + NumberWeightHeaderElement { + id: numberWeightHeaderElement + + x: 0 + y: 0 + width: numberWeightDropAreaRectangle.width + height: numberWeightDropAreaRectangle.height /10 + } + + // Implement columns where the numberWeights are set by the user + Rectangle { + id: numberWeightsDropTiles + + property alias numberWeightDropAreaGridRepeater: numberWeightDropAreaGridRepeater + + anchors.top: numberWeightHeaderElement.bottom + width: parent.width + height: parent.height - numberWeightHeaderElement.height + + Grid { + id: numberWeightDropAreaGrid + + anchors.left: parent.left + anchors.top: parent.top + anchors.bottom: parent.bottom; + width: parent.width + height: parent.height + columns: 1 + + Repeater { + id: numberWeightDropAreaGridRepeater + model: 9 + + DropArea { + property alias numberWeightImageTile: numberWeightImageTile + property alias numberWeightComponentRectangle: numberWeightComponentRectangle + + keys: "numberWeightKey" + + width: parent.width + height: parent.height/9 + + onEntered: { + numberWeightComponentRectangle.color = overlapColor + } + + onExited: { + numberWeightComponentRectangle.color = defaultColor + } + + onDropped: { + var imageName = drag.source.imageName + var caption = drag.source.caption + var weightValue = drag.source.weightValue + Activity.setNumberWeightComponent(numberWeightImageTile,imageName,caption, weightValue) + numberWeightComponentRectangle.color = defaultColor + } + + Rectangle { + id: numberWeightComponentRectangle + + border.color: "black" + border.width: 5 + radius: 10 + width: parent.width + height: parent.height + color: defaultColor + + Image { + id: numberWeightImageTile + + property string caption: "" + property string weightValue: "" + property alias border: numberWeightComponentRectangle.border + + anchors.fill: parent + sourceSize.width: parent.width + sourceSize.height: parent.height + + MouseArea { + anchors.fill: parent + onClicked: { + if (numberWeightImageTile.status === Image.Ready) { + Activity.removeNumberWeightComponent(numberWeightImageTile) + } + else { + if (Activity.selectedNumberWeightDragElementIndex !== -1) { + var imageName = numberWeightDragListModel.get(Activity.selectedNumberWeightDragElementIndex).imageName + var caption = numberWeightDragListModel.get(Activity.selectedNumberWeightDragElementIndex).caption + var weightValue = numberWeightDragListModel.get(Activity.selectedNumberWeightDragElementIndex).weightValue + Activity.setNumberWeightComponent(numberWeightImageTile,imageName,caption,weightValue) + } + } + } + } + + GCText { + id: numberClassElementCaption + + anchors.fill: parent + anchors.bottom: parent.bottom + fontSizeMode: Text.Fit + color: "white" + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + text: numberWeightImageTile.caption + } + } + } + } + } + } + } + } + } + } +} diff --git a/src/activities/numeration_weights_integer/NumberClassHeaderElement.qml b/src/activities/numeration_weights_integer/NumberClassHeaderElement.qml new file mode 100644 index 000000000..0f0fd5ef7 --- /dev/null +++ b/src/activities/numeration_weights_integer/NumberClassHeaderElement.qml @@ -0,0 +1,116 @@ + +/* GCompris - NumberClassHeaderElement.qml + * + * Copyright (C) 2019 Emmanuel Charruau + * + * 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" + + +Item { + id: numberClassHeaderElement + + MouseArea { + id: dragArea + + property bool held: false + + width: mainZoneArea.width / numberClassListModel.count + height: numberClassHeaders.height + + drag.target: held ? content : undefined + drag.axis: Drag.XAxis + + onPressAndHold: { + held = true + } + onReleased: { + if ((content.x < leftWidget.width) && held) //don't understand why I have a content.x = 0 when held is not true, this point needs to be cleared + { + numberClassListModel.get(index).element_src.dragEnabled = true + numberClassListModel.remove(index,1) + } + held = false + } + + + Rectangle { + id: content + + anchors { + horizontalCenter: parent.horizontalCenter + verticalCenter: parent.verticalCenter + } + + width: mainZoneArea.width / numberClassListModel.count + height: numberClassHeaders.height / 2 + border.width: 1 + border.color: "lightsteelblue" + color: dragArea.held ? "lightsteelblue" : "white" + Behavior on color { ColorAnimation { duration: 100 } } + radius: 2 + Drag.active: dragArea.held + Drag.source: dragArea + Drag.hotSpot.x: width / 2 + Drag.hotSpot.y: height / 2 + + states: State { + when: dragArea.held + + ParentChange { target: content; parent: root } + AnchorChanges { + target: content + anchors { horizontalCenter: undefined; verticalCenter: undefined } + } + } + + GCText { + id: numberClassHeaderCaption + + anchors.fill: parent + anchors.bottom: parent.bottom + fontSizeMode: Text.Fit + color: "black" + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + text: index //numberClassListModel.get(index).name //? + z: 100 + } + + } + + DropArea { + anchors { fill: parent; margins: 10 } + + onEntered: { + + console.log("entered") + visualModel.items.move( + drag.source.DelegateModel.itemsIndex, + dragArea.DelegateModel.itemsIndex) + console.log("drag.source.DelegateModel.itemsIndex : " + drag.source.DelegateModel.itemsIndex) + console.log("dragArea.DelegateModel.itemsIndex : " + dragArea.DelegateModel.itemsIndex) + numberClassListModel.move( + drag.source.DelegateModel.itemsIndex, + dragArea.DelegateModel.itemsIndex,1) + } + } + } +} + diff --git a/src/activities/numeration_weights_integer/NumberWeightDragElement.qml b/src/activities/numeration_weights_integer/NumberWeightDragElement.qml new file mode 100644 index 000000000..9e5f1cba1 --- /dev/null +++ b/src/activities/numeration_weights_integer/NumberWeightDragElement.qml @@ -0,0 +1,107 @@ +/* GCompris - NumberWeightDragElement.qml + * + * Copyright (C) 2019 Emmanuel Charruau + * + * 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 "numeration_weights_integer.js" as Activity + +Rectangle { + id: numberWeightDragElement + + property int lastX + property int lastY + property string imageName + property string name + property bool canDrag: true + property string caption + property string src + property int weightValue + property bool selected + + // callback defined in each numberWeightDragElement called when we release the element in background //? + property var releaseElement: null //? + + width: parent.width - parent.width/5 + height: parent.height / 15 + + color: "transparent" + border.color: "red" + border.width: selected === true ? 1 : 0 + + + + Drag.active: numberWeightDragElementMouseArea.drag.active + + src: "resource/images/" + imageName + + Image { + id: numberWeightDragElementImage + sourceSize.width: parent.width + sourceSize.height: parent.height + source: imageName !== "" ? numberWeightDragElement.src : "" + anchors.fill: parent + + //number of available items + GCText { + id: numberWeightDragElementCaption + + anchors.fill: parent + anchors.margins: 10 + fontSizeMode: Text.Fit + color: "white" + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + text: numberWeightDragElement.caption + } + } + + MouseArea { + id: numberWeightDragElementMouseArea + anchors.fill: parent + + onPressed: { + //set the initial position + numberWeightDragElement.lastX = numberWeightDragElement.x + numberWeightDragElement.lastY = numberWeightDragElement.y + } + + onPositionChanged: { + Activity.unselectAllNumberWeightDragElement() + } + + + onClicked: { + Activity.selectNumberWeightDragElement(index) + } + + drag.target: numberWeightDragElement + drag.axis: numberWeightDragElement.x < parent.width ? Drag.XAxis : Drag.XAndYAxis + Drag.hotSpot.x: width + Drag.hotSpot.y: height + + onReleased: { + parent.Drag.drop() + //set the element to its initial coordinates + numberWeightDragElement.x = numberWeightDragElement.lastX + numberWeightDragElement.y = numberWeightDragElement.lastY + } + } +} diff --git a/src/activities/numeration_weights_integer/NumberWeightHeaderElement.qml b/src/activities/numeration_weights_integer/NumberWeightHeaderElement.qml new file mode 100644 index 000000000..80615e8cc --- /dev/null +++ b/src/activities/numeration_weights_integer/NumberWeightHeaderElement.qml @@ -0,0 +1,115 @@ + +/* GCompris - NumberWeightHeaderElement.qml + * + * Copyright (C) 2019 Emmanuel Charruau + * + * 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 "numeration_weights_integer.js" as Activity + +Rectangle { + id: numberWeightHeaderElement + + property string defaultColor: "darkred" + property string overlapColor: "blue" + + color: "darkred" + radius: 0.2 + + anchors.top: parent.top //? + + property int lastX + property int lastY + + property Item dragParent + + property alias textAlias: numberWeightHeaderCaption.text + + border.color: "red" + border.width: 0 + + DropArea { + id: numberWeightsHeaderDropArea + + anchors.fill: parent + keys: "numberWeightHeaderKey" + + onEntered: { + numberWeightHeaderElement.color = overlapColor + } + + onExited: { + numberWeightHeaderElement.color = defaultColor + } + + onDropped: { + numberWeightHeaderElement.color = defaultColor + numberWeightHeaderCaption.text = drag.source.caption + } + + Image { + id: numberWeightHeaderImage + + anchors.fill: parent + sourceSize.width: parent.width //? + sourceSize.height: parent.height + + GCText { + id: numberClassElementCaption + + anchors.fill: parent + anchors.bottom: parent.bottom + fontSizeMode: Text.Fit + color: "white" + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + } + } + } + + GCText { + id: numberWeightHeaderCaption + + anchors.fill: parent + anchors.margins: 10 //find a way to fit the text without truncating it + fontSizeMode: Text.Fit + color: "white" + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + wrapMode: TextEdit.WordWrap + text: qsTr("Drag column weight here.") + } + + MouseArea { + anchors.fill: parent + onClicked: { + if (numberWeightHeaderImage.status === Image.Ready) { + Activity.removeNumberWeightComponent(numberWeightImageTile) + } + else { + if (Activity.selectedNumberWeightDragElementIndex !== -1) { + if (numberWeightDragListModel.get(Activity.selectedNumberWeightDragElementIndex).dragkeys === "numberWeightHeaderKey") { + numberWeightHeaderImage.source = numberWeightDragListModel.get(Activity.selectedNumberWeightDragElementIndex).imageName + numberWeightHeaderCaption.text = numberWeightDragListModel.get(Activity.selectedNumberWeightDragElementIndex).caption + } + } + } + } + } +} diff --git a/src/activities/numeration_weights_integer/Numeration_weights_integer.qml b/src/activities/numeration_weights_integer/Numeration_weights_integer.qml new file mode 100644 index 000000000..f661c5e70 --- /dev/null +++ b/src/activities/numeration_weights_integer/Numeration_weights_integer.qml @@ -0,0 +1,649 @@ +/* GCompris - Share.qml + * + * Copyright (C) 2019 Emmanuel Charruau + * + * 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 . + */ + + +// TODO: ne valider que si les poids sont dans la bonne case +// TODO: ajouter des niveaux pour pouvoir le faire tester par un élève +// TODO: fix error when removing a class dragging it +// TODO: give new number only when bonus is finished +// TODO: remove cellsize +// TODO: is it possible to have a vertical mode? If not remove everything related to vertical mode +// TODO: remove settings in bar menu + + +import QtQuick 2.6 +import GCompris 1.0 +import QtQuick.Layouts 1.3 +import QtQuick.Controls 1.5 +import QtQml.Models 2.1 + +import "../../core" + +import "numeration_weights_integer.js" as Activity + +ActivityBase { + id: activity + + onStart: focus = true + onStop: {} + + pageComponent: Rectangle { + id: background + + anchors.fill: parent + color: "#ffffb3" + signal start + signal stop + + Component.onCompleted: { + dialogActivityConfig.getInitialConfiguration() + 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 alias mainZoneArea: mainZoneArea + property alias bar: bar + property alias bonus: bonus + property alias instruction: instruction + property alias warningRectangle: warningRectangle + property alias dataset: dataset + property alias numberClassListModel: numberClassListModel + property alias numberClassDragListModel: numberClassDragListModel + property alias numberWeightDragListModel: numberWeightDragListModel + property alias numberClassTypeModel: numberClassTypeModel + property alias leftWidget: leftWidget + property alias progressBar: progressBar + property alias numberClassDropAreaRepeater: numberClassDropAreaRepeater + property alias classNameListView: classNameListView + property int barHeightAddon: ApplicationSettings.isBarHidden ? 1 : 3 + property int cellSize: Math.min(background.width / 11, background.height / (9 + barHeightAddon)) + property var levels: activity.datasetLoader.item.data + property alias numberToConvertRectangle: numberToConvertRectangle + } + + Loader { + id: dataset + asynchronous: false + } + + onStart: { Activity.start(items) } + onStop: { Activity.stop() } + + property bool vert: background.width >= background.height + + + + //mainZone + DropArea { + id: mainZoneArea + + width: background.vert ? + background.width - leftWidget.width - 40 : background.width - 40 + height: ApplicationSettings.isBarHidden ? + background.height : background.vert ? + background.height - (bar.height * 1.1) : + background.height - (bar.height * 1.1) - leftWidget.height + + anchors { + top: background.vert ? background.top : leftWidget.bottom + left: background.vert ? leftWidget.right : parent.left + leftMargin: 20 + } + + keys: "NumberClassKey" + + //shows/hides the objective/instruction + MouseArea { + anchors.fill: mainZoneArea + onClicked: instruction.show() + } + + Rectangle { + id: mainZoneAreaDropRectangleVisualisation + + anchors.fill: parent + color: "pink" + } + + onDropped: { + var className = drag.source.name + drag.source.dragEnabled = false + Activity.appendClassNameColumn(className, drag.source, false) + } + + Rectangle { + id: topBanner + + height: mainZoneArea.height / 10 + width: mainZoneArea.width + anchors { + left: mainZoneArea.left + top: mainZoneArea.top + } + color: "green" + + Rectangle { + id: numberToConvertRectangle + anchors.fill: numberToConvertRectangleTxt + color: "blue" + opacity: 0.8 + property alias text: numberToConvertRectangleTxt.text + } + + //display number to convert + GCText { + id: numberToConvertRectangleTxt + height: parent.height + width: parent.width / 3 + anchors { + left: numberToConvertRectangle.left + top: numberToConvertRectangle.top + } + opacity: numberToConvertRectangle.opacity + //z: instruction.z + fontSize: background.vert ? regularSize : smallSize + color: "white" + style: Text.Outline + styleColor: "black" + horizontalAlignment: Text.AlignHCenter + wrapMode: TextEdit.WordWrap + } + + ProgressBar { + id: progressBar + height: parent.height + width: parent.width / 3 + + property int percentage: 0 + + maximumValue: 100 + visible: true //!items.isTutorialMode + anchors { + bottom: parent.bottom + right: parent.right + rightMargin: 40 + } + + GCText { + anchors.centerIn: parent + + fontSize: mediumSize + font.bold: true + color: "black" + //: The following translation represents percentage. + text: qsTr("%1%").arg(parent.value) + z: 2 + } + } + } + + //store strings Integer and Decimal to display in numeration table header + ListModel { + id: numberClassTypeModel + } + + Rectangle { + id: numberClassTypeHeader + width: mainZoneArea.width + height: mainZoneArea.height / 15 + anchors.top: topBanner.bottom + anchors.left: parent.left + anchors.right: parent.right + border.color: "red" + border.width: 1 + + ListView { + id: numberClassTypeHeaderListView + + anchors { fill: parent} + model: numberClassTypeModel + orientation: ListView.Horizontal + //spacing: 10 //? + + delegate: Rectangle { + width: numberClassTypeModel.get(index).numberClassTypeHeaderWidth + height: numberClassTypeHeader.height / 1.5 + border.width: 1 + border.color: "black" + color: "lightsteelblue" + radius: 2 + + GCText { + id: numberClassHeaderCaption + + anchors.fill: parent + anchors.bottom: parent.bottom + fontSizeMode: Text.Fit + color: "black" + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + text: numberClassTypeModel.get(index).numberClassType + visible: numberClassTypeModel.get(index).numberClassTypeHeaderWidth === 0 ? false : true + } + } + } + } + + Rectangle { + id: numberClassHeaders + + width: mainZoneArea.width + height: mainZoneArea.height / 15 + anchors.top: numberClassTypeHeader.bottom + anchors.left: parent.left + anchors.right: parent.right + + border.color: "red" + border.width: 1 + + + GCText { + id: numberClassHeadersRectangleAdvice + height: parent.height + width: parent.width + anchors { + horizontalCenter: parent.horizontalCenter + verticalCenter: parent.verticalCenter + } + opacity: visualModel.count === 0 ? 1 : 0 + fontSizeMode: Text.Fit + color: "black" + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + text: qsTr("Drag here the class numbers") + } + + ListView { + id: classNameListView + + anchors { fill: parent} + model: visualModel + orientation: ListView.Horizontal + interactive: false + cacheBuffer: 50 + } + + DelegateModel { + id: visualModel + + model: numberClassListModel + delegate: nnumberClassHeaderElement //Qt.createComponent("NumberClassHeaderElement.qml") //ask johnny for some help there + } + } + + Component { // ? what to do when removed element ? TypeError: Cannot read property 'misplaced' of undefined + id: nnumberClassHeaderElement + + MouseArea { + id: dragArea + + property bool held: false + + width: mainZoneArea.width / numberClassListModel.count + height: numberClassHeaders.height + + drag.target: held ? content : undefined + drag.axis: Drag.XAxis + + onPressed: held = true + onReleased: { + if ((content.x < leftWidget.width) && held) //? don't understand why I have a content.x = 0 when held is not true, this point needs to be cleared + { + console.log("index className element",index) + numberClassListModel.get(index).element_src.dragEnabled = true + numberClassListModel.remove(index,1) + Activity.updateIntegerAndDecimalHeaderWidth() + } + held = false + } + + Rectangle { + id: content + + anchors { + horizontalCenter: parent.horizontalCenter + verticalCenter: parent.verticalCenter + } + + width: mainZoneArea.width / numberClassListModel.count + height: numberClassHeaders.height / 1.5 + border.width: 1 + //FIXME: when removing an element of NumberClassList model border color is stilll asked + border.color: numberClassListModel.get(index).misplaced === true ? "red" : "lightsteelblue" + color: dragArea.held ? "lightsteelblue" : "white" + Behavior on color { ColorAnimation { duration: 100 } } + radius: 2 + Drag.active: dragArea.held + Drag.source: dragArea + Drag.hotSpot.x: width / 2 + Drag.hotSpot.y: height / 2 + + states: State { + when: dragArea.held + + ParentChange { target: content; parent: root } + AnchorChanges { + target: content + anchors { horizontalCenter: undefined; verticalCenter: undefined } + } + } + + GCText { + id: numberClassHeaderCaption + + anchors.fill: parent + anchors.bottom: parent.bottom + fontSizeMode: Text.Fit + color: "black" + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + text: numberClassListModel.get(index).name //here there a problem when removing a number class + z: 100 + } + } + + DropArea { + anchors { fill: parent; margins: 10 } + onEntered: { + console.log("dragArea.DelegateModel.itemsIndex",dragArea.DelegateModel.itemsIndex) + console.log("classNameListView.count",classNameListView.count) + //move class name columns except the decimal part which stays always on the last position + if (dragArea.DelegateModel.itemsIndex < classNameListView.count - 1) { + numberClassListModel.move(drag.source.DelegateModel.itemsIndex, dragArea.DelegateModel.itemsIndex,1) + } + } + } + } + } + + + RowLayout { + id: numberClassDropAreasGridLayout + + anchors.top: numberClassHeaders.bottom + width: parent.width + height: parent.height - topBanner.height - numberClassHeaders.height - numberClassTypeHeader.height + spacing: 10 + + Repeater { + id: numberClassDropAreaRepeater + model: numberClassListModel + + NumberClassDropArea { + id: numberClassDropAreaElement + + //property alias numberWeightDragListModel: activity.background.numberWeightDragListModel //? + + className: name //name comes from numberClassListModel + + Layout.fillHeight: true + Layout.fillWidth: true + Layout.minimumWidth: 50 + Layout.preferredWidth: 100 + } + } + } + } + + + ListModel { + id: numberClassListModel + } + + ListModel { + id: numberClassDragListModel + } + + ListModel { + id: numberWeightDragListModel + } + + + //instruction rectangle + Rectangle { + id: instruction + anchors.fill: instructionTxt + opacity: 0.8 + radius: 10 + border.width: 2 + z: 10 + border.color: "black" + gradient: Gradient { + GradientStop { position: 0.0; color: "#000" } + GradientStop { position: 0.9; color: "#666" } + GradientStop { position: 1.0; color: "#AAA" } + } + + property alias text: instructionTxt.text + + Behavior on opacity { PropertyAnimation { duration: 200 } } + + //shows/hides the Instruction + MouseArea { + anchors.fill: parent + onClicked: instruction.hide() + enabled: instruction.opacity !== 0 + } + + function show() { + if(text) + opacity = 0.8 + } + function hide() { + opacity = 0 + } + } + + //display level objective + GCText { + id: instructionTxt + anchors { + top: background.vert ? parent.top : leftWidget.bottom + topMargin: -10 + horizontalCenter: background.horizontalCenter + } + opacity: instruction.opacity + z: instruction.z + fontSize: background.vert ? regularSize : smallSize + color: "white" + style: Text.Outline + styleColor: "black" + horizontalAlignment: Text.AlignHCenter + width: Math.max(Math.min(parent.width * 0.8, text.length * 8), parent.width * 0.3) + wrapMode: TextEdit.WordWrap + } + + + //display level objective + GCText { + id: warningTxt + anchors { + horizontalCenter: background.horizontalCenter + verticalCenter: background.verticalCenter + } + opacity: warningRectangle.opacity + z: warningRectangle.z + 1 + fontSize: regularSize + color: "white" + style: Text.Outline + styleColor: "black" + horizontalAlignment: Text.AlignHCenter + width: Math.max(Math.min(parent.width * 0.8, text.length * 8), parent.width * 0.3) + wrapMode: TextEdit.WordWrap + } + + Rectangle { + id: warningRectangle + anchors.fill: warningTxt + opacity: 0 + radius: 10 + border.width: 2 + z: 10 + border.color: "black" + gradient: Gradient { + GradientStop { position: 0.0; color: "#000" } + GradientStop { position: 0.9; color: "#666" } + GradientStop { position: 1.0; color: "#AAA" } + } + + property alias text: warningTxt.text + + Behavior on opacity { PropertyAnimation { duration: 200 } } + + //shows/hides the Instruction + MouseArea { + anchors.fill: parent + onClicked: warningRectangle.hide() + enabled: warningRectangle.opacity !== 0 + } + + function show() { + if(text) + opacity = 0.8 + } + function hide() { + opacity = 0 + } + } + + + + + + //dragable weights list (leftwidget) + Rectangle { + id: leftWidget + width: background.vert ? + items.cellSize * 1.74 : background.width + height: background.vert ? + background.height : items.cellSize * 1.74 + color: "#FFFF42" + border.color: "#FFD85F" + border.width: 4 + z: 4 + + + //grid with ok button and the different draggable number weights + Flickable { + id: flickableElement + + anchors.fill: parent + width: background.height + height: leftWidget.width + //contentHeight: gridView.height + contentHeight: gridView.height * 1.8 //? + contentWidth: leftWidget.width + boundsBehavior: Flickable.DragAndOvershootBounds + + Grid { + id: gridView + x: 10 + y: 10 + + width: parent.width + height: background.height + + //width: background.vert ? leftWidget.width : 3 * bar.height + // height: background.vert ? background.height - 2 * bar.height : bar.height + spacing: 10 + columns: background.vert ? 1 : 5 + + //ok button + Image { + id: okButton + source:"qrc:/gcompris/src/core/resource/bar_ok.svg" + sourceSize.width: items.cellSize * 1.5 + fillMode: Image.PreserveAspectFit + + MouseArea { + id: mouseArea + anchors.fill: parent + enabled: background.finished ? false : true + onPressed: okButton.opacity = 0.6 + onReleased: okButton.opacity = 1 + onClicked: { + Activity.checkAnswer() + } + } + } + + // numbers classes drag elements + Repeater { + model: numberClassDragListModel + + NumberClassDragElement { + id: classDragElement + + name: model.name + color: model.color + Drag.keys: model.dragkeys + } + } + + // numbers columns weights and numbers weigths drag elements + Repeater { + model: numberWeightDragListModel + + NumberWeightDragElement { + id: weightComponentDragElement + name: model.name + imageName: model.imageName + Drag.keys: model.dragkeys + weightValue: model.weightValue + caption: model.caption + color: model.color + selected: model.selected + } + } + } + } + } + + + //bar buttons + DialogHelp { + id: dialogHelp + onClose: home() + } + + Bar { + id: bar + content: BarEnumContent { value: help | home | level | reload | config} + onHelpClicked: { + displayDialog(dialogHelp) + } + onPreviousLevelClicked: Activity.previousLevel() + onNextLevelClicked: Activity.nextLevel() + onHomeClicked: activity.home() + onReloadClicked: Activity.reloadRandom() //? + onConfigClicked: { + dialogActivityConfig.active = true + displayDialog(dialogActivityConfig) + } + } + + Bonus { + id: bonus + } + } +} diff --git a/src/activities/numeration_weights_integer/numeration_weights_integer.js b/src/activities/numeration_weights_integer/numeration_weights_integer.js new file mode 100644 index 000000000..e7b191279 --- /dev/null +++ b/src/activities/numeration_weights_integer/numeration_weights_integer.js @@ -0,0 +1,537 @@ +/* GCompris - numeration.js + * + * Copyright (C) 2019 Emmanuel Charruau + * + * 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 QtQuick 2.6 as Quick + +var currentLevel = 0 +var numberOfLevel = 0 //? +var items + +var numbersToConvert = [] +var scorePercentage = 0 +var scorePourcentageStep = 0 +var numbersToConvertIndex = 0 +var selectedNumberWeightDragElementIndex = -1 +var numberHasADecimalPart = false + + +var fullClassNamesConstantArray = ["Decimal Part","Unit class","Thousand class","Million class","Milliard class"] +var classNamesUsedArray + +var numberClassesObj = { + "Decimal Part": { name: qsTr("Decimal Part"), color: "black", dragkeys: "NumberClassKey"}, + "Unit class": { name: qsTr("Unit class"), color: "black", dragkeys: "NumberClassKey"}, + "Thousand class": { name: qsTr("Thousand class"), color: "black", dragkeys: "NumberClassKey"}, + "Million class": { name: qsTr("Million class"), color: "black", dragkeys: "NumberClassKey"}, + "Milliard class": { name: qsTr("Milliard class"), color: "black", dragkeys: "NumberClassKey"} +} + +var numberWeightsColumnsArray = ["HundredColumn","TenColumn","UnitColumn"] + +var numberWeightComponentConstantArray = ["UnitColumn","TenColumn","HundredColumn","Unit","Ten","Hundred","Thousand","TenThousand", + "OneHundredThousand","OneMillion","TenMillion","OneHundredMillion", + "OneMilliard","TenMilliard","OneHundredMilliard"] + + + +var numberWeightDragArray = { + "UnitColumn": { name: qsTr("Unit"), caption: "Unit", imageName: "", weightValue: "1", dragkeys: "numberWeightHeaderKey", color: "lightskyblue", selected: false }, + "TenColumn": { name: qsTr("Ten"), caption: "Ten", imageName: "", weightValue: "10", dragkeys: "numberWeightHeaderKey", color: "lightskyblue", selected: false }, + "HundredColumn": { name: qsTr("Hundred"), caption: "Hundred", imageName: "", weightValue: "100", dragkeys: "numberWeightHeaderKey", color: "lightskyblue", selected: false }, + "Unit": { name: qsTr("Unit"), caption: "", imageName: "unit.svg", weightValue: "1", dragkeys: "numberWeightKey", color: "transparent", selected: false }, + "Ten": { name: qsTr("Unit"), caption: "", imageName: "ten.svg", weightValue: "10", dragkeys: "numberWeightKey", color: "transparent", selected: false }, + "Hundred": { name: qsTr("Unit"), caption: "", imageName: "hundred.svg", weightValue: "100", dragkeys: "numberWeightKey", color: "transparent", selected: false }, + "Thousand": { name: qsTr("Unit"), caption: "1000", imageName: "weightCaption.svg", weightValue: "1000", dragkeys: "numberWeightKey", color: "transparent", selected: false }, + "TenThousand": { name: qsTr("Unit"), caption: "10 000", imageName: "weightCaption.svg", weightValue: "10000", dragkeys: "numberWeightKey", color: "transparent", selected: false }, + "OneHundredThousand": { name: qsTr("Unit"), caption: "100 000", imageName: "weightCaption.svg", weightValue: "100000", dragkeys: "numberWeightKey", color: "transparent", selected: false }, + "OneMillion": { name: qsTr("Unit"), caption: "1 000 000", imageName: "weightCaption.svg", weightValue: "1000000", dragkeys: "numberWeightKey", color: "transparent", selected: false }, + "TenMillion": { name: qsTr("Unit"), caption: "10 000 000", imageName: "weightCaption.svg", weightValue: "10000000", dragkeys: "numberWeightKey", color: "transparent", selected: false }, + "OneHundredMillion": { name: qsTr("Unit"), caption: "1000 000 000", imageName: "weightCaption.svg", weightValue: "100000000", dragkeys: "numberWeightKey", color: "transparent" , selected: false }, + "OneMilliard": { name: qsTr("Unit"), caption: "1 000 000 000", imageName: "weightCaption.svg", weightValue: "1000000000", dragkeys: "numberWeightKey", color: "transparent" , selected: false }, + "TenMilliard": { name: qsTr("Unit"), caption: "10 000 000 000", imageName: "weightCaption.svg", weightValue: "10000000000", dragkeys: "numberWeightKey", color: "transparent" , selected: false }, + "OneHundredMilliard": { name: qsTr("Unit"), caption: "100 000 000 000", imageName: "weightCaption.svg", weightValue: "100000000000", dragkeys: "numberWeightKey", color: "transparent" , selected: false } +} + +// for what is used name in numberWeightDragArray ? //? + + +var numberClassTypeColumnsArray = ["Integer Part","Decimal Part"] + + + +function removeClassInNumberClassesArray(className) { + console.log(numberClassesArray) + var index = numberClassesArray.indexOf(className); + if (index > -1) { + numberClassesArray.splice(index, 1); + } + console.log(numberClassesArray) +} + +function removeClassInNumberClassesArray() { + numberClassesArray.pop(numberClass) +} + + +function setNumberWeightHeader(numberWeightImageTile,imageName,caption,weightValue) { + if ( imageName !== "") { + numberWeightImageTile.source = "qrc:/gcompris/src/activities/numeration_weights_integer/resource/images/" + imageName + } + numberWeightImageTile.caption = caption + numberWeightImageTile.weightValue = weightValue +} + +function setNumberWeightComponent(numberWeightImageTile,imageName,caption,weightValue) { + if ( imageName !== "") { + numberWeightImageTile.source = "qrc:/gcompris/src/activities/numeration_weights_integer/resource/images/" + imageName + numberWeightImageTile.caption = caption + numberWeightImageTile.weightValue = weightValue + } +} + +function removeNumberWeightComponent(numberWeightImageTile) { + numberWeightImageTile.source = "" + numberWeightImageTile.caption = "" + numberWeightImageTile.weightValue = "" + numberWeightImageTile.border.color = "black" +} + +function resetNumerationTable() { + for (var i = 0; i=0; i--,classNamesUsedIndex++) { + if (items.numberClassListModel.get(i).name === classNamesUsedArray[classNamesUsedIndex]) { + items.numberClassListModel.setProperty(i, "misplaced", false) + } + else { + items.numberClassListModel.setProperty(i, "misplaced", true) + allClassesColumnsInRightPositions = false + } + } + return allClassesColumnsInRightPositions +} + + +function expectedAndEnteredValuesAreEquals() { + var enteredValue = readNumerationTableEnteredValue() + console.log("enteredValue/parseInt(numbersToConvert[numbersToConvertIndex],10)",enteredValue + "/" + parseInt(numbersToConvert[numbersToConvertIndex],10)) + + //test if entered value is equal to number expected + if (enteredValue === parseInt(numbersToConvert[numbersToConvertIndex],10)) { + console.log("enteredValue/parseInt(numbersToConvert[numbersToConvertIndex],10)",enteredValue + "/" + parseInt(numbersToConvert[numbersToConvertIndex],10)) + return true + } + else { + return false + } +} + +function checkEnteredValue() { + var _expectedAndEnteredValuesAreEquals = expectedAndEnteredValuesAreEquals() + if (_expectedAndEnteredValuesAreEquals) { + return true + } + else { + return false + } +} + +function evaluateAndDisplayProgresses(correctAnswer) { + if (correctAnswer) { + items.bonus.good("flower") + console.log("1///////////////scorePercentage",scorePercentage) + scorePercentage = scorePercentage + scorePourcentageStep //? + console.log("2///////////////scorePercentage",scorePercentage) + items.progressBar.value = scorePercentage + if (scorePercentage > 97) { + nextLevel() + } + numbersToConvertIndex++ + items.numberToConvertRectangle.text = numbersToConvert[numbersToConvertIndex] + return + } + else { + items.bonus.bad("flower") + scorePercentage = scorePercentage - (2 * scorePourcentageStep) + if (scorePercentage < 0) scorePercentage = 0 + items.progressBar.value = scorePercentage + var numbersToConvertIndexPlus4 = numbersToConvertIndex + 4 + //we insert here an random additional value, otherwise there could be an overflow when adding the 2 values + //inserted when the user makes an error and that we are at the end of the array + if (numbersToConvertIndexPlus4 -1 > numbersToConvert.length ) { + var randomValueToInsert = numbersToConvert[Math.floor(Math.random() * numbersToConvert.length)] + numbersToConvert.push(randomValueToInsert) + } + //when user makes an error, the given error is inserted twice, one time to find the good result, a second time to be sure that the answer is understood + numbersToConvert.splice(numbersToConvertIndex+1, 0, numbersToConvert[numbersToConvertIndex]); + numbersToConvert.splice(numbersToConvertIndex+3, 0, numbersToConvert[numbersToConvertIndex]); + numbersToConvertIndex++ //? how can we catch here the stop signal to wait a little bit before to go to next question ? + items.numberToConvertRectangle.text = numbersToConvert[numbersToConvertIndex] + } +} + +function start(items_) { + items = items_ + currentLevel = 0 + + classNamesUsedArray = setClassNamesUsedArray(fullClassNamesConstantArray) + + numberHasADecimalPart = hasNumberADecimalPart() + setNumberClassTypeListModel() + updateIntegerAndDecimalHeaderWidth() + + setNumberClassDragListModel(fullClassNamesConstantArray) + setNumberWeightDragListModel(numberWeightComponentConstantArray) + initLevel() + + numberOfLevel = items.levels.length // ? +} + + +function setNumberClassTypeListModel() { + items.numberClassTypeModel.append({"numberClassType": "Integer Part", "numberClassTypeHeaderWidth": 0}) + if (hasNumberADecimalPart()) { + addDecimalHeaderToNumberClassTypeModel() + } +} + + +function setClassNamesUsedArray(fullClassNamesArray) { + var smallerNumberClass = items.levels[currentLevel].smallerNumberClass + var biggerNumberClass = items.levels[currentLevel].biggerNumberClass + if (!isClassNamePresentInfullClassNamesArray(fullClassNamesArray, smallerNumberClass)) { + return fullClassNamesConstantArray + } + if (!isClassNamePresentInfullClassNamesArray(fullClassNamesArray, biggerNumberClass)) { + return fullClassNamesConstantArray + } + return fullClassNamesArray.slice(fullClassNamesArray.indexOf(smallerNumberClass),fullClassNamesArray.indexOf(biggerNumberClass)+1) +} + +function isClassNamePresentInfullClassNamesArray(fullClassNamesArray, className) { + if (fullClassNamesArray.indexOf(className) !== -1) { + return true + } else { + items.warningRectangle.text = qsTr("The class name \"" + className + "\" is not present in the available list: \"" + fullClassNamesArray+ "\". Check your configuration file (lower case or uppercase error?).") + items.warningRectangle.show() + return false + } +} + +function hasNumberADecimalPart() { + for (var i=0; i + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/src/activities/numeration_weights_integer/resource/1/Data.qml b/src/activities/numeration_weights_integer/resource/1/Data.qml new file mode 100644 index 000000000..0abb6a0cd --- /dev/null +++ b/src/activities/numeration_weights_integer/resource/1/Data.qml @@ -0,0 +1,114 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2019 Emmanuel Charruau + * + * Authors: + * Emmanuel Charruau + * + * 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("Drag the different numbers weights to obtain a number between 1 and 99.") + difficulty: 1 + data: [ + { + "level" : "1", + "objective" : qsTr("Drag the number weights in the right cells to create numbers up to 9"), + //possible smallerNumberClass are "Decimal Part","Unit class","Thousand class","Million class","Milliard class" + "smallerNumberClass": "Unit class", + //"smallerNumberClass": "Decimal Part", + "biggerNumberClass": "Milliard class", + "numbers" : [ + "4", + "1", + "5", + "6", + "8", + "2", + "9", + "3", + "7", + "10" + ] + }, + { + "level" : "2", + "objective" : qsTr("Drag the number weights in the right cells to create numbers up to 20."), + "numbers" : [ + "14", + "2", + "11", + "2", + "7", + "18", + "5", + "19", + "13", + "20" + ] + }, + { + "level" : "3", + "objective" : qsTr("Drag the number weights in the right cells to create numbers up to 40"), + "numbers" : [ + "14", + "2", + "22", + "2", + "37", + "38", + "5", + "29", + "13", + "40" + ] + }, + { + "level" : "4", + "objective" : qsTr("Drag the number weights in the right cells to create numbers up to 60"), + "numbers" : [ + "54", + "23", + "22", + "2", + "43", + "57", + "5", + "39", + "53", + "60" + ] + }, + { + "level" : "5", + "objective" : qsTr("Drag the number weights in the right cells to create numbers up to 99"), + "numbers" : [ + "64", + "13", + "82", + "92", + "44", + "77", + "85", + "9", + "53", + "99" + ] + } + ] +} diff --git a/src/activities/numeration_weights_integer/resource/2/Data.qml b/src/activities/numeration_weights_integer/resource/2/Data.qml new file mode 100644 index 000000000..8663e7591 --- /dev/null +++ b/src/activities/numeration_weights_integer/resource/2/Data.qml @@ -0,0 +1,114 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2019 Emmanuel Charruau + * + * Authors: + * Emmanuel Charruau + * + * 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("Drag the different numbers weights to obtain a number between 1 and 999.") + difficulty: 1 + data: [ + { + "level" : "1", + "objective" : qsTr("Drag the number weights in the right cells to create numbers up to 99"), + //possible smallerNumberClass are "Decimal Part","Unit class","Thousand class","Million class","Milliard class" + "smallerNumberClass": "Unit class", + //"smallerNumberClass": "Decimal Part", + "biggerNumberClass": "Milliard class", + "numbers" : [ + "40", + "10", + "50", + "65", + "82", + "95", + "25", + "37", + "86", + "99" + ] + }, + { + "level" : "2", + "objective" : qsTr("Drag the number weights in the right cells to create numbers up to 199."), + "numbers" : [ + "155", + "10", + "125", + "15", + "109", + "56", + "101", + "158", + "89", + "112" + ] + }, + { + "level" : "3", + "objective" : qsTr("Drag the number weights in the right cells to create numbers up to 300"), + "numbers" : [ + "256", + "122", + "85", + "215", + "288", + "105", + "203", + "158", + "89", + "109" + ] + }, + { + "level" : "4", + "objective" : qsTr("Drag the number weights in the right cells to create numbers up to 700"), + "numbers" : [ + "556", + "422", + "285", + "615", + "588", + "105", + "303", + "358", + "689", + "699" + ] + }, + { + "level" : "5", + "objective" : qsTr("Drag the number weights in the right cells to create numbers up to 999"), + "numbers" : [ + "62", + "822", + "900", + "600", + "689", + "5", + "685", + "956", + "123", + "999" + ] + } + ] +} diff --git a/src/activities/numeration_weights_integer/resource/3/Data.qml b/src/activities/numeration_weights_integer/resource/3/Data.qml new file mode 100644 index 000000000..297a6a412 --- /dev/null +++ b/src/activities/numeration_weights_integer/resource/3/Data.qml @@ -0,0 +1,84 @@ +/* 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("Select a number on dice up to 9") + difficulty: 3 + data: [ + { + "level" : "1", + "objective" : qsTr("Select the number on dice up to 6"), + "words" : [ + "1", + "2", + "3", + "4", + "5", + "6" + ] + }, + { + "level" : "2", + "objective" : qsTr("Select the number on dice up to 7"), + "words" : [ + "1", + "2", + "3", + "4", + "5", + "6", + "7" + ] + }, + { + "level" : "3", + "objective" : qsTr("Select the number on dice up to 8"), + "words" : [ + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8" + ] + }, + { + "level" : "4", + "objective" : qsTr("Select the number on dice up to 9"), + "words" : [ + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9" + ] + } + ] +} diff --git a/src/activities/numeration_weights_integer/resource/images/hundred.svg b/src/activities/numeration_weights_integer/resource/images/hundred.svg new file mode 100644 index 000000000..72fa58b7d --- /dev/null +++ b/src/activities/numeration_weights_integer/resource/images/hundred.svg @@ -0,0 +1,500 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + centaine 100 + 2011-10-09T07:58:07 + + https://openclipart.org/detail/163171/centaine-100-by-cyrille + + + cyrille + + + + + 100 + cent + hundred + maths + mathématiques + numération + + + + + + + + + + + diff --git a/src/activities/numeration_weights_integer/resource/images/ten.svg b/src/activities/numeration_weights_integer/resource/images/ten.svg new file mode 100644 index 000000000..215e4954f --- /dev/null +++ b/src/activities/numeration_weights_integer/resource/images/ten.svg @@ -0,0 +1,416 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + dizaine 10 + 2011-10-09T07:59:09 + + https://openclipart.org/detail/163177/dizaine-10-by-cyrille + + + cyrille + + + + + 10 + dix + dizaine + maths + mathématiques + numération + ten + + + + + + + + + + + diff --git a/src/activities/numeration_weights_integer/resource/images/unit.svg b/src/activities/numeration_weights_integer/resource/images/unit.svg new file mode 100644 index 000000000..6225cb042 --- /dev/null +++ b/src/activities/numeration_weights_integer/resource/images/unit.svg @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + unité 1 + 2011-10-09T07:59:40 + + https://openclipart.org/detail/163183/unité-1--by-cyrille + + + cyrille + + + + + maths + mathématiques + numération + one + un + unité + + + + + + + + + + + diff --git a/src/activities/numeration_weights_integer/resource/images/weightCaption.svg b/src/activities/numeration_weights_integer/resource/images/weightCaption.svg new file mode 100644 index 000000000..16d749027 --- /dev/null +++ b/src/activities/numeration_weights_integer/resource/images/weightCaption.svg @@ -0,0 +1,53 @@ + + + + + +image/svg+xmlOpenclipart \ No newline at end of file