ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #06896
[Merge] lp:~ubuntu-calculator-dev/ubuntu-calculator-app/ubuntu-calculator-app-decrease-startup-time into lp:ubuntu-calculator-app
Bartosz Kosiorek has proposed merging lp:~ubuntu-calculator-dev/ubuntu-calculator-app/ubuntu-calculator-app-decrease-startup-time into lp:ubuntu-calculator-app.
Commit message:
Decrease Calculator's startup time (LP: #1520554)
Requested reviews:
Ubuntu Calculator Developers (ubuntu-calculator-dev)
Related bugs:
Bug #1520554 in Ubuntu Calculator App: "Startup of calculator should be optimized"
https://bugs.launchpad.net/ubuntu-calculator-app/+bug/1520554
For more details, see:
https://code.launchpad.net/~ubuntu-calculator-dev/ubuntu-calculator-app/ubuntu-calculator-app-decrease-startup-time/+merge/281278
Decrease Calculator's startup time (LP: #1520554)
--
Your team Ubuntu Calculator Developers is requested to review the proposed merge of lp:~ubuntu-calculator-dev/ubuntu-calculator-app/ubuntu-calculator-app-decrease-startup-time into lp:ubuntu-calculator-app.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2015-07-09 20:39:32 +0000
+++ CMakeLists.txt 2015-12-23 09:03:00 +0000
@@ -33,7 +33,7 @@
set(MAIN_QML ${APP_HARDCODE}.qml)
set(ICON_FILE "${APP_HARDCODE}.png")
set(DESKTOP_FILE "${APP_HARDCODE}.desktop")
-set(APP_VERSION 2.0)
+set(APP_VERSION 2.1)
set(AUTOPILOT_DIR ubuntu_calculator_app)
if(CLICK_MODE)
=== modified file 'app/ubuntu-calculator-app.qml'
--- app/ubuntu-calculator-app.qml 2015-12-20 00:53:33 +0000
+++ app/ubuntu-calculator-app.qml 2015-12-23 09:03:00 +0000
@@ -348,16 +348,13 @@
visible: model.dbId !== -1
selectionMode: visualModel.isInSelectionMode
- selected: visualModel.isSelected(visualDelegate)
+ selected: visualModel.isSelected(parent)
property var removalAnimation
function remove() {
removalAnimation.start();
}
- // parent is the loader component
- property var visualDelegate: parent ? parent : null
-
onSwippingChanged: {
visualModel.updateSwipeState(screenDelegate);
}
@@ -368,15 +365,15 @@
onItemClicked: {
if (visualModel.isInSelectionMode) {
- if (!visualModel.selectItem(visualDelegate)) {
- visualModel.deselectItem(visualDelegate);
+ if (!visualModel.selectItem(parent)) {
+ visualModel.deselectItem(parent);
}
}
}
onItemPressAndHold: {
visualModel.startSelection();
- visualModel.selectItem(visualDelegate);
+ visualModel.selectItem(parent);
}
rightSideActions: [
=== modified file 'app/ui/FavouritePage.qml'
--- app/ui/FavouritePage.qml 2015-11-27 16:40:30 +0000
+++ app/ui/FavouritePage.qml 2015-12-23 09:03:00 +0000
@@ -43,7 +43,7 @@
subTitle: i18n.tr("Swipe calculations to the left\nto mark as favorites")
iconName: "starred"
anchors.centerIn: parent
- visible: calculationHistory.numberOfFavourites == 0;
+ visible: calculationHistory.numberOfFavourites === 0;
}
ListView {
@@ -52,8 +52,9 @@
model: calculationHistory.getContents();
delegate: ListItem.Empty {
- visible: model.isFavourite && model.dbId != -1
- height: visible ? units.gu(6) : 0
+ visible: model && model.dbId !== -1
+ // To decrease start time, we would like to avoid using "visible" binding
+ height: (model && model.dbId !== -1) ? units.gu(6) : 0
MouseArea {
anchors.fill: parent
=== modified file 'app/ui/KeyboardButton.qml'
--- app/ui/KeyboardButton.qml 2015-11-09 14:18:18 +0000
+++ app/ui/KeyboardButton.qml 2015-12-23 09:03:00 +0000
@@ -58,6 +58,7 @@
Text {
id: buttonText
anchors.centerIn: parent
+ textFormat: Text.PlainText
color: "#5a5a5c"
font.pixelSize: 0.5 * parent.height
=== modified file 'app/ui/KeyboardPage.qml'
--- app/ui/KeyboardPage.qml 2015-11-09 14:18:18 +0000
+++ app/ui/KeyboardPage.qml 2015-12-23 09:03:00 +0000
@@ -57,7 +57,7 @@
1 means square buttons
0.5 means the button's height will be half the button's width
*/
- property real buttonRatio: 0.7
+ property real buttonRatio: 0.6
property real buttonMaxHeight: units.gu(10)
//Space between the buttons
@@ -74,19 +74,20 @@
function buildModel() {
generatedModel.clear();
- var emptyPlaces = new Array();
-
- for (var i = 0; i < keyboardRoot.keyboardModel.length; i++) {
- var entry = keyboardRoot.keyboardModel[i];
- var text = entry.number || entry.forceNumber ? Number(entry.number).toLocaleString(Qt.locale(), "f", 0) : entry.text ? entry.text : "";
+ var emptyPlaces = [];
+ var i;
+ var entry
+ var keyModel = keyboardRoot.keyboardModel;
+ for (i = 0; i < keyModel.length; i++) {
+ entry = keyModel[i];
generatedModel.append(
{
- text: text,
+ text: entry.text,
wFactor: entry.wFactor ? entry.wFactor : 1,
hFactor: entry.hFactor ? entry.hFactor : 1,
action: entry.action ? entry.action : "push",
- objectName: entry.name ? entry.name + "Button" : "",
- pushText: entry.pushText ? entry.pushText : text,
+ objectName: entry.name,
+ pushText: entry.pushText ? entry.pushText : entry.text,
kbdKeys: entry.kbdKeys ? JSON.stringify(entry.kbdKeys) : JSON.stringify([]),
secondaryAction: entry.secondaryAction ? entry.secondaryAction : "",
textColor: entry.textColor ? entry.textColor : "#5a5a5c"
@@ -94,10 +95,11 @@
)
if (entry.wFactor && entry.wFactor > 1) {
- for (var j = 1; j < entry.wFactor; j++) {
+ var j
+ for (j = 1; j < entry.wFactor; j++) {
generatedModel.append({text: ""})
}
- for (var j = 0; j < emptyPlaces.length; j++) {
+ for (j = emptyPlaces.length; j--;) {
emptyPlaces[j] = emptyPlaces[j] - entry.wFactor + 1;
}
}
=== modified file 'app/ui/LandscapeKeyboard.qml'
--- app/ui/LandscapeKeyboard.qml 2015-12-02 22:16:57 +0000
+++ app/ui/LandscapeKeyboard.qml 2015-12-23 09:03:00 +0000
@@ -23,11 +23,10 @@
id: calcKeyboard
KeyboardPage {
- buttonRatio: 0.6
- buttonMaxHeight: scrollableView.height / 10.0
columns: 8
+ buttonMaxHeight: 0.1 * scrollableView.height
- keyboardModel: new Array(
+ keyboardModel: [
{ text: "←", name: "delete", wFactor: 2, action: "delete", kbdKeys: [Qt.Key_Backspace, Qt.Key_Delete], secondaryAction: "clearFormula" },
{ text: "√", name: "sqrt", pushText: "sqrt(" },
{ text: "÷", name: "divide", pushText: "/", kbdKeys: [Qt.Key_Slash] },
@@ -35,38 +34,38 @@
{ text: "x²", name: "square", pushText: "^2", kbdKeys: [Qt.Key_twosuperior] },
{ text: "x³", name: "cube", pushText: "^3", kbdKeys: [Qt.Key_threesuperior] },
{ text: i18n.tr("log"), name: "logarithm", pushText: "log(", kbdKeys: [Qt.Key_L] },
- { number: 7, name: "seven", textColor: "#DD4814" },
- { number: 8, name: "eight", textColor: "#DD4814" },
- { number: 9, name: "nine", textColor: "#DD4814" },
+ { text: "7", name: "seven", textColor: "#DD4814" },
+ { text: "8", name: "eight", textColor: "#DD4814" },
+ { text: "9", name: "nine", textColor: "#DD4814" },
{ text: "×", name: "multiply", pushText: "*", kbdKeys: [Qt.Key_Asterisk] },
{ text: "ℯ", name: "eNumber", pushText: "E", kbdKeys: [Qt.Key_E] },
{ text: "π", name: "piNumber", pushText: "pi", kbdKeys: [Qt.Key_P] },
{ text: i18n.tr("mod"), name: "modulo", pushText: "%", kbdKeys: [Qt.Key_Percent] },
{ text: "!", name: "factorialNumber", kbdKeys: [Qt.Key_Exclam] },
- { number: 4, name: "four", textColor: "#DD4814" },
- { number: 5, name: "five", textColor: "#DD4814" },
- { number: 6, name: "six", textColor: "#DD4814" },
+ { text: "4", name: "four", textColor: "#DD4814" },
+ { text: "5", name: "five", textColor: "#DD4814" },
+ { text: "6", name: "six", textColor: "#DD4814" },
{ text: "−", name: "minus", pushText: "-", kbdKeys: [Qt.Key_Minus] },
{ text: "ℯⁿ", name: "exp", pushText: "E^"},
{ text: "1/x", name: "multiplicativeInverse", pushText: "^-1" },
{ text: "1/x²", name: "multiplicativeInverse2", pushText: "^-2" },
{ text: "1/x³", name: "multiplicativeInverse3", pushText: "^-3" },
- { number: 1, name: "one", textColor: "#DD4814" },
- { number: 2, name: "two", textColor: "#DD4814" },
- { number: 3, name: "three", textColor: "#DD4814" },
+ { text: "1", name: "one", textColor: "#DD4814" },
+ { text: "2", name: "two", textColor: "#DD4814" },
+ { text: "3", name: "three", textColor: "#DD4814" },
{ text: "+", name: "plus" },
{ text: "i", name: "i", pushText: "i", kbdKeys: [Qt.Key_I] },
{ text: "sin", name: "sinus", pushText: "sin(", kbdKeys: [Qt.Key_S] },
{ text: "cos", name: "cos", pushText: "cos(", kbdKeys: [Qt.Key_C] },
{ text: "tan", name: "tangens", pushText: "tan(", kbdKeys: [Qt.Key_T] },
{ text: decimalPoint, name: "point", pushText: ".", textColor: "#DD4814" },
- { number: 0, name: "zero", textColor: "#DD4814", forceNumber: true },
+ { text: "0", name: "zero", textColor: "#DD4814" },
{ text: "( )", name: "universalBracket", pushText: "()", pasteTexts: ["(", ")"], textColor: "#DD4814", kbdKeys: [Qt.Key_ParenLeft, Qt.Key_ParenRight, Qt.Key_BracketLeft, Qt.Key_BracketRight] },
{ text: "=", name: "equals", action: "calculate", kbdKeys: [Qt.Key_Enter, Qt.Key_Return] },
{ text: "|x|", name: "abs", pushText: "abs(", kbdKeys: [Qt.Key_A, Qt.Key_Bar] },
{ text: "sin⁻¹", name: "arcsinus", pushText: "asin(" },
{ text: "cos⁻¹", name: "arccos", pushText: "acos(" },
{ text: "tan⁻¹", name: "arctangens", pushText: "atan(" }
- )
+ ]
}
}
=== modified file 'app/ui/PortraitKeyboard.qml'
--- app/ui/PortraitKeyboard.qml 2015-12-02 22:16:57 +0000
+++ app/ui/PortraitKeyboard.qml 2015-12-23 09:03:00 +0000
@@ -22,37 +22,33 @@
id: calcKeyboard
KeyboardPage {
- buttonRatio: 0.6
- buttonMaxHeight: scrollableView.height / 10.0
-
- keyboardModel: new Array(
+ buttonMaxHeight: 0.1 * scrollableView.height
+ keyboardModel: [
{ text: "←", name: "delete", wFactor: 2, action: "delete", kbdKeys: [Qt.Key_Backspace, Qt.Key_Delete], secondaryAction: "clearFormula" },
{ text: "√", name: "sqrt", pushText: "sqrt("},
{ text: "÷", name: "divide", pushText: "/", kbdKeys: [Qt.Key_Slash] },
- { number: 7, name: "seven", textColor: "#DD4814" },
- { number: 8, name: "eight", textColor: "#DD4814" },
- { number: 9, name: "nine", textColor: "#DD4814" },
+ { text: "7", name: "seven", textColor: "#DD4814" },
+ { text: "8", name: "eight", textColor: "#DD4814" },
+ { text: "9", name: "nine", textColor: "#DD4814" },
{ text: "×", name: "multiply", pushText: "*", kbdKeys: [Qt.Key_Asterisk] },
- { number: 4, name: "four", textColor: "#DD4814" },
- { number: 5, name: "five", textColor: "#DD4814" },
- { number: 6, name: "six", textColor: "#DD4814" },
+ { text: "4", name: "four", textColor: "#DD4814" },
+ { text: "5", name: "five", textColor: "#DD4814" },
+ { text: "6", name: "six", textColor: "#DD4814" },
{ text: "−", name: "minus", pushText: "-", kbdKeys: [Qt.Key_Minus] },
- { number: 1, name: "one", textColor: "#DD4814" },
- { number: 2, name: "two", textColor: "#DD4814" },
- { number: 3, name: "three", textColor: "#DD4814" },
+ { text: "1", name: "one", textColor: "#DD4814" },
+ { text: "2", name: "two", textColor: "#DD4814" },
+ { text: "3", name: "three", textColor: "#DD4814" },
{ text: "+", name: "plus" },
{ text: decimalPoint, name: "point", pushText: ".", textColor: "#DD4814" },
- { number: 0, name: "zero", textColor: "#DD4814", forceNumber: true },
+ { text: "0", name: "zero", textColor: "#DD4814" },
{ text: "( )", name: "universalBracket", pushText: "()", pasteTexts: ["(", ")"], textColor: "#DD4814", kbdKeys: [Qt.Key_ParenLeft, Qt.Key_ParenRight, Qt.Key_BracketLeft, Qt.Key_BracketRight] },
{ text: "=", name: "equals", action: "calculate", kbdKeys: [Qt.Key_Enter, Qt.Key_Return] }
- )
+ ]
}
KeyboardPage {
- buttonRatio: 0.6
- buttonMaxHeight: scrollableView.height / 10.0
-
- keyboardModel: new Array(
+ buttonMaxHeight: 0.1 * scrollableView.height
+ keyboardModel: [
{ 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
{ text: "x²", name: "square", pushText: "^2", kbdKeys: [Qt.Key_twosuperior] },
{ text: "x³", name: "cube", pushText: "^3", kbdKeys: [Qt.Key_threesuperior] },
@@ -75,7 +71,7 @@
{ text: "sin⁻¹", name: "arcsinus", pushText: "asin(" },
{ text: "cos⁻¹", name: "arccos", pushText: "acos(" },
{ text: "tan⁻¹", name: "arctangens", pushText: "atan(" }
- )
+ ]
}
}
=== modified file 'debian/changelog'
--- debian/changelog 2015-11-28 21:35:19 +0000
+++ debian/changelog 2015-12-23 09:03:00 +0000
@@ -7,8 +7,9 @@
with Google Closure (LP: #1520594)
* Run Calculator in Landscape mode for Desktop (LP: #1468663)
* Add instruction how to enable profiling (workaround for LP: #1520551)
+ * Decrease Calculator's startup time (LP: #1520554)
- -- Bartosz Kosiorek <gang65@xxxxxxxxxxxxxx> Thu, 12 Nov 2015 13:28:29 +0100
+ -- Bartosz Kosiorek <gang65@xxxxxxxxxxxxxx> Tue, 22 Dec 2015 09:52:54 +0100
ubuntu-calculator-app (2.0.233) vivid; urgency=medium
=== modified file 'po/com.ubuntu.calculator.pot'
--- po/com.ubuntu.calculator.pot 2015-10-19 22:40:29 +0000
+++ po/com.ubuntu.calculator.pot 2015-12-23 09:03:00 +0000
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-10-20 00:39+0200\n"
+"POT-Creation-Date: 2015-12-22 23:30+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -17,39 +17,44 @@
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: ../app/engine/formula.js:176
+#: ../app/engine/formula.js:176 ../app/engine/formula_compiled.js:3
msgid "NaN"
msgstr ""
-#: ../app/ubuntu-calculator-app.qml:258 ../app/ubuntu-calculator-app.qml:263
+#: ../app/ubuntu-calculator-app.qml:250
+#: /home/kosiorek/dev/core/ubuntu-calculator-app-profile/po/ubuntu-calculator-app.desktop.in.in.h:1
+msgid "Calculator"
+msgstr ""
+
+#: ../app/ubuntu-calculator-app.qml:253 ../app/ubuntu-calculator-app.qml:258
msgid "Favorite"
msgstr ""
-#: ../app/ubuntu-calculator-app.qml:311
+#: ../app/ubuntu-calculator-app.qml:305
msgid "Cancel"
msgstr ""
-#: ../app/ubuntu-calculator-app.qml:325
+#: ../app/ubuntu-calculator-app.qml:315
msgid "Select All"
msgstr ""
-#: ../app/ubuntu-calculator-app.qml:325
+#: ../app/ubuntu-calculator-app.qml:315
msgid "Select None"
msgstr ""
-#: ../app/ubuntu-calculator-app.qml:332 ../app/ubuntu-calculator-app.qml:403
+#: ../app/ubuntu-calculator-app.qml:322 ../app/ubuntu-calculator-app.qml:383
msgid "Copy"
msgstr ""
-#: ../app/ubuntu-calculator-app.qml:340 ../app/ubuntu-calculator-app.qml:455
+#: ../app/ubuntu-calculator-app.qml:330 ../app/ubuntu-calculator-app.qml:429
msgid "Delete"
msgstr ""
-#: ../app/ubuntu-calculator-app.qml:416
+#: ../app/ubuntu-calculator-app.qml:393
msgid "Edit"
msgstr ""
-#: ../app/ubuntu-calculator-app.qml:432
+#: ../app/ubuntu-calculator-app.qml:407
msgid "Add to favorites"
msgstr ""
@@ -59,7 +64,7 @@
#. TRANSLATORS: this is a time formatting string, see
#. http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid
#. expressions
-#: ../app/ubuntu-calculator-app.qml:586 ../app/ui/FavouritePage.qml:89
+#: ../app/ubuntu-calculator-app.qml:556 ../app/ui/FavouritePage.qml:90
#: ../app/ui/Screen.qml:51
msgid "dd MMM yyyy"
msgstr ""
@@ -75,12 +80,12 @@
msgstr ""
#. TRANSLATORS Natural logarithm symbol (logarithm to the base e)
-#: ../app/ui/LandscapeKeyboard.qml:19 ../app/ui/PortraitKeyboard.qml:43
+#: ../app/ui/LandscapeKeyboard.qml:36 ../app/ui/PortraitKeyboard.qml:56
msgid "log"
msgstr ""
#. TRANSLATORS Modulo operation: Finds the remainder after division of one number by another
-#: ../app/ui/LandscapeKeyboard.qml:26 ../app/ui/PortraitKeyboard.qml:47
+#: ../app/ui/LandscapeKeyboard.qml:43 ../app/ui/PortraitKeyboard.qml:60
msgid "mod"
msgstr ""
@@ -103,14 +108,10 @@
msgid "Yesterday"
msgstr ""
-#: /tmp/tmp.PtmhCGoY3S/po/ubuntu-calculator-app.desktop.in.in.h:1
-msgid "Calculator"
-msgstr ""
-
-#: /tmp/tmp.PtmhCGoY3S/po/ubuntu-calculator-app.desktop.in.in.h:2
+#: /home/kosiorek/dev/core/ubuntu-calculator-app-profile/po/ubuntu-calculator-app.desktop.in.in.h:2
msgid "A calculator for Ubuntu."
msgstr ""
-#: /tmp/tmp.PtmhCGoY3S/po/ubuntu-calculator-app.desktop.in.in.h:3
+#: /home/kosiorek/dev/core/ubuntu-calculator-app-profile/po/ubuntu-calculator-app.desktop.in.in.h:3
msgid "math;addition;subtraction;multiplication;division;"
msgstr ""
Follow ups