Warning, /education/gcompris/src/activities/adjacent_numbers/ActivityConfig.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - ActivityConfig.qml
0002 *
0003 * SPDX-FileCopyrightText: 2023 Alexandre Laurent <littlewhite.dev@gmail.com>
0004 * SPDX-License-Identifier: GPL-3.0-or-later
0005 */
0006 import QtQuick 2.12
0007 import GCompris 1.0
0008
0009 import "../../core"
0010
0011 Item {
0012 id: activityConfiguration
0013 property Item background
0014 property int answerMode: answerModeBox.currentIndex
0015 width: flick.width
0016 height: childrenRect.height
0017
0018 readonly property var availableModes: [
0019 { "text": qsTr("Automatic"), "value": 1 },
0020 { "text": qsTr("OK button"), "value": 2 }
0021 ]
0022
0023 Column {
0024 spacing: 10 * ApplicationInfo.ratio
0025 width: parent.width
0026 GCComboBox {
0027 id: answerModeBox
0028 model: availableModes
0029 background: activityConfiguration.background
0030 label: qsTr("Validate answers")
0031 }
0032 }
0033
0034 property var dataToSave
0035
0036 function setDefaultValues() {
0037 if(dataToSave["answerMode"] === undefined) {
0038 dataToSave["answerMode"] = 1;
0039 }
0040
0041 for( var i = 0 ; i < availableModes.length ; i++) {
0042 if(availableModes[i].value == dataToSave["answerMode"]) {
0043 answerModeBox.currentIndex = i;
0044 break;
0045 }
0046 }
0047 }
0048
0049 function saveValues() {
0050 dataToSave = {
0051 "answerMode": availableModes[answerMode].value
0052 };
0053 }
0054 }