diff --git a/src/activities/family/Family.qml b/src/activities/family/Family.qml index 4bff8be02..60e6328a2 100644 --- a/src/activities/family/Family.qml +++ b/src/activities/family/Family.qml @@ -1,269 +1,271 @@ /* GCompris - family.qml * * Copyright (C) 2016 RAJDEEP KAUR * * Authors: * * RAJDEEP KAUR * * 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.1 import GCompris 1.0 import "../../core" import "family.js" as Activity ActivityBase { id: activity onStart: focus = true onStop: {} pageComponent: Image { id: background anchors.fill: parent source: Activity.url + "back.svg" sourceSize.width: parent.width fillMode: Image.PreserveAspectCrop + property bool horizontalLayout:background.width > background.height signal start signal stop Component.onCompleted: { activity.start.connect(start) activity.stop.connect(stop) } // Add here the QML items you need to access in javascript QtObject { id: items property Item main: activity.main property alias background: background property alias bar: bar property alias bonus: bonus property alias nodecreator:nodecreator property alias answerschoice: answerschoice property alias edgecreator: edgecreator } onStart: { Activity.start(items) } onStop: { Activity.stop() } Item { id: partition width: background.width height: background.height Rectangle { id: tree color: "transparent" - width: background.width*0.65 - height: background.height + width: background.horizontalLayout ? background.width*0.65 : background.width + height: background.horizontalLayout ? background.height : background.height*0.65 border.color: "black" border.width: 5 Item { id: treestructure Repeater { id: nodecreator model: ListModel{} delegate: Tree { id: currentpointer x: xx*tree.width y: yy*tree.height width: tree.width/5 height: tree.width/5 recwidth: currentpointer.width recheight: currentpointer.height searchitem: 3 nodeimagesource: Activity.url+nodee bordercolor: "black" borderwidth: 4 colorr: "transparent" radius: recwidth/2 state:currentstate MouseArea { id: nodemousearea anchors.fill: parent } states: [ State { name: "active" PropertyChanges { target: currentpointer bordercolor: "blue" } }, State { name: "deactive" PropertyChanges { target: currentpointer } }, State { name: "activeto" PropertyChanges { target: currentpointer bordercolor: "red" } } ] SequentialAnimation { id: anim running: currentpointer.state === "active" || currentpointer.state === "activeto" loops: Animation.Infinite alwaysRunToEnd: true NumberAnimation { target: currentpointer property: "rotation" from: 0; to: 10 duration: 200 easing.type: Easing.OutQuad } NumberAnimation { target: currentpointer property: "rotation" from: 10; to: -10 duration: 400 easing.type: Easing.InOutQuad } NumberAnimation { target: currentpointer property: "rotation" from: -10; to: 0 duration: 200 easing.type: Easing.InQuad } } } } Image { id: me source: Activity.url + "me.svg" visible: Activity.treestructure[bar.level-1].captions[0] !== undefined x: Activity.treestructure[bar.level-1].captions[0] ? Activity.treestructure[bar.level-1].captions[0][0]*tree.width : 0 y: Activity.treestructure[bar.level-1].captions[0] ? Activity.treestructure[bar.level-1].captions[0][1]*tree.height : 0 width: tree.width/12 height: tree.height/14 } Image { id: questionmark source: Activity.url + "questionmark.svg" visible: Activity.treestructure[bar.level-1].captions[1] !== undefined x: Activity.treestructure[bar.level-1].captions[0] ? Activity.treestructure[bar.level-1].captions[1][0]*tree.width : 0 y: Activity.treestructure[bar.level-1].captions[0] ? Activity.treestructure[bar.level-1].captions[1][1]*tree.height : 0 } Repeater { id: edgecreator model: ListModel{} delegate: Rectangle { id: edge opacity: 1 antialiasing: true color: "black" transformOrigin: Item.TopLeft x: x1*tree.width y: y1*tree.height property var x2: x22*tree.width property var y2: y22*tree.height width: Math.sqrt(Math.pow(x - x2, 2) + Math.pow(y- y2, 2)) height: 4 * ApplicationInfo.ratio rotation: (Math.atan((y2 - y)/(x2-x)) * 180 / Math.PI) + (((y2-y) < 0 && (x2-x) < 0) * 180) + (((y2-y) >= 0 && (x2-x) < 0) * 180) Behavior on height { NumberAnimation { duration: 2000 easing.type: Easing.OutExpo } } Behavior on width { NumberAnimation { duration: 2000 easing.type: Easing.OutExpo } } } } } } Rectangle { id: answers color: "transparent" - width: background.width*0.35 - height: background.height - anchors.left: tree.right + width: background.horizontalLayout ? background.width*0.35 : background.width + height: background.horizontalLayout ? background.height : background.height*0.35 + anchors.left: background.horizontalLayout ? tree.right : partition.left + anchors.top: background.horizontalLayout ? partition.top: tree.bottom border.color: "black" border.width: 5 Image { width: parent.width * 0.99 height: parent.height * 0.99 anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter source: Activity.url + "answerarea.svg" Grid { columns: 1 rowSpacing: 20 anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter Repeater { id: answerschoice model: ListModel{} delegate: AnswerButton { id: options - width: answers.width*0.80 - height: answers.width*0.25 + width: answers.width*0.70 + height: answers.height*Activity.answerbuttonheight textLabel: optionn isCorrectAnswer: textLabel === answer onCorrectlyPressed: bonus.good("lion") } } } } } } DialogHelp { id: dialogHelp onClose: home() } Bar { id: bar content: BarEnumContent { value: help | home | level } onHelpClicked: { displayDialog(dialogHelp) } onPreviousLevelClicked: Activity.previousLevel() onNextLevelClicked: Activity.nextLevel() onHomeClicked: activity.home() } Bonus { id: bonus Component.onCompleted: win.connect(Activity.nextLevel) } } } diff --git a/src/activities/family/family.js b/src/activities/family/family.js index 54705cc18..8acb3eabb 100644 --- a/src/activities/family/family.js +++ b/src/activities/family/family.js @@ -1,480 +1,489 @@ -/* GCompris - family.js +/* GCompris - family.js * * Copyright (C) 2016 RAJDEEP KAUR * * Authors: * "RAJDEEP KAUR" * * 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.0 as Quick var currentLevel = 0 var items var url = "qrc:/gcompris/src/activities/family/resource/" var treestructure = [ { edgelist: [ [0.41, 0.25, 0.64, 0.25], [0.53, 0.25, 0.53, 0.50] ], nodePositions: [ [0.211, 0.20], [0.633, 0.20], [0.40, 0.50] ], rationn: [80, 80, 80], captions: [ [0.28, 0.60], [0.101, 0.25] - ] + ], + nodeleave: ["man3.svg", "lady2.svg", "boy1.svg"], + currentstate: ["active", "deactive", "activeto"], + answer: [qsTr("Father")], + optionss: [qsTr("Father"), qsTr("Grandfather"), qsTr("Uncle")] + }, { edgelist: [ [0.41, 0.25, 0.64, 0.25], [0.53, 0.25, 0.53, 0.50] ], nodePositions: [ [0.211, 0.20], [0.633, 0.20], [0.4, 0.50] ], rationn: [80, 80, 80], - captions: [ [0.45, 0.75], - [0.733, 0.10] - ] + captions: [ [0.28, 0.60], + [0.8283, 0.24] + ], + nodeleave: ["man3.svg", "lady2.svg", "boy1.svg"], + currentstate: ["deactive", "active", "activeto"], + answer: [qsTr("Mother")], + optionss: [qsTr("Mother"), qsTr("GrandMother"), qsTr("Aunty")] + }, { edgelist: [ [0.41, 0.25, 0.64, 0.25], - [0.53, 0.25, 0.44, 0.50], - [0.53, 0.25, 0.63, 0.50] + [0.53, 0.257, 0.44, 0.50], + [0.53, 0.257, 0.63, 0.50] ], nodePositions: [ [0.211, 0.20], [0.633, 0.20], [0.33, 0.50], [0.55, 0.50] ], rationn: [80, 80, 80], - captions: [ [0.44, 0.75], - [0.66, 0.75] - ] + captions:[ [0.22, 0.605], + [0.760, 0.605] + ], + nodeleave: ["man3.svg", "lady2.svg", "boy1.svg", "boy2.svg"], + currentstate: ["deactive", "deactive", "active", "activeto"], + answer: [qsTr("Brother")], + optionss: [qsTr("Cousin"), qsTr("Brother"), qsTr("Sister")] }, { edgelist: [ [0.41, 0.25, 0.64, 0.25], [0.53, 0.26, 0.33, 0.50], [0.53, 0.25, 0.53, 0.50], [0.53, 0.25, 0.70, 0.52] ], nodePositions: [ [0.211, 0.20], [0.633, 0.20], [0.22, 0.50], [0.43, 0.50], [0.65, 0.50] ], rationn: [80, 80, 80], - captions: [ - ] + captions: [ [0.281,0.77], + [0.50,0.75] + ], + nodeleave: ["man3.svg", "lady2.svg", "boy1.svg", "girl1.svg", "boy2.svg"], + currentstate: ["deactive", "deactive", "active", "activeto", "deactive"], + answer: [qsTr("Sister")], + optionss: [qsTr("Cousin"), qsTr("Brother"), qsTr("Sister")] }, { edgelist: [ [0.491, 0.17, 0.54, 0.17], [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.525, 0.45, 0.525, 0.65], [0.33, 0.65, 0.70, 0.65], [0.33, 0.65, 0.33, 0.70], [0.525, 0.65, 0.525, 0.70], [0.70, 0.65, 0.70, 0.725] ], nodePositions: [ [0.311, 0.10], [0.533, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70], [0.43, 0.70], [0.65, 0.70] ], rationn: [80, 80, 80], - captions: [] + captions: [ [0.22,0.17], + [0.118,0.76] + ], + nodeleave: ["grandfather.svg", "old-lady.svg", "man2.svg", "lady1.svg", "girl1.svg", "boy1.svg", "boy2.svg"], + currentstate: ["active", "deactive", "deactive", "deactive", "activeto", "deactive", "deactive"], + answer: [qsTr("Grand Father")], + optionss: [qsTr("Grand Daughter"), qsTr("Grand Son"), qsTr("Grand Father"), qsTr("Grand Mother")] }, { edgelist: [ [0.50, 0.17, 0.54, 0.17], [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.525, 0.45, 0.525, 0.65], [0.33, 0.65, 0.70, 0.65], [0.33, 0.65, 0.33, 0.70], [0.525, 0.65, 0.525, 0.70], [0.70, 0.65, 0.70, 0.725] ], nodePositions: [ [0.311, 0.10], [0.533, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70], [0.43, 0.70], [0.65, 0.70], ], rationn: [80, 80, 80], - captions: [] + captions: [ [0.743,0.16], + [0.85,0.76], + ], + nodeleave: ["grandfather.svg", "old-lady.svg", "man2.svg", "lady1.svg", "boy1.svg", "girl1.svg", "boy2.svg"], + currentstate: ["deactive", "active", "deactive", "deactive", "deactive", "deactive", "activeto", "active"], + answer: [qsTr("Grand Mother")], + optionss: [qsTr("Grand Daughter"), qsTr("Grand Son"), qsTr("Grand Father"), qsTr("Grand Mother")], }, { edgelist: [ [0.50, 0.17, 0.54, 0.17], [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.525, 0.45, 0.525, 0.65], [0.33, 0.65, 0.70, 0.65], [0.33, 0.65, 0.33, 0.70], [0.525, 0.65, 0.525, 0.70], [0.70, 0.65, 0.70, 0.725] ], nodePositions: [ [0.311, 0.10], [0.533, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70], [0.43, 0.70], [0.65, 0.70] ], rationn: [80, 80, 80], - captions: [] + captions: [ [0.85,0.76], + [0.22,0.17] + ], + nodeleave: ["grandfather.svg", "old-lady.svg", "man2.svg", "lady1.svg", "boy1.svg", "boy2.svg","girl1.svg" ], + currentstate: ["activeto", "deactive", "deactive", "deactive", "deactive", "deactive", "active"], + answer: [qsTr("Grand Daughter")], + optionss: [qsTr("Grand Daughter"), qsTr("Grand Son"), qsTr("Grand Father"), qsTr("Grand Mother")] }, { edgelist: [ [0.50, 0.17, 0.54, 0.17], [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.525, 0.45, 0.525, 0.65], [0.33, 0.65, 0.70, 0.65], [0.33, 0.65, 0.33, 0.70], [0.525, 0.65, 0.525, 0.70], [0.70, 0.65, 0.70, 0.725] ], nodePositions: [ [0.311, 0.10], [0.533, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70], [0.43, 0.70], [0.65, 0.70] ], rationn: [80, 80, 80], - captions: [] + captions: [ [0.85,0.76], + [0.743,0.16] + ], + nodeleave: ["grandfather.svg", "old-lady.svg", "man2.svg", "lady1.svg", "boy1.svg", "girl1.svg", "boy2.svg"], + currentstate: ["deactive", "activeto", "deactive", "deactive", "deactive", "deactive", "active", "activeto"], + answer: [qsTr("Grand Son")], + optionss: [qsTr("Grand Daughter"), qsTr("Grand Son"), qsTr("Grand Father"), qsTr("Grand Mother")] }, { edgelist: [ [0.50, 0.17, 0.53, 0.17], [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.22, 0.45, 0.254, 0.45], [0.22, 0.45, 0.22, 0.72], [0.22, 0.71, 0.25, 0.71] ], nodePositions: [ [0.311, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70] ], rationn: [80, 80, 80], - captions: [] + captions: [ [0.118,0.76], + [0.83,0.45] + ], + nodeleave: ["grandfather.svg", "man3.svg", "man2.svg", "boy1.svg"], + currentstate: ["deactive", "deactive", "active", "activeto"], + answer: [qsTr("Uncle")], + optionss: [qsTr("Uncle"), qsTr("Aunty"), qsTr("Nephew"), qsTr("Niece")] + }, { edgelist: [ [0.50, 0.17, 0.53, 0.17], [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.22, 0.45, 0.254, 0.45], [0.22, 0.45, 0.22, 0.72], [0.22, 0.71, 0.25, 0.71] ], nodePositions: [ [0.311, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70] ], rationn: [80, 80, 80], - captions: [] + captions: [ [0.83,0.45], + [0.118,0.76], + ], + nodeleave: ["grandfather.svg", "man3.svg", "man2.svg", "boy1.svg"], + currentstate: ["deactive", "deactive", "activeto", "active"], + answer: [qsTr("Nephew")], + optionss: [qsTr("Uncle"), qsTr("Aunty"), qsTr("Nephew"), qsTr("Niece")] }, { edgelist: [ [0.50, 0.17, 0.53, 0.17], [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.22, 0.45, 0.254, 0.45], [0.22, 0.45, 0.22, 0.72], [0.22, 0.71, 0.25, 0.71] ], nodePositions: [ [0.311, 0.10], [0.533, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70] ], rationn: [80, 80, 80], - captions: [] + captions: [ [0.118,0.76], + [0.83,0.45], + ], + nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady1.svg", "babyboy.svg"], + currentstate: ["deactive", "deactive", "deactive", "active", "activeto"], + answer: [qsTr("Aunty")], + optionss: [qsTr("Uncle"), qsTr("Aunty"), qsTr("Nephew"), qsTr("Niece")] }, { edgelist: [ [0.50, 0.17, 0.53, 0.17], [0.525, 0.17, 0.525, 0.45], [0.44, 0.45, 0.60, 0.45], [0.22, 0.45, 0.254, 0.45], [0.22, 0.45, 0.22, 0.72], [0.22, 0.71, 0.25, 0.71] ], nodePositions: [ [0.311, 0.10], [0.533, 0.10], [0.251, 0.40], [0.588, 0.40], [0.22, 0.70] ], rationn: [80, 80, 80], - captions: [] + captions: [ [0.83,0.45], + [0.118,0.76] + ], + nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady1.svg", "babyboy.svg"], + currentstate: ["deactive", "deactive", "deactive", "activeto", "active"], + answer: [qsTr("Niece")], + optionss: [qsTr("Uncle"), qsTr("Aunty"), qsTr("Nephew"), qsTr("Niece")] }, { edgelist: [ [0.65, 0.16, 0.745, 0.16], [0.70, 0.16, 0.70, 0.70], [0.70, 0.50, 0.58, 0.50], [0.40, 0.52, 0.34, 0.52], [0.69, 0.695, 0.75, 0.695] ], nodePositions: [ [0.463, 0.10], [0.733, 0.10], [0.400, 0.45], [0.150, 0.45], [0.733, 0.67] ], - rationn: [], - captions: [] + rationn: [80, 80, 80], + captions: [ [0.02,0.51], + [0.32,0.16] + ], + nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg"], + currentstate: ["active", "deactive", "deactive", "activeto", "deactive"], + answer: [qsTr("Father-in-law")], + optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] }, { edgelist: [ [0.65, 0.16, 0.745, 0.16], [0.70, 0.16, 0.70, 0.70], [0.70, 0.50, 0.58, 0.50], [0.40, 0.52, 0.34, 0.52], [0.69, 0.695, 0.75, 0.695] ], nodePositions: [ [0.463, 0.10], [0.733, 0.10], [0.400, 0.45], [0.150, 0.45], [0.733, 0.67] ], - rationn: [], - captions: [] + rationn: [80, 80, 80], + captions: [ [0.02,0.51], + [0.80,0.365], + ], + nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg"], + currentstate: ["deactive", "active", "deactive", "activeto", "deactive"], + answer: [qsTr("Mother-in-law")], + optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] }, { edgelist: [ [0.65, 0.16, 0.745, 0.16], [0.70, 0.16, 0.70, 0.70], [0.70, 0.50, 0.58, 0.50], [0.40, 0.52, 0.34, 0.52], [0.69, 0.695, 0.75, 0.695] ], nodePositions: [ [0.463, 0.10], [0.733, 0.10], [0.400, 0.45], [0.150, 0.45], [0.733, 0.67] ], - rationn: [], - captions: [] + rationn: [80, 80, 80], + captions: [ [0.02,0.51], + [0.78,0.5340] + ], + nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg"], + currentstate: ["deactive", "deactive", "deactive", "activeto", "active"], + answer: [qsTr("Brother-in-law")], + optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] }, { edgelist: [ [0.54, 0.16, 0.61, 0.16], [0.58, 0.16, 0.58, 0.70], [0.58, 0.50, 0.475, 0.50], [0.310, 0.52, 0.235, 0.52], [0.57, 0.695, 0.63, 0.695], [0.615, 0.75, 0.50, 0.75] ], nodePositions: [ [0.343, 0.10], [0.603, 0.10], [0.300, 0.45], [0.040, 0.45], [0.603, 0.67], [0.30, 0.70] ], - rationn: [], - captions: [] + rationn: [80, 80, 80], + captions: [ [0.10,0.34], + [0.20,0.76] + ], + nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg", "lady1.svg"], + currentstate: ["dective", "deactive", "deactive", "active", "deactive", "activeto"], + answer: [qsTr("Sister-in-law")], + optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] }, { edgelist: [ [0.65, 0.16, 0.745, 0.16], [0.70, 0.16, 0.70, 0.70], [0.70, 0.50, 0.58, 0.50], [0.40, 0.52, 0.34, 0.52], [0.69, 0.695, 0.75, 0.695] ], nodePositions: [ [0.463, 0.10], [0.733, 0.10], [0.400, 0.45], [0.150, 0.45], [0.733, 0.67] ], - rationn: [], - captions: [] + rationn: [80, 80, 80], + captions: [ [0.32,0.15], + [0.05,0.50] + ], + nodeleave: ["grandfather.svg", "old-lady.svg", "lady2.svg", "man3.svg", "man1.svg"], + currentstate: ["active", "deactive", "deactive", "activeto", "deactive", "deactive"], + answer: [qsTr("Son-in-law")], + optionss: [qsTr("Son-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] } ] -var dataset = [ - { nodeleave: ["man3.svg", "lady2.svg", "boy1.svg"], - currentstate: ["active", "deactive", "activeto"], - answer: [qsTr("Father")], - optionss: [qsTr("Father"), qsTr("Grandfather"), qsTr("Uncle")] - - }, - { nodeleave: ["man3.svg", "lady2.svg", "boy1.svg"], - currentstate: ["deactive", "active", "activeto"], - answer: [qsTr("Mother")], - optionss: [qsTr("Mother"), qsTr("GrandMother"), qsTr("Aunty")] - - }, - { nodeleave: ["man3.svg", "lady2.svg", "boy1.svg", "boy2.svg"], - currentstate: ["deactive", "deactive", "active", "activeto"], - answer: [qsTr("Brother")], - optionss: [qsTr("Cousin"), qsTr("Brother"), qsTr("Sister")] - }, - { nodeleave: ["man3.svg", "lady2.svg", "boy1.svg", "girl1.svg", "boy2.svg"], - currentstate: ["deactive", "deactive", "active", "activeto", "deactive"], - answer: [qsTr("Sister")], - optionss: [qsTr("Cousin"), qsTr("Brother"), qsTr("Sister")] - }, - { nodeleave: ["grandfather.svg", "old-lady.svg", "man2.svg", "lady1.svg", "boy1.svg", "girl1.svg", "boy2.svg"], - currentstate: ["active", "deactive", "deactive", "deactive", "deactive", "activeto", "deactive", "active"], - answer: [qsTr("Grandfather")], - optionss: [qsTr("Granddaughter"), qsTr("Grandson"), qsTr("Grandfather"), qsTr("Grandmother")] - }, - { nodeleave: ["grandfather.svg", "old-lady.svg", "man2.svg", "lady1.svg", "boy1.svg", "girl1.svg", "boy2.svg"], - currentstate: ["deactive", "active", "deactive", "deactive", "deactive", "deactive", "activeto", "active"], - answer: [qsTr("Grandmother")], - optionss: [qsTr("Granddaughter"), qsTr("Grandson"), qsTr("Grandfather"), qsTr("Grandmother")], - }, - { nodeleave: ["grandfather.svg", "old-lady.svg", "man2.svg", "lady1.svg", "boy1.svg", "girl1.svg", "boy2.svg"], - currentstate: ["activeto", "deactive", "deactive", "deactive", "deactive", "deactive", "active", "deactive"], - answer: [qsTr("Granddaughter")], - optionss: [qsTr("Granddaughter"), qsTr("Grandson"), qsTr("Grandfather"), qsTr("Grandmother")] - }, - { nodeleave: ["grandfather.svg", "old-lady.svg", "man2.svg", "lady1.svg", "boy1.svg", "girl1.svg", "boy2.svg"], - currentstate: ["deactive", "activeto", "deactive", "deactive", "deactive", "deactive", "active", "activeto"], - answer: [qsTr("Grandson")], - optionss: [qsTr("Granddaughter"), qsTr("Grandson"), qsTr("Grandfather"), qsTr("Grandmother")] - }, - { nodeleave: ["grandfather.svg", "man3.svg", "man2.svg", "boy1.svg"], - currentstate: ["deactive", "deactive", "active", "activeto"], - answer: [qsTr("Uncle")], - optionss: [qsTr("Uncle"), qsTr("Aunty"), qsTr("Nephew"), qsTr("Niece")] - }, - { nodeleave: ["grandfather.svg", "man3.svg", "man2.svg", "boy1.svg"], - currentstate: ["deactive", "deactive", "activeto", "active"], - answer: [qsTr("Nephew")], - optionss: [qsTr("Uncle"), qsTr("Aunty"), qsTr("Nephew"), qsTr("Niece")] - }, - { nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady1.svg", "babyboy.svg"], - currentstate: ["deactive", "deactive", "deactive", "active", "activeto"], - answer: [qsTr("Aunty")], - optionss: [qsTr("Uncle"), qsTr("Aunty"), qsTr("Nephew"), qsTr("Niece")] - }, - { nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady1.svg", "babyboy.svg"], - currentstate: ["deactive", "deactive", "deactive", "activeto", "active"], - answer: [qsTr("Niece")], - optionss: [qsTr("Uncle"), qsTr("Aunty"), qsTr("Nephew"), qsTr("Niece")] - }, - { nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg"], - currentstate: ["active", "deactive", "deactive", "activeto", "deactive"], - answer: [qsTr("Father-in-law")], - optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] - }, - { nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg"], - currentstate: ["deactive", "active", "deactive", "activeto", "deactive"], - answer: [qsTr("Mother-in-law")], - optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] - }, - { nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg"], - currentstate: ["deactive", "deactive", "deactive", "activeto", "active"], - answer: [qsTr("Brother-in-law")], - optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] - }, - { nodeleave: ["grandfather.svg", "old-lady.svg", "man3.svg", "lady2.svg", "man1.svg", "lady1.svg"], - currentstate: ["dective", "deactive", "deactive", "active", "deactive", "activeto"], - answer: [qsTr("Sister-in-law")], - optionss: [qsTr("Father-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] - }, - { nodeleave: ["grandfather.svg", "old-lady.svg", "lady2.svg", "man3.svg", "man1.svg"], - currentstate: ["active", "deactive", "deactive", "activeto", "deactive", "deactive"], - answer: [qsTr("Son-in-law")], - optionss: [qsTr("Son-in-law"), qsTr("Mother-in-law"), qsTr("Sister-in-law"), qsTr("Brother-in-law"), qsTr("Daughter-in-law")] - } -] - -var numberOfLevel = dataset.length; +var numberOfLevel = treestructure.length; +var answerbuttonheight = 0 ; function start(items_) { items = items_ currentLevel = 0 initLevel() } function stop() { } function initLevel() { items.bar.level = currentLevel + 1 var levelTree = treestructure[currentLevel] - var levelDataset = dataset[currentLevel] + answerbuttonheight = 1/(levelTree.optionss.length+4); items.nodecreator.model.clear(); items.answerschoice.model.clear(); items.edgecreator.model.clear(); for(var i = 0 ; i < levelTree.nodePositions.length ; i++) { items.nodecreator.model.append({ "xx": levelTree.nodePositions[i][0], "yy": levelTree.nodePositions[i][1], - "nodee": levelDataset.nodeleave[i], + "nodee": levelTree.nodeleave[i], "rationn": levelTree.rationn[i], - "currentstate": levelDataset.currentstate[i] + "currentstate": levelTree.currentstate[i] }); } - for(var j = 0 ; j