summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay Kumar <[email protected]>2019-09-01 10:28:33 +0200
committerJohnny Jazeix <[email protected]>2019-09-01 10:28:33 +0200
commit57985fcaf8191860eca3648f34d1919b8b450d42 (patch)
treec7da8cc9e2dfea22dfd9a256c9d4bd3c91df1f74
parent160543e4075a7765609c1f819c3a25c60f58745a (diff)
target, add multiple datasetmultiple_dataset
-rw-r--r--src/activities/target/ActivityInfo.qml1
-rw-r--r--src/activities/target/Target.qml28
-rw-r--r--src/activities/target/TargetItem.qml5
-rw-r--r--src/activities/target/resource/1/Data.qml59
-rw-r--r--src/activities/target/resource/2/Data.qml64
-rw-r--r--src/activities/target/resource/3/Data.qml70
-rw-r--r--src/activities/target/resource/4/Data.qml74
-rw-r--r--src/activities/target/resource/5/Data.qml78
-rw-r--r--src/activities/target/target.js79
9 files changed, 381 insertions, 77 deletions
diff --git a/src/activities/target/ActivityInfo.qml b/src/activities/target/ActivityInfo.qml
index 5be887a..be3346b 100644
--- a/src/activities/target/ActivityInfo.qml
+++ b/src/activities/target/ActivityInfo.qml
@@ -37,4 +37,5 @@ ActivityInfo {
credit: ""
section: "math addition arithmetic"
createdInVersion: 0
+ levels: "1,2,3,4,5"
}
diff --git a/src/activities/target/Target.qml b/src/activities/target/Target.qml
index 9fe5bd1..e4be14b 100644
--- a/src/activities/target/Target.qml
+++ b/src/activities/target/Target.qml
@@ -50,6 +50,7 @@ ActivityBase {
}
Component.onCompleted: {
+ dialogActivityConfig.initialize()
activity.start.connect(start)
activity.stop.connect(stop)
}
@@ -62,6 +63,7 @@ ActivityBase {
property alias bar: bar
property alias bonus: bonus
property alias targetModel: targetItem.model
+ property var levels: activity.datasetLoader.item.data
property alias targetItem: targetItem
property alias userEntry: userEntry
property int currentArrow
@@ -164,7 +166,7 @@ ActivityBase {
userEntry.text += text
- if(targetItem.scoreTotal === userEntry.text)
+ if(targetItem.scoreTotal.toString() === userEntry.text)
bonus.good("flower")
}
@@ -208,6 +210,25 @@ ActivityBase {
onError: console.log("VirtualKeyboard error: " + msg);
}
+ DialogChooseLevel {
+ id: dialogActivityConfig
+ currentActivity: activity.activityInfo
+
+ onSaveData: {
+ levelFolder = dialogActivityConfig.chosenLevel
+ currentActivity.currentLevel = dialogActivityConfig.chosenLevel
+ ApplicationSettings.setCurrentLevel(currentActivity.name, dialogActivityConfig.chosenLevel)
+ background.start()
+ home()
+ }
+ onClose: {
+ home()
+ }
+ onStartActivity: {
+ background.start()
+ }
+ }
+
DialogHelp {
id: dialogHelp
onClose: home()
@@ -216,10 +237,13 @@ ActivityBase {
Bar {
id: bar
anchors.bottom: keyboard.top
- content: BarEnumContent { value: help | home | level }
+ content: BarEnumContent { value: help | home | level | activityConfig }
onHelpClicked: {
displayDialog(dialogHelp)
}
+ onActivityConfigClicked: {
+ displayDialog(dialogActivityConfig)
+ }
onPreviousLevelClicked: Activity.previousLevel()
onNextLevelClicked: Activity.nextLevel()
onHomeClicked: activity.home()
diff --git a/src/activities/target/TargetItem.qml b/src/activities/target/TargetItem.qml
index 0d72142..5ed138a 100644
--- a/src/activities/target/TargetItem.qml
+++ b/src/activities/target/TargetItem.qml
@@ -151,6 +151,11 @@ Image {
GCText {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
+ width: ApplicationInfo.ratio * 30
+ horizontalAlignment: Text.AlignHCenter
+ font.pointSize: 20
+ minimumPointSize: 5
+ fontSizeMode: Text.Fit
text: score
}
diff --git a/src/activities/target/resource/1/Data.qml b/src/activities/target/resource/1/Data.qml
new file mode 100644
index 0000000..f1a157d
--- /dev/null
+++ b/src/activities/target/resource/1/Data.qml
@@ -0,0 +1,59 @@
+/* GCompris - Data.qml
+ *
+ * Copyright (C) 2019 Akshay Kumar <[email protected]>
+ *
+ * Authors:
+ * Akshay Kumar <[email protected]>
+ *
+ * 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 QtQuick 2.6
+import GCompris 1.0
+import "../../../../core"
+
+Dataset {
+ objective: qsTr("Practice addition on targets with max value 10")
+ difficulty: 2
+ property var colors: [
+ "#ff1b00",
+ "#7edee2",
+ "#f1f500",
+ "#3dff00",
+ "#b7d2d4",
+ "#6db5ba"
+ ]
+ data: [
+ [
+ {size: 50, color: colors[0], score: 5},
+ {size: 100, color: colors[1], score: 4},
+ {size: 150, color: colors[2], score: 3},
+ {size: 200, color: colors[3], score: 2},
+ {size: 250, color: colors[4], score: 1}
+ ],
+ [
+ {size: 50, color: colors[0], score: 7},
+ {size: 100, color: colors[1], score: 5},
+ {size: 150, color: colors[2], score: 3},
+ {size: 200, color: colors[3], score: 2},
+ {size: 250, color: colors[4], score: 1}
+ ],
+ [
+ {size: 50, color: colors[0], score: 10},
+ {size: 100, color: colors[1], score: 7},
+ {size: 150, color: colors[2], score: 5},
+ {size: 200, color: colors[3], score: 3},
+ {size: 250, color: colors[4], score: 2}
+ ]
+ ]
+}
diff --git a/src/activities/target/resource/2/Data.qml b/src/activities/target/resource/2/Data.qml
new file mode 100644
index 0000000..b674e23
--- /dev/null
+++ b/src/activities/target/resource/2/Data.qml
@@ -0,0 +1,64 @@
+/* GCompris - Data.qml
+ *
+ * Copyright (C) 2019 Akshay Kumar <[email protected]>
+ *
+ * Authors:
+ * Akshay Kumar <[email protected]>
+ *
+ * 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 QtQuick 2.6
+import GCompris 1.0
+import "../../../../core"
+
+Dataset {
+ objective: qsTr("Practice addition on targets with max value 50")
+ difficulty: 3
+ property var colors: [
+ "#ff1b00",
+ "#7edee2",
+ "#f1f500",
+ "#3dff00",
+ "#b7d2d4",
+ "#6db5ba"
+ ]
+ data: [
+ [
+ {size: 50, color: colors[0], score: 20},
+ {size: 100, color: colors[1], score: 10},
+ {size: 150, color: colors[2], score: 8},
+ {size: 200, color: colors[3], score: 4},
+ {size: 250, color: colors[4], score: 2},
+ {size: 300, color: colors[5], score: 1}
+ ],
+ [
+ {size: 50, color: colors[0], score: 30},
+ {size: 100, color: colors[1], score: 20},
+ {size: 150, color: colors[2], score: 10},
+ {size: 200, color: colors[3], score: 8},
+ {size: 250, color: colors[4], score: 4},
+ {size: 300, color: colors[5], score: 2},
+ {size: 350, color: colors[5], score: 1}
+ ],
+ [
+ {size: 50, color: colors[0], score: 50},
+ {size: 100, color: colors[1], score: 20},
+ {size: 150, color: colors[2], score: 10},
+ {size: 200, color: colors[3], score: 8},
+ {size: 250, color: colors[4], score: 4},
+ {size: 300, color: colors[5], score: 2},
+ {size: 350, color: colors[5], score: 1}
+ ]
+ ]
+}
diff --git a/src/activities/target/resource/3/Data.qml b/src/activities/target/resource/3/Data.qml
new file mode 100644
index 0000000..880285a
--- /dev/null
+++ b/src/activities/target/resource/3/Data.qml
@@ -0,0 +1,70 @@
+/* GCompris - Data.qml
+ *
+ * Copyright (C) 2019 Akshay Kumar <[email protected]>
+ *
+ * Authors:
+ * Akshay Kumar <[email protected]>
+ *
+ * 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 QtQuick 2.6
+import GCompris 1.0
+import "../../../../core"
+
+Dataset {
+ objective: qsTr("Practice addition on targets with max value 500")
+ difficulty: 4
+ property var colors: [
+ "#ff1b00",
+ "#7edee2",
+ "#f1f500",
+ "#3dff00",
+ "#b7d2d4",
+ "#6db5ba"
+ ]
+ data: [
+ [
+ {size: 50, color: colors[0], score: 100},
+ {size: 100, color: colors[1], score: 20},
+ {size: 150, color: colors[2], score: 10},
+ {size: 200, color: colors[3], score: 8},
+ {size: 250, color: colors[4], score: 4},
+ {size: 300, color: colors[5], score: 2},
+ {size: 350, color: colors[5], score: 1}
+ ],
+ [
+ {size: 50, color: colors[0], score: 300},
+ {size: 100, color: colors[1], score: 100},
+ {size: 150, color: colors[2], score: 30},
+ {size: 200, color: colors[3], score: 20},
+ {size: 250, color: colors[3], score: 10},
+ {size: 300, color: colors[4], score: 8},
+ {size: 350, color: colors[4], score: 4},
+ {size: 400, color: colors[5], score: 2},
+ {size: 450, color: colors[5], score: 1},
+ ],
+ [
+ {size: 50, color: colors[0], score: 500},
+ {size: 100, color: colors[1], score: 300},
+ {size: 150, color: colors[2], score: 100},
+ {size: 200, color: colors[2], score: 30},
+ {size: 250, color: colors[3], score: 20},
+ {size: 300, color: colors[3], score: 10},
+ {size: 350, color: colors[4], score: 8},
+ {size: 400, color: colors[4], score: 4},
+ {size: 450, color: colors[5], score: 2},
+ {size: 450, color: colors[5], score: 1}
+ ]
+ ]
+}
diff --git a/src/activities/target/resource/4/Data.qml b/src/activities/target/resource/4/Data.qml
new file mode 100644
index 0000000..f7fb6fb
--- /dev/null
+++ b/src/activities/target/resource/4/Data.qml
@@ -0,0 +1,74 @@
+/* GCompris - Data.qml
+ *
+ * Copyright (C) 2019 Akshay Kumar <[email protected]>
+ *
+ * Authors:
+ * Akshay Kumar <[email protected]>
+ *
+ * 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 QtQuick 2.6
+import GCompris 1.0
+import "../../../../core"
+
+Dataset {
+ objective: qsTr("Practice addition on targets with max value 50000")
+ difficulty: 5
+ property var colors: [
+ "#ff1b00",
+ "#7edee2",
+ "#f1f500",
+ "#3dff00",
+ "#b7d2d4",
+ "#6db5ba"
+ ]
+ data: [
+ [
+ {size: 50, color: colors[0], score: 100},
+ {size: 100, color: colors[1], score: 20},
+ {size: 150, color: colors[2], score: 10},
+ {size: 200, color: colors[3], score: 8},
+ {size: 250, color: colors[4], score: 4},
+ {size: 300, color: colors[5], score: 2},
+ {size: 350, color: colors[5], score: 1}
+ ],
+ [
+ {size: 50, color: colors[0], score: 10000},
+ {size: 100, color: colors[1], score: 4000},
+ {size: 150, color: colors[1], score: 1000},
+ {size: 200, color: colors[2], score: 300},
+ {size: 250, color: colors[2], score: 100},
+ {size: 300, color: colors[3], score: 30},
+ {size: 350, color: colors[3], score: 10},
+ {size: 400, color: colors[4], score: 8},
+ {size: 450, color: colors[4], score: 4},
+ {size: 500, color: colors[5], score: 2},
+ {size: 550, color: colors[5], score: 1}
+ ],
+ [
+ {size: 50, color: colors[0], score: 50000},
+ {size: 100, color: colors[1], score: 10000},
+ {size: 150, color: colors[1], score: 4000},
+ {size: 200, color: colors[2], score: 1000},
+ {size: 250, color: colors[2], score: 300},
+ {size: 300, color: colors[3], score: 100},
+ {size: 350, color: colors[3], score: 30},
+ {size: 400, color: colors[4], score: 10},
+ {size: 450, color: colors[4], score: 8},
+ {size: 500, color: colors[5], score: 4},
+ {size: 550, color: colors[5], score: 2},
+ {size: 600, color: colors[5], score: 1},
+ ]
+ ]
+}
diff --git a/src/activities/target/resource/5/Data.qml b/src/activities/target/resource/5/Data.qml
new file mode 100644
index 0000000..17b417d
--- /dev/null
+++ b/src/activities/target/resource/5/Data.qml
@@ -0,0 +1,78 @@
+/* GCompris - Data.qml
+ *
+ * Copyright (C) 2019 Akshay Kumar <[email protected]>
+ *
+ * Authors:
+ * Akshay Kumar <[email protected]>
+ *
+ * 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 QtQuick 2.6
+import GCompris 1.0
+import "../../../../core"
+
+Dataset {
+ objective: qsTr("Practice addition on targets with max value 500000")
+ difficulty: 6
+ property var colors: [
+ "#ff1b00",
+ "#7edee2",
+ "#f1f500",
+ "#3dff00",
+ "#b7d2d4",
+ "#6db5ba",
+ "#ffffff"
+ ]
+
+ data: [
+ [
+ {size: 50, color: colors[0], score: 100},
+ {size: 100, color: colors[1], score: 20},
+ {size: 150, color: colors[2], score: 10},
+ {size: 200, color: colors[3], score: 8},
+ {size: 250, color: colors[4], score: 4},
+ {size: 300, color: colors[5], score: 2},
+ {size: 350, color: colors[5], score: 1}
+ ],
+ [
+ {size: 50, color: colors[0], score: 10000},
+ {size: 100, color: colors[1], score: 4000},
+ {size: 150, color: colors[1], score: 1000},
+ {size: 200, color: colors[2], score: 300},
+ {size: 250, color: colors[2], score: 100},
+ {size: 300, color: colors[3], score: 30},
+ {size: 350, color: colors[3], score: 10},
+ {size: 400, color: colors[4], score: 8},
+ {size: 450, color: colors[4], score: 4},
+ {size: 500, color: colors[5], score: 2},
+ {size: 550, color: colors[5], score: 1}
+ ],
+ [
+ {size: 50, color: colors[0], score: 500000},
+ {size: 100, color: colors[1], score: 100000},
+ {size: 150, color: colors[1], score: 50000},
+ {size: 200, color: colors[2], score: 10000},
+ {size: 250, color: colors[2], score: 4000},
+ {size: 300, color: colors[3], score: 1000},
+ {size: 350, color: colors[3], score: 300},
+ {size: 400, color: colors[4], score: 100},
+ {size: 450, color: colors[4], score: 30},
+ {size: 500, color: colors[5], score: 10},
+ {size: 550, color: colors[5], score: 8},
+ {size: 600, color: colors[6], score: 4},
+ {size: 650, color: colors[6], score: 2},
+ {size: 700, color: colors[6], score: 1},
+ ]
+ ]
+}
diff --git a/src/activities/target/target.js b/src/activities/target/target.js
index 329abbe..b8056d9 100644
--- a/src/activities/target/target.js
+++ b/src/activities/target/target.js
@@ -24,87 +24,16 @@
var url = "qrc:/gcompris/src/activities/target/resource/"
-var colors = [
- "#ff1b00",
- "#7edee2",
- "#f1f500",
- "#3dff00",
- "#b7d2d4",
- "#6db5ba"
- ]
-
-var levels = [
- [
- {size: 50, color: colors[0], score: 5},
- {size: 100, color: colors[1], score: 4},
- {size: 150, color: colors[2], score: 3},
- {size: 200, color: colors[3], score: 2},
- {size: 250, color: colors[4], score: 1}
- ],
- [
- {size: 50, color: colors[0], score: 10},
- {size: 100, color: colors[1], score: 5},
- {size: 150, color: colors[2], score: 3},
- {size: 200, color: colors[3], score: 2},
- {size: 250, color: colors[4], score: 1}
- ],
- [
- {size: 50, color: colors[0], score: 20},
- {size: 100, color: colors[1], score: 10},
- {size: 150, color: colors[2], score: 8},
- {size: 200, color: colors[3], score: 5},
- {size: 250, color: colors[4], score: 3},
- {size: 300, color: colors[5], score: 2}
- ],
- [
- {size: 50, color: colors[0], score: 30},
- {size: 100, color: colors[1], score: 20},
- {size: 150, color: colors[2], score: 10},
- {size: 200, color: colors[3], score: 5},
- {size: 250, color: colors[4], score: 3},
- {size: 300, color: colors[5], score: 2}
- ],
- [
- {size: 50, color: colors[0], score: 50},
- {size: 100, color: colors[1], score: 30},
- {size: 150, color: colors[2], score: 20},
- {size: 200, color: colors[3], score: 8},
- {size: 250, color: colors[4], score: 3},
- {size: 300, color: colors[5], score: 2}
- ],
- [
- {size: 50, color: colors[0], score: 100},
- {size: 100, color: colors[1], score: 50},
- {size: 150, color: colors[2], score: 12},
- {size: 200, color: colors[3], score: 8},
- {size: 250, color: colors[4], score: 3},
- {size: 300, color: colors[5], score: 2}
- ],
- [
- {size: 50, color: colors[0], score: 500},
- {size: 100, color: colors[1], score: 100},
- {size: 150, color: colors[2], score: 50},
- {size: 200, color: colors[3], score: 15},
- {size: 250, color: colors[4], score: 7},
- {size: 300, color: colors[5], score: 3}
- ],
- [
- {size: 50, color: colors[0], score: 64},
- {size: 100, color: colors[1], score: 32},
- {size: 150, color: colors[2], score: 16},
- {size: 200, color: colors[3], score: 8},
- {size: 250, color: colors[4], score: 4},
- {size: 300, color: colors[5], score: 2}
- ]
- ]
-
+var levels
var currentLevel = 0
-var numberOfLevel = levels.length
+var numberOfLevel
var items
function start(items_) {
items = items_
currentLevel = 0
+ levels = items.levels
+ numberOfLevel = levels.length
items.currentSubLevel = 0
items.numberOfSubLevel = 5
initLevel()