diff --git a/Linphone/view/CMakeLists.txt b/Linphone/view/CMakeLists.txt index 76a170815..b3a2f39a6 100644 --- a/Linphone/view/CMakeLists.txt +++ b/Linphone/view/CMakeLists.txt @@ -19,6 +19,7 @@ list(APPEND _LINPHONEAPP_QML_FILES view/Control/Button/Slider.qml view/Control/Button/Switch.qml view/Control/Button/Settings/ComboSetting.qml + view/Control/Button/Settings/KeyboardShortcutSetting.qml view/Control/Button/Settings/SwitchSetting.qml view/Control/Button/LabelButton.qml @@ -92,6 +93,7 @@ list(APPEND _LINPHONEAPP_QML_FILES view/Control/Input/Calendar.qml view/Control/Input/DecoratedTextField.qml view/Control/Input/DigitInput.qml + view/Control/Input/KeyboardShortcutInput.qml view/Control/Input/NumericPad.qml view/Control/Input/PhoneNumberInput.qml view/Control/Input/SearchBar.qml @@ -154,6 +156,7 @@ list(APPEND _LINPHONEAPP_QML_FILES view/Page/Layout/Settings/ChatSettingsLayout.qml view/Page/Layout/Settings/SecuritySettingsLayout.qml view/Page/Layout/Settings/NetworkSettingsLayout.qml + view/Page/Layout/Settings/AccessibilitySettingsLayout.qml view/Page/Layout/Settings/AdvancedSettingsLayout.qml view/Page/Layout/Chat/MessageImdnStatusInfos.qml view/Page/Layout/Chat/MessageInfosLayout.qml diff --git a/Linphone/view/Control/Button/Settings/KeyboardShortcutSetting.qml b/Linphone/view/Control/Button/Settings/KeyboardShortcutSetting.qml new file mode 100644 index 000000000..f6811afa6 --- /dev/null +++ b/Linphone/view/Control/Button/Settings/KeyboardShortcutSetting.qml @@ -0,0 +1,23 @@ +import QtQuick +import QtQuick.Controls.Basic +import QtQuick.Layouts +import Linphone + +RowLayout{ + id: mainItem + spacing : Math.round(20 * DefaultStyle.dp) + property string titleText + property string keySequence + + Text{ + text: titleText + font: Typography.p2l + wrapMode: Text.WordWrap + color: DefaultStyle.main2_600 + Layout.fillWidth: true + } + + KeyboardShortcutInput{ + keySequence: keySequence +} +} diff --git a/Linphone/view/Control/Input/KeyboardShortcutInput.qml b/Linphone/view/Control/Input/KeyboardShortcutInput.qml new file mode 100644 index 000000000..647c569cb --- /dev/null +++ b/Linphone/view/Control/Input/KeyboardShortcutInput.qml @@ -0,0 +1,63 @@ +import QtQuick +import QtQuick.Controls as Control +import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils + +Control.TextField { + + id: root + property string keySequence + property string savedKeySequence: keySequence + placeholderText: "Press a key sequence" + + onFocusChanged: { + if (focus) { + savedKeySequence = keySequence + } else { + if (keySequence === StandardKey.Undefined) { + keySequence = savedKeySequence + } + savedKeySequence = StandardKey.Undefined + } + } + + Keys.onPressed: event => { + var keys = [] + event.accepted = true + + // If escape key, stop + if (event.key === Qt.Key_Escape) { + return + } + + if (event.modifiers & Qt.ControlModifier) + keys.push("Ctrl") + if (event.modifiers & Qt.AltModifier) + keys.push("Alt") + if (event.modifiers & Qt.ShiftModifier) + keys.push("Shift") + if (event.modifiers & Qt.MetaModifier) + keys.push("Meta") + + // https://doc.qt.io/qt-6/qt.html#Key-enum + if (event.key !== Qt.Key_Control && + event.key !== Qt.Key_Shift && + event.key !== Qt.Key_Alt && + event.key !== Qt.Key_Meta) { + console.log(event.key) + console.log(event.text) + console.log(event.text.toUpperCase()) + var key = event.text + var keyupper = event.text.toUpperCase() + console.log(key) + console.log(keyupper) + keys.push(event.text.toUpperCase()) + } + + var seqString = keys.join("+") + if (seqString.length > 0) { + root.keySequence = seqString + root.text = seqString + } + + } +} diff --git a/Linphone/view/Page/Form/Settings/SettingsPage.qml b/Linphone/view/Page/Form/Settings/SettingsPage.qml index 9f46fa253..ec04d3236 100644 --- a/Linphone/view/Page/Form/Settings/SettingsPage.qml +++ b/Linphone/view/Page/Form/Settings/SettingsPage.qml @@ -27,6 +27,8 @@ AbstractSettingsMenu { {title: qsTr("settings_security_title"), layout: "SecuritySettingsLayout"}, //: "Réseau" {title: qsTr("settings_network_title"), layout: "NetworkSettingsLayout"}, + //: "Accessibilité" + {title: "Accessibilité", layout: "AccessibilitySettingsLayout"}, //: "Paramètres avancés" {title: qsTr("settings_advanced_title"), layout: "AdvancedSettingsLayout"} ] diff --git a/Linphone/view/Page/Layout/Settings/AccessibilitySettingsLayout.qml b/Linphone/view/Page/Layout/Settings/AccessibilitySettingsLayout.qml new file mode 100644 index 000000000..9fe262802 --- /dev/null +++ b/Linphone/view/Page/Layout/Settings/AccessibilitySettingsLayout.qml @@ -0,0 +1,39 @@ + +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls.Basic as Control +import SettingsCpp 1.0 +import Linphone +import UtilsCpp + +AbstractSettingsLayout { + id: mainItem + width: parent?.width + contentModel: [ + { + //: Appel + title: "Appel", + subTitle: "", + contentComponent: callKeyboardShortcutsComponent + } + ] + onSave: { + SettingsCpp.save() + } + onUndo: SettingsCpp.undo() + + + // Call shortcuts + ///////////////// + + Component { + id: callKeyboardShortcutsComponent + ColumnLayout { + spacing: Math.round(20 * DefaultStyle.dp) + KeyboardShortcutSetting{ + titleText: "Accepter l'appel" + keySequence: "Ctrl+Shift+A" + } + } + } +} \ No newline at end of file diff --git a/Linphone/view/Page/Window/Call/CallsWindow.qml b/Linphone/view/Page/Window/Call/CallsWindow.qml index f053cf6e1..a4df47231 100644 --- a/Linphone/view/Page/Window/Call/CallsWindow.qml +++ b/Linphone/view/Page/Window/Call/CallsWindow.qml @@ -1575,22 +1575,27 @@ AbstractWindow { mainWindow.call.core.lStartRecording() } } - IconLabelButton { - Layout.fillWidth: true + Control.Action { + id: speakerMuteUnmuteAction checkable: true - style: ButtonStyle.noBackground icon.width: Math.round(32 * DefaultStyle.dp) icon.height: Math.round(32 * DefaultStyle.dp) icon.source: !mainWindow.call || mainWindow.call.core.speakerMuted ? AppIcons.speakerSlash : AppIcons.speaker - contentImageColor: mainWindow.call - && mainWindow.call.core.speakerMuted ? DefaultStyle.danger_500main : DefaultStyle.main2_500main - hoveredImageColor: contentImageColor + shortcut: "Ctrl+M" text: mainWindow.call && mainWindow.call.core.speakerMuted //: "Activer le son" ? qsTr("call_activate_speaker_hint") //: "Désactiver le son" : qsTr("call_deactivate_speaker_hint") + } + IconLabelButton { + Layout.fillWidth: true + action: speakerMuteUnmuteAction + style: ButtonStyle.noBackground + contentImageColor: mainWindow.call + && mainWindow.call.core.speakerMuted ? DefaultStyle.danger_500main : DefaultStyle.main2_500main + hoveredImageColor: contentImageColor textColor: mainWindow.call && mainWindow.call.core.speakerMuted ? DefaultStyle.danger_500main : DefaultStyle.main2_500main hoveredTextColor: textColor