PushRuleSettingsPopup: add custom sound field

This commit is contained in:
miruka 2021-02-28 18:06:27 -04:00
parent 8b53b4ae11
commit c46e1eb897
2 changed files with 21 additions and 10 deletions

View File

@ -1,6 +1,5 @@
# TODO
- sfx selection
- custom action
- seen tooltips can't be shown on image hover

View File

@ -39,11 +39,7 @@ HFlickableColumnPopup {
undefined
const actions = []
const sfx =
soundCheck.checked && rule.sound ? rule.sound :
soundCheck.checked && rule.rule_id === ".m.rule.call" ? "ring" :
soundCheck.checked ? "default":
false
const sfx = soundCheck.checked ? soundCombo.editText : false
notifyCheck.checked && actions.push("notify")
actions.push({set_tweak: "highlight", value: highlightCheck.checked})
@ -233,12 +229,28 @@ HFlickableColumnPopup {
Layout.fillWidth: true
}
HCheckBox {
id: soundCheck
text: qsTr("Play sound")
HFlow {
enabled: notifyCheck.checked
defaultChecked: root.rule.sound
spacing: theme.spacing / 2
Layout.fillWidth: true
HCheckBox {
id: soundCheck
text: qsTr("Play sound: ")
defaultChecked: root.rule.sound
height: soundCombo.height
}
HComboBox {
id: soundCombo
readonly property string current: root.rule.sound || "default"
model: [...new Set(["default", "ring", current])]
editText: current
currentIndex: model.indexOf(current)
editable: true
}
}
HCheckBox {