/* GCompris - ActivityConfig.qml * * SPDX-FileCopyrightText: 2020 Johnny Jazeix * * Authors: * Johnny Jazeix * * SPDX-License-Identifier: GPL-3.0-or-later */ import QtQuick 2.9 import GCompris 1.0 import "../../core" Item { id: activityConfiguration property Item background property alias modeBox: modeBox width: if(background) background.width property var availableModes: [ { "text": qsTr("Colors"), "value": "color" }, { "text": qsTr("Shapes"), "value": "symbol" } ] Column { spacing: 10 * ApplicationInfo.ratio width: parent.width GCComboBox { id: modeBox model: availableModes background: activityConfiguration.background label: qsTr("Select your mode") } } property var dataToSave function setDefaultValues() { if(dataToSave["mode"] === undefined) { dataToSave["mode"] = "color"; modeBox.currentIndex = 0 } for(var i = 0 ; i < availableModes.length ; i ++) { if(availableModes[i].value === dataToSave["mode"]) { modeBox.currentIndex = i; break; } } } function saveValues() { var newMode = availableModes[modeBox.currentIndex].value; dataToSave = {"mode": newMode}; } }