Changeset View
Changeset View
Standalone View
Standalone View
src/activities/alphabet-sequence/ActivityConfig.qml
- This file was added.
1 | /* GCompris - ActivityConfig.qml | ||||
---|---|---|---|---|---|
2 | * | ||||
3 | * Copyright (C) 2019 Akshay Kumar <email.akshay98@gmail.com> | ||||
4 | * | ||||
5 | * Authors: | ||||
6 | * Akshay Kumar <email.akshay98@gmail.com> | ||||
7 | * | ||||
8 | * This program is free software; you can redistribute it and/or modify | ||||
9 | * it under the terms of the GNU General Public License as published by | ||||
10 | * the Free Software Foundation; either version 3 of the License, or | ||||
11 | * (at your option) any later version. | ||||
12 | * | ||||
13 | * This program is distributed in the hope that it will be useful, | ||||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
16 | * GNU General Public License for more details. | ||||
17 | * | ||||
18 | * You should have received a copy of the GNU General Public License | ||||
19 | * along with this program; if not, see <https://www.gnu.org/licenses/>. | ||||
20 | */ | ||||
21 | import QtQuick 2.6 | ||||
22 | | ||||
23 | import "../../core" | ||||
24 | | ||||
25 | Item { | ||||
26 | id: activityConfiguration | ||||
27 | property Item background | ||||
28 | property alias modeBox: modeBox | ||||
29 | property var availableModes: [ | ||||
30 | { "text": qsTr("Lower Case"), "value": "lower" }, | ||||
31 | { "text": qsTr("Upper Case"), "value": "upper" }, | ||||
32 | ] | ||||
33 | Flow { | ||||
34 | id: flow | ||||
35 | spacing: 5 | ||||
36 | width: parent.width | ||||
37 | GCComboBox { | ||||
38 | id: modeBox | ||||
39 | model: availableModes | ||||
40 | background: activityConfiguration.background | ||||
41 | label: qsTr("Select Domino Representation") | ||||
jjazeix: not adapted | |||||
42 | } | ||||
43 | } | ||||
44 | | ||||
45 | property var dataToSave | ||||
46 | function setDefaultValues() { | ||||
47 | for(var i = 0 ; i < availableModes.length ; i++) { | ||||
You can replace the loop with this simple condition: amankumargupta: You can replace the loop with this simple condition:
modeBox.currentIndex = ((availableModes[0]. | |||||
@amankumargupta But we cannot use the statement if we have to add another mode in the future. AkshayCHD: @amankumargupta But we cannot use the statement if we have to add another mode in the future. | |||||
48 | if(availableModes[i].value === dataToSave["mode"]) { | ||||
49 | modeBox.currentIndex = i; | ||||
50 | break; | ||||
51 | } | ||||
52 | } | ||||
53 | } | ||||
54 | function saveValues() { | ||||
55 | var newMode = availableModes[modeBox.currentIndex].value; | ||||
56 | dataToSave = {"mode": newMode}; | ||||
57 | } | ||||
58 | } |
not adapted