1/* GCompris - ActivityConfig.qml 2 * 3 * SPDX-FileCopyrightText: 2020 Deepak Kumar <deepakdk2431@gmail.com> 4 * 5 * Authors: 6 * Deepak Kumar <deepakdk2431@gmail.com> 7 * 8 * SPDX-License-Identifier: GPL-3.0-or-later 9 */ 10import QtQuick 2.9 11import GCompris 1.0 12 13import "../../core" 14 15Item { 16 id: activityConfiguration 17 property Item background 18 property alias modeBox: modeBox 19 width: if(background) background.width 20 property var availableModes: [ 21 { "text": qsTr("Learning Mode"), "value": "learning" }, 22 { "text": qsTr("Assessment Mode"), "value": "assessment" } 23 ] 24 Column { 25 spacing: 10 * ApplicationInfo.ratio 26 width: parent.width 27 GCComboBox { 28 id: modeBox 29 model: availableModes 30 background: activityConfiguration.background 31 label: qsTr("Select your mode") 32 } 33 } 34 35 property var dataToSave 36 37 function setDefaultValues() { 38 if(dataToSave["mode"] === undefined) { 39 dataToSave["mode"] = "learning"; 40 modeBox.currentIndex = 0 41 } 42 for(var i = 0 ; i < availableModes.length ; i++) { 43 if(availableModes[i].value === dataToSave["mode"]) { 44 modeBox.currentIndex = i; 45 break; 46 } 47 } 48 } 49 50 function saveValues() { 51 var newMode = availableModes[modeBox.currentIndex].value; 52 dataToSave = {"mode": newMode}; 53 } 54} 55