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

0001 /* GCompris - ActivityConfig.qml
0002  *
0003  * SPDX-FileCopyrightText: 2020 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 QtQuick.Controls 2.12
0012 import GCompris 1.0
0013 
0014 import "../../core"
0015 
0016 Item {
0017     id: activityConfiguration
0018     property Item background
0019 
0020     readonly property string coloredNotes: "coloredNotes"
0021     readonly property string coloredlessNotes: "colorlessNotes"
0022     property string mode: coloredNotes
0023     width: flick.width
0024 
0025     ButtonGroup {
0026         id: childGroup
0027     }
0028 
0029     Column {
0030         spacing: 10 * ApplicationInfo.ratio
0031         width: parent.width
0032         GCDialogCheckBox {
0033             id: coloredNotesModeBox
0034             text: qsTr("Display colored notes.")
0035             checked: activityConfiguration.mode === coloredNotes
0036             ButtonGroup.group: childGroup
0037             onCheckedChanged: {
0038                 if(coloredNotesModeBox.checked) {
0039                     activityConfiguration.mode = coloredNotes
0040                 }
0041             }
0042         }
0043 
0044         GCDialogCheckBox {
0045             id: colorlessNotesModeBox
0046             text: qsTr("Display colorless notes.")
0047             checked: activityConfiguration.mode === coloredlessNotes
0048             ButtonGroup.group: childGroup
0049             onCheckedChanged: {
0050                 if(colorlessNotesModeBox.checked) {
0051                     activityConfiguration.mode = coloredlessNotes
0052                 }
0053             }
0054         }
0055     }
0056 
0057     property var dataToSave
0058 
0059     function setDefaultValues() {
0060         if(dataToSave["mode"] === undefined) {
0061             dataToSave["mode"] = coloredNotes;
0062         }
0063         activityConfiguration.mode = dataToSave["mode"];
0064         if(activityConfiguration.mode === coloredNotes) {
0065             coloredNotesModeBox.checked = true
0066         }
0067         else {
0068             colorlessNotesModeBox.checked = true
0069         }
0070     }
0071 
0072     function saveValues() {
0073         dataToSave = {"mode": activityConfiguration.mode};
0074     }
0075 }