Warning, /education/gcompris/src/activities/learn_digits/ActivityConfig.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - ActivityConfig.qml 0002 * 0003 * SPDX-FileCopyrightText: 2020 Timothée Giet <animtim@gmail.com> 0004 * 0005 * Authors: 0006 * Timothée Giet <animtim@gmail.com> 0007 * 0008 * SPDX-License-Identifier: GPL-3.0-or-later 0009 */ 0010 import QtQuick 2.12 0011 import GCompris 1.0 0012 0013 import "../../core" 0014 0015 Item { 0016 id: activityConfiguration 0017 property Item background 0018 property alias modeBox: modeBox 0019 property alias enableVoicesBox: enableVoicesBox 0020 property bool voicesEnabled: enableVoicesBox.checked 0021 width: flick.width 0022 property var availableModes: [ 0023 { "text": qsTr("Arabic numerals"), "value": 1 }, 0024 { "text": qsTr("Dots"), "value": 2 }, 0025 { "text": qsTr("Fingers"), "value": 3 } 0026 ] 0027 Column { 0028 spacing: 10 * ApplicationInfo.ratio 0029 width: parent.width 0030 GCComboBox { 0031 id: modeBox 0032 model: availableModes 0033 background: activityConfiguration.background 0034 label: qsTr("Digits representation") 0035 } 0036 GCDialogCheckBox { 0037 id: enableVoicesBox 0038 text: qsTr("Enable voices") 0039 checked: voicesEnabled 0040 } 0041 } 0042 0043 property var dataToSave 0044 0045 function setDefaultValues() { 0046 // Recreate the binding 0047 enableVoicesBox.checked = Qt.binding(function(){return activityConfiguration.voicesEnabled;}); 0048 0049 if(dataToSave["mode"] === undefined) { 0050 dataToSave["mode"] = 1; 0051 modeBox.currentIndex = 0; 0052 } 0053 if(dataToSave["voicesEnabled"] === undefined) { 0054 dataToSave["voicesEnabled"] = "true"; 0055 enableVoicesBox.checked = true; 0056 } 0057 for(var i = 0 ; i < availableModes.length ; i ++) { 0058 if(availableModes[i].value == dataToSave["mode"]) { 0059 modeBox.currentIndex = i; 0060 break; 0061 } 0062 } 0063 voicesEnabled = (dataToSave.voicesEnabled === "true") 0064 } 0065 0066 function saveValues() { 0067 var newMode = availableModes[modeBox.currentIndex].value; 0068 voicesEnabled = enableVoicesBox.checked 0069 dataToSave = {"mode": newMode, "voicesEnabled": "" + voicesEnabled}; 0070 } 0071 } 0072