Changeset View
Changeset View
Standalone View
Standalone View
src/activities/piano_composition/Piano_composition.qml
Context not available. | |||||
24 | import GCompris 1.0 | 24 | import GCompris 1.0 | ||
---|---|---|---|---|---|
25 | 25 | | |||
26 | import "../../core" | 26 | import "../../core" | ||
27 | import "qrc:/gcompris/src/core/core.js" as Core | ||||
27 | import "piano_composition.js" as Activity | 28 | import "piano_composition.js" as Activity | ||
28 | import "melodies.js" as Dataset | 29 | import "melodies.js" as Dataset | ||
29 | 30 | | |||
Context not available. | |||||
127 | onError: console.error("File error: " + msg) | 128 | onError: console.error("File error: " + msg) | ||
128 | } | 129 | } | ||
129 | 130 | | |||
131 | Item { | ||||
132 | id: clickedOptionMessage | ||||
133 | | ||||
134 | signal show(string message) | ||||
135 | onShow: { | ||||
136 | messageText.text = message | ||||
137 | messageAnimation.stop() | ||||
138 | messageAnimation.start() | ||||
139 | } | ||||
140 | | ||||
141 | width: horizontalLayout ? parent.width / 12 : parent.width / 6 | ||||
142 | height: width * 0.4 | ||||
143 | visible: false | ||||
144 | anchors.top: optionsRow.bottom | ||||
145 | anchors.horizontalCenter: optionsRow.horizontalCenter | ||||
146 | z: 5 | ||||
147 | Rectangle { | ||||
148 | id: messageRectangle | ||||
149 | anchors.fill: parent | ||||
150 | color: "black" | ||||
151 | opacity: 0.5 | ||||
152 | border.width: 3 | ||||
153 | border.color: "black" | ||||
154 | radius: 15 | ||||
155 | } | ||||
156 | | ||||
157 | GCText { | ||||
158 | id: messageText | ||||
159 | anchors.fill: parent | ||||
160 | anchors.rightMargin: parent.width * 0.02 | ||||
161 | anchors.leftMargin: parent.width * 0.02 | ||||
162 | horizontalAlignment: Text.AlignHCenter | ||||
163 | verticalAlignment: Text.AlignVCenter | ||||
164 | fontSizeMode: Text.Fit | ||||
165 | color: "white" | ||||
166 | } | ||||
167 | | ||||
168 | SequentialAnimation { | ||||
169 | id: messageAnimation | ||||
170 | onStarted: clickedOptionMessage.visible = true | ||||
171 | PauseAnimation { | ||||
172 | duration: 1000 | ||||
173 | } | ||||
174 | NumberAnimation { | ||||
175 | targets: [messageRectangle, messageText] | ||||
176 | property: "opacity" | ||||
177 | to: 0 | ||||
178 | duration: 200 | ||||
179 | } | ||||
180 | onStopped: { | ||||
181 | clickedOptionMessage.visible = false | ||||
182 | messageRectangle.opacity = 0.5 | ||||
183 | messageText.opacity = 1 | ||||
184 | } | ||||
185 | } | ||||
186 | } | ||||
187 | | ||||
130 | MelodyList { | 188 | MelodyList { | ||
131 | id: melodyList | 189 | id: melodyList | ||
132 | onClose: { | 190 | onClose: { | ||
Context not available. | |||||
293 | background.undidChange = false | 351 | background.undidChange = false | ||
294 | } | 352 | } | ||
295 | onClearButtonClicked: { | 353 | onClearButtonClicked: { | ||
296 | lyricsArea.resetLyricsArea() | 354 | Core.showMessageDialog(main, | ||
297 | Activity.undoStack = [] | 355 | qsTr("Do you want to erase all the notes?"), | ||
298 | multipleStaff.eraseAllNotes() | 356 | qsTr("Yes"), function() { | ||
357 | Activity.undoStack = [] | ||||
358 | lyricsArea.resetLyricsArea() | ||||
359 | multipleStaff.eraseAllNotes() | ||||
360 | }, | ||||
361 | qsTr("No"), null, | ||||
362 | null | ||||
363 | ) | ||||
299 | } | 364 | } | ||
300 | onOpenButtonClicked: { | 365 | onOpenButtonClicked: { | ||
301 | melodyList.melodiesModel.clear() | 366 | melodyList.melodiesModel.clear() | ||
Context not available. | |||||
309 | melodyList.forceActiveFocus() | 374 | melodyList.forceActiveFocus() | ||
310 | } | 375 | } | ||
311 | onSaveButtonClicked: Activity.saveMelody() | 376 | onSaveButtonClicked: Activity.saveMelody() | ||
377 | onEmitOptionMessage: clickedOptionMessage.show(message) | ||||
312 | } | 378 | } | ||
313 | 379 | | |||
314 | DialogHelp { | 380 | DialogHelp { | ||
Context not available. |