Warning, /education/gcompris/src/activities/number_sequence/ActivityConfig.qml is written in an unsupported language. File is not indexed.

0001 /* GCompris - ActivityConfig.qml
0002  *
0003  * SPDX-FileCopyrightText: 2020 Shubham Mishra <shivam828787@gmail.com>
0004  *
0005  * Authors:
0006  *   Shubham Mishra <shivam828787@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 bool highlightEnabled: highlightBox.checked
0019     property alias modeBox: modeBox
0020     width: flick.width
0021     property var availableModes: [
0022         { "text": qsTr("Automatic"), "value": 1 },
0023         { "text": qsTr("Manual"), "value": 2 }
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("Go to the next level")
0033         }
0034         GCDialogCheckBox {
0035             id: highlightBox
0036             text: qsTr("Highlight next point")
0037         }
0038     }
0039 
0040     property var dataToSave
0041 
0042     function setDefaultValues() {
0043         if(dataToSave["mode"] === undefined) {
0044             dataToSave["mode"] = 1;
0045             modeBox.currentIndex = 0
0046         }
0047         for(var i = 0 ; i < availableModes.length ; i ++) {
0048             if(availableModes[i].value == dataToSave["mode"]) {
0049                 modeBox.currentIndex = i;
0050                 break;
0051             }
0052         }
0053 
0054         if(dataToSave["highlight"] === undefined) {
0055             dataToSave["highlight"] = "true";
0056         }
0057         highlightBox.checked = (dataToSave.highlight === "true")
0058     }
0059 
0060     function saveValues() {
0061         var newMode = availableModes[modeBox.currentIndex].value;
0062         dataToSave = {"mode": newMode, "highlight" : "" + highlightEnabled};
0063     }
0064 }