Merge lp:~samertm/ubuntu-calculator-app/fixes-1273887 into lp:~ubuntu-calculator-dev/ubuntu-calculator-app/old_trunk

Proposed by Samer Masterson
Status: Rejected
Rejected by: Alan Pope 🍺🐧🐱 πŸ¦„
Proposed branch: lp:~samertm/ubuntu-calculator-app/fixes-1273887
Merge into: lp:~ubuntu-calculator-dev/ubuntu-calculator-app/old_trunk
Diff against target: 68 lines (+7/-5)
3 files modified
Simple/CalcLabel.qml (+1/-1)
Simple/Screen.qml (+3/-4)
Simple/SimplePage.qml (+3/-0)
To merge this branch: bzr merge lp:~samertm/ubuntu-calculator-app/fixes-1273887
Reviewer Review Type Date Requested Status
David Planella Needs Information
Riccardo Padovani Needs Fixing
Mihir Soni Needs Fixing
Review via email: mp+204602@code.launchpad.net

Commit message

 * Operators do not change screen when it is cleared

Description of the change

 * Operators do not change screen when it is cleared

I made this fix by moving the variable newCalculation out of root in Screen.qml and into formulaView in SimplePage.qml. This is because I couldn't figure out how to write a signal handler in Screen.qml that used a signal defined in formulaView. If there's a clearer solution, feel free to reject this merge! :)

To post a comment you must log in.
Revision history for this message
Mihir Soni (mihirsoni) wrote :

Could you go to this line
http://bazaar.launchpad.net/~ubuntu-calculator-dev/ubuntu-calculator-app/trunk/view/head:/Simple/SimplePage.qml#L131

and replace this line with following :-

screenFormula = [{_text:'0', _operation: '', _number:''}];

This should work, could you please let me know ?

Revision history for this message
Samer Masterson (samertm) wrote :

When you make that change, the label is changed to 0, like this (after following the steps to reproduce the bug): http://imgur.com/ZzGUVO0. It also doesn't work when you set _number to '0'.

Revision history for this message
Mihir Soni (mihirsoni) wrote :

Hi samer,

I did try to put 0 in place of Number , and it is working fine.

Could you take the latest and try doing this??

review: Needs Fixing
Revision history for this message
Samer Masterson (samertm) wrote :

This was how the app acted when I changed the line to:
screenFormula = [{_text:'', _operation: '', _number:'0'}];

http://www.youtube.com/watch?v=c5nULrERgGk&feature=youtu.be

For the first 5 seconds, I hit the operators before hitting clear. I hit clear 6 seconds in, and you can see the calculator screen move downwards. It also tacks '0' onto the number if you start typing.

Revision history for this message
Samer Masterson (samertm) wrote :

> I hit clear 6 seconds in, and you can see the calculator screen move downwards.

*and you can see the calculator screen move downwards after I press an operator button.

Revision history for this message
Samer Masterson (samertm) wrote :

Has there been any movement on this issue?

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Sorry for the late response Samer.

I notice a wrong behavior:
- Start the app
- Press *
- The '0' disappears

review: Needs Fixing
Revision history for this message
Samer Masterson (samertm) wrote :

That's alright!

Can you elaborate on how you ran into the issue? Testing a fresh fetch of my code solves the bug, as seen here: http://www.youtube.com/watch?v=pFNmhMz0jeg&feature=youtu.be

Additionally, when I apply the diff to the trunk, the bug is still fixed.

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Mhh, right, you have to do a calc before:
- Start the app
- Do a calc and tear off
- Close the app
- Restart the app
- Press * as first button
- 0 disappears.

It's a very corner case, because it exist only on first calc, only if you press an operator as first button and only if there is at least a calc in history

Revision history for this message
David Planella (dpm) wrote :

Samer, this branch has been in status "Needs Fixing" for quite a while. Have you had the chance to look into the issues pointed out by Riccardo?

review: Needs Information

Unmerged revisions

215. By Samer Masterson

 * Operators do not change screen when it is cleared

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Simple/CalcLabel.qml'
2--- Simple/CalcLabel.qml 2014-01-12 17:48:38 +0000
3+++ Simple/CalcLabel.qml 2014-02-04 05:17:41 +0000
4@@ -121,7 +121,7 @@
5 fontSizeMode: Text.Fit
6 horizontalAlignment: Text.AlignRight
7 // If is a new calculation or if last calculation as been deleted print 0, else the number
8- text: ((isLast && !newCalculation) || (root.numbers === "" && formulaView.headerItem.state !== "newPush")) ? "0" : root.numbers
9+ text: ((isLast && !formulaView.newCalculation) || (root.numbers === "" && formulaView.headerItem.state !== "newPush")) ? "0" : root.numbers
10 }
11 }
12 }
13
14=== modified file 'Simple/Screen.qml'
15--- Simple/Screen.qml 2014-01-12 17:48:38 +0000
16+++ Simple/Screen.qml 2014-02-04 05:17:41 +0000
17@@ -27,7 +27,6 @@
18 transformOrigin: Item.Bottom
19
20 property var ops
21- property bool newCalculation: false
22 signal useAnswer(string answerToUse, string formulaData)
23 signal labelTextUpdated(int idx, string newText)
24 signal mainLabelUpdated(int idx, string newText)
25@@ -150,7 +149,7 @@
26 id: row
27 height: units.gu(4)
28 width: parent.width
29- visible: !isLastItem || newCalculation && formulaView.headerItem.state !== ""
30+ visible: !isLastItem || formulaView.newCalculation && formulaView.headerItem.state !== ""
31 Item {
32 id: editIcon
33 objectName: "editIcon"
34@@ -288,11 +287,11 @@
35 }
36
37 onNumbersChanged: {
38- newCalculation = true
39+ formulaView.newCalculation = true
40 }
41
42 onOperationChanged: {
43- newCalculation = true
44+ formulaView.newCalculation = true
45 }
46
47 /*
48
49=== modified file 'Simple/SimplePage.qml'
50--- Simple/SimplePage.qml 2014-01-28 23:56:49 +0000
51+++ Simple/SimplePage.qml 2014-02-04 05:17:41 +0000
52@@ -131,6 +131,7 @@
53 screenFormula = [{_text:'', _operation: '', _number:''}];
54 formula = new F.Formula();
55 formulaView.currentOperatorsChanged();
56+ formulaView.newCalculation = false; // sets display to 0
57 }
58
59 function addFromMemory(numberToAdd) {
60@@ -284,6 +285,8 @@
61 property bool __toBeRefresh: false
62 property int __displaceDist: contentY - __initialContentY
63
64+ property bool newCalculation: false
65+
66 signal currentOperatorsChanged()
67
68 function addCurrentToMemory() {

Subscribers

People subscribed via source and target branches