Commit 7f1c6365 authored by Timothée Giet's avatar Timothée Giet

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

parent 052aa976
......@@ -39,10 +39,12 @@ ActivityBase {
id: background
anchors.fill: parent
color: "#ABCDEF"
signal start
signal stop
// if audio is disabled, we display a dialog to tell users this activity requires audio anyway
property bool audioDisabled: false
Component.onCompleted: {
activity.start.connect(start)
activity.stop.connect(stop)
......@@ -66,7 +68,12 @@ ActivityBase {
property bool isWrongRhythm: false
}
onStart: { Activity.start(items) }
onStart: {
if(!ApplicationSettings.isAudioVoicesEnabled || !ApplicationSettings.isAudioEffectsEnabled) {
background.audioDisabled = true;
}
Activity.start(items);
}
onStop: { Activity.stop() }
property string clefType: "Treble"
......@@ -354,5 +361,24 @@ ActivityBase {
loose.connect(Activity.initSubLevel)
}
}
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;
}
}
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