Merge lp:~gcollura/ubuntu-calculator-app/fix-button-height into lp:ubuntu-calculator-app

Proposed by Giulio Collura on 2015-01-29
Status: Merged
Approved by: Bartosz Kosiorek on 2015-01-30
Approved revision: 83
Merged at revision: 84
Proposed branch: lp:~gcollura/ubuntu-calculator-app/fix-button-height
Merge into: lp:ubuntu-calculator-app
Diff against target: 78 lines (+9/-5)
4 files modified
app/ubuntu-calculator-app.qml (+1/-1)
app/ui/KeyboardPage.qml (+3/-2)
app/ui/LandscapeKeyboard.qml (+2/-1)
app/ui/PortraitKeyboard.qml (+3/-1)
To merge this branch: bzr merge lp:~gcollura/ubuntu-calculator-app/fix-button-height
Reviewer Review Type Date Requested Status
Bartosz Kosiorek Approve on 2015-01-30
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-01-29
Alan Pope 🍺🐧🐱 πŸ¦„ 2015-01-29 Approve on 2015-01-29
Review via email: mp+248053@code.launchpad.net

Commit Message

Fix button height on certain devices and window sizes. Fix PortraitKeyboard filename.

Description of the Change

This is only a first attempt, if it works for you, you can approve this merge proposal until we find a better solution after the ubuntu phone release.
I'm requesting also the attention of popey, since this fix targets the bug with landscape mode on krillin.
Thanks

Giulio

ps: I've also changed the PortraitKeyboard.qml file name, I hope you don't mind :)

To post a comment you must log in.
Bartosz Kosiorek (gang65) wrote :

Nice work.

It is working perfectly for me.

Can we adjust default buttonRatio (to 0.6) for Portrait, to be the same for both keyboards (Portrait and Landscape)?
So both keyboards will look almost the same.

review: Needs Information
83. By Giulio Collura on 2015-01-29

set 0.6 ratio for portrait keyboard as well

Bartosz Kosiorek (gang65) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/ubuntu-calculator-app.qml'
2--- app/ubuntu-calculator-app.qml 2015-01-27 00:41:25 +0000
3+++ app/ubuntu-calculator-app.qml 2015-01-29 22:17:44 +0000
4@@ -469,7 +469,7 @@
5 Loader {
6 id: keyboardLoader
7 width: parent.width
8- source: scrollableView.width > scrollableView.height ? "ui/LandscapeKeyboard.qml" : "ui/PortraiKeyboard.qml"
9+ source: scrollableView.width > scrollableView.height ? "ui/LandscapeKeyboard.qml" : "ui/PortraitKeyboard.qml"
10 opacity: ((y+height) >= scrollableView.contentY) && (y <= (scrollableView.contentY + scrollableView.height)) ? 1 : 0
11 }
12 }
13
14=== modified file 'app/ui/KeyboardPage.qml'
15--- app/ui/KeyboardPage.qml 2014-12-11 09:59:23 +0000
16+++ app/ui/KeyboardPage.qml 2015-01-29 22:17:44 +0000
17@@ -41,6 +41,7 @@
18 0.5 means the button's height will be half the button's width
19 */
20 property real buttonRatio: 0.7
21+ property real buttonMaxHeight: units.gu(10)
22
23 spacing: units.gu(1)
24
25@@ -104,7 +105,7 @@
26 Loader {
27 sourceComponent: model.text ? buttonComponent : undefined
28
29- height: width * keyboardRoot.buttonRatio
30+ height: Math.min(width * keyboardRoot.buttonRatio, keyboardRoot.buttonMaxHeight)
31 width: keyboardRoot.width / keyboardRoot.columns - keyboardRoot.spacing
32
33 Component {
34@@ -112,7 +113,7 @@
35
36 Item {
37 KeyboardButton {
38- height: repeater.baseSize * keyboardRoot.buttonRatio * model.hFactor + (keyboardRoot.spacing * (model.hFactor - 1))
39+ height: Math.min(repeater.baseSize * keyboardRoot.buttonRatio, keyboardRoot.buttonMaxHeight) * model.hFactor + (keyboardRoot.spacing * (model.hFactor - 1))
40 width: repeater.baseSize * model.wFactor + (keyboardRoot.spacing * (model.wFactor - 1))
41 text: model.text
42 objectName: model.objectName
43
44=== modified file 'app/ui/LandscapeKeyboard.qml'
45--- app/ui/LandscapeKeyboard.qml 2015-01-23 13:32:46 +0000
46+++ app/ui/LandscapeKeyboard.qml 2015-01-29 22:17:44 +0000
47@@ -5,7 +5,8 @@
48 id: calcKeyboard
49
50 KeyboardPage {
51- buttonRatio: 0.7
52+ buttonRatio: 0.6
53+ buttonMaxHeight: scrollableView.height / 10.0
54 columns: 8
55
56 keyboardModel: new Array(
57
58=== renamed file 'app/ui/PortraiKeyboard.qml' => 'app/ui/PortraitKeyboard.qml'
59--- app/ui/PortraiKeyboard.qml 2015-01-10 15:41:43 +0000
60+++ app/ui/PortraitKeyboard.qml 2015-01-29 22:17:44 +0000
61@@ -5,7 +5,8 @@
62 id: calcKeyboard
63
64 KeyboardPage {
65- buttonRatio: 0.7
66+ buttonRatio: 0.6
67+ buttonMaxHeight: scrollableView.height / 10.0
68
69 keyboardModel: new Array(
70 { text: "←", name: "clear", action: "delete", kbdKeys: [Qt.Key_Backspace] },
71@@ -31,6 +32,7 @@
72
73 KeyboardPage {
74 buttonRatio: 0.7
75+ buttonMaxHeight: scrollableView.height / 10.0
76
77 keyboardModel: new Array(
78 { text: "xⁿ", name: "power", pushText: "^", kbdKeys: [Qt.Key_AsciiCircum] },

Subscribers

People subscribed via source and target branches