From c46e1eb89755e038a2d5cb3d5946fa31d39d6a5b Mon Sep 17 00:00:00 2001 From: miruka Date: Sun, 28 Feb 2021 18:06:27 -0400 Subject: [PATCH] PushRuleSettingsPopup: add custom sound field --- docs/TODO.md | 1 - .../PushRuleSettingsPopup.qml | 30 +++++++++++++------ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/docs/TODO.md b/docs/TODO.md index 5105f438..2dc1f94b 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -1,6 +1,5 @@ # TODO -- sfx selection - custom action - seen tooltips can't be shown on image hover diff --git a/src/gui/Popups/PushRuleSettingsPopup/PushRuleSettingsPopup.qml b/src/gui/Popups/PushRuleSettingsPopup/PushRuleSettingsPopup.qml index ad68b759..b38a4c95 100644 --- a/src/gui/Popups/PushRuleSettingsPopup/PushRuleSettingsPopup.qml +++ b/src/gui/Popups/PushRuleSettingsPopup/PushRuleSettingsPopup.qml @@ -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 {