Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
229cac33
Commit
229cac33
authored
Jan 18, 2018
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ui/modules/Linphone/TelKeypad): supports keyboard (close #106)
parent
b0110fb4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
18 deletions
+66
-18
resources.qrc
resources.qrc
+1
-0
TelKeypad.js
ui/modules/Linphone/TelKeypad/TelKeypad.js
+51
-0
TelKeypad.qml
ui/modules/Linphone/TelKeypad/TelKeypad.qml
+14
-18
No files found.
resources.qrc
View file @
229cac33
...
...
@@ -368,6 +368,7 @@
<file>
ui/modules/Linphone/Styles/Timeline/TimelineStyle.qml
</file>
<file>
ui/modules/Linphone/Styles/View/SipAddressesViewStyle.qml
</file>
<file>
ui/modules/Linphone/TelKeypad/TelKeypadButton.qml
</file>
<file>
ui/modules/Linphone/TelKeypad/TelKeypad.js
</file>
<file>
ui/modules/Linphone/TelKeypad/TelKeypad.qml
</file>
<file>
ui/modules/Linphone/Timeline/Timeline.js
</file>
<file>
ui/modules/Linphone/Timeline/Timeline.qml
</file>
...
...
ui/modules/Linphone/TelKeypad/TelKeypad.js
0 → 100644
View file @
229cac33
// =============================================================================
// `TelKeypad.qml` Logic.
// =============================================================================
.
import
Linphone
.
Styles
1.0
as
LinphoneStyles
.
import
'
qrc:/ui/scripts/Utils/utils.js
'
as
Utils
// =============================================================================
function
mapKeyToButtonIndex
(
key
)
{
// Digits.
if
(
key
===
48
)
{
return
13
}
if
(
key
>=
49
&&
key
<=
57
)
{
return
(
key
-
49
)
+
parseInt
((
key
-
49
)
/
3
)
}
// A, B, C and D.
if
(
key
>=
65
&&
key
<=
68
)
{
return
(
key
-
65
)
*
4
+
3
}
// *
if
(
key
===
42
)
{
return
12
}
// #
if
(
key
===
35
)
{
return
14
}
}
function
sendDtmf
(
index
)
{
var
children
=
grid
.
children
[
index
]
children
.
color
=
LinphoneStyles
.
TelKeypadStyle
.
button
.
color
.
pressed
children
.
clicked
()
var
timeout
=
children
.
_timeout
if
(
timeout
)
{
Utils
.
clearTimeout
(
timeout
)
}
children
.
_timeout
=
Utils
.
setTimeout
(
dragBox
,
100
,
(
function
(
index
)
{
grid
.
children
[
index
].
color
=
LinphoneStyles
.
TelKeypadStyle
.
button
.
color
.
normal
}).
bind
(
dragBox
,
index
))
}
ui/modules/Linphone/TelKeypad/TelKeypad.qml
View file @
229cac33
...
...
@@ -3,7 +3,8 @@ import QtQuick.Layouts 1.3
import
Common
1.0
import
Linphone
.
Styles
1.0
import
Utils
1.0
import
'
TelKeypad.js
'
as
Logic
// =============================================================================
...
...
@@ -23,6 +24,14 @@ Rectangle {
height
:
TelKeypadStyle
.
height
width
:
TelKeypadStyle
.
width
Keys.onPressed
:
{
var
index
=
Logic
.
mapKeyToButtonIndex
(
event
.
key
)
if
(
index
!=
null
)
{
event
.
accepted
=
true
;
Logic
.
sendDtmf
(
index
)
}
}
// ---------------------------------------------------------------------------
GridLayout
{
...
...
@@ -82,24 +91,11 @@ Rectangle {
_mouseX
=
mouse
.
x
_mouseY
=
mouse
.
y
_id
=
parseInt
(
_mouseX
/
(
parent
.
width
/
grid
.
columns
))
+
parseInt
(
_mouseY
/
(
parent
.
height
/
grid
.
rows
))
*
grid
.
columns
}
onReleased
:
{
if
(
Math
.
abs
(
_mouseX
-
mouse
.
x
)
<=
delta
&&
Math
.
abs
(
_mouseY
-
mouse
.
y
)
<=
delta
)
{
var
children
=
grid
.
children
[
_id
]
children
.
color
=
TelKeypadStyle
.
button
.
color
.
pressed
children
.
clicked
()
var
timeout
=
children
.
_timeout
if
(
timeout
)
{
Utils
.
clearTimeout
(
timeout
)
}
children
.
_timeout
=
Utils
.
setTimeout
(
this
,
100
,
(
function
(
id
)
{
grid
.
children
[
id
].
color
=
TelKeypadStyle
.
button
.
color
.
normal
}).
bind
(
this
,
_id
))
}
telKeypad
.
focus
=
true
}
onReleased
:
Math
.
abs
(
_mouseX
-
mouse
.
x
)
<=
delta
&&
Math
.
abs
(
_mouseY
-
mouse
.
y
)
<=
delta
&&
Logic
.
sendDtmf
(
_id
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment