Commit e56412e9 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/modules/Linphone/TelKeypad/TelKeypad): supports color on click

parent 6c29ac7c
...@@ -385,5 +385,6 @@ bool CallModel::getRecording () const { ...@@ -385,5 +385,6 @@ bool CallModel::getRecording () const {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void CallModel::sendDtmf (const QString &dtmf) { void CallModel::sendDtmf (const QString &dtmf) {
qInfo() << QStringLiteral("Send dtmf: `%1`.").arg(dtmf);
mLinphoneCall->sendDtmf(dtmf.constData()[0].toLatin1()); mLinphoneCall->sendDtmf(dtmf.constData()[0].toLatin1());
} }
...@@ -3,6 +3,7 @@ import QtQuick.Layouts 1.3 ...@@ -3,6 +3,7 @@ import QtQuick.Layouts 1.3
import Common 1.0 import Common 1.0
import Linphone.Styles 1.0 import Linphone.Styles 1.0
import Utils 1.0
// ============================================================================= // =============================================================================
...@@ -71,11 +72,7 @@ Rectangle { ...@@ -71,11 +72,7 @@ Rectangle {
icon: modelData.icon || '' icon: modelData.icon || ''
text: modelData.text text: modelData.text
onClicked: { onClicked: telKeypad.call.sendDtmf(modelData.text)
var text = modelData.text
console.info('Send dtmf: ' + text)
telKeypad.call.sendDtmf(text)
}
} }
} }
} }
...@@ -87,6 +84,8 @@ Rectangle { ...@@ -87,6 +84,8 @@ Rectangle {
readonly property int delta: 5 readonly property int delta: 5
property var _timeout
property int _id
property var _mouseX property var _mouseX
property var _mouseY property var _mouseY
...@@ -103,12 +102,22 @@ Rectangle { ...@@ -103,12 +102,22 @@ Rectangle {
onPressed: { onPressed: {
_mouseX = mouse.x _mouseX = mouse.x
_mouseY = mouse.y _mouseY = mouse.y
_id = parseInt(_mouseX / (parent.width / grid.columns)) + parseInt(_mouseY / (parent.height / grid.rows)) * grid.columns
} }
onReleased: { onReleased: {
if (Math.abs(_mouseX - mouse.x) <= delta && Math.abs(_mouseY - mouse.y) <= delta) { if (Math.abs(_mouseX - mouse.x) <= delta && Math.abs(_mouseY - mouse.y) <= delta) {
var id = parseInt(_mouseX / (parent.width / grid.columns)) + parseInt(_mouseY / (parent.height / grid.rows)) * grid.columns grid.children[_id].color = TelKeypadStyle.button.color.pressed
grid.children[id].clicked()
grid.children[_id].clicked()
if (_timeout) {
Utils.clearTimeout(_timeout)
}
_timeout = Utils.setTimeout(this, 100, (function (id) {
grid.children[id].color = TelKeypadStyle.button.color.normal
}).bind(this, _id))
} }
} }
} }
......
...@@ -8,6 +8,7 @@ import Linphone.Styles 1.0 ...@@ -8,6 +8,7 @@ import Linphone.Styles 1.0
Item { Item {
id: button id: button
property color color: TelKeypadStyle.button.color.normal
property string icon: '' property string icon: ''
property string text: '' property string text: ''
...@@ -19,7 +20,7 @@ Item { ...@@ -19,7 +20,7 @@ Item {
anchors.fill: parent anchors.fill: parent
background: Rectangle { background: Rectangle {
color: TelKeypadStyle.button.color.normal color: button.color
} }
contentItem: Text { contentItem: Text {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment