ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #01716
[Merge] lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-welcome-wizard into lp:ubuntu-calculator-app
Bartosz Kosiorek has proposed merging lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-welcome-wizard into lp:ubuntu-calculator-app.
Commit message:
Introduce welcome screen for calculator, to explain how to access to scientific functions
Requested reviews:
Ubuntu Calculator Developers (ubuntu-calculator-dev)
For more details, see:
https://code.launchpad.net/~gang65/ubuntu-calculator-app/ubuntu-calculator-app-welcome-wizard/+merge/257160
Introduce welcome screen for calculator, to explain how to access to scientific functions
--
Your team Ubuntu Calculator Developers is requested to review the proposed merge of lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-welcome-wizard into lp:ubuntu-calculator-app.
=== added file 'app/graphics/gift.png'
Binary files app/graphics/gift.png 1970-01-01 00:00:00 +0000 and app/graphics/gift.png 2015-04-22 19:02:58 +0000 differ
=== added file 'app/graphics/rotate.png'
Binary files app/graphics/rotate.png 1970-01-01 00:00:00 +0000 and app/graphics/rotate.png 2015-04-22 19:02:58 +0000 differ
=== modified file 'app/ubuntu-calculator-app.qml'
--- app/ubuntu-calculator-app.qml 2015-04-06 12:49:36 +0000
+++ app/ubuntu-calculator-app.qml 2015-04-22 19:02:58 +0000
@@ -24,6 +24,7 @@
import "engine"
import "engine/math.js" as MathJs
import "engine/formula.js" as Formula
+import Qt.labs.settings 1.0
MainView {
id: mainView
@@ -69,6 +70,11 @@
// Var used to store currently edited calculation history item
property int editedCalculationIndex: -1
+ property var settings: Settings {
+ // Used for Welcome Wizard
+ property bool firstRun: true
+ }
+
// By default we delete selected calculation from history.
// If it is set to false, then editing will be invoked
property bool deleteSelectedCalculation: true;
@@ -134,7 +140,7 @@
try {
shortFormula = mathJs.eval(shortFormula);
} catch(exception) {
- console.log("Error: math.js " + exception.toString() + " engine formula:" + shortFormula);
+ console.log("[LOG]: Unable to create short formula from: \"" + longFormula + "\", math.js: " + exception.toString());
}
isFormulaIsValidToCalculate = false;
@@ -180,7 +186,7 @@
for (var i = 0; i < numberOfOpenedBrackets; i++) {
deleteLastFormulaElement();
}
- console.log("Error: math.js " + exception.toString() + " engine formula:" + longFormula);
+ console.log("[LOG]: Unable to calculate formula : \"" + longFormula + "\", math.js: " + exception.toString());
errorAnimation.restart();
return false;
}
@@ -205,13 +211,19 @@
id: mainStack
Component.onCompleted: {
- push(calculatorPage);
- calculatorPage.forceActiveFocus();
+ // Show the welcome wizard only when running the app for the first time
+ if (settings.firstRun) {
+ console.log("[LOG]: Detecting first time run by user. Starting welcome wizard.")
+ push(Qt.resolvedUrl("welcomewizard/WelcomeWizard.qml"))
+ } else {
+ push(calculatorPage);
+ calculatorPage.forceActiveFocus();
+ }
}
PageWithBottomEdge {
id: calculatorPage
-
+ visible: false
bottomEdgeTitle: i18n.tr("Favorite")
bottomEdgePageComponent: FavouritePage {
=== added file 'app/ui/ActionButton.qml'
--- app/ui/ActionButton.qml 1970-01-01 00:00:00 +0000
+++ app/ui/ActionButton.qml 2015-04-22 19:02:58 +0000
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2015 Canonical Ltd
+ *
+ * This file is part of Ubuntu Calculator App
+ *
+ * Ubuntu Calculator App is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Ubuntu Calculator App is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import QtQuick 2.3
+import Ubuntu.Components 1.1
+
+AbstractButton {
+ id: abstractButton
+
+ property alias iconName: _icon.name
+ property alias color: _icon.color
+
+ Rectangle {
+ visible: abstractButton.pressed
+ anchors.fill: parent
+ color: UbuntuColors.orange
+ }
+
+ Icon {
+ id: _icon
+ width: units.gu(2.5)
+ height: width
+ anchors.centerIn: parent
+ color: UbuntuColors.orange
+ }
+}
=== added file 'app/ui/Walkthrough.qml'
--- app/ui/Walkthrough.qml 1970-01-01 00:00:00 +0000
+++ app/ui/Walkthrough.qml 2015-04-22 19:02:58 +0000
@@ -0,0 +1,186 @@
+/*
+ * Copyright 2015 Nekhelesh Ramananthan (UCS)
+ *
+ * This file is part of Ubuntu Calculator App
+ *
+ * Ubuntu Calculator App is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Ubuntu Calculator App is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+import QtQuick 2.3
+import Ubuntu.Components 1.1
+import Ubuntu.Components.ListItems 1.0 as ListItem
+
+Page {
+ id: walkthrough
+
+ // Property to set the app name used in the walkthrough
+ property string appName
+
+ // Property to check if this is the first run or not
+ property bool isFirstRun: true
+
+ // Property to store the slides shown in the walkthrough (Each slide is a component defined in a separate file for simplicity)
+ property list<Component> model
+
+ // Property to set the color of bottom cirle to indicate the user's progress
+ property color completeColor: "green"
+
+ // Property to set the color of the bottom circle to indicate the slide still left to cover
+ property color inCompleteColor: "lightgrey"
+
+ // Property to set the color of the skip welcome wizard text
+ property color skipTextColor: "grey"
+
+ // Property to signal walkthrough completion
+ signal finished
+
+ // ListView to show the slides
+ ListView {
+ id: listView
+ anchors {
+ left: parent.left
+ right: parent.right
+ top: skipLabel.bottom
+ bottom: slideIndicator.top
+ }
+
+ model: walkthrough.model
+ snapMode: ListView.SnapOneItem
+ orientation: Qt.Horizontal
+ highlightMoveDuration: UbuntuAnimation.FastDuration
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ highlightFollowsCurrentItem: true
+
+ delegate: Item {
+ width: listView.width
+ height: listView.height
+ clip: true
+
+ Loader {
+ anchors {
+ fill: parent
+ margins: units.gu(2)
+ }
+
+ sourceComponent: modelData
+ }
+ }
+ }
+
+ // Label to skip the walkthrough. Only visible on the first slide
+ Label {
+ id: skipLabel
+
+ color: skipTextColor
+ fontSize: "small"
+ wrapMode: Text.WordWrap
+ text: i18n.tr("Skip")
+ horizontalAlignment: Text.AlignRight
+
+ anchors {
+ top: parent.top/*
+ * Copyright (C) 2014 Canonical Ltd
+ *
+ * This file is part of Ubuntu Calculator App
+ *
+ * Ubuntu Calculator App is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Ubuntu Calculator App is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+ left: parent.left
+ right: parent.right
+ margins: units.gu(2)
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: walkthrough.finished()
+ }
+ }
+
+ // Indicator element to represent the current slide of the walkthrough
+ Row {
+ id: slideIndicator
+ height: units.gu(6)
+ spacing: units.gu(2)
+ anchors {
+ bottom: parent.bottom
+ horizontalCenter: parent.horizontalCenter
+ }
+
+ Repeater {
+ model: walkthrough.model.length
+ delegate: Rectangle {
+ height: width
+ radius: width/2
+ width: units.gu(2)
+ antialiasing: true
+ border.width: listView.currentIndex == index ? units.gu(0.2) : units.gu(0)
+ border.color: completeColor
+ anchors.verticalCenter: parent.verticalCenter
+ color: listView.currentIndex == index ? "White"
+ : listView.currentIndex >= index ? completeColor
+ : inCompleteColor
+ Behavior on color {
+ ColorAnimation {
+ duration: UbuntuAnimation.FastDuration
+ }
+ }
+ }
+ }
+ }
+
+ ActionButton {
+ id: rightchevron
+
+ width: units.gu(6)
+ height: units.gu(6)
+
+ anchors {
+ bottom: parent.bottom
+ right: parent.right
+ }
+
+ iconName: "chevron"
+ visible: enabled
+ enabled: listView.currentIndex !== listView.count-1
+ onClicked: listView.currentIndex++
+ }
+
+ ActionButton {
+ id: leftchevron
+
+ width: units.gu(6)
+ height: units.gu(6)
+
+ anchors {
+ bottom: parent.bottom
+ left: parent.left
+ }
+
+ iconName: "chevron"
+ rotation: 180
+ visible: enabled
+ enabled: listView.currentIndex !== 0
+ onClicked: listView.currentIndex--
+ }
+}
=== added directory 'app/welcomewizard'
=== added file 'app/welcomewizard/CMakeLists.txt'
--- app/welcomewizard/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ app/welcomewizard/CMakeLists.txt 2015-04-22 19:02:58 +0000
@@ -0,0 +1,8 @@
+file(GLOB WELCOMEWIZARD_QML_JS_FILES WelcomeWizard.qml Slide1.qml Slide2.qml Slide3.qml)
+Slide1.qml
+# Make the files visible in the qtcreator tree
+add_custom_target(podbird_welcomewizard_QMlFiles ALL SOURCES ${WELCOMEWIZARD_QML_JS_FILES})
+
+install(FILES ${WELCOMEWIZARD_QML_JS_FILES} DESTINATION ${PODBIRD_DIR}/welcomewizard)
+
+
=== added file 'app/welcomewizard/Slide1.qml'
--- app/welcomewizard/Slide1.qml 1970-01-01 00:00:00 +0000
+++ app/welcomewizard/Slide1.qml 2015-04-22 19:02:58 +0000
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2015 Canonical Ltd
+ *
+ * This file is part of Ubuntu Calculator App
+ *
+ * Ubuntu Calculator App is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Ubuntu Calculator App is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import QtQuick 2.3
+import Ubuntu.Components 1.1
+
+// Slide 1
+Component {
+ id: slide1
+ Item {
+ id: slide1Container
+
+ Image {
+ anchors {
+ top: parent.top
+ bottom: introductionText.top
+ bottomMargin: units.gu(6)
+ horizontalCenter: parent.horizontalCenter
+ }
+ source: Qt.resolvedUrl("../graphics/ubuntu-calculator-app.png")
+ fillMode: Image.PreserveAspectFit
+ antialiasing: true
+ }
+
+ Label {
+ id: introductionText
+ text: i18n.tr("Welcome to Calculator")
+ fontSize: "x-large"
+ height: contentHeight
+ anchors.centerIn: parent
+ }
+
+ Label {
+ id: bodyText
+ text: i18n.tr("Enjoy the power of math by using Calculator.")
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.margins: units.gu(1)
+ anchors.top: introductionText.bottom
+ anchors.topMargin: units.gu(4)
+ anchors.bottom: swipeText.top
+ wrapMode: Text.WordWrap
+ horizontalAlignment: Text.AlignHCenter
+ }
+
+ Label {
+ id: swipeText
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.margins: units.gu(1)
+ anchors.bottom: parent.bottom
+ color: "grey"
+ fontSize: "small"
+ wrapMode: Text.WordWrap
+ horizontalAlignment: Text.AlignHCenter
+ text: i18n.tr("Swipe to move between pages")
+
+ }
+ }
+}
=== added file 'app/welcomewizard/Slide2.qml'
--- app/welcomewizard/Slide2.qml 1970-01-01 00:00:00 +0000
+++ app/welcomewizard/Slide2.qml 2015-04-22 19:02:58 +0000
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2015 Canonical Ltd
+ *
+ * This file is part of Ubuntu Calculator App
+ *
+ * Ubuntu Calculator App is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Ubuntu Calculator App is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import QtQuick 2.3
+import Ubuntu.Components 1.1
+
+// Slide 2
+Component {
+ id: slide2
+ Item {
+ id: slide1Container
+
+ Image {
+ anchors {
+ top: parent.top
+ bottom: introductionText.top
+ bottomMargin: units.gu(6)
+ horizontalCenter: parent.horizontalCenter
+ }
+ fillMode: Image.PreserveAspectFit
+ source: Qt.resolvedUrl("../graphics/rotate.png")
+ }
+
+ Label {
+ id: introductionText
+ anchors.centerIn: parent
+ elide: Text.ElideRight
+ fontSize: "x-large"
+ maximumLineCount: 2
+ text: i18n.tr("Discover Scientific Calculator")
+ horizontalAlignment: Text.AlignHCenter
+ width: parent.width
+ wrapMode: Text.WordWrap
+ }
+
+ Label {
+ id: finalMessage
+ anchors {
+ top: introductionText.bottom
+ bottom: parent.bottom
+ left: parent.left
+ right: parent.right
+ margins: units.gu(1)
+ topMargin: units.gu(4)
+ }
+ horizontalAlignment: Text.AlignHCenter
+ text: i18n.tr("You can rotate for the Scientific Calculator")
+ wrapMode: Text.WordWrap
+ }
+ }
+}
=== added file 'app/welcomewizard/Slide3.qml'
--- app/welcomewizard/Slide3.qml 1970-01-01 00:00:00 +0000
+++ app/welcomewizard/Slide3.qml 2015-04-22 19:02:58 +0000
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2015 Canonical Ltd
+ *
+ * This file is part of Ubuntu Calculator App
+ *
+ * Ubuntu Calculator App is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Ubuntu Calculator App is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import QtQuick 2.3
+import Ubuntu.Components 1.1
+
+// Slide 6
+Component {
+ id: slide6
+ Item {
+ id: slide1Container
+
+ Image {
+ anchors {
+ top: parent.top
+ bottom: introductionText.top
+ bottomMargin: units.gu(6)
+ horizontalCenter: parent.horizontalCenter
+ }
+ fillMode: Image.PreserveAspectFit
+ source: Qt.resolvedUrl("../graphics/gift.png")
+ }
+
+ Label {
+ id: introductionText
+ anchors.centerIn: parent
+ elide: Text.ElideRight
+ fontSize: "x-large"
+ maximumLineCount: 2
+ text: i18n.tr("Enjoy")
+ horizontalAlignment: Text.AlignHCenter
+ width: parent.width
+ wrapMode: Text.WordWrap
+ }
+
+ Label {
+ id: finalMessage
+ anchors {
+ top: introductionText.bottom
+ bottom: continueButton.top
+ left: parent.left
+ right: parent.right
+ margins: units.gu(1)
+ topMargin: units.gu(4)
+ }
+ horizontalAlignment: Text.AlignHCenter
+ text: i18n.tr("We hope you enjoy using Calculator!")
+ wrapMode: Text.WordWrap
+ }
+
+ Button {
+ id: continueButton
+ anchors {
+ bottom: parent.bottom
+ bottomMargin: units.gu(3)
+ horizontalCenter: parent.horizontalCenter
+ }
+ height: units.gu(6)
+ width: parent.width/1.3
+ color: UbuntuColors.green
+ text: i18n.tr("Finish")
+ onClicked: finished()
+ }
+ }
+}
=== added file 'app/welcomewizard/WelcomeWizard.qml'
--- app/welcomewizard/WelcomeWizard.qml 1970-01-01 00:00:00 +0000
+++ app/welcomewizard/WelcomeWizard.qml 2015-04-22 19:02:58 +0000
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2015 Canonical Ltd
+ *
+ * This file is part of Ubuntu Calculator App
+ *
+ * Ubuntu Calculator App is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Ubuntu Calculator App is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import QtQuick 2.3
+import Ubuntu.Components 1.1
+import "../ui"
+
+// Initial Walkthrough tutorial
+Walkthrough {
+ id: walkthrough
+ appName: "Calculator"
+ onFinished: {
+ console.log("[LOG]: Welcome tour complete")
+ settings.firstRun = false
+ mainStack.pop()
+ mainStack.push(calculatorPage)
+ calculatorPage.forceActiveFocus();
+ }
+ model: [
+ Slide1{},
+ Slide2{},
+ Slide3{}
+ ]
+}
Follow ups