From 74932a19a7336207e793e5f892217ce52a1e3e82 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Fri, 1 Jul 2022 18:03:27 +0200 Subject: [PATCH] Update dialpad to show history. Clicking on it will erase it. --- .../modules/Linphone/TelKeypad/TelKeypad.qml | 88 +++++++++++-------- .../views/App/Calls/AbstractStartingCall.qml | 2 +- linphone-app/ui/views/App/Calls/Incall.qml | 2 +- .../App/Calls/IncallFullscreenWindow.qml | 2 +- .../ui/views/App/Calls/VideoConference.qml | 2 +- .../App/Calls/VideoConferenceFullscreen.qml | 2 +- 6 files changed, 58 insertions(+), 40 deletions(-) diff --git a/linphone-app/ui/modules/Linphone/TelKeypad/TelKeypad.qml b/linphone-app/ui/modules/Linphone/TelKeypad/TelKeypad.qml index c230d0fef..2f25543a0 100644 --- a/linphone-app/ui/modules/Linphone/TelKeypad/TelKeypad.qml +++ b/linphone-app/ui/modules/Linphone/TelKeypad/TelKeypad.qml @@ -10,7 +10,7 @@ import 'TelKeypad.js' as Logic Rectangle { id: telKeypad - + property bool showHistory: false property var container: parent property var call signal sendDtmf(var dtmf) @@ -24,7 +24,7 @@ Rectangle { enabled: true } - height: TelKeypadStyle.height + height: TelKeypadStyle.height + (showHistory ? history.contentHeight : 0) width: TelKeypadStyle.width radius:TelKeypadStyle.radius+1.0 // +1 for avoid mixing color with border slection (some pixels can be print after the line) onVisibleChanged: if(visible) telKeypad.forceActiveFocus() @@ -33,48 +33,66 @@ Rectangle { MouseArea{ anchors.fill:parent onClicked: telKeypad.forceActiveFocus() - } - GridLayout { - id: grid - + } + ColumnLayout { anchors.fill: parent anchors.topMargin: TelKeypadStyle.rowSpacing+5 anchors.bottomMargin: TelKeypadStyle.rowSpacing+5 anchors.leftMargin: TelKeypadStyle.columnSpacing+5 anchors.rightMargin: TelKeypadStyle.columnSpacing+5 - columns: 4 // Not a style. - rows: 4 // Same idea. + Text{ + id: history + Layout.preferredWidth: parent.width + Layout.preferredHeight: implicitHeight + color: 'white' + wrapMode: Text.WrapAnywhere + horizontalAlignment: Qt.AlignCenter + visible: showHistory + MouseArea{ + anchors.fill: parent + onClicked: parent.text = '' + } + } - columnSpacing: TelKeypadStyle.columnSpacing - rowSpacing: TelKeypadStyle.rowSpacing - - Repeater { - model: [ - '1', '2', '3', 'A', - '4', '5', '6', 'B', - '7', '8', '9', 'C', - '*', '0', '#', 'D', - ] + GridLayout { + id: grid - TelKeypadButton { - id: telKeypadButton - property var _timeout - showVoicemail: index === 0 - auxSymbol: index === 13 ? '+' : '' + columns: 4 // Not a style. + rows: 4 // Same idea. + + columnSpacing: TelKeypadStyle.columnSpacing + rowSpacing: TelKeypadStyle.rowSpacing + + Repeater { + model: [ + '1', '2', '3', 'A', + '4', '5', '6', 'B', + '7', '8', '9', 'C', + '*', '0', '#', 'D', + ] - Layout.fillHeight: true - Layout.fillWidth: true - - text: modelData - onSendDtmf: { - telKeypad.forceActiveFocus() - if(telKeypad.call) telKeypad.call.sendDtmf(dtmf) - telKeypad.sendDtmf(dtmf) - } - Connections{ - target: telKeypad - onKeyPressed: telKeypadButton.activateEvent(event.key) + TelKeypadButton { + id: telKeypadButton + property var _timeout + showVoicemail: index === 0 + auxSymbol: index === 13 ? '+' : '' + + Layout.fillHeight: true + Layout.fillWidth: true + + text: modelData + onSendDtmf: { + telKeypad.forceActiveFocus() + if(telKeypad.call) telKeypad.call.sendDtmf(dtmf) + telKeypad.sendDtmf(dtmf) + if(showHistory) + history.text += dtmf + } + Connections{ + target: telKeypad + onKeyPressed: telKeypadButton.activateEvent(event.key) + } } } } diff --git a/linphone-app/ui/views/App/Calls/AbstractStartingCall.qml b/linphone-app/ui/views/App/Calls/AbstractStartingCall.qml index c5160fe82..14066920c 100644 --- a/linphone-app/ui/views/App/Calls/AbstractStartingCall.qml +++ b/linphone-app/ui/views/App/Calls/AbstractStartingCall.qml @@ -124,7 +124,7 @@ Rectangle { TelKeypad { id: telKeypad - + showHistory:true call: parent.call visible: SettingsModel.showTelKeypadAutomatically y: 50 diff --git a/linphone-app/ui/views/App/Calls/Incall.qml b/linphone-app/ui/views/App/Calls/Incall.qml index 258947d34..83e9971a9 100644 --- a/linphone-app/ui/views/App/Calls/Incall.qml +++ b/linphone-app/ui/views/App/Calls/Incall.qml @@ -470,7 +470,7 @@ Rectangle { TelKeypad { id: telKeypad - + showHistory: true call: incall.call visible: SettingsModel.showTelKeypadAutomatically y: 50 diff --git a/linphone-app/ui/views/App/Calls/IncallFullscreenWindow.qml b/linphone-app/ui/views/App/Calls/IncallFullscreenWindow.qml index db6802540..642ef74d6 100644 --- a/linphone-app/ui/views/App/Calls/IncallFullscreenWindow.qml +++ b/linphone-app/ui/views/App/Calls/IncallFullscreenWindow.qml @@ -525,7 +525,7 @@ Window { TelKeypad { id: telKeypad - + showHistory:true call: window.call visible: false y: 50 diff --git a/linphone-app/ui/views/App/Calls/VideoConference.qml b/linphone-app/ui/views/App/Calls/VideoConference.qml index aa2676b8c..0a6e5aa0b 100644 --- a/linphone-app/ui/views/App/Calls/VideoConference.qml +++ b/linphone-app/ui/views/App/Calls/VideoConference.qml @@ -445,7 +445,7 @@ Rectangle { } TelKeypad { id: telKeypad - + showHistory:true call: callModel visible: SettingsModel.showTelKeypadAutomatically y: 50 diff --git a/linphone-app/ui/views/App/Calls/VideoConferenceFullscreen.qml b/linphone-app/ui/views/App/Calls/VideoConferenceFullscreen.qml index a7d24030a..00dfd3819 100644 --- a/linphone-app/ui/views/App/Calls/VideoConferenceFullscreen.qml +++ b/linphone-app/ui/views/App/Calls/VideoConferenceFullscreen.qml @@ -483,7 +483,7 @@ Window { } TelKeypad { id: telKeypad - + showHistory:true call: callModel visible: SettingsModel.showTelKeypadAutomatically y: 50