Commit fe8f1b5e authored by Timothée Giet's avatar Timothée Giet

instruments, add dialog to warn that activity will play audio in any case

parent 87765ff4
......@@ -49,6 +49,8 @@ ActivityBase {
source: backgroundImg
property bool keyboardMode: false
// if audio is disabled, we display a dialog to tell users this activity requires audio anyway
property bool audioDisabled: false
signal start
signal stop
......@@ -70,7 +72,13 @@ ActivityBase {
property bool audioOk: false
property alias score: score
}
onStart: Activity.start(items, dataset, mode)
onStart: {
if((!ApplicationSettings.isAudioVoicesEnabled || !ApplicationSettings.isAudioEffectsEnabled) && activity.isMusicalActivity) {
background.audioDisabled = true;
} else {
Activity.start(items, dataset, mode);
}
}
onStop: Activity.stop()
Keys.onPressed: {
......@@ -227,6 +235,26 @@ ActivityBase {
interval: 2000
Component.onCompleted: win.connect(Activity.nextLevel)
}
Loader {
id: audioNeededDialog
sourceComponent: GCDialog {
parent: activity
isDestructible: false
message: qsTr("This activity requires audio, so it will play some sounds even if the audio voices or effects are disabled in the main configuration.")
button1Text: qsTr("Quit")
button2Text: qsTr("Continue")
onButton1Hit: activity.home();
onClose: {
background.audioDisabled = false;
Activity.start(items, dataset, mode);
}
}
anchors.fill: parent
focus: true
active: background.audioDisabled
onStatusChanged: if (status == Loader.Ready) item.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