Commit ac538a2f authored by Bruno Coudoin's avatar Bruno Coudoin
Browse files

menu, pass the audio items up front when the activity is created

The audio items was passed after the activity was created which was
making it hard to get them when referenced directly in created sub items.

Now we pass them to the loader so that activities are created with these
properties set instead of being set after.
parent c5f26f7e
......@@ -91,6 +91,7 @@ ActivityBase {
function loadActivity() {
activityLoader.item.menu = menuActivity
activityLoader.item.activityInfo = ActivityInfoTree.currentActivity
console.log("loadActivity", menuActivity.audioVoices)
pageView.push(activityLoader.item)
}
......@@ -298,8 +299,11 @@ ActivityBase {
function selectCurrentItem() {
particles.emitter.burst(50)
ActivityInfoTree.currentActivity = ActivityInfoTree.menuTree[index]
activityLoader.source = "qrc:/gcompris/src/activities/" +
ActivityInfoTree.menuTree[index].name
activityLoader.setSource("qrc:/gcompris/src/activities/" + ActivityInfoTree.menuTree[index].name,
{
'audioVoices': audioVoices,
'audioEffects': audioEffects
})
if (activityLoader.status == Loader.Ready) loadActivity()
}
}
......
......@@ -105,7 +105,14 @@ Window {
StackView {
id: pageView
anchors.fill: parent
initialItem: "qrc:/gcompris/src/activities/" + ActivityInfoTree.rootMenu.name
initialItem: {
"item": "qrc:/gcompris/src/activities/" + ActivityInfoTree.rootMenu.name,
"properties": {
'audioVoices': audioVoices,
'audioEffects': audioEffects
}
}
delegate: StackViewDelegate {
id: root
function getTransition(properties)
......@@ -115,8 +122,6 @@ Window {
if(!properties.exitItem.isDialog) {
if(!properties.enterItem.isDialog) {
playIntroVoice(properties.enterItem.activityInfo.name)
properties.enterItem.audioVoices = audioVoices
properties.enterItem.audioEffects = audioEffects
}
properties.enterItem.start()
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment