ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #03944
[Merge] lp:~ubuntu-clock-dev/ubuntu-clock-app/stopwatch-feature-staging into lp:ubuntu-clock-app
Nekhelesh Ramananthan has proposed merging lp:~ubuntu-clock-dev/ubuntu-clock-app/stopwatch-feature-staging into lp:ubuntu-clock-app.
Commit message:
Implement the new stopwatch feature
Requested reviews:
Ubuntu Clock Developers (ubuntu-clock-dev)
For more details, see:
https://code.launchpad.net/~ubuntu-clock-dev/ubuntu-clock-app/stopwatch-feature-staging/+merge/266718
This is a staging MP for the stopwatch feature. All intermediate stopwatch code implementation should be merged into this branch while keep trunk clean and stable.
Things Implemented:
-------------------
- New navigation model
Things that need to be implemented
----------------------------------
- Stopwatch UI
- Stopwatch backend JS functions
- Final finishing touches
- Manual testing
- Unit tests
- Autopilot tests
--
Your team Ubuntu Clock Developers is requested to review the proposed merge of lp:~ubuntu-clock-dev/ubuntu-clock-app/stopwatch-feature-staging into lp:ubuntu-clock-app.
=== modified file 'app/CMakeLists.txt'
--- app/CMakeLists.txt 2014-09-26 16:58:03 +0000
+++ app/CMakeLists.txt 2015-08-03 13:40:25 +0000
@@ -10,9 +10,11 @@
endif(CLICK_MODE)
install(FILES ${MAIN_QML} DESTINATION ${UBUNTU-CLOCK_APP_DIR})
+install(FILES "MainPage.qml" DESTINATION ${UBUNTU-CLOCK_APP_DIR})
add_subdirectory(clock)
add_subdirectory(alarm)
+add_subdirectory(stopwatch)
add_subdirectory(graphics)
add_subdirectory(components)
add_subdirectory(worldclock)
=== added file 'app/MainPage.qml'
--- app/MainPage.qml 1970-01-01 00:00:00 +0000
+++ app/MainPage.qml 2015-08-03 13:40:25 +0000
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2014-2015 Canonical Ltd
+ *
+ * This file is part of Ubuntu Clock App
+ *
+ * Ubuntu Clock 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 Clock 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.4
+import Ubuntu.Components 1.2
+import "upstreamcomponents"
+import "alarm"
+import "clock"
+
+PageWithBottomEdge {
+ id: _mainPage
+ objectName: "mainPage"
+
+ // Property to keep track of the clock time
+ property var clockTime: new Date()
+
+ // Property to keep track of an app cold start status
+ property alias isColdStart: clockPage.isColdStart
+
+ // Clock App Alarm Model Reference Variable
+ property var alarmModel
+
+ flickable: null
+ bottomEdgeTitle: alarmUtils.set_bottom_edge_title(alarmModel, clockTime)
+
+ Component.onCompleted: {
+ console.log("[LOG]: Main Page loaded")
+ _mainPage.setBottomEdgePage(Qt.resolvedUrl("alarm/AlarmPage.qml"), {})
+ }
+
+ AlarmUtils {
+ id: alarmUtils
+ }
+
+ VisualItemModel {
+ id: navigationModel
+ ClockPage {
+ id: clockPage
+ clockTime: _mainPage.clockTime
+ width: clockApp.width
+ height: listview.height
+ }
+
+ // #FIXME: Demo Purposes Only! Replace with working version
+ Rectangle {
+ color: "LightBlue"
+ height: listview.height
+ width: clockApp.width
+ Label {
+ anchors.centerIn: parent
+ text: "Stopwatch!"
+ }
+ }
+
+ // #FIXME: Demo Purposes Only! Replace with working version
+ Rectangle {
+ color: "LightGreen"
+ height: listview.height
+ width: clockApp.width
+ Label {
+ anchors.centerIn: parent
+ text: "Timer!"
+ }
+ }
+ }
+
+ // #TODO: Preferable this header should hide while scrolling up/down similar to ubuntu browser.
+ Rectangle {
+ id: headerRow
+
+ color: "LightBlue"
+ height: units.gu(8)
+ opacity: 0
+
+ anchors {
+ top: parent.top
+ left: parent.left
+ right: parent.right
+ topMargin: 0
+ }
+
+ // #FIXME: Remove Later!
+ Label {
+ anchors {
+ left: parent.left
+ verticalCenter: parent.verticalCenter
+ leftMargin: units.gu(2)
+ }
+ text: "Header Container"
+ fontSize: "large"
+ }
+
+ AbstractButton {
+ id: settingsIcon
+ objectName: "settingsIcon"
+
+ onClicked: {
+ mainStack.push(Qt.resolvedUrl("alarm/AlarmSettingsPage.qml"))
+ }
+
+ width: units.gu(5)
+ height: width
+
+ anchors {
+ verticalCenter: parent.verticalCenter
+ right: parent.right
+ rightMargin: units.gu(2)
+ }
+
+ Rectangle {
+ visible: settingsIcon.pressed
+ anchors.fill: parent
+ color: Theme.palette.selected.background
+ }
+
+ Icon {
+ width: units.gu(3)
+ height: width
+ anchors.centerIn: parent
+ name: "settings"
+ color: "Grey"
+ }
+ }
+ }
+
+ ListView {
+ id: listview
+ anchors { top: headerRow.bottom; left: parent.left; right: parent.right; bottom: parent.bottom }
+ model: navigationModel
+ orientation: ListView.Horizontal
+ snapMode: ListView.SnapOneItem
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ }
+}
=== modified file 'app/clock/ClockPage.qml'
--- app/clock/ClockPage.qml 2015-07-21 11:40:58 +0000
+++ app/clock/ClockPage.qml 2015-08-03 13:40:25 +0000
@@ -21,12 +21,10 @@
import QtPositioning 5.2
import Ubuntu.Components 1.2
import GeoLocation 1.0
-import "../alarm"
import "../components"
-import "../upstreamcomponents"
import "../worldclock"
-PageWithBottomEdge {
+Item {
id: _clockPage
objectName: "clockPage"
@@ -39,18 +37,8 @@
// Property to keep track of app cold start status
property alias isColdStart: clock.isColdStart
- property var alarmModel
-
- flickable: null
- bottomEdgeTitle: alarmUtils.set_bottom_edge_title(alarmModel, clockTime)
-
Component.onCompleted: {
console.log("[LOG]: Clock Page loaded")
- _clockPage.setBottomEdgePage(Qt.resolvedUrl("../alarm/AlarmPage.qml"), {})
- }
-
- AlarmUtils {
- id: alarmUtils
}
PositionSource {
@@ -176,46 +164,13 @@
forceActiveFocus()
}
+ clip: true
anchors.fill: parent
contentWidth: parent.width
contentHeight: clock.height + date.height + locationRow.height
+ worldCityColumn.height + addWorldCityButton.height
+ units.gu(16)
- AbstractButton {
- id: settingsIcon
- objectName: "settingsIcon"
-
- onClicked: {
- mainStack.push(Qt.resolvedUrl("../alarm/AlarmSettingsPage.qml"))
- }
-
- width: units.gu(5)
- height: width
- opacity: 0
-
- anchors {
- top: parent.top
- topMargin: units.gu(6)
- right: parent.right
- rightMargin: units.gu(2)
- }
-
- Rectangle {
- visible: settingsIcon.pressed
- anchors.fill: parent
- color: Theme.palette.selected.background
- }
-
- Icon {
- width: units.gu(3)
- height: width
- anchors.centerIn: parent
- name: "settings"
- color: "Grey"
- }
- }
-
MainClock {
id: clock
objectName: "clock"
@@ -228,7 +183,7 @@
anchors {
verticalCenter: parent.top
- verticalCenterOffset: units.gu(20)
+ verticalCenterOffset: units.gu(18)
horizontalCenter: parent.horizontalCenter
}
}
@@ -243,7 +198,7 @@
}
text: clock.analogTime.toLocaleDateString()
- opacity: settingsIcon.opacity
+ opacity: 0
color: locationRow.visible ? Theme.palette.baseText : UbuntuColors.midAubergine
fontSize: "medium"
}
@@ -252,7 +207,7 @@
id: locationRow
objectName: "locationRow"
- opacity: settingsIcon.opacity
+ opacity: date.opacity
spacing: units.gu(1)
visible: location.text !== "Null" && location.text !== "Denied"
@@ -295,7 +250,7 @@
id: worldCityColumn
objectName: "worldCityColumn"
- opacity: settingsIcon.opacity
+ opacity: date.opacity
anchors {
top: locationRow.bottom
topMargin: units.gu(4)
@@ -306,7 +261,7 @@
id: addWorldCityButton
objectName: "addWorldCityButton"
- opacity: settingsIcon.opacity
+ opacity: date.opacity
anchors {
top: worldCityColumn.bottom
topMargin: units.gu(1)
@@ -317,15 +272,23 @@
id: otherElementsStartUpAnimation
PropertyAnimation {
- target: settingsIcon
+ target: headerRow
property: "anchors.topMargin"
- from: units.gu(6)
- to: units.gu(2)
- duration: 900
- }
-
- PropertyAnimation {
- target: settingsIcon
+ from: units.gu(4)
+ to: 0
+ duration: 900
+ }
+
+ PropertyAnimation {
+ target: headerRow
+ property: "opacity"
+ from: 0
+ to: 1
+ duration: 900
+ }
+
+ PropertyAnimation {
+ target: date
property: "opacity"
from: 0
to: 1
=== added directory 'app/stopwatch'
=== added file 'app/stopwatch/CMakeLists.txt'
--- app/stopwatch/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ app/stopwatch/CMakeLists.txt 2015-08-03 13:40:25 +0000
@@ -0,0 +1,6 @@
+file(GLOB STOPWATCH_QML_JS_FILES *.qml *.js)
+
+# make the files visible in the qtcreator tree
+add_custom_target(ubuntu-clock-app_stopwatch_QMlFiles ALL SOURCES ${STOPWATCH_QML_JS_FILES})
+
+install(FILES ${STOPWATCH_QML_JS_FILES} DESTINATION ${UBUNTU-CLOCK_APP_DIR}/stopwatch)
=== modified file 'app/ubuntu-clock-app.qml'
--- app/ubuntu-clock-app.qml 2015-07-15 22:31:52 +0000
+++ app/ubuntu-clock-app.qml 2015-08-03 13:40:25 +0000
@@ -20,7 +20,6 @@
import DateTime 1.0
import U1db 1.0 as U1db
import Ubuntu.Components 1.2
-import "clock"
import "components"
MainView {
@@ -89,7 +88,7 @@
Reload the alarm model when the clock app gains focus to refresh
the alarm page UI in the case of alarm notifications.
*/
- if(applicationState && !clockPage.isColdStart) {
+ if(applicationState && !mainPage.isColdStart) {
alarmModelLoader.source = ""
alarmModelLoader.source = Qt.resolvedUrl("alarm/AlarmModelComponent.qml")
}
@@ -98,10 +97,10 @@
PageStack {
id: mainStack
- Component.onCompleted: push(clockPage)
+ Component.onCompleted: push(mainPage)
- ClockPage {
- id: clockPage
+ MainPage {
+ id: mainPage
Loader {
id: alarmModelLoader
@@ -113,20 +112,20 @@
clock page title. This will then set the correct window title on
the desktop.
- title: "Clock"
- */
-
- /*
- Create a new Date() object and pass the date, month, year, hour, minute
- and second received from the DateTime plugin manually to ensure the
- timezone info is set correctly.
-
- Javascript Month is 0-11 while QDateTime month is 1-12. Hence the -1
- is required.
- */
-
- /*
- FIXME: When the upstream QT bug at
+ title: i18n.tr("Clock")
+ */
+
+ /*
+ Create a new Date() object and pass the date, month, year, hour, minute
+ and second received from the DateTime plugin manually to ensure the
+ timezone info is set correctly.
+
+ Javascript Month is 0-11 while QDateTime month is 1-12. Hence the -1
+ is required.
+ */
+
+ /*
+ #FIXME: When the upstream QT bug at
https://bugreports.qt-project.org/browse/QTBUG-40275 is fixed it will be
possible to receive a datetime object directly instead of using this hack.
*/
=== modified file 'manifest.json.in'
--- manifest.json.in 2015-07-27 20:52:03 +0000
+++ manifest.json.in 2015-08-03 13:40:25 +0000
@@ -21,7 +21,7 @@
"python3-lxml"
]
}
- }
+ },
"x-source": {
"vcs-bzr": "@BZR_SOURCE@",
"vcs-bzr-revno": "@BZR_REVNO@"
Follow ups