Changeset View
Changeset View
Standalone View
Standalone View
src/activities/piano_composition/Piano_composition.qml
Context not available. | |||||
108 | property alias melodyList: melodyList | 108 | property alias melodyList: melodyList | ||
---|---|---|---|---|---|
109 | property alias file: file | 109 | property alias file: file | ||
110 | property alias piano: piano | 110 | property alias piano: piano | ||
111 | property alias staffModesOptions: staffModesOptions | ||||
111 | } | 112 | } | ||
112 | 113 | | |||
113 | onStart: { Activity.start(items) } | 114 | onStart: { Activity.start(items) } | ||
Context not available. | |||||
116 | property string currentType: "Whole" | 117 | property string currentType: "Whole" | ||
117 | property string restType: "Whole" | 118 | property string restType: "Whole" | ||
118 | property string clefType: bar.level == 2 ? "bass" : "treble" | 119 | property string clefType: bar.level == 2 ? "bass" : "treble" | ||
120 | property string staffMode: "add" | ||||
119 | 121 | | |||
120 | File { | 122 | File { | ||
121 | id: file | 123 | id: file | ||
Context not available. | |||||
171 | anchors.top: instructionBox.bottom | 173 | anchors.top: instructionBox.bottom | ||
172 | anchors.topMargin: parent.height * 0.1 | 174 | anchors.topMargin: parent.height * 0.1 | ||
173 | anchors.rightMargin: parent.width * 0.043 | 175 | anchors.rightMargin: parent.width * 0.043 | ||
174 | onNoteClicked: playNoteAudio(noteName, noteType) | 176 | onNoteClicked: { | ||
177 | if(background.staffMode === "add") | ||||
178 | playNoteAudio(noteName, noteType) | ||||
179 | else if(background.staffMode === "replace") | ||||
180 | noteToReplace = [noteIndex, staffIndex] | ||||
181 | else | ||||
182 | multipleStaff.eraseNote(noteIndex, staffIndex) | ||||
183 | } | ||||
175 | } | 184 | } | ||
176 | 185 | | |||
177 | GCButtonScroll { | 186 | GCButtonScroll { | ||
Context not available. | |||||
198 | anchors.topMargin: horizontalLayout ? parent.height * 0.08 : parent.height * 0.025 | 207 | anchors.topMargin: horizontalLayout ? parent.height * 0.08 : parent.height * 0.025 | ||
199 | blackLabelsVisible: [4, 5, 6, 7, 8].indexOf(items.bar.level) == -1 ? false : true | 208 | blackLabelsVisible: [4, 5, 6, 7, 8].indexOf(items.bar.level) == -1 ? false : true | ||
200 | useSharpNotation: bar.level == 5 ? false : true | 209 | useSharpNotation: bar.level == 5 ? false : true | ||
201 | onNoteClicked: multipleStaff.addNote(note, currentType, false, true) | 210 | onNoteClicked: { | ||
211 | if(background.staffMode === "add") | ||||
212 | multipleStaff.addNote(note, currentType, false, true) | ||||
213 | else if(background.staffMode === "replace") | ||||
214 | multipleStaff.replaceNote(note, currentType) | ||||
215 | } | ||||
202 | } | 216 | } | ||
203 | 217 | | |||
204 | Image { | 218 | Image { | ||
Context not available. | |||||
246 | anchors.horizontalCenter: parent.horizontalCenter | 260 | anchors.horizontalCenter: parent.horizontalCenter | ||
247 | 261 | | |||
248 | readonly property var noteLengthName: ["Whole", "Half", "Quarter", "Eighth"] | 262 | readonly property var noteLengthName: ["Whole", "Half", "Quarter", "Eighth"] | ||
263 | readonly property var staffModes: ["add", "replace", "erase"] | ||||
249 | 264 | | |||
250 | SwitchableOptions { | 265 | SwitchableOptions { | ||
251 | id: noteOptions | 266 | id: noteOptions | ||
252 | source: "qrc:/gcompris/src/activities/piano_composition/resource/genericNote%1.svg".arg(optionsRow.noteLengthName[currentIndex]) | 267 | source: "qrc:/gcompris/src/activities/piano_composition/resource/genericNote%1.svg".arg(optionsRow.noteLengthName[currentIndex]) | ||
268 | nbOptions: optionsRow.noteLengthName.length | ||||
253 | onClicked: currentType = optionsRow.noteLengthName[currentIndex] | 269 | onClicked: currentType = optionsRow.noteLengthName[currentIndex] | ||
254 | } | 270 | } | ||
255 | 271 | | |||
Context not available. | |||||
278 | } | 294 | } | ||
279 | } | 295 | } | ||
280 | 296 | | |||
297 | SwitchableOptions { | ||||
298 | id:staffModesOptions | ||||
299 | nbOptions: optionsRow.staffModes.length | ||||
300 | source: "qrc:/gcompris/src/activities/piano_composition/resource/%1.svg".arg(optionsRow.staffModes[currentIndex]) | ||||
301 | anchors.top: parent.top | ||||
302 | anchors.topMargin: 4 | ||||
303 | onClicked: background.staffMode = optionsRow.staffModes[currentIndex] | ||||
304 | visible: true | ||||
305 | } | ||||
306 | | ||||
281 | Image { | 307 | Image { | ||
282 | id: clearButton | 308 | id: clearButton | ||
283 | source: "qrc:/gcompris/src/activities/piano_composition/resource/edit-clear.svg" | 309 | source: "qrc:/gcompris/src/activities/piano_composition/resource/edit-clear.svg" | ||
Context not available. | |||||
337 | readonly property string restTypeImage: ((optionsRow.noteLengthName[currentIndex] === "Half") ? "Whole" : optionsRow.noteLengthName[currentIndex]).toLowerCase() | 363 | readonly property string restTypeImage: ((optionsRow.noteLengthName[currentIndex] === "Half") ? "Whole" : optionsRow.noteLengthName[currentIndex]).toLowerCase() | ||
338 | 364 | | |||
339 | source: "qrc:/gcompris/src/activities/piano_composition/resource/%1Rest.svg".arg(restTypeImage) | 365 | source: "qrc:/gcompris/src/activities/piano_composition/resource/%1Rest.svg".arg(restTypeImage) | ||
366 | nbOptions: optionsRow.noteLengthName.length | ||||
340 | onClicked: restType = optionsRow.noteLengthName[currentIndex] | 367 | onClicked: restType = optionsRow.noteLengthName[currentIndex] | ||
341 | rotation: optionsRow.noteLengthName[currentIndex] === "Half" ? 180 : 0 | 368 | rotation: optionsRow.noteLengthName[currentIndex] === "Half" ? 180 : 0 | ||
342 | sourceSize.width: 70 | 369 | sourceSize.width: 70 | ||
Context not available. | |||||
354 | onPressed: parent.scale = 0.8 | 381 | onPressed: parent.scale = 0.8 | ||
355 | onReleased: { | 382 | onReleased: { | ||
356 | parent.scale = 1 | 383 | parent.scale = 1 | ||
357 | multipleStaff.addNote(restType.toLowerCase(), "Rest", false, false) | 384 | if(background.staffMode === "add") | ||
385 | multipleStaff.addNote(restType.toLowerCase(), "Rest", false, false) | ||||
386 | else | ||||
387 | multipleStaff.replaceNote(restType.toLowerCase(), "Rest") | ||||
358 | } | 388 | } | ||
359 | } | 389 | } | ||
360 | } | 390 | } | ||
Context not available. |