1/* GCompris - ActivityConfig.qml
2 *
3 * SPDX-FileCopyrightText: 2019 Johnny Jazeix <jazeix@gmail.com>
4 *
5 * Authors:
6 *   Johnny Jazeix <jazeix@gmail.com>
7 *
8 *   SPDX-License-Identifier: GPL-3.0-or-later
9 */
10import QtQuick 2.9
11import GCompris 1.0
12
13import "../../core"
14
15Item {
16    id: activityConfiguration
17    property Item background
18    property alias modeBox: modeBox
19    width: if(background) background.width
20    property var availableModes: [
21        { "text": qsTr("Dots"), "value": "dot" },
22        { "text": qsTr("Arabic numbers"), "value": "number" },
23        { "text": qsTr("Roman numbers"), "value": "roman" },
24        { "text": qsTr("Images"), "value": "image" }
25    ]
26    Column {
27        spacing: 10 * ApplicationInfo.ratio
28        width: parent.width
29        GCComboBox {
30            id: modeBox
31            model: availableModes
32            background: activityConfiguration.background
33            label: qsTr("Select Domino Representation")
34        }
35    }
36
37    property var dataToSave
38    function setDefaultValues() {
39        if(dataToSave["mode"] === undefined) {
40            dataToSave["mode"] = "dot";
41            modeBox.currentIndex = 0
42        }
43        for(var i = 0 ; i < availableModes.length ; i++) {
44            if(availableModes[i].value === dataToSave["mode"]) {
45                modeBox.currentIndex = i;
46                break;
47            }
48        }
49    }
50    function saveValues() {
51        var newMode = availableModes[modeBox.currentIndex].value;
52        dataToSave = {"mode": newMode};
53    }
54}
55