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

0001 /* GCompris - KeyOption.qml
0002 *
0003 * SPDX-FileCopyrightText: 2018 Aman Kumar Gupta <gupta2140@gmail.com>
0004 *
0005 * Authors:
0006 *   Beth Hadley <bethmhadley@gmail.com> (GTK+ version)
0007 *   Johnny Jazeix <jazeix@gmail.com> (Qt Quick port)
0008 *   Aman Kumar Gupta <gupta2140@gmail.com> (Qt Quick port)
0009 *   Timothée Giet <animtim@gmail.com> (refactoring)
0010 *
0011 *   SPDX-License-Identifier: GPL-3.0-or-later
0012 */
0013 import QtQuick 2.12
0014 import GCompris 1.0
0015 
0016 import "../../core"
0017 
0018 Item {
0019     id: clefOption
0020 
0021     property alias clefButtonIndex: clefButton.currentIndex
0022     property bool clefButtonVisible: false
0023     signal clefAdded
0024 
0025     width: optionsRow.iconsWidth * 2
0026     height: optionsRow.iconsWidth
0027     visible: clefButtonVisible
0028     Rectangle {
0029         color: "yellow"
0030         opacity: 0.1
0031         border.width: 2
0032         border.color: "black"
0033         anchors.fill: parent
0034         radius: 10
0035     }
0036 
0037     SwitchableOptions {
0038         id: clefButton
0039         nbOptions: 2
0040         source: "qrc:/gcompris/src/activities/piano_composition/resource/" + (!currentIndex ? "trebbleClefButton.svg"
0041         : "bassClefButton.svg")
0042         width: optionsRow.iconsWidth * 0.9
0043         sourceSize.width: width
0044         visible: clefButtonVisible
0045         onClicked: {
0046             //: Treble clef and Bass clef are the notations to indicate the pitch of the sound written on it.
0047             emitOptionMessage(!currentIndex ? qsTr("Treble clef") : qsTr("Bass clef"))
0048         }
0049         anchors.left: parent.left
0050         anchors.verticalCenter: parent.verticalCenter
0051     }
0052 
0053     BarButton {
0054         id: addClefButton
0055         width: clefButton.width
0056         sourceSize.width: width
0057         source: "qrc:/gcompris/src/activities/piano_composition/resource/add.svg"
0058         anchors.right: parent.right
0059         anchors.verticalCenter: parent.verticalCenter
0060         visible: clefButton.visible
0061         onClicked: {
0062             background.clefType = !clefButton.currentIndex ? "Treble" : "Bass"
0063             emitOptionMessage(!clefButton.currentIndex ? qsTr("Treble clef added") : qsTr("Bass clef added"))
0064             parent.scale = 1
0065             clefAdded()
0066         }
0067     }
0068 }