Warning, /education/gcompris/src/activities/smallnumbers2/ActivityConfig.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - ActivityConfig.qml 0002 * 0003 * SPDX-FileCopyrightText: 2019 Akshay Kumar <email.akshay98@gmail.com> 0004 * 0005 * Authors: 0006 * Akshay Kumar <email.akshay98@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 var availableModes: [ 0020 { "text": qsTr("Dots"), "value": "dot" }, 0021 { "text": qsTr("Arabic numbers"), "value": "number" }, 0022 { "text": qsTr("Roman numbers"), "value": "roman" }, 0023 { "text": qsTr("Images"), "value": "image" } 0024 ] 0025 property alias speedSlider: speedSlider 0026 property int speedSetting: 10 0027 width: flick.width 0028 0029 Column { 0030 spacing: 10 * ApplicationInfo.ratio 0031 width: activityConfiguration.width 0032 GCComboBox { 0033 id: modeBox 0034 model: availableModes 0035 background: activityConfiguration.background 0036 label: qsTr("Select Domino Representation") 0037 } 0038 GCText { 0039 id: speedSliderText 0040 width: parent.width 0041 text: qsTr("Speed") 0042 fontSize: mediumSize 0043 wrapMode: Text.WordWrap 0044 } 0045 GCSlider { 0046 id: speedSlider 0047 width: 250 * ApplicationInfo.ratio 0048 value: speedSetting 0049 to: 10 0050 from: 1 0051 wheelEnabled: false 0052 } 0053 } 0054 0055 property var dataToSave 0056 function setDefaultValues() { 0057 speedSlider.value = Qt.binding(function() {return activityConfiguration.speedSetting;}) 0058 for(var i = 0 ; i < availableModes.length ; i++) { 0059 if(availableModes[i].value === dataToSave["mode"]) { 0060 modeBox.currentIndex = i; 0061 break; 0062 } 0063 } 0064 if(dataToSave["mode"] === undefined) { 0065 dataToSave["mode"] = "dot"; 0066 modeBox.currentIndex = 0 0067 } 0068 if(dataToSave.speedSetting) { 0069 activityConfiguration.speedSetting = dataToSave.speedSetting 0070 } 0071 else { 0072 activityConfiguration.speedSetting = 10 0073 } 0074 } 0075 function saveValues() { 0076 var newMode = availableModes[modeBox.currentIndex].value; 0077 speedSetting = speedSlider.value 0078 dataToSave = {"mode": newMode, "speedSetting": speedSetting} 0079 } 0080 }