Warning, /education/gcompris/src/activities/enumerate/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 width: flick.width
0020 property var availableModes: [
0021 { "text": qsTr("Automatic"), "value": 1 },
0022 { "text": qsTr("OK button"), "value": 2 }
0023 ]
0024
0025 Column {
0026 spacing: 10 * ApplicationInfo.ratio
0027 width: parent.width
0028 GCComboBox {
0029 id: modeBox
0030 model: availableModes
0031 background: activityConfiguration.background
0032 label: qsTr("Validate answers")
0033 }
0034 }
0035
0036 property var dataToSave
0037
0038 function setDefaultValues() {
0039 if(dataToSave["mode"] === undefined) {
0040 dataToSave["mode"] = 1;
0041 modeBox.currentIndex = 0
0042 }
0043 for(var i = 0 ; i < availableModes.length ; i ++) {
0044 if(availableModes[i].value == dataToSave["mode"]) {
0045 modeBox.currentIndex = i;
0046 break;
0047 }
0048 }
0049 }
0050
0051 function saveValues() {
0052 var newMode = availableModes[modeBox.currentIndex].value;
0053 dataToSave = {"mode": newMode};
0054 }
0055 }