Activate numeric pad buttons with numpad keyboard in calls window #LINQT-2310
This commit is contained in:
parent
7e9e3e6f55
commit
389fae13d8
2 changed files with 120 additions and 31 deletions
|
|
@ -42,49 +42,64 @@ FocusScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onPressed: (event) => {
|
Keys.onPressed: (event) => {
|
||||||
|
event.accepted = false
|
||||||
if (event.modifiers & Qt.KeypadModifier) {
|
if (event.modifiers & Qt.KeypadModifier) {
|
||||||
if (event.key === Qt.Key_0) {
|
if (event.key === Qt.Key_0) {
|
||||||
keypadKeyPressedAtIndex(10)
|
keypadKeyPressedAtIndex(10)
|
||||||
|
event.accepted = true
|
||||||
}
|
}
|
||||||
if (event.key === Qt.Key_1) {
|
if (event.key === Qt.Key_1) {
|
||||||
keypadKeyPressedAtIndex(0)
|
keypadKeyPressedAtIndex(0)
|
||||||
|
event.accepted = true
|
||||||
}
|
}
|
||||||
if (event.key === Qt.Key_2) {
|
if (event.key === Qt.Key_2) {
|
||||||
keypadKeyPressedAtIndex(1)
|
keypadKeyPressedAtIndex(1)
|
||||||
|
event.accepted = true
|
||||||
}
|
}
|
||||||
if (event.key === Qt.Key_3) {
|
if (event.key === Qt.Key_3) {
|
||||||
keypadKeyPressedAtIndex(2)
|
keypadKeyPressedAtIndex(2)
|
||||||
|
event.accepted = true
|
||||||
}
|
}
|
||||||
if (event.key === Qt.Key_4) {
|
if (event.key === Qt.Key_4) {
|
||||||
keypadKeyPressedAtIndex(3)
|
keypadKeyPressedAtIndex(3)
|
||||||
|
event.accepted = true
|
||||||
}
|
}
|
||||||
if (event.key === Qt.Key_5) {
|
if (event.key === Qt.Key_5) {
|
||||||
keypadKeyPressedAtIndex(4)
|
keypadKeyPressedAtIndex(4)
|
||||||
|
event.accepted = true
|
||||||
}
|
}
|
||||||
if (event.key === Qt.Key_6) {
|
if (event.key === Qt.Key_6) {
|
||||||
keypadKeyPressedAtIndex(5)
|
keypadKeyPressedAtIndex(5)
|
||||||
|
event.accepted = true
|
||||||
}
|
}
|
||||||
if (event.key === Qt.Key_7) {
|
if (event.key === Qt.Key_7) {
|
||||||
keypadKeyPressedAtIndex(6)
|
keypadKeyPressedAtIndex(6)
|
||||||
|
event.accepted = true
|
||||||
}
|
}
|
||||||
if (event.key === Qt.Key_8) {
|
if (event.key === Qt.Key_8) {
|
||||||
keypadKeyPressedAtIndex(7)
|
keypadKeyPressedAtIndex(7)
|
||||||
|
event.accepted = true
|
||||||
}
|
}
|
||||||
if (event.key === Qt.Key_9) {
|
if (event.key === Qt.Key_9) {
|
||||||
keypadKeyPressedAtIndex(8)
|
keypadKeyPressedAtIndex(8)
|
||||||
|
event.accepted = true
|
||||||
}
|
}
|
||||||
if (event.key === Qt.Key_Asterisk) {
|
if (event.key === Qt.Key_Asterisk) {
|
||||||
keypadKeyPressedAtIndex(9)
|
keypadKeyPressedAtIndex(9)
|
||||||
|
event.accepted = true
|
||||||
}
|
}
|
||||||
if (event.key === Qt.Key_Plus) {
|
if (event.key === Qt.Key_Plus) {
|
||||||
mainItem.buttonPressed("+")
|
mainItem.buttonPressed("+")
|
||||||
|
event.accepted = true
|
||||||
}
|
}
|
||||||
if (event.key === Qt.Key_Enter) {
|
if (event.key === Qt.Key_Enter) {
|
||||||
mainItem.launchCall()
|
mainItem.launchCall()
|
||||||
|
event.accepted = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.key === Qt.Key_Backspace) {
|
if (event.key === Qt.Key_Backspace) {
|
||||||
mainItem.wipe()
|
mainItem.wipe()
|
||||||
|
event.accepted = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,18 @@ AbstractWindow {
|
||||||
if (middleItemStackView.currentItem.objectName === "waitingRoom")
|
if (middleItemStackView.currentItem.objectName === "waitingRoom")
|
||||||
middleItemStackView.replace(inCallItem)
|
middleItemStackView.replace(inCallItem)
|
||||||
}
|
}
|
||||||
|
Connections {
|
||||||
|
enabled: activeFocusItem !== null
|
||||||
|
target: activeFocusItem.Keys
|
||||||
|
function onPressed(event) {
|
||||||
|
if (rightPanel.contentLoader.item && rightPanel.contentLoader.item.objectName === "dialerPanel"){
|
||||||
|
mainWindow.keyPressedOnDialer(event)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signal keyPressedOnDialer(KeyEvent event)
|
||||||
|
|
||||||
|
|
||||||
function changeLayout(layoutIndex) {
|
function changeLayout(layoutIndex) {
|
||||||
if (layoutIndex == 0) {
|
if (layoutIndex == 0) {
|
||||||
|
|
@ -319,16 +331,18 @@ AbstractWindow {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: DefaultStyle.grey_900
|
color: DefaultStyle.grey_900
|
||||||
Keys.onEscapePressed: {
|
focus: true
|
||||||
if (mainWindow.visibility == Window.FullScreen)
|
|
||||||
|
Keys.onPressed: (event) => {
|
||||||
|
if ((event.key === Qt.Key_Escape || event.key === Qt.Key_Return) && mainWindow.visibility == Window.FullScreen)
|
||||||
mainWindow.showNormal()
|
mainWindow.showNormal()
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: Utils.getSizeWithScreenRatio(10)
|
|
||||||
anchors.bottomMargin: Utils.getSizeWithScreenRatio(10)
|
anchors.bottomMargin: Utils.getSizeWithScreenRatio(10)
|
||||||
anchors.topMargin: Utils.getSizeWithScreenRatio(10)
|
anchors.topMargin: Utils.getSizeWithScreenRatio(10)
|
||||||
|
spacing: Utils.getSizeWithScreenRatio(10)
|
||||||
Item {
|
Item {
|
||||||
id: headerItem
|
id: headerItem
|
||||||
Layout.margins: Utils.getSizeWithScreenRatio(10)
|
Layout.margins: Utils.getSizeWithScreenRatio(10)
|
||||||
|
|
@ -369,10 +383,7 @@ AbstractWindow {
|
||||||
|| mainWindow.callState
|
|| mainWindow.callState
|
||||||
=== LinphoneEnums.CallState.Released
|
=== LinphoneEnums.CallState.Released
|
||||||
|| mainWindow.conference ? DefaultStyle.danger_500_main : mainWindow.call.core.dir === LinphoneEnums.CallDir.Outgoing ? DefaultStyle.info_500_main : DefaultStyle.success_500_main
|
|| mainWindow.conference ? DefaultStyle.danger_500_main : mainWindow.call.core.dir === LinphoneEnums.CallDir.Outgoing ? DefaultStyle.info_500_main : DefaultStyle.success_500_main
|
||||||
onColorizationColorChanged: {
|
|
||||||
callStatusIcon.active = !callStatusIcon.active
|
|
||||||
callStatusIcon.active = !callStatusIcon.active
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
spacing: Utils.getSizeWithScreenRatio(6)
|
spacing: Utils.getSizeWithScreenRatio(6)
|
||||||
|
|
@ -921,6 +932,69 @@ AbstractWindow {
|
||||||
UtilsCpp.createCall(dialerTextInput.text)
|
UtilsCpp.createCall(dialerTextInput.text)
|
||||||
}
|
}
|
||||||
Component.onCompleted: parent.height = height
|
Component.onCompleted: parent.height = height
|
||||||
|
Connections {
|
||||||
|
target: mainWindow
|
||||||
|
function onKeyPressedOnDialer(event) {
|
||||||
|
if (event.modifiers & Qt.KeypadModifier) {
|
||||||
|
if (event.key === Qt.Key_0) {
|
||||||
|
numPad.keypadKeyPressedAtIndex(10)
|
||||||
|
event.accepted = true
|
||||||
|
}
|
||||||
|
if (event.key === Qt.Key_1) {
|
||||||
|
numPad.keypadKeyPressedAtIndex(0)
|
||||||
|
event.accepted = true
|
||||||
|
}
|
||||||
|
if (event.key === Qt.Key_2) {
|
||||||
|
numPad.keypadKeyPressedAtIndex(1)
|
||||||
|
event.accepted = true
|
||||||
|
}
|
||||||
|
if (event.key === Qt.Key_3) {
|
||||||
|
numPad.keypadKeyPressedAtIndex(2)
|
||||||
|
event.accepted = true
|
||||||
|
}
|
||||||
|
if (event.key === Qt.Key_4) {
|
||||||
|
numPad.keypadKeyPressedAtIndex(3)
|
||||||
|
event.accepted = true
|
||||||
|
}
|
||||||
|
if (event.key === Qt.Key_5) {
|
||||||
|
numPad.keypadKeyPressedAtIndex(4)
|
||||||
|
event.accepted = true
|
||||||
|
}
|
||||||
|
if (event.key === Qt.Key_6) {
|
||||||
|
numPad.keypadKeyPressedAtIndex(5)
|
||||||
|
event.accepted = true
|
||||||
|
}
|
||||||
|
if (event.key === Qt.Key_7) {
|
||||||
|
numPad.keypadKeyPressedAtIndex(6)
|
||||||
|
event.accepted = true
|
||||||
|
}
|
||||||
|
if (event.key === Qt.Key_8) {
|
||||||
|
numPad.keypadKeyPressedAtIndex(7)
|
||||||
|
event.accepted = true
|
||||||
|
}
|
||||||
|
if (event.key === Qt.Key_9) {
|
||||||
|
numPad.keypadKeyPressedAtIndex(8)
|
||||||
|
event.accepted = true
|
||||||
|
}
|
||||||
|
if (event.key === Qt.Key_Asterisk) {
|
||||||
|
numPad.keypadKeyPressedAtIndex(9)
|
||||||
|
event.accepted = true
|
||||||
|
}
|
||||||
|
if (event.key === Qt.Key_Plus) {
|
||||||
|
numPad.buttonPressed("+")
|
||||||
|
event.accepted = true
|
||||||
|
}
|
||||||
|
if (event.key === Qt.Key_Enter) {
|
||||||
|
numPad.launchCall()
|
||||||
|
event.accepted = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (event.key === Qt.Key_Backspace) {
|
||||||
|
numPad.wipe()
|
||||||
|
event.accepted = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue