mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 03:18:07 +00:00
DRAFT - Add Keyboard shortcuts
This commit is contained in:
parent
4fca0a4140
commit
3ec1fc62e1
6 changed files with 141 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
63
Linphone/view/Control/Input/KeyboardShortcutInput.qml
Normal file
63
Linphone/view/Control/Input/KeyboardShortcutInput.qml
Normal file
|
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -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"}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue