diff --git a/src/activities/piano_composition/NoteNotations.js b/src/activities/piano_composition/NoteNotations.js index 561b51acf..2d6b1968c 100644 --- a/src/activities/piano_composition/NoteNotations.js +++ b/src/activities/piano_composition/NoteNotations.js @@ -1,621 +1,621 @@ /* GCompris - NoteNotations.js * * Copyright (C) 2018 Aman Kumar Gupta * * Authors: * Beth Hadley (GTK+ version) * Johnny Jazeix (Qt Quick port) * Aman Kumar Gupta (Qt Quick port) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . **/ function get() { return [ { "noteName": "TrebleD3", "imageName": "trebleD3", "rotation": 0, "positionOnStaff": 9 }, { "noteName": "TrebleE3", "imageName": "trebleE3", "rotation": 0, "positionOnStaff": 8.5 }, { "noteName": "TrebleF#3", "imageName": "bassG4", "rotation": 0, "positionOnStaff": 8 }, { "noteName": "TrebleF3", "imageName": "bassG4", "rotation": 0, "positionOnStaff": 8 }, { "noteName": "TrebleGb3", "imageName": "bassF4", "rotation": 0, "positionOnStaff": 7.5 }, { "noteName": "TrebleG3", "imageName": "bassF4", "rotation": 0, "positionOnStaff": 7.5 }, { "noteName": "TrebleG#3", "imageName": "bassF4", "rotation": 0, "positionOnStaff": 7.5 }, { "noteName": "TrebleA3", "imageName": "trebleA3", "rotation": 0, "positionOnStaff": 7 }, { "noteName": "TrebleA#3", "imageName": "trebleA3", "rotation": 0, "positionOnStaff": 7 }, { "noteName": "TrebleAb3", "imageName": "trebleA3", "rotation": 0, "positionOnStaff": 7 }, { "noteName": "TrebleB3", "imageName": "trebleB3", "rotation": 0, "positionOnStaff": 6.5 }, { "noteName": "TrebleBb3", "imageName": "trebleB3", "rotation": 0, "positionOnStaff": 6.5 }, { "noteName": "TrebleC4", "imageName": "trebleC4", "rotation": 0, "positionOnStaff": 6 }, { "noteName": "TrebleC#4", "imageName": "trebleC4", "rotation": 0, "positionOnStaff": 6 }, { "noteName": "TrebleDb4", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 5.5 }, { "noteName": "TrebleD4", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 5.5 }, { "noteName": "TrebleD#4", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 5.5 }, { "noteName": "TrebleEb4", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 5 }, { "noteName": "TrebleE4", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 5 }, { "noteName": "TrebleF4", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 4.5 }, { "noteName": "TrebleF#4", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 4.5 }, { "noteName": "TrebleG4", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 4 }, { "noteName": "TrebleGb4", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 4 }, { "noteName": "TrebleG#4", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 4 }, { "noteName": "TrebleAb4", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 3.5 }, { "noteName": "TrebleA4", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 3.5 }, { "noteName": "TrebleA#4", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 3.5 }, { "noteName": "TrebleBb4", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 3 }, { "noteName": "TrebleB4", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 3 }, { "noteName": "TrebleC5", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 2.5 }, { "noteName": "TrebleC#5", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 2.5 }, { "noteName": "TrebleDb5", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 2 }, { "noteName": "TrebleD5", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 2 }, { "noteName": "TrebleD#5", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 2 }, { "noteName": "TrebleEb5", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 1.5 }, { "noteName": "TrebleE5", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 1.5 }, { "noteName": "TrebleF5", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 1 }, { "noteName": "TrebleF#5", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 1 }, { "noteName": "TrebleG5", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 0.5 }, { "noteName": "TrebleGb5", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 0.5 }, { "noteName": "TrebleG#5", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 0.5 }, { "noteName": "TrebleAb5", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 0 }, { "noteName": "TrebleA5", "imageName": "trebleC4", "rotation": 180, "positionOnStaff": 0 }, { "noteName": "TrebleA#5", "imageName": "trebleC4", "rotation": 180, "positionOnStaff": 0 }, { "noteName": "TrebleBb5", "imageName": "trebleB3", "rotation": 180, "positionOnStaff": -0.5 }, { "noteName": "TrebleB5", "imageName": "trebleB3", "rotation": 180, "positionOnStaff": -0.5 }, { "noteName": "TrebleC6", "imageName": "trebleA3", "rotation": 180, "positionOnStaff": -1 }, { "noteName": "TrebleC#6", "imageName": "trebleA3", "rotation": 180, "positionOnStaff": -1 }, { "noteName": "TrebleDb6", "imageName": "bassF4", "rotation": 180, "positionOnStaff": -1.5 }, { "noteName": "TrebleD6", "imageName": "bassF4", "rotation": 180, "positionOnStaff": -1.5 }, { "noteName": "TrebleD#6", "imageName": "bassF4", "rotation": 180, "positionOnStaff": -1.5 }, { "noteName": "TrebleEb6", "imageName": "bassG4", "rotation": 180, "positionOnStaff": -2 }, { "noteName": "TrebleE6", "imageName": "bassG4", "rotation": 180, "positionOnStaff": -2 }, { "noteName": "TrebleF6", "imageName": "trebleE3", "rotation": 180, "positionOnStaff": -2.5 }, { "noteName": "BassF1", "imageName": "trebleD3", "rotation": 0, "positionOnStaff": 9 }, { "noteName": "BassG1", "imageName": "trebleE3", "rotation": 0, "positionOnStaff": 8.5 }, { "noteName": "BassA1", "imageName": "bassG4", "rotation": 0, "positionOnStaff": 8 }, { "noteName": "BassB1", "imageName": "bassF4", "rotation": 0, "positionOnStaff": 7.5 }, { "noteName": "BassC2", "imageName": "trebleA3", "rotation": 0, "positionOnStaff": 7 }, { "noteName": "BassD2", "imageName": "trebleB3", "rotation": 0, "positionOnStaff": 6.5 }, { "noteName": "BassE2", "imageName": "trebleC4", "rotation": 0, "positionOnStaff": 6 }, { "noteName": "BassF2", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 5.5 }, { "noteName": "BassG2", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 5 }, { "noteName": "BassA2", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 4.5 }, { "noteName": "BassB2", "imageName": "genericNote", "rotation": 0, "positionOnStaff": 4 }, { "noteName": "BassC3", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 3.5 }, { "noteName": "BassC#3", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 3.5 }, { "noteName": "BassDb3", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 3 }, { "noteName": "BassD3", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 3 }, { "noteName": "BassD#3", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 3 }, { "noteName": "BassEb3", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 2.5 }, { "noteName": "BassE3", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 2.5 }, { "noteName": "BassF3", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 2 }, { "noteName": "BassF#3", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 2 }, { "noteName": "BassG3", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 1.5 }, { "noteName": "BassGb3", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 1.5 }, { "noteName": "BassG#3", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 1.5 }, { "noteName": "BassAb3", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 1 }, { "noteName": "BassA3", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 1 }, { "noteName": "BassA#3", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 1 }, { "noteName": "BassBb3", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 0.5 }, { "noteName": "BassB3", "imageName": "genericNote", "rotation": 180, "positionOnStaff": 0.5 }, { "noteName": "BassC4", "imageName": "trebleC4", "rotation": 180, "positionOnStaff": 0 }, { "noteName": "BassC#4", "imageName": "trebleC4", "rotation": 180, "positionOnStaff": 0 }, { "noteName": "BassD4", "imageName": "trebleB3", "rotation": 180, "positionOnStaff": -0.5 }, { "noteName": "BassD#4", "imageName": "trebleB3", "rotation": 180, "positionOnStaff": -0.5 }, { "noteName": "BassDb4", "imageName": "trebleB3", "rotation": 180, "positionOnStaff": -0.5 }, { "noteName": "BassE4", "imageName": "trebleA3", "rotation": 180, "positionOnStaff": -1 }, { "noteName": "BassEb4", "imageName": "trebleA3", "rotation": 180, "positionOnStaff": -1 }, { "noteName": "BassF4", "imageName": "bassF4", "rotation": 180, "positionOnStaff": -1.5 }, { "noteName": "BassF#4", "imageName": "bassF4", "rotation": 180, "positionOnStaff": -1.5 }, { "noteName": "BassG4", "imageName": "bassG4", "rotation": 180, "positionOnStaff": -2 }, { "noteName": "BassGb4", "imageName": "bassG4", "rotation": 180, "positionOnStaff": -2 }, { "noteName": "BassA4", "imageName": "trebleE3", "rotation": 180, "positionOnStaff": -2.5 }, { "noteName": "BassB4", "imageName": "trebleD3", "rotation": 180, "positionOnStaff": -3 }, { "noteName": "wholeRest", "imageName": "wholeRest", "rotation": 0, "positionOnStaff": 3.4 }, { "noteName": "halfRest", - "imageName": "wholeRest", - "rotation": 180, - "positionOnStaff": 1.6 + "imageName": "halfRest", + "rotation": 0, + "positionOnStaff": 3.4 }, { "noteName": "quarterRest", "imageName": "quarterRest", "rotation": 0, "positionOnStaff": 4.5 }, { "noteName": "eighthRest", "imageName": "eighthRest", "rotation": 0, "positionOnStaff": 4.6 } ] } diff --git a/src/activities/piano_composition/OptionsRow.qml b/src/activities/piano_composition/OptionsRow.qml index d5152c1ff..7c5bc0cc2 100644 --- a/src/activities/piano_composition/OptionsRow.qml +++ b/src/activities/piano_composition/OptionsRow.qml @@ -1,209 +1,208 @@ /* GCompris - OptionsRow.qml * * Copyright (C) 2018 Aman Kumar Gupta * * Authors: * Beth Hadley (GTK+ version) * Johnny Jazeix (Qt Quick port) * Aman Kumar Gupta (Qt Quick port) * Timothée Giet (refactoring) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import QtQuick 2.6 import GCompris 1.0 import "../../core" Grid { id: optionsRow columns: 2 //: Whole note, Half note, Quarter note and Eighth note are the different length notes in the musical notation. readonly property var noteLengthName: [[qsTr("Whole note"), "Whole"], [qsTr("Half note"), "Half"], [qsTr("Quarter note"), "Quarter"], [qsTr("Eighth note"), "Eighth"]] //: Whole rest, Half rest, Quarter rest and Eighth rest are the different length rests (silences) in the musical notation. readonly property var restAddedMessage: [qsTr("Added whole rest"), qsTr("Added half rest"), qsTr("Added quarter rest"), qsTr("Added eighth rest")] readonly property var translatedRestNames: [qsTr("Whole rest"), qsTr("Half rest"), qsTr("Quarter rest"), qsTr("Eighth rest")] readonly property var lyricsOrPianoModes: [[qsTr("Piano"), "piano"], [qsTr("Lyrics"), "lyrics"]] property real iconsWidth: score.height * 1.2 property alias noteOptionsIndex: noteOptions.currentIndex property alias lyricsOrPianoModeIndex: lyricsOrPianoModeOption.currentIndex property alias keyOption: keyOption property alias bpmMeter: bpmMeter property alias restOptionIndex: restOptions.currentIndex property bool restOptionsVisible: false property bool noteOptionsVisible: false property bool playButtonVisible: false property bool clearButtonVisible: false property bool undoButtonVisible: false property bool openButtonVisible: false property bool saveButtonVisible: false property bool changeAccidentalStyleButtonVisible: false property bool lyricsOrPianoModeOptionVisible: false property bool bpmVisible: false signal undoButtonClicked signal clearButtonClicked signal openButtonClicked signal saveButtonClicked signal playButtonClicked signal bpmIncreased signal bpmDecreased signal emitOptionMessage(string message) BpmMeter { id: bpmMeter } BarButton { id: playButton source: "qrc:/gcompris/src/activities/piano_composition/resource/play.svg" sourceSize.width: optionsRow.iconsWidth visible: playButtonVisible onClicked: { optionsRow.playButtonClicked() emitOptionMessage(qsTr("Play melody")) multipleStaff.play() } } BarButton { id: clearButton source: "qrc:/gcompris/src/activities/piano_composition/resource/erase.svg" sourceSize.width: optionsRow.iconsWidth visible: clearButtonVisible onClicked: clearButtonClicked() } BarButton { id: undoButton source: "qrc:/gcompris/src/activities/piano_composition/resource/undo.svg" sourceSize.width: optionsRow.iconsWidth visible: undoButtonVisible onClicked: { emitOptionMessage(qsTr("Undo")) undoButtonClicked() } } KeyOption { id: keyOption } Item { id: rests width: optionsRow.iconsWidth * 2 height: optionsRow.iconsWidth visible: restOptionsVisible Rectangle { color: "yellow" opacity: 0.1 border.width: 2 border.color: "black" anchors.fill: parent radius: 10 } - // Since the half rest image is just the rotated image of whole rest image, we check if the current rest type is half, we assign the source as whole rest and rotate it by 180 degrees. SwitchableOptions { id: restOptions readonly property string restTypeImage: (optionsRow.noteLengthName[currentIndex][1]).toLowerCase() source: "qrc:/gcompris/src/activities/piano_composition/resource/%1Rest.svg".arg(restTypeImage) nbOptions: optionsRow.noteLengthName.length onClicked: { background.restType = optionsRow.noteLengthName[currentIndex][1] emitOptionMessage(optionsRow.translatedRestNames[currentIndex]) } width: optionsRow.iconsWidth * 0.9 sourceSize.width: width visible: restOptionsVisible anchors.topMargin: -3 anchors.left: parent.left anchors.leftMargin: 5 } BarButton { id: addRestButton width: restOptions.width sourceSize.width: width source: "qrc:/gcompris/src/activities/piano_composition/resource/add.svg" anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter visible: restOptions.visible onClicked: { emitOptionMessage(optionsRow.restAddedMessage[restOptionIndex]) parent.scale = 1 background.addMusicElementAndPushToStack(restType.toLowerCase(), "Rest") } } } BarButton { id: changeAccidentalStyleButton source: changeAccidentalStyleButtonVisible ? (piano.useSharpNotation ? "qrc:/gcompris/src/activities/piano_composition/resource/blacksharp.svg" : "qrc:/gcompris/src/activities/piano_composition/resource/blackflat.svg") : "" sourceSize.width: optionsRow.iconsWidth visible: changeAccidentalStyleButtonVisible onClicked: { piano.useSharpNotation = !piano.useSharpNotation //: Sharp notes and Flat notes represents the accidental style of the notes in the music. emitOptionMessage(piano.useSharpNotation ? qsTr("Sharp notes") : qsTr("Flat notes")) } } SwitchableOptions { id: noteOptions source: "qrc:/gcompris/src/activities/piano_composition/resource/genericNote%1.svg".arg(optionsRow.noteLengthName[currentIndex][1]) nbOptions: optionsRow.noteLengthName.length currentIndex: 2 onClicked: { background.currentType = optionsRow.noteLengthName[currentIndex][1] emitOptionMessage(optionsRow.noteLengthName[currentIndex][0]) } visible: noteOptionsVisible } BarButton { id: openButton source: "qrc:/gcompris/src/activities/piano_composition/resource/open.svg" sourceSize.width: optionsRow.iconsWidth visible: openButtonVisible onClicked: openButtonClicked() } BarButton { id: saveButton source: "qrc:/gcompris/src/activities/piano_composition/resource/save.svg" sourceSize.width: optionsRow.iconsWidth visible: saveButtonVisible onClicked: saveButtonClicked() } SwitchableOptions { id: lyricsOrPianoModeOption nbOptions: optionsRow.lyricsOrPianoModes.length source: "qrc:/gcompris/src/activities/piano_composition/resource/%1.svg".arg(optionsRow.lyricsOrPianoModes[currentIndex][1]) visible: lyricsOrPianoModeOptionVisible onClicked: emitOptionMessage(optionsRow.lyricsOrPianoModes[currentIndex][0]) } } diff --git a/src/activities/piano_composition/resource/halfRest.svg b/src/activities/piano_composition/resource/halfRest.svg index 1937a4477..dcc65e091 100644 --- a/src/activities/piano_composition/resource/halfRest.svg +++ b/src/activities/piano_composition/resource/halfRest.svg @@ -1,79 +1,79 @@ image/svg+xml - + 2018 Timothée Giet