← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-multiline-support into lp:ubuntu-calculator-app

 

Bartosz Kosiorek has proposed merging lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-multiline-support into lp:ubuntu-calculator-app.

Commit message:
Change position of the formula in history, according to screen weight (LP: #1446808)


Requested reviews:
  Ubuntu Calculator Developers (ubuntu-calculator-dev)
Related bugs:
  Bug #1446808 in Ubuntu Calculator App: "[Calculator]Long formulas do not fit in calculator history"
  https://bugs.launchpad.net/ubuntu-calculator-app/+bug/1446808

For more details, see:
https://code.launchpad.net/~gang65/ubuntu-calculator-app/ubuntu-calculator-app-multiline-support/+merge/278897

Change position of the formula in history, according to screen weight (LP: #1446808)

I removed opacity as it was caused binding loop and impacting performance.
I checked these changes with profiler, and I notice slightly improve of performance of run (from 8.85s to 8.72s)
-- 
Your team Ubuntu Calculator Developers is requested to review the proposed merge of lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-multiline-support into lp:ubuntu-calculator-app.
=== modified file 'app/ubuntu-calculator-app.qml'
--- app/ubuntu-calculator-app.qml	2015-11-28 20:44:02 +0000
+++ app/ubuntu-calculator-app.qml	2015-11-28 21:27:19 +0000
@@ -70,6 +70,8 @@
     // If it is set to false, then editing will be invoked
     property bool deleteSelectedCalculation: true;
 
+    property bool isLandscapeView: width > units.gu(60);
+
     /**
      * The function calls the Formula.deleteLastFormulaElement function and
      * place the result in right vars
@@ -510,17 +512,6 @@
                         width: parent.width
                         height: model.dbId !== -1 ? item.height : 0;
                         sourceComponent: screenDelegateComponent
-                        opacity: ((y + height) >= scrollableView.contentY) && (y <= (scrollableView.contentY + scrollableView.height)) ? 1 : 0
-                        onOpacityChanged: {
-                            if (this.hasOwnProperty('item') && this.item !== null) {
-                                if (opacity > 0) {
-                                    sourceComponent = screenDelegateComponent;
-                                } else {
-                                    this.item.visible = false;
-                                    sourceComponent = emptyDelegate;
-                                }
-                            }
-                        }
                     }
                 }
             }

=== modified file 'app/ui/Screen.qml'
--- app/ui/Screen.qml	2015-11-24 13:43:38 +0000
+++ app/ui/Screen.qml	2015-11-28 21:27:19 +0000
@@ -52,18 +52,20 @@
     }
 
     color: "white"
+    height: units.gu(7) + (mainView.isLandscapeView ? 0 : units.gu(3.7))
     Column {
         anchors.fill: parent
         Row {
             id: creationDateRow
             width: parent.width
+            height: units.gu(1.8)
             anchors.right: parent.right
-            spacing: units.gu(1)
 
             layoutDirection: Qt.RightToLeft
 
             Text {
                 id: creationTimeText
+                height: units.gu(1.8)
                 color: UbuntuColors.darkGrey
                 text: formatDate(model.date)
                 textFormat: Text.PlainText
@@ -81,6 +83,7 @@
 
             Text {
                 id: favouriteDescriptionText
+                height: units.gu(1.8)
                 color: UbuntuColors.orange
                 text: model.favouriteText
                 textFormat: Text.PlainText
@@ -89,10 +92,12 @@
                 font.bold: true
             }
         }
+      
         Row {
             id: calculationRow
             objectName: "historyrow"
             width: parent.width
+            height: units.gu(3.5)
             anchors.right: parent.right
 
             layoutDirection: Qt.RightToLeft
@@ -101,9 +106,9 @@
             Text {
                 id: result
                 objectName: "result" + model.index
-
-                anchors.bottom: formula.bottom
-
+                visible: mainView.isLandscapeView
+                height: units.gu(3.5)
+                //anchors.bottom: parent.bottom
                 color: UbuntuColors.darkGrey
                 text: Formula.returnFormulaToDisplay(model.result)
                 textFormat: Text.PlainText
@@ -123,12 +128,33 @@
                 textFormat: Text.PlainText
                 text: Formula.returnFormulaToDisplay(model.formula) + " ="
                 font.pixelSize: units.gu(2.5)
-                lineHeight: units.gu(1) + 1
+
+                verticalAlignment: Text.AlignVCenter
+                horizontalAlignment: Text.AlignRight
+            }
+        }
+
+        Row {
+            objectName: "resultInPortraitView"
+            width: parent.width
+            height: units.gu(4)
+            anchors.right: parent.right
+
+            layoutDirection: Qt.RightToLeft
+            spacing: units.gu(1)
+            Text {
+                objectName: "result" + model.index
+                visible: !mainView.isLandscapeView
+
+                height: units.gu(4)
+ 
+                color: UbuntuColors.darkGrey
+                text: Formula.returnFormulaToDisplay(model.result)
+                font.pixelSize: units.gu(3.5)
+                lineHeight: units.gu(2)
                 lineHeightMode: Text.FixedHeight
-
-                elide: Text.ElideLeft
                 horizontalAlignment: Text.AlignRight
             }
-        }
+       }
     }
 }

=== modified file 'debian/changelog'
--- debian/changelog	2015-11-28 20:44:02 +0000
+++ debian/changelog	2015-11-28 21:27:19 +0000
@@ -5,6 +5,7 @@
   * Upgrade math.js to version 2.4.2 to fix complex numbers formatting 
   * Run Calculator in Landscape mode for Desktop (LP: #1468663)
   * Add instruction how to enable profiling (workaround for LP: #1520551) 
+  * Change position of the formula in history, according to screen weight (LP: #1446808)
 
  -- Bartosz Kosiorek <gang65@xxxxxxxxxxxxxx>  Thu, 12 Nov 2015 13:28:29 +0100
 


Follow ups