diff --git a/src/activities/clockgame/resource/1/Data.qml b/src/activities/clockgame/resource/1/Data.qml index edf183680..36103177b 100644 --- a/src/activities/clockgame/resource/1/Data.qml +++ b/src/activities/clockgame/resource/1/Data.qml @@ -1,57 +1,58 @@ /* GCompris - Data.qml * * Copyright (C) 2018 Johnny Jazeix * * Authors: * Johnny Jazeix * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import QtQuick 2.6 import GCompris 1.0 import "../../../../core" Dataset { objective: qsTr("Set and display time on analog clock for full half and quarters of an hour.") + difficulty: 2 data: [ { "numberOfSubLevels": 5, "fixedMinutes": 0, "displayMinutesHand": false, "fixedSeconds": 0, "displaySecondsHand": false }, { "numberOfSubLevels": 5, "fixedMinutes": 15, "displayMinutesHand": true, "fixedSeconds": 0, "displaySecondsHand": false }, { "numberOfSubLevels": 5, "fixedMinutes": 30, "displayMinutesHand": true, "fixedSeconds": 0, "displaySecondsHand": false }, { "numberOfSubLevels": 5, "fixedMinutes": 45, "displayMinutesHand": true, "fixedSeconds": 0, "displaySecondsHand": false } ] } diff --git a/src/activities/clockgame/resource/2/Data.qml b/src/activities/clockgame/resource/2/Data.qml index de4192430..21c92b703 100644 --- a/src/activities/clockgame/resource/2/Data.qml +++ b/src/activities/clockgame/resource/2/Data.qml @@ -1,53 +1,54 @@ /* GCompris - Data.qml * * Copyright (C) 2018 Johnny Jazeix * * Authors: * Johnny Jazeix * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import QtQuick 2.6 import GCompris 1.0 import "../../../../core" Dataset { objective: qsTr("Set and display time on analog clock for a time containing minutes and seconds.") + difficulty: 4 data: [ { "numberOfSubLevels": 5, "displayMinutesHand": true, "fixedSeconds": 0, "displaySecondsHand": false }, { "numberOfSubLevels": 5, "fixedMinutes": 0, "displayMinutesHand": true, "fixedSeconds": 30, "displaySecondsHand": true }, { "numberOfSubLevels": 5, "displayMinutesHand": true, "displaySecondsHand": true }, { "numberOfSubLevels": 10, "displayMinutesHand": true, "displaySecondsHand": true, "zonesVisible": false } ] } diff --git a/src/activities/reversecount/resource/1/Data.qml b/src/activities/reversecount/resource/1/Data.qml index 496338136..fa2fb42a7 100644 --- a/src/activities/reversecount/resource/1/Data.qml +++ b/src/activities/reversecount/resource/1/Data.qml @@ -1,49 +1,50 @@ /* GCompris - Data.qml * * Copyright (C) 2018 Johnny Jazeix * * Authors: * Johnny Jazeix * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import QtQuick 2.6 import GCompris 1.0 import "../../../../core" Dataset { objective: qsTr("Numbers between 1 and 8") + difficulty: 1 data: [ { - "maxNumber": 1, /* Max number on each domino side */ "minNumber": 1, + "maxNumber": 1, /* Max number on each domino side */ "numberOfFish": 3 }, { - "maxNumber": 2, "minNumber": 1, + "maxNumber": 2, "numberOfFish": 4 }, { - "maxNumber": 3, "minNumber": 1, + "maxNumber": 3, "numberOfFish": 5 }, { - "maxNumber": 4, "minNumber": 1, + "maxNumber": 4, "numberOfFish": 5 } ] } diff --git a/src/activities/reversecount/resource/2/Data.qml b/src/activities/reversecount/resource/2/Data.qml index a790cd10a..c4f15968f 100644 --- a/src/activities/reversecount/resource/2/Data.qml +++ b/src/activities/reversecount/resource/2/Data.qml @@ -1,54 +1,55 @@ /* GCompris - Data.qml * * Copyright (C) 2018 Johnny Jazeix * * Authors: * Johnny Jazeix * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import QtQuick 2.6 import GCompris 1.0 import "../../../../core" Dataset { objective: qsTr("Numbers between 2 and 18") + difficulty: 2 data: [ { - "maxNumber": 5, "minNumber": 2, + "maxNumber": 5, "numberOfFish": 5 }, { - "maxNumber": 6, "minNumber": 3, + "maxNumber": 6, "numberOfFish": 5 }, { - "maxNumber": 7, "minNumber": 4, + "maxNumber": 7, "numberOfFish": 5 }, { - "maxNumber": 8, "minNumber": 4, + "maxNumber": 8, "numberOfFish": 5 }, { - "maxNumber": 9, "minNumber": 5, + "maxNumber": 9, "numberOfFish": 5 } ] } diff --git a/src/core/Dataset.qml b/src/core/Dataset.qml index c2803e55e..f9fe9db75 100644 --- a/src/core/Dataset.qml +++ b/src/core/Dataset.qml @@ -1,38 +1,39 @@ /* GCompris - Dataset.qml * * Copyright (C) 2018 Johnny Jazeix * * Authors: * Johnny Jazeix * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import QtQuick 2.6 import GCompris 1.0 /** * Contains objective and data variable to instanciate new dataset. * Each activity defines its own data format. * @ingroup components * * Used by each activities wanting to provide multiple dataset along with * their objectives. * */ Item { id: dataset property string objective + property int difficulty property var data } diff --git a/src/core/DialogChooseLevel.qml b/src/core/DialogChooseLevel.qml index c7e9b654b..191a818aa 100644 --- a/src/core/DialogChooseLevel.qml +++ b/src/core/DialogChooseLevel.qml @@ -1,289 +1,299 @@ /* GCompris - DialogChooseLevel.qml * * Copyright (C) 2018 Johnny Jazeix * * Authors: * Johnny Jazeix * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import QtQuick 2.6 import QtQuick.Controls 1.5 import GCompris 1.0 /** * todo * @ingroup components * * todo * * @sa ApplicationSettings * @inherit QtQuick.Item */ Rectangle { id: dialogChooseLevel visible: false /* Public interface: */ /** * type:string * The name of the activity in case of per-activity config. * * Will be autogenerated unless set by the caller. */ property string activityName /// @cond INTERNAL_DOCS property bool isDialog: true /** * type:string * Title of the configuration dialog. */ - readonly property string title: currentActivity ? qsTr("%1 levels").arg(currentActivity.title) : "" + readonly property string title: currentActivity ? qsTr("%1 settings").arg(currentActivity.title) : "" property var difficultiesModel: [] property QtObject currentActivity property string chosenLevel /// @endcond /** * Emitted when the config dialog has been closed. */ signal close /** * Emitted when the config dialog has been started. */ signal start signal stop signal saveData signal startActivity color: "#696da3" border.color: "black" border.width: 1 onCurrentActivityChanged: initialize() function initialize() { activityName = currentActivity.name.split('/')[0] chosenLevel = currentActivity.currentLevel difficultiesModel = [] for(var level in currentActivity.levels) { objectiveLoader.dataFiles.push({"level": currentActivity.levels[level], "file": "qrc:/gcompris/src/activities/"+activityName+"/resource/"+currentActivity.levels[level]+"/Data.qml"}) } objectiveLoader.start() } Loader { id: objectiveLoader property var dataFiles: [] property var currentFile signal start signal stop onStart: { var file = dataFiles.shift() currentFile = file source = file.file.toString() } onLoaded: { - difficultiesModel.push({"level": currentFile.level, "objective": item.objective}) + difficultiesModel.push({"level": currentFile.level, "objective": item.objective, "difficulty": item.difficulty}) if(dataFiles.length != 0) { start() } else { stop() } } onStop: { difficultiesRepeater.model = difficultiesModel } } Row { visible: true spacing: 2 Item { width: 10; height: 1 } Column { spacing: 10 anchors.top: parent.top Item { width: 1; height: 10 } Rectangle { color: "#e6e6e6" radius: 6.0 width: dialogChooseLevel.width - 30 height: title.height * 1.2 border.color: "black" border.width: 2 Row { spacing: 2 padding: 8 Image { id: titleIcon anchors { left: parent.left top: parent.top margins: 4 * ApplicationInfo.ratio } } GCText { id: title text: dialogChooseLevel.title width: dialogChooseLevel.width - (30 + cancel.width) horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: "black" fontSize: 20 font.weight: Font.DemiBold wrapMode: Text.WordWrap } } } Row { id: datasetOptionsRow height: datasetVisibleButton.height width: parent.width spacing: parent.width / 4 anchors.leftMargin: parent.width / 8 Button { id: datasetVisibleButton text: qsTr("Dataset") width: parent.width / 3 property bool selected: true style: GCButtonStyle { selected: datasetVisibleButton.selected } onClicked: { selected = true; } } Button { id: optionsVisibleButton text: qsTr("Options") width: parent.width / 3 style: GCButtonStyle { selected: !datasetVisibleButton.selected } onClicked: { datasetVisibleButton.selected = false; } //showOptions() } } Rectangle { color: "#e6e6e6" radius: 6.0 width: dialogChooseLevel.width - 30 height: dialogChooseLevel.height - (30 + title.height * 1.2) - saveAndPlayRow.height - datasetOptionsRow.height - 3 * parent.spacing border.color: "black" border.width: 2 Flickable { id: flick anchors.margins: 8 anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom flickableDirection: Flickable.VerticalFlick clip: true contentHeight: contentItem.childrenRect.height + 40 * ApplicationInfo.ratio ExclusiveGroup { id: levelsGroup } Column { + spacing: 10 Repeater { id: difficultiesRepeater - delegate: GCDialogCheckBox { - id: objective - width: dialogChooseLevel.width - 30 - 2 * flick.anchors.margins - text: modelData.objective - exclusiveGroup: levelsGroup - checked: chosenLevel == modelData.level - onClicked: chosenLevel = modelData.level + delegate: Row { + height: objective.height + Image { + id: difficultyIcon + source: "qrc:/gcompris/src/core/resource/difficulty" + + modelData.difficulty + ".svg"; + sourceSize.height: objective.indicatorImageHeight + anchors.verticalCenter: objective.verticalCenter + } + GCDialogCheckBox { + id: objective + width: dialogChooseLevel.width - 30 - difficultyIcon.width - 2 * flick.anchors.margins + text: modelData.objective + exclusiveGroup: levelsGroup + checked: chosenLevel == modelData.level + onClicked: chosenLevel = modelData.level + } } } } } // The scroll buttons GCButtonScroll { anchors.right: parent.right anchors.rightMargin: 5 * ApplicationInfo.ratio anchors.bottom: flick.bottom anchors.bottomMargin: 5 * ApplicationInfo.ratio onUp: flick.flick(0, 1400) onDown: flick.flick(0, -1400) upVisible: flick.visibleArea.yPosition <= 0 ? false : true downVisible: flick.visibleArea.yPosition + flick.visibleArea.heightRatio >= 1 ? false : true } - } Row { id: saveAndPlayRow height: cancelButton.height width: parent.width spacing: parent.width / 16 Button { id: cancelButton text: qsTr("Cancel") width: parent.width / 4 property bool selected: true style: GCButtonStyle {} onClicked: dialogChooseLevel.close() } Button { id: saveButton text: qsTr("Save") width: parent.width / 4 property bool selected: true style: GCButtonStyle { } onClicked: { saveData(); } } Button { id: saveAndStartButton text: qsTr("Save and start") width: parent.width / 3 style: GCButtonStyle { } onClicked: { saveData(); startActivity(); } } } Item { width: 1; height: 10 } } } // The cancel button GCButtonCancel { id: cancel onClose: { parent.close() } } }