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

0001 /* GCompris - ActivityConfig.qml
0002  *
0003  * SPDX-FileCopyrightText: 2019 Johnny Jazeix <jazeix@gmail.com>
0004  *
0005  * Authors:
0006  *   Johnny Jazeix <jazeix@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("Colors"), "value": "COLOR" },
0022         { "text": qsTr("Images"), "value": "IMAGE" }
0023     ]
0024     Column {
0025         spacing: 10 * ApplicationInfo.ratio
0026         width: parent.width
0027         GCComboBox {
0028             id: modeBox
0029             model: availableModes
0030             background: activityConfiguration.background
0031             label: qsTr("Select your mode")
0032         }
0033     }
0034 
0035     property var dataToSave
0036 
0037     function setDefaultValues() {
0038         if(dataToSave["mode"] === undefined) {
0039             dataToSave["mode"] = "IMAGE";
0040             modeBox.currentIndex = 0
0041         }
0042         for(var i = 0 ; i < availableModes.length ; i ++) {
0043             if(availableModes[i].value === dataToSave["mode"]) {
0044                 modeBox.currentIndex = i;
0045                 break;
0046             }
0047         }
0048     }
0049 
0050     function saveValues() {
0051         var newMode = availableModes[modeBox.currentIndex].value;
0052         dataToSave = {"mode": newMode};
0053     }
0054 }