← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~nik90/ubuntu-clock-app/migrate-clock-pageheaders into lp:ubuntu-clock-app

 

Nekhelesh Ramananthan has proposed merging lp:~nik90/ubuntu-clock-app/migrate-clock-pageheaders into lp:ubuntu-clock-app.

Commit message:
Migrated all page.head to the new PageHeaders except for SoundPeerPicker.qml (since it uses ContentPeerPicker that uses UC 1.2. Mixing 1.2 and 1.3 is not recommended)

Requested reviews:
  Ubuntu Clock Developers (ubuntu-clock-dev)
Related bugs:
  Bug #1550991 in Ubuntu Clock App: "Migrate all page head to the new PageHeader"
  https://bugs.launchpad.net/ubuntu-clock-app/+bug/1550991

For more details, see:
https://code.launchpad.net/~nik90/ubuntu-clock-app/migrate-clock-pageheaders/+merge/287416

Migrated all page.head to the new PageHeaders except for SoundPeerPicker.qml (since it uses ContentPeerPicker that uses UC 1.2. Mixing 1.2 and 1.3 is not recommended)
-- 
Your team Ubuntu Clock Developers is requested to review the proposed merge of lp:~nik90/ubuntu-clock-app/migrate-clock-pageheaders into lp:ubuntu-clock-app.
=== modified file 'app/alarm/AlarmLabel.qml'
--- app/alarm/AlarmLabel.qml	2016-02-25 22:16:54 +0000
+++ app/alarm/AlarmLabel.qml	2016-02-28 20:46:04 +0000
@@ -30,27 +30,32 @@
     property string oldAlarmLabel: alarm.message
 
     visible: false
-    title: i18n.tr("Label")
-
-    head.backAction: Action {
-        id: backAction
-        iconName: "back"
-        onTriggered: {
-            // Restore old alarm label if user presses the back button
-            alarm.message = oldAlarmLabel
-            pop()
-        }
-    }
-
-    head.actions: Action {
-        id: saveAction
-        objectName: "saveAction"
-        iconName: "ok"
-        enabled: oldAlarmLabel !== _labelEntry.text.trim() && _labelEntry.text.trim()
-        onTriggered: {
-            alarm.message = _labelEntry.text.trim()
-            pop()
-        }
+
+    header: PageHeader {
+        title: i18n.tr("Label")
+        leadingActionBar.actions: [
+            Action {
+                id: backAction
+                iconName: "back"
+                onTriggered: {
+                    // Restore old alarm label if user presses the back button
+                    alarm.message = oldAlarmLabel
+                    pop()
+                }
+            }
+        ]
+        trailingActionBar.actions: [
+            Action {
+                id: saveAction
+                objectName: "saveAction"
+                iconName: "ok"
+                enabled: oldAlarmLabel !== _labelEntry.text.trim() && _labelEntry.text.trim()
+                onTriggered: {
+                    alarm.message = _labelEntry.text.trim()
+                    pop()
+                }
+            }
+        ]
     }
 
     Component.onCompleted: {
@@ -63,7 +68,10 @@
         spacing: units.gu(0.5)
 
         anchors {
-            fill: parent
+            top: _alarmLabelPage.header.bottom
+            left: parent.left
+            right: parent.right
+            bottom: parent.bottom
             margins: units.gu(2)
         }
 

=== modified file 'app/alarm/AlarmRepeat.qml'
--- app/alarm/AlarmRepeat.qml	2016-02-25 22:16:54 +0000
+++ app/alarm/AlarmRepeat.qml	2016-02-28 20:46:04 +0000
@@ -33,7 +33,57 @@
     property int oldAlarmDaysOfWeek
 
     visible: false
-    title: i18n.tr("Repeat")
+
+    header: PageHeader {
+        title: i18n.tr("Repeat")
+        leadingActionBar.actions: [
+            Action {
+                iconName: "back"
+                onTriggered: {
+                    // Restore alarm frequency and type if user presses the back button
+                    alarm.daysOfWeek = oldAlarmDaysOfWeek
+                    detectAlarmType()
+                    pop()
+                }
+            }
+        ]
+        trailingActionBar.actions: [
+            Action {
+                text: i18n.tr("Select All")
+
+                iconSource: {
+                    if(alarm.daysOfWeek === 127)
+                        return Qt.resolvedUrl("../graphics/select-none.svg")
+                    else
+                        return Qt.resolvedUrl("../graphics/select.svg")
+                }
+
+                onTriggered: {
+                    if (alarm.daysOfWeek === 127) {
+                        for (var i=0; i<_alarmDays.count; i++) {
+                            _alarmDays.itemAt(i).isChecked = false
+                        }
+                    }
+
+                    else {
+                        for (var i=0; i<_alarmDays.count; i++) {
+                            _alarmDays.itemAt(i).isChecked = true
+                        }
+                    }
+                }
+            },
+
+            Action {
+                id: saveAction
+                objectName: "saveAction"
+                iconName: "ok"
+                enabled: oldAlarmDaysOfWeek !== alarm.daysOfWeek
+                onTriggered: {
+                    pop()
+                }
+            }
+        ]
+    }
 
     // Function to detect if alarm is OneTime or Repeating
     function detectAlarmType() {
@@ -44,53 +94,6 @@
         }
     }
 
-    head.backAction: Action {
-        iconName: "back"
-        onTriggered: {
-            // Restore alarm frequency and type if user presses the back button
-            alarm.daysOfWeek = oldAlarmDaysOfWeek
-            detectAlarmType()
-            pop()
-        }
-    }
-
-    head.actions: [
-        Action {
-            text: i18n.tr("Select All")
-
-            iconSource: {
-                if(alarm.daysOfWeek === 127)
-                    return Qt.resolvedUrl("../graphics/select-none.svg")
-                else
-                    return Qt.resolvedUrl("../graphics/select.svg")
-            }
-
-            onTriggered: {
-                if (alarm.daysOfWeek === 127) {
-                    for (var i=0; i<_alarmDays.count; i++) {
-                        _alarmDays.itemAt(i).isChecked = false
-                    }
-                }
-
-                else {
-                    for (var i=0; i<_alarmDays.count; i++) {
-                        _alarmDays.itemAt(i).isChecked = true
-                    }
-                }
-            }
-        },
-
-        Action {
-            id: saveAction
-            objectName: "saveAction"
-            iconName: "ok"
-            enabled: oldAlarmDaysOfWeek !== alarm.daysOfWeek
-            onTriggered: {
-                pop()
-            }
-        }
-    ]
-
     /*
      By Default, the alarm is set to Today. However if it is a one-time alarm,
      this should be set to none, since this page shows the days the alarm
@@ -135,7 +138,12 @@
     Column {
         id: _alarmDayColumn
 
-        anchors.fill: parent
+        anchors {
+            top: _alarmRepeatPage.header.bottom
+            left: parent.left
+            right: parent.right
+            bottom: parent.bottom
+        }
 
         Repeater {
             id: _alarmDays

=== modified file 'app/alarm/AlarmSettingsPage.qml'
--- app/alarm/AlarmSettingsPage.qml	2016-02-25 22:16:54 +0000
+++ app/alarm/AlarmSettingsPage.qml	2016-02-28 20:46:04 +0000
@@ -25,9 +25,12 @@
 Page {
     id: _alarmSettings
 
-    title: i18n.tr("Settings")
     visible: false
-    flickable: settingsPlugin
+
+    header: PageHeader {
+        title: i18n.tr("Settings")
+        flickable: settingsPlugin
+    }
 
     Connections {
         target: clockApp

=== modified file 'app/alarm/AlarmSound.qml'
--- app/alarm/AlarmSound.qml	2016-02-15 21:44:47 +0000
+++ app/alarm/AlarmSound.qml	2016-02-28 20:46:04 +0000
@@ -27,8 +27,6 @@
     id: _alarmSoundPage
     objectName: "alarmSoundPage"
 
-    title: i18n.tr("Sound")
-    flickable: _pageFlickable
     visible: false
 
     // Property used to let pageStack know that this is the alarm sound page
@@ -58,24 +56,31 @@
         oldAlarmSoundName = alarmSound.subText
     }
 
-    head.backAction: Action {
-        iconName: "back"
-        onTriggered: {
-            // Restore alarm sound to old values (url, name) if the back button is pressed
-            alarm.sound = oldAlarmSoundUrl
-            alarmSound.subText = oldAlarmSoundName
-            pop()
-        }
-    }
-
-    head.actions: Action {
-        id: saveAction
-        objectName: "saveAction"
-        iconName: "ok"
-        enabled: oldAlarmSoundUrl !== alarm.sound
-        onTriggered: {
-            pop()
-        }
+    header: PageHeader {
+        title: i18n.tr("Sound")
+        flickable: _pageFlickable
+        leadingActionBar.actions: [
+            Action {
+                iconName: "back"
+                onTriggered: {
+                    // Restore alarm sound to old values (url, name) if the back button is pressed
+                    alarm.sound = oldAlarmSoundUrl
+                    alarmSound.subText = oldAlarmSoundName
+                    pop()
+                }
+            }
+        ]
+        trailingActionBar.actions: [
+            Action {
+                id: saveAction
+                objectName: "saveAction"
+                iconName: "ok"
+                enabled: oldAlarmSoundUrl !== alarm.sound
+                onTriggered: {
+                    pop()
+                }
+            }
+        ]
     }
 
     FolderListModel {
@@ -125,7 +130,7 @@
         for (var i=0; i<customSoundModel.count; i++) {
             if (soundUrl === customSoundModel.get(i, "fileURL")) {
                 alarmSound.subText = customSoundModel.get(i, "fileBaseName")
-                alarm.sound = soundUrl                
+                alarm.sound = soundUrl
                 _customAlarmSounds.itemAt(i).isChecked = true
                 previewAlarmSound.controlPlayback(soundUrl)
                 return
@@ -217,7 +222,7 @@
                     objectName: "customAlarmSoundDelegate" + index
 
                     property bool isChecked: alarmSound.subText === _customSoundName.title.text ? true
-                                                                                          : false
+                                                                                                : false
 
                     height: _customSoundName.height + divider.height
 
@@ -244,7 +249,7 @@
                                             for (var i=0; i<defaultSoundModel.count; i++) {
                                                 if (defaultSoundModel.get(i, "fileBaseName") === alarmSound.subText) {
                                                     alarm.sound = defaultSoundModel.get(i, "fileURL")
-                                                    oldAlarmSoundUrl = alarm.sound                                                    
+                                                    oldAlarmSoundUrl = alarm.sound
                                                     _alarmSounds.itemAt(i).isChecked = true
                                                     previewAlarmSound.controlPlayback(defaultSoundModel.get(i, "fileURL"))
                                                 }
@@ -354,7 +359,7 @@
                     objectName: "alarmSoundDelegate" + index
 
                     property bool isChecked: alarmSound.subText === _soundName.title.text ? true
-                                                                                    : false
+                                                                                          : false
 
                     height: _soundName.height + divider.height
 

=== modified file 'app/components/EmptyState.qml'
--- app/components/EmptyState.qml	2016-02-25 22:16:54 +0000
+++ app/components/EmptyState.qml	2016-02-28 20:46:04 +0000
@@ -45,12 +45,13 @@
     Label {
         id: emptyLabel
         textSize: Label.Large
-        font.bold: true
+        font.weight: Font.Normal
         width: parent.width
         wrapMode: Text.WordWrap
         anchors.top: emptyIcon.bottom
         anchors.topMargin: units.gu(4)
         horizontalAlignment: Text.AlignHCenter
+        color: "#5d5d5d"
     }
 
     Label {
@@ -59,5 +60,6 @@
         wrapMode: Text.WordWrap
         anchors.top: emptyLabel.bottom
         horizontalAlignment: Text.AlignHCenter
+        color: "#888888"
     }
 }

=== modified file 'app/worldclock/WorldCityList.qml'
--- app/worldclock/WorldCityList.qml	2016-02-25 22:16:54 +0000
+++ app/worldclock/WorldCityList.qml	2016-02-28 20:46:04 +0000
@@ -47,56 +47,60 @@
         staticTimeZoneModelLoader.sourceComponent = staticTimeZoneModelComponent
     }
 
-    title: i18n.tr("Select a city")
     visible: false
-    flickable: null
-
-    state: "default"
-    states: [
-        PageHeadState {
-            name: "default"
-            head: worldCityList.head
-            actions: [
-                Action {
-                    objectName: "searchButton"
-                    iconName: "search"
-                    text: i18n.tr("City")
-                    onTriggered: {
-                        worldCityList.state = "search"
-                        searchComponentLoader.sourceComponent = searchComponent
-                        jsonTimeZoneModelLoader.sourceComponent = jsonTimeZoneModelComponent
-                        searchComponentLoader.item.forceActiveFocus()
-                    }
+    header: standardHeader
+
+    PageHeader {
+        id: standardHeader
+
+        title: i18n.tr("Select a city")
+        flickable: null
+        visible: worldCityList.header === standardHeader
+        trailingActionBar.actions: [
+            Action {
+                objectName: "searchButton"
+                iconName: "search"
+                text: i18n.tr("City")
+                onTriggered: {
+                    worldCityList.header = searchHeader
+                    searchComponentLoader.sourceComponent = searchComponent
+                    jsonTimeZoneModelLoader.sourceComponent = jsonTimeZoneModelComponent
+                    searchComponentLoader.item.forceActiveFocus()
                 }
-            ]
-        },
-
-        PageHeadState {
-            name: "search"
-            head: worldCityList.head
-            backAction: Action {
+            }
+        ]
+    }
+
+    PageHeader {
+        id: searchHeader
+
+        flickable: null
+        visible: worldCityList.header === searchHeader
+
+        leadingActionBar.actions: [
+            Action {
                 iconName: "back"
                 text: i18n.tr("Back")
                 onTriggered: {
                     cityList.forceActiveFocus()
                     searchComponentLoader.item.text = ""
-                    worldCityList.state = "default"
+                    worldCityList.header = standardHeader
                     isOnlineMode = false
                     searchComponentLoader.sourceComponent = undefined
                     jsonTimeZoneModelLoader.sourceComponent = undefined
                 }
             }
+        ]
 
-            contents: Loader {
-                id: searchComponentLoader
-                anchors {
-                    left: parent ? parent.left : undefined
-                    right: parent ? parent.right : undefined
-                    rightMargin: units.gu(2)
-                }
+        contents: Loader {
+            id: searchComponentLoader
+            anchors {
+                left: parent ? parent.left : undefined
+                right: parent ? parent.right : undefined
+                verticalCenter: parent ? parent.verticalCenter : undefined
             }
         }
-    ]
+    }
 
     Component {
         id: searchComponent
@@ -242,7 +246,7 @@
             left: parent.left
             right: parent.right
             margins: units.gu(2)
-            top: parent.top
+            top: worldCityList.header.bottom
             topMargin: units.gu(4)
         }
     }
@@ -262,7 +266,7 @@
         }
     }
 
-    ListView {
+    UbuntuListView {
         id: cityList
         objectName: "cityList"
 
@@ -293,9 +297,14 @@
             forceActiveFocus()
         }
 
-        anchors.fill: parent
-        anchors.rightMargin: fastScroll.showing ? fastScroll.width - units.gu(1)
-                                                : 0
+        anchors {
+            top: worldCityList.header.bottom
+            left: parent.left
+            right: parent.right
+            bottom: parent.bottom
+            rightMargin: fastScroll.showing ? fastScroll.width - units.gu(1)
+                                            : 0
+        }
 
         model: sortedTimeZoneModel
         currentIndex: -1

=== modified file 'debian/changelog'
--- debian/changelog	2016-02-26 10:01:48 +0000
+++ debian/changelog	2016-02-28 20:46:04 +0000
@@ -24,6 +24,7 @@
   [ Nekhelesh Ramananthan ]
   * Fix 'Shutter' effect animation on title bar when opening bottom edge (LP: #1543496)
   * Migrate to the new SDK Bottom edge (LP: #1549988)
+  * Migrated all page head to the new PageHeader (LP: #1550991)
   * Reduce binding in ActionIcon.qml and fixed stopwatch slide delete UI issue.
 
  -- Bartosz Kosiorek <gang65@xxxxxxxxxxxxxx>  Wed, 30 Dec 2015 01:43:24 +0100


Follow ups