Commit a55e9714 authored by Shubham Mishra's avatar Shubham Mishra Committed by Johnny Jazeix

chronos, add multiple dataset

parent 39237eb0
......@@ -32,6 +32,7 @@ ActivityBase {
// But for imageName for example, we reuse the images of babymatch, so we need to differentiate them
property string imagesUrl: boardsUrl
property string soundsUrl: boardsUrl
property bool useMultipleDataset: false
property string boardsUrl: "qrc:/gcompris/src/activities/babymatch/resource/"
property int levelCount: 7
property bool answerGlow: true //For highlighting the answers
......@@ -51,6 +52,7 @@ ActivityBase {
property bool vert: background.width >= background.height
Component.onCompleted: {
dialogActivityConfig.initialize()
activity.start.connect(start)
activity.stop.connect(stop)
}
......@@ -70,6 +72,7 @@ ActivityBase {
property alias instruction: instruction
property alias toolTip: toolTip
property alias score: score
property var levels: activity.datasetLoader.data.length !== 0 ? activity.datasetLoader.data : null
property alias dataset: dataset
}
......@@ -78,7 +81,7 @@ ActivityBase {
asynchronous: false
}
onStart: { Activity.start(items, imagesUrl, soundsUrl, boardsUrl, levelCount, answerGlow, displayDropCircle) }
onStart: { Activity.start(items, imagesUrl, soundsUrl, boardsUrl, levelCount, answerGlow, displayDropCircle, useMultipleDataset) }
onStop: { Activity.stop() }
DialogHelp {
......@@ -88,13 +91,42 @@ ActivityBase {
Bar {
id: bar
content: BarEnumContent { value: help | home | level }
content: BarEnumContent { value: useMultipleDataset ? (help | home | level | activityConfig) : (help | home | level) }
onHelpClicked: {displayDialog(dialogHelp)}
onPreviousLevelClicked: Activity.previousLevel()
onNextLevelClicked: Activity.nextLevel()
onHomeClicked: activity.home()
onHomeClicked: {
Activity.resetData();
activity.home()
}
onActivityConfigClicked: {
Activity.initLevel()
displayDialog(dialogActivityConfig)
}
}
DialogChooseLevel {
id: dialogActivityConfig
currentActivity: activity.activityInfo
onSaveData: {
levelFolder = dialogActivityConfig.chosenLevels
currentActivity.currentLevels = dialogActivityConfig.chosenLevels
ApplicationSettings.setCurrentLevels(currentActivity.name, dialogActivityConfig.chosenLevels)
activity.focus = true
}
onLoadData: {
if(activityData) {
Activity.initLevel()
}
}
onClose: {
home()
}
onStartActivity: {
background.start()
}
}
Score {
id: score
visible: numberOfSubLevels > 1
......
......@@ -23,6 +23,7 @@
.import QtQuick 2.6 as Quick
.import GCompris 1.0 as GCompris //for ApplicationInfo
var useMultipleDataset
var currentLevel = 1
var currentSubLevel = 0
var numberOfLevel
......@@ -37,20 +38,34 @@ var spots = []
var showText = []
var displayDropCircle
function start(items_, imagesUrl_, soundsUrl_, boardsUrl_, levelCount_, answerGlow_, displayDropCircle_) {
function start(items_, imagesUrl_, soundsUrl_, boardsUrl_, levelCount_, answerGlow_, displayDropCircle_, useMultipleDataset_) {
items = items_
imagesUrl = imagesUrl_
soundsUrl = soundsUrl_
boardsUrl = boardsUrl_
numberOfLevel = levelCount_
useMultipleDataset = useMultipleDataset_
numberOfLevel = useMultipleDataset ? items.levels.length : levelCount_
glowEnabledDefault = answerGlow_
displayDropCircle = displayDropCircle_
currentLevel = 1
currentSubLevel = 0
numberOfSubLevel = 0
resetData()
initLevel()
}
function resetData() {
items.availablePieces.model.clear()
for(var i = 0 ; i < spots.length ; ++ i)
spots[i].destroy()
spots = []
for(var i = 0 ; i < showText.length ; ++ i)
showText[i].destroy()
showText = []
initLevel()
items.backgroundPiecesModel.clear()
items.backgroundImage.source = ""
}
function stop() {
......@@ -60,22 +75,12 @@ function stop() {
function initLevel() {
items.bar.level = currentLevel
var filename = boardsUrl + "board" + "/" + "board" + currentLevel + "_" + currentSubLevel + ".qml"
items.dataset.source = filename
if(useMultipleDataset)
items.dataset.source = items.levels[currentLevel-1][currentSubLevel];
else
items.dataset.source = boardsUrl + "board" + "/" + "board" + currentLevel + "_" + currentSubLevel + ".qml"
var levelData = items.dataset.item
items.availablePieces.model.clear()
for(var i = 0 ; i < spots.length ; ++ i)
spots[i].destroy()
spots = []
for(var i = 0 ; i < showText.length ; ++ i)
showText[i].destroy()
showText = []
items.backgroundPiecesModel.clear()
items.backgroundImage.source = ""
resetData();
items.availablePieces.view.currentDisplayedGroup = 0
items.availablePieces.view.previousNavigation = 1
items.availablePieces.view.nextNavigation = 1
......
......@@ -41,4 +41,5 @@ ActivityInfo {
credit: qsTr("Moon photo is copyright NASA. The space sounds come from Tuxpaint and Vegastrike which are released under the GPL license. The transportation images are copyright Franck Doucet. Dates of Transportation are based on those found in &lt;https://www.wikipedia.org&gt;.")
section: "sciences history"
createdInVersion: 4000
levels: "1,2"
}
GCOMPRIS_ADD_RCC(activities/chronos *.qml *.svg *.js resource/board/* resource/images/* resource/sound/*.${COMPRESSED_AUDIO})
GCOMPRIS_ADD_RCC(activities/chronos *.qml *.svg *.js resource/*.svg resource/*/*)
......@@ -25,10 +25,10 @@ import "../babymatch"
Babymatch {
id: activity
onStart: focus = true
onStop: {}
useMultipleDataset: true
boardsUrl: "qrc:/gcompris/src/activities/chronos/resource/"
levelCount: 6
}
/* GCompris - Data.qml
*
* Copyright (C) 2020 Shubham Mishra <email.shivam828787@gmail.com>
*
* Authors:
* Shubham Mishra <email.shivam828787@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
import "../../../../core"
Dataset {
objective: qsTr("For children who can read numbers")
difficulty: 5
data: [
[
"qrc:/gcompris/src/activities/chronos/resource/board/board1_0.qml"
],
[
"qrc:/gcompris/src/activities/chronos/resource/board/board3_0.qml"
],
[
"qrc:/gcompris/src/activities/chronos/resource/board/board4_0.qml"
]
]
}
/* GCompris - Data.qml
*
* Copyright (C) 2020 Shubham Mishra <email.shivam828787@gmail.com>
*
* Authors:
* Shubham Mishra <email.shivam828787@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
import "../../../../core"
Dataset {
objective: qsTr("For children who can read words")
difficulty: 6
data: [
[
"qrc:/gcompris/src/activities/chronos/resource/board/board2_0.qml"
],
[
"qrc:/gcompris/src/activities/chronos/resource/board/board5_0.qml",
"qrc:/gcompris/src/activities/chronos/resource/board/board5_1.qml",
"qrc:/gcompris/src/activities/chronos/resource/board/board5_2.qml",
"qrc:/gcompris/src/activities/chronos/resource/board/board5_3.qml",
"qrc:/gcompris/src/activities/chronos/resource/board/board5_4.qml",
],
[
"qrc:/gcompris/src/activities/chronos/resource/board/board6_0.qml",
"qrc:/gcompris/src/activities/chronos/resource/board/board6_1.qml",
"qrc:/gcompris/src/activities/chronos/resource/board/board6_2.qml",
"qrc:/gcompris/src/activities/chronos/resource/board/board6_3.qml",
]
]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment