numericpad item
This commit is contained in:
parent
34e5a28482
commit
4170e1d5af
7 changed files with 274 additions and 223 deletions
|
|
@ -63,6 +63,7 @@ list(APPEND _LINPHONEAPP_QML_FILES
|
||||||
|
|
||||||
view/Control/Popup/DesktopPopup.qml
|
view/Control/Popup/DesktopPopup.qml
|
||||||
view/Control/Popup/InformationPopup.qml
|
view/Control/Popup/InformationPopup.qml
|
||||||
|
view/Control/Popup/NumericPadPopup.qml
|
||||||
view/Control/Popup/Popup.qml
|
view/Control/Popup/Popup.qml
|
||||||
view/Control/Popup/Dialog/AuthenticationDialog.qml
|
view/Control/Popup/Dialog/AuthenticationDialog.qml
|
||||||
view/Control/Popup/Dialog/Dialog.qml
|
view/Control/Popup/Dialog/Dialog.qml
|
||||||
|
|
|
||||||
|
|
@ -6,78 +6,19 @@ import Linphone
|
||||||
import UtilsCpp
|
import UtilsCpp
|
||||||
import LinphoneCallsCpp
|
import LinphoneCallsCpp
|
||||||
|
|
||||||
Control.Popup {
|
FocusScope{
|
||||||
id: mainItem
|
id: mainItem
|
||||||
closePolicy: Control.Popup.CloseOnEscape
|
|
||||||
leftPadding: 72 * DefaultStyle.dp
|
|
||||||
rightPadding: 72 * DefaultStyle.dp
|
|
||||||
topPadding: 41 * DefaultStyle.dp
|
|
||||||
bottomPadding: 18 * DefaultStyle.dp
|
|
||||||
property bool closeButtonVisible: true
|
|
||||||
property bool roundedBottom: false
|
|
||||||
property var currentCall
|
property var currentCall
|
||||||
|
|
||||||
onButtonPressed: (text) => {
|
onButtonPressed: (text) => {
|
||||||
if (currentCall) currentCall.core.lSendDtmf(text)
|
if (currentCall) currentCall.core.lSendDtmf(text)
|
||||||
else UtilsCpp.playDtmf(text)
|
else UtilsCpp.playDtmf(text)
|
||||||
}
|
}
|
||||||
onOpened: numPad.forceActiveFocus()
|
|
||||||
signal buttonPressed(string text)
|
signal buttonPressed(string text)
|
||||||
signal launchCall()
|
signal launchCall()
|
||||||
signal wipe()
|
signal wipe()
|
||||||
|
|
||||||
background: Item {
|
|
||||||
anchors.fill: parent
|
|
||||||
Rectangle {
|
|
||||||
id: numPadBackground
|
|
||||||
width: parent.width
|
|
||||||
height: parent.height
|
|
||||||
color: DefaultStyle.grey_100
|
|
||||||
radius: 20 * DefaultStyle.dp
|
|
||||||
}
|
|
||||||
MultiEffect {
|
|
||||||
id: effect
|
|
||||||
anchors.fill: numPadBackground
|
|
||||||
source: numPadBackground
|
|
||||||
shadowEnabled: true
|
|
||||||
shadowColor: DefaultStyle.grey_1000
|
|
||||||
shadowOpacity: 0.1
|
|
||||||
shadowBlur: 1
|
|
||||||
z: -1
|
|
||||||
}
|
|
||||||
Rectangle {
|
|
||||||
width: parent.width
|
|
||||||
height: parent.height / 2
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
color: DefaultStyle.grey_100
|
|
||||||
visible: !mainItem.roundedBottom
|
|
||||||
}
|
|
||||||
Button {
|
|
||||||
id: closeButton
|
|
||||||
visible: mainItem.closeButtonVisible
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.topMargin: 10 * DefaultStyle.dp
|
|
||||||
anchors.rightMargin: 10 * DefaultStyle.dp
|
|
||||||
background: Item {
|
|
||||||
anchors.fill: parent
|
|
||||||
visible: false
|
|
||||||
}
|
|
||||||
icon.source: AppIcons.closeX
|
|
||||||
width: 24 * DefaultStyle.dp
|
|
||||||
height: 24 * DefaultStyle.dp
|
|
||||||
icon.width: 24 * DefaultStyle.dp
|
|
||||||
icon.height: 24 * DefaultStyle.dp
|
|
||||||
onClicked: mainItem.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
contentItem: FocusScope{
|
|
||||||
id: numPad
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.topMargin: 41 * DefaultStyle.dp
|
|
||||||
anchors.bottomMargin: 18 * DefaultStyle.dp
|
|
||||||
anchors.rightMargin: 72 * DefaultStyle.dp
|
|
||||||
anchors.leftMargin: 72 * DefaultStyle.dp
|
|
||||||
|
|
||||||
Layout.GridLayout {
|
Layout.GridLayout {
|
||||||
id: numPadGrid
|
id: numPadGrid
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
@ -234,5 +175,4 @@ Control.Popup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,23 +14,24 @@ FocusScope {
|
||||||
property string text: textField.text
|
property string text: textField.text
|
||||||
property bool magnifierVisible: true
|
property bool magnifierVisible: true
|
||||||
property var validator: RegularExpressionValidator{}
|
property var validator: RegularExpressionValidator{}
|
||||||
property Control.Popup numericPad
|
property Control.Popup numericPadPopup
|
||||||
property alias numericPadButton: dialerButton
|
property alias numericPadButton: dialerButton
|
||||||
readonly property bool hasActiveFocus: textField.activeFocus
|
readonly property bool hasActiveFocus: textField.activeFocus
|
||||||
property alias color: backgroundItem.color
|
property alias color: backgroundItem.color
|
||||||
|
|
||||||
onVisibleChanged: if (!visible && numericPad) numericPad.close()
|
onVisibleChanged: if (!visible && numericPadPopup) numericPadPopup.close()
|
||||||
|
|
||||||
function clearText() {
|
function clearText() {
|
||||||
textField.text = ""
|
textField.text = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
enabled: numericPad != undefined
|
enabled: numericPadPopup != undefined
|
||||||
target: numericPad ? numericPad : null
|
target: numericPadPopup ? numericPadPopup : null
|
||||||
function onAboutToHide() { mainItem.numericPadButton.checked = false }
|
function onAboutToHide() { mainItem.numericPadButton.checked = false }
|
||||||
function onAboutToShow() { mainItem.numericPadButton.checked = true }
|
function onAboutToShow() { mainItem.numericPadButton.checked = true }
|
||||||
function onButtonPressed(text) {
|
function onButtonPressed(text) {
|
||||||
|
console.log("text", text)
|
||||||
textField.text += text
|
textField.text += text
|
||||||
}
|
}
|
||||||
function onWipe(){ textField.text = textField.text.slice(0, -1)}
|
function onWipe(){ textField.text = textField.text.slice(0, -1)}
|
||||||
|
|
@ -87,7 +88,7 @@ FocusScope {
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
id: dialerButton
|
id: dialerButton
|
||||||
visible: numericPad != undefined && textField.text.length === 0
|
visible: numericPadPopup != undefined && textField.text.length === 0
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: false
|
checked: false
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
|
|
||||||
81
Linphone/view/Control/Popup/NumericPadPopup.qml
Normal file
81
Linphone/view/Control/Popup/NumericPadPopup.qml
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls as Control
|
||||||
|
import QtQuick.Layouts as Layout
|
||||||
|
import QtQuick.Effects
|
||||||
|
import Linphone
|
||||||
|
import UtilsCpp
|
||||||
|
import LinphoneCallsCpp
|
||||||
|
|
||||||
|
Control.Popup {
|
||||||
|
id: mainItem
|
||||||
|
closePolicy: Control.Popup.CloseOnEscape
|
||||||
|
leftPadding: 72 * DefaultStyle.dp
|
||||||
|
rightPadding: 72 * DefaultStyle.dp
|
||||||
|
topPadding: 41 * DefaultStyle.dp
|
||||||
|
bottomPadding: 18 * DefaultStyle.dp
|
||||||
|
property bool closeButtonVisible: true
|
||||||
|
property bool roundedBottom: false
|
||||||
|
property var currentCall
|
||||||
|
onOpened: numPad.forceActiveFocus()
|
||||||
|
signal buttonPressed(string text)
|
||||||
|
signal launchCall()
|
||||||
|
signal wipe()
|
||||||
|
|
||||||
|
background: Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
Rectangle {
|
||||||
|
id: numPadBackground
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height
|
||||||
|
color: DefaultStyle.grey_100
|
||||||
|
radius: 20 * DefaultStyle.dp
|
||||||
|
}
|
||||||
|
MultiEffect {
|
||||||
|
id: effect
|
||||||
|
anchors.fill: numPadBackground
|
||||||
|
source: numPadBackground
|
||||||
|
shadowEnabled: true
|
||||||
|
shadowColor: DefaultStyle.grey_1000
|
||||||
|
shadowOpacity: 0.1
|
||||||
|
shadowBlur: 1
|
||||||
|
z: -1
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height / 2
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
color: DefaultStyle.grey_100
|
||||||
|
visible: !mainItem.roundedBottom
|
||||||
|
}
|
||||||
|
Button {
|
||||||
|
id: closeButton
|
||||||
|
visible: mainItem.closeButtonVisible
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.topMargin: 10 * DefaultStyle.dp
|
||||||
|
anchors.rightMargin: 10 * DefaultStyle.dp
|
||||||
|
background: Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
icon.source: AppIcons.closeX
|
||||||
|
width: 24 * DefaultStyle.dp
|
||||||
|
height: 24 * DefaultStyle.dp
|
||||||
|
icon.width: 24 * DefaultStyle.dp
|
||||||
|
icon.height: 24 * DefaultStyle.dp
|
||||||
|
onClicked: mainItem.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
contentItem: NumericPad{
|
||||||
|
id: numPad
|
||||||
|
currentCall: currentCall
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.topMargin: 41 * DefaultStyle.dp
|
||||||
|
anchors.bottomMargin: 18 * DefaultStyle.dp
|
||||||
|
anchors.rightMargin: 72 * DefaultStyle.dp
|
||||||
|
anchors.leftMargin: 72 * DefaultStyle.dp
|
||||||
|
onButtonPressed: (text) => {
|
||||||
|
console.log("BUTTON PRESSED NUMPAD")
|
||||||
|
mainItem.buttonPressed(text)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,7 +14,7 @@ FocusScope {
|
||||||
property color searchBarBorderColor: "transparent"
|
property color searchBarBorderColor: "transparent"
|
||||||
property alias searchBar: searchBar
|
property alias searchBar: searchBar
|
||||||
property FriendGui selectedContact
|
property FriendGui selectedContact
|
||||||
property NumericPad numPad
|
property NumericPadPopup numPadPopup
|
||||||
signal callButtonPressed(string address)
|
signal callButtonPressed(string address)
|
||||||
signal callSelectedContact()
|
signal callSelectedContact()
|
||||||
signal groupCallCreationRequested()
|
signal groupCallCreationRequested()
|
||||||
|
|
@ -40,7 +40,7 @@ FocusScope {
|
||||||
color: mainItem.searchBarColor
|
color: mainItem.searchBarColor
|
||||||
borderColor: mainItem.searchBarBorderColor
|
borderColor: mainItem.searchBarBorderColor
|
||||||
placeholderText: qsTr("Rechercher un contact")
|
placeholderText: qsTr("Rechercher un contact")
|
||||||
numericPad: mainItem.numPad
|
numericPadPopup: mainItem.numPadPopup
|
||||||
KeyNavigation.down: grouCallButton
|
KeyNavigation.down: grouCallButton
|
||||||
}
|
}
|
||||||
Flickable {
|
Flickable {
|
||||||
|
|
|
||||||
|
|
@ -104,8 +104,8 @@ AbstractMainPage {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
height: 402 * DefaultStyle.dp
|
height: 402 * DefaultStyle.dp
|
||||||
NumericPad {
|
NumericPadPopup {
|
||||||
id: numericPad
|
id: numericPadPopup
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
visible: false
|
visible: false
|
||||||
|
|
@ -495,7 +495,7 @@ AbstractMainPage {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
focus: true
|
focus: true
|
||||||
numPad: numericPad
|
numPadPopup: numericPadPopup
|
||||||
groupCallVisible: true
|
groupCallVisible: true
|
||||||
searchBarColor: DefaultStyle.grey_100
|
searchBarColor: DefaultStyle.grey_100
|
||||||
//onSelectedContactChanged: mainWindow.startCallWithContact(selectedContact, false, callContactsList)
|
//onSelectedContactChanged: mainWindow.startCallWithContact(selectedContact, false, callContactsList)
|
||||||
|
|
@ -511,7 +511,7 @@ AbstractMainPage {
|
||||||
function onOpenNumPadRequest(){ if (!callContactsList.searchBar.numericPadButton.checked) callContactsList.searchBar.numericPadButton.checked = true}
|
function onOpenNumPadRequest(){ if (!callContactsList.searchBar.numericPadButton.checked) callContactsList.searchBar.numericPadButton.checked = true}
|
||||||
}
|
}
|
||||||
Binding {
|
Binding {
|
||||||
target: numericPad
|
target: numericPadPopup
|
||||||
property: "visible"
|
property: "visible"
|
||||||
value: true
|
value: true
|
||||||
when: callContactsList.searchBar.numericPadButton.checked
|
when: callContactsList.searchBar.numericPadButton.checked
|
||||||
|
|
|
||||||
|
|
@ -563,7 +563,7 @@ AbstractWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NewCallForm {
|
NewCallForm {
|
||||||
id: callcontactslist
|
id: newCallForm
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.topMargin: 21 * DefaultStyle.dp
|
anchors.topMargin: 21 * DefaultStyle.dp
|
||||||
anchors.leftMargin: 16 * DefaultStyle.dp
|
anchors.leftMargin: 16 * DefaultStyle.dp
|
||||||
|
|
@ -572,7 +572,35 @@ AbstractWindow {
|
||||||
searchBarColor: DefaultStyle.grey_0
|
searchBarColor: DefaultStyle.grey_0
|
||||||
searchBarBorderColor: DefaultStyle.grey_200
|
searchBarBorderColor: DefaultStyle.grey_200
|
||||||
onSelectedContactChanged: {
|
onSelectedContactChanged: {
|
||||||
if (selectedContact) mainWindow.transferCallToContact(mainWindow.call, selectedContact, callcontactslist)
|
if (selectedContact) mainWindow.transferCallToContact(mainWindow.call, selectedContact, newCallForm)
|
||||||
|
}
|
||||||
|
numPadPopup: numPadPopup
|
||||||
|
Binding {
|
||||||
|
target: numPadPopup
|
||||||
|
property: "visible"
|
||||||
|
value: true
|
||||||
|
when: newCallForm.searchBar.numericPadButton.checked
|
||||||
|
restoreMode: Binding.RestoreValue
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
height: 402 * DefaultStyle.dp
|
||||||
|
NumericPadPopup {
|
||||||
|
id: numPadPopup
|
||||||
|
width: parent.width
|
||||||
|
roundedBottom: true
|
||||||
|
visible: false
|
||||||
|
leftPadding: 40 * DefaultStyle.dp
|
||||||
|
rightPadding: 40 * DefaultStyle.dp
|
||||||
|
topPadding: 41 * DefaultStyle.dp
|
||||||
|
bottomPadding: 18 * DefaultStyle.dp
|
||||||
|
onLaunchCall: {
|
||||||
|
UtilsCpp.createCall(dialerTextInput.text)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -601,15 +629,15 @@ AbstractWindow {
|
||||||
color: DefaultStyle.grey_0
|
color: DefaultStyle.grey_0
|
||||||
borderColor: DefaultStyle.grey_200
|
borderColor: DefaultStyle.grey_200
|
||||||
placeholderText: ""
|
placeholderText: ""
|
||||||
numericPad: numPad
|
numericPadPopup: numPadPopup
|
||||||
numericPadButton.visible: false
|
numericPadButton.visible: false
|
||||||
}
|
}
|
||||||
Item {
|
Item {
|
||||||
Layout.preferredWidth: parent.width
|
Layout.preferredWidth: parent.width
|
||||||
Layout.preferredHeight: numPad.height
|
Layout.preferredHeight: numPadPopup.height
|
||||||
Layout.topMargin: 10 * DefaultStyle.dp
|
Layout.topMargin: 10 * DefaultStyle.dp
|
||||||
NumericPad {
|
NumericPadPopup {
|
||||||
id: numPad
|
id: numPadPopup
|
||||||
width: parent.width
|
width: parent.width
|
||||||
closeButtonVisible: false
|
closeButtonVisible: false
|
||||||
roundedBottom: true
|
roundedBottom: true
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue