Merge lp:~boiko/dialer-app/fix_1082054 into lp:dialer-app

Proposed by Gustavo Pichorim Boiko
Status: Merged
Approved by: Tiago Salem Herrmann
Approved revision: 51
Merged at revision: 51
Proposed branch: lp:~boiko/dialer-app/fix_1082054
Merge into: lp:dialer-app
Diff against target: 65 lines (+24/-14)
1 file modified
src/qml/DialerPage/KeypadEntry.qml (+24/-14)
To merge this branch: bzr merge lp:~boiko/dialer-app/fix_1082054
Reviewer Review Type Date Requested Status
Tiago Salem Herrmann (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+188446@code.launchpad.net

Commit message

Limit the number of digits to 20 and scale the font down when the numbers don't fit on the screen.

Description of the change

Limit the number of digits to 20 and scale the font down when the numbers don't fit on the screen.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~boiko/dialer-app/fix_1082054 updated
51. By Gustavo Pichorim Boiko

Merge latest changes from trunk.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

looks good.
works correctly.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/qml/DialerPage/KeypadEntry.qml'
2--- src/qml/DialerPage/KeypadEntry.qml 2013-09-30 18:20:58 +0000
3+++ src/qml/DialerPage/KeypadEntry.qml 2013-09-30 22:47:54 +0000
4@@ -37,23 +37,13 @@
5 opacity: 0.05
6 }
7
8- Label {
9- id: dots
10- clip: true
11- anchors.left: parent.left
12- anchors.verticalCenter: parent.verticalCenter
13- text: "..."
14- visible: (input.contentWidth > (keypadEntry.width - dots.width))
15- font.pixelSize: input.font.pixelSize
16- font.weight: Font.Light
17- font.family: "Ubuntu"
18- color: "#AAAAAA"
19- }
20-
21 TextInput {
22 id: input
23
24- anchors.left: dots.visible ? dots.right : parent.left
25+ property bool __adjusting: false
26+
27+ anchors.left: parent.left
28+ anchors.leftMargin: units.gu(2)
29 anchors.right: parent.right
30 anchors.rightMargin: units.gu(2)
31 anchors.verticalCenter: parent.verticalCenter
32@@ -63,6 +53,7 @@
33 font.weight: Font.Light
34 font.family: "Ubuntu"
35 color: "#AAAAAA"
36+ maximumLength: 20
37 focus: true
38 cursorVisible: true
39 clip: true
40@@ -83,6 +74,25 @@
41 if (!cursorVisible)
42 cursorVisible = true
43 }
44+
45+ onContentWidthChanged: {
46+ // avoid infinite recursion here
47+ if (__adjusting) {
48+ return;
49+ }
50+
51+ __adjusting = true;
52+
53+ // start by resetting the font size to discover the scale that should be used
54+ font.pixelSize = units.dp(39);
55+
56+ // check if it really needs to be scaled
57+ if (contentWidth > width) {
58+ var factor = width / contentWidth;
59+ font.pixelSize = font.pixelSize * factor;
60+ }
61+ __adjusting = false;
62+ }
63 }
64
65 MouseArea {

Subscribers

People subscribed via source and target branches