Merge lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts into lp:ubuntu-calculator-app

Proposed by Niklas Wenzel on 2015-06-11
Status: Merged
Approved by: Riccardo Padovani on 2015-06-11
Approved revision: 183
Merged at revision: 183
Proposed branch: lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts
Merge into: lp:ubuntu-calculator-app
Diff against target: 113 lines (+24/-14)
3 files modified
app/ubuntu-calculator-app.qml (+11/-1)
app/ui/LandscapeKeyboard.qml (+6/-6)
app/ui/PortraitKeyboard.qml (+7/-7)
To merge this branch: bzr merge lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-06-12
Riccardo Padovani 2015-06-11 Approve on 2015-06-11
Review via email: mp+261747@code.launchpad.net

Commit Message

Fix typing special characters on hardware keyboards

Description of the Change

Fix typing special characters on hardware keyboards.

Makes the app usable on the desktop. :)

To post a comment you must log in.
Riccardo Padovani (rpadovani) wrote :

Thanks, this is very important with the convergence coming!

review: Approve
Niklas Wenzel (nikwen) wrote :

@rpadovani: Thanks for reviewing this that fast!

It's strange that it worked the first time but failed the second time. Let's check that.

Riccardo Padovani (rpadovani) wrote :

We have a problem with autopilot since ages, it randomly failes on phone

Niklas Wenzel (nikwen) wrote :

Ah, ok. Thanks. :)

review: Approve (continuous-integration)
Bartosz Kosiorek (gang65) wrote :

When we approve second time, the Autopilot tests are not run and it is always passed.
@nikwen Do you know what could cause this issue?

Niklas Wenzel (nikwen) wrote :

@rpadovani: Thanks for approving again and merging this.

@gang65: I think there are some serious problems with running autopilot tests here.
Just compare which tests were run the first time (when it passed) and which ones were run the second time (when it failed):

http://91.189.93.70:8080/job/generic-mediumtests-utopic/2906/testReport/ubuntu_calculator_app.tests.test_main/MainTestCase/
http://91.189.93.70:8080/job/generic-mediumtests-utopic/2910/testReport/ubuntu_calculator_app.tests.test_main/MainTestCase/

These lists differ quite a lot! I'll ping popey on IRC.

And yes, I have an idea why it failed the second time. Let me check the test case but it should be unrelated to this MP.

Niklas Wenzel (nikwen) wrote :

I found the issue why the test failed once. I filed it as LP: #1464571 and will take care of it as soon as possible.

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-04-26 22:41:49 +0000
3+++ app/ubuntu-calculator-app.qml 2015-06-11 15:45:00 +0000
4@@ -287,7 +287,7 @@
5 id: calculationHistory
6 }
7
8- Keys.onPressed: {
9+ Keys.onPressed: { //Some special keys like backspace captured in TextField below as they are for some reason not sent to the application but to the text input
10 keyboardLoader.item.pressedKey = event.key;
11 keyboardLoader.item.pressedKeyText = event.text;
12 }
13@@ -630,6 +630,16 @@
14 rightMargin: units.gu(1)
15 }
16
17+ Keys.onPressed: { //Need to capture special keys like backspace here as they are for some reason not sent to the application but to the text input
18+ keyboardLoader.item.pressedKey = event.key;
19+ keyboardLoader.item.pressedKeyText = event.text;
20+ }
21+
22+ Keys.onReleased: {
23+ keyboardLoader.item.pressedKey = -1;
24+ keyboardLoader.item.pressedKeyText = "";
25+ }
26+
27 readOnly: true
28 selectByMouse: true
29 cursorVisible: true
30
31=== modified file 'app/ui/LandscapeKeyboard.qml'
32--- app/ui/LandscapeKeyboard.qml 2015-03-12 21:21:47 +0000
33+++ app/ui/LandscapeKeyboard.qml 2015-06-11 15:45:00 +0000
34@@ -10,12 +10,12 @@
35 columns: 8
36
37 keyboardModel: new Array(
38- { text: "←", name: "delete", wFactor: 2, action: "delete", kbdKeys: [Qt.Key_Backspace], secondaryAction: "clearFormula" },
39+ { text: "←", name: "delete", wFactor: 2, action: "delete", kbdKeys: [Qt.Key_Backspace, Qt.Key_Delete], secondaryAction: "clearFormula" },
40 { text: "√", name: "sqrt", pushText: "sqrt(" },
41 { text: "÷", name: "divide", pushText: "/", kbdKeys: [Qt.Key_Slash] },
42- { text: "xⁿ", name: "power", pushText: "^", kbdKeys: [Qt.Key_AsciiCircum] },
43- { text: "x²", name: "square", pushText: "^2" },
44- { text: "x³", name: "cube", pushText: "^3" },
45+ { text: "xⁿ", name: "power", pushText: "^", kbdKeys: [Qt.Key_AsciiCircum, 16781906] }, //Number needed to make key work with the German keyboard layout as that character is normally typed by pressing the circumflex key twice but that does not work here
46+ { text: "x²", name: "square", pushText: "^2", kbdKeys: [Qt.Key_twosuperior] },
47+ { text: "x³", name: "cube", pushText: "^3", kbdKeys: [Qt.Key_threesuperior] },
48 { text: i18n.tr("log"), name: "logarithm", pushText: "log(", kbdKeys: [Qt.Key_L] },
49 { number: 7, name: "seven", textColor: "#DD4814" },
50 { number: 8, name: "eight", textColor: "#DD4814" },
51@@ -43,9 +43,9 @@
52 { text: "tan", name: "tangens", pushText: "tan(", kbdKeys: [Qt.Key_T] },
53 { text: decimalPoint, name: "point", pushText: ".", textColor: "#DD4814" },
54 { number: 0, name: "zero", textColor: "#DD4814", forceNumber: true },
55- { text: "( )", name: "universalBracket", pushText: "()", textColor: "#DD4814" },
56+ { text: "( )", name: "universalBracket", pushText: "()", textColor: "#DD4814", kbdKeys: [Qt.Key_ParenLeft, Qt.Key_ParenRight, Qt.Key_BracketLeft, Qt.Key_BracketRight] },
57 { text: "=", name: "equals", action: "calculate", kbdKeys: [Qt.Key_Enter, Qt.Key_Return] },
58- { text: "|x|", name: "abs", pushText: "abs(", kbdKeys: [Qt.Key_A] },
59+ { text: "|x|", name: "abs", pushText: "abs(", kbdKeys: [Qt.Key_A, Qt.Key_Bar] },
60 { text: "sin⁻¹", name: "arcsinus", pushText: "asin(" },
61 { text: "cos⁻¹", name: "arccos", pushText: "acos(" },
62 { text: "tan⁻¹", name: "arctangens", pushText: "atan(" }
63
64=== modified file 'app/ui/PortraitKeyboard.qml'
65--- app/ui/PortraitKeyboard.qml 2015-03-12 21:21:47 +0000
66+++ app/ui/PortraitKeyboard.qml 2015-06-11 15:45:00 +0000
67@@ -9,7 +9,7 @@
68 buttonMaxHeight: scrollableView.height / 10.0
69
70 keyboardModel: new Array(
71- { text: "←", name: "delete", wFactor: 2, action: "delete", kbdKeys: [Qt.Key_Backspace], secondaryAction: "clearFormula" },
72+ { text: "←", name: "delete", wFactor: 2, action: "delete", kbdKeys: [Qt.Key_Backspace, Qt.Key_Delete], secondaryAction: "clearFormula" },
73 { text: "√", name: "sqrt", pushText: "sqrt("},
74 { text: "÷", name: "divide", pushText: "/", kbdKeys: [Qt.Key_Slash] },
75 { number: 7, name: "seven", textColor: "#DD4814" },
76@@ -26,7 +26,7 @@
77 { text: "+", name: "plus" },
78 { text: decimalPoint, name: "point", pushText: ".", textColor: "#DD4814" },
79 { number: 0, name: "zero", textColor: "#DD4814", forceNumber: true },
80- { text: "( )", name: "universalBracket", pushText: "()", textColor: "#DD4814" },
81+ { text: "( )", name: "universalBracket", pushText: "()", textColor: "#DD4814", kbdKeys: [Qt.Key_ParenLeft, Qt.Key_ParenRight, Qt.Key_BracketLeft, Qt.Key_BracketRight] },
82 { text: "=", name: "equals", action: "calculate", kbdKeys: [Qt.Key_Enter, Qt.Key_Return] }
83 )
84 }
85@@ -36,15 +36,15 @@
86 buttonMaxHeight: scrollableView.height / 10.0
87
88 keyboardModel: new Array(
89- { text: "xⁿ", name: "power", pushText: "^", kbdKeys: [Qt.Key_AsciiCircum] },
90- { text: "x²", name: "square", pushText: "^2" },
91- { text: "x³", name: "cube", pushText: "^3" },
92+ { text: "xⁿ", name: "power", pushText: "^", kbdKeys: [Qt.Key_AsciiCircum, 16781906] }, //Number needed to make key work with the German keyboard layout as that character is normally typed by pressing the circumflex key twice but that does not work here
93+ { text: "x²", name: "square", pushText: "^2", kbdKeys: [Qt.Key_twosuperior] },
94+ { text: "x³", name: "cube", pushText: "^3", kbdKeys: [Qt.Key_threesuperior] },
95 { text: i18n.tr("log"), name: "logarithm", pushText: "log(", kbdKeys: [Qt.Key_L] },
96 { text: "ℯ", name: "eNumber", pushText: "E", kbdKeys: [Qt.Key_E] },
97 { text: "π", name: "piNumber", pushText: "pi", kbdKeys: [Qt.Key_P] },
98 { text: i18n.tr("mod"), name: "modulo", pushText: "%", kbdKeys: [Qt.Key_Percent] },
99 { text: "!", name: "factorialNumber", kbdKeys: [Qt.Key_Exclam] },
100- { text: "ℯⁿ", name: "exp", pushText: "E^"},
101+ { text: "ℯⁿ", name: "exp", pushText: "E^" },
102 { text: "1/x", name: "multiplicativeInverse", pushText: "^-1" },
103 { text: "1/x²", name: "multiplicativeInverse2", pushText: "^-2" },
104 { text: "1/x³", name: "multiplicativeInverse3", pushText: "^-3" },
105@@ -52,7 +52,7 @@
106 { text: "sin", name: "sinus", pushText: "sin(", kbdKeys: [Qt.Key_S] },
107 { text: "cos", name: "cos", pushText: "cos(", kbdKeys: [Qt.Key_C] },
108 { text: "tan", name: "tangens", pushText: "tan(", kbdKeys: [Qt.Key_T] },
109- { text: "|x|", name: "abs", pushText: "abs(", kbdKeys: [Qt.Key_A] },
110+ { text: "|x|", name: "abs", pushText: "abs(", kbdKeys: [Qt.Key_A, Qt.Key_Bar] },
111 { text: "sin⁻¹", name: "arcsinus", pushText: "asin(" },
112 { text: "cos⁻¹", name: "arccos", pushText: "acos(" },
113 { text: "tan⁻¹", name: "arctangens", pushText: "atan(" }

Subscribers

People subscribed via source and target branches