/usr/share/ubuntu/settings/system/qml-plugins/sound/SoundsList.qml is in ubuntu-system-settings 0.1+14.04.20140411-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | import GSettings 1.0
import QtQuick 2.0
import QtMultimedia 5.0
import SystemSettings 1.0
import Ubuntu.Components 0.1
import Ubuntu.Components.ListItems 0.1 as ListItem
import Ubuntu.SystemSettings.Sound 1.0
import "utilities.js" as Utilities
ItemPage {
property variant soundDisplayNames
property variant soundFileNames
property bool showStopButton: false
property int soundType // 0: ringtone, 1: message
property string soundsDir
id: soundsPage
UbuntuSoundPanel {
id: backendInfo
Component.onCompleted: {
soundFileNames = listSounds(soundsDir).map(function (sound)
{return soundsDir+sound})
soundDisplayNames = Utilities.buildSoundValues(soundFileNames)
if (soundType == 0)
soundSelector.selectedIndex =
Utilities.indexSelectedFile(soundFileNames,
incomingCallSound)
else if (soundType == 1)
soundSelector.selectedIndex =
Utilities.indexSelectedFile(soundFileNames,
incomingMessageSound)
}
onIncomingCallSoundChanged: {
if (soundType == 0)
soundSelector.selectedIndex =
Utilities.indexSelectedFile(soundFileNames,
incomingCallSound)
}
onIncomingMessageSoundChanged: {
if (soundType == 1)
soundSelector.selectedIndex =
Utilities.indexSelectedFile(soundFileNames,
incomingMessageSound)
}
}
GSettings {
id: soundSettings
schema.id: "com.ubuntu.touch.sound"
}
Audio {
id: soundEffect
}
Column {
id: columnId
anchors.left: parent.left
anchors.right: parent.right
SilentModeWarning { visible: backendInfo.silentMode }
ListItem.SingleControl {
id: listId
control: Button {
text: i18n.tr("Stop playing")
width: parent.width - units.gu(4)
onClicked:
soundEffect.stop()
}
enabled: soundEffect.playbackState == Audio.PlayingState
visible: showStopButton && !backendInfo.silentMode
}
}
ListItem.ItemSelector {
id: soundSelector
anchors.top: columnId.bottom
anchors.bottom: soundsPage.bottom
containerHeight: height
expanded: true
model: soundDisplayNames
onDelegateClicked: {
if (soundType == 0) {
soundSettings.incomingCallSound = soundFileNames[index]
backendInfo.incomingCallSound = soundFileNames[index]
} else if (soundType == 1) {
soundSettings.incomingMessageSound = soundFileNames[index]
backendInfo.incomingMessageSound = soundFileNames[index]
}
/* Only preview the file if not in silent mode */
if (!backendInfo.silentMode) {
soundEffect.source = soundFileNames[index]
soundEffect.play()
}
}
}
}
|