1/* GCompris - ActivityConfig.qml
2 *
3* SPDX-FileCopyrightText: 2020 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 speedSlider: speedSlider
19    property int speedSetting: 5
20    width: if(background) background.width
21
22    Column {
23        spacing: 10 * ApplicationInfo.ratio
24        width: activityConfiguration.width
25        GCText {
26            id: speedSliderText
27            text: qsTr("Speed")
28            fontSize: mediumSize
29            wrapMode: Text.WordWrap
30        }
31        GCSlider {
32            id: speedSlider
33            width: 250 * ApplicationInfo.ratio
34            value: speedSetting
35            maximumValue: 5
36            minimumValue: 1
37            scrollEnabled: false
38        }
39    }
40
41    property var dataToSave
42    function setDefaultValues() {
43        speedSlider.value = Qt.binding(function() {return activityConfiguration.speedSetting;})
44        if(dataToSave.speedSetting) {
45            activityConfiguration.speedSetting = dataToSave.speedSetting
46        }
47        else {
48            activityConfiguration.speedSetting = 5
49        }
50    }
51    function saveValues() {
52        speedSetting = speedSlider.value
53        dataToSave = {"speedSetting": speedSetting}
54    }
55}
56