ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #02995
[Merge] lp:~nik90/ubuntu-weather-app/dev-migrate-new-listitems into lp:ubuntu-weather-app/reboot
Nekhelesh Ramananthan has proposed merging lp:~nik90/ubuntu-weather-app/dev-migrate-new-listitems into lp:ubuntu-weather-app/reboot.
Commit message:
Migrates the following pages to the new SDK list items,
- SettingsPage.qml
- DayDelegate.qml
- Individual settings page like DataProviderPage.qml, RefreshIntervalPage.qml and UnitsPage.qml.
- AddLocationsPage.qml
Requested reviews:
Ubuntu Weather Developers (ubuntu-weather-dev)
For more details, see:
https://code.launchpad.net/~nik90/ubuntu-weather-app/dev-migrate-new-listitems/+merge/262539
Migrates the following pages to the new SDK list items,
- SettingsPage.qml
- DayDelegate.qml
- Individual settings page like DataProviderPage.qml, RefreshIntervalPage.qml and UnitsPage.qml.
- AddLocationsPage.qml
The LocationsPage itself has not been migrated since it involves also migrating the multiselection and reorder features. I rather do that in a separate MP for easier review.
--
Your team Ubuntu Weather Developers is requested to review the proposed merge of lp:~nik90/ubuntu-weather-app/dev-migrate-new-listitems into lp:ubuntu-weather-app/reboot.
=== modified file 'app/components/DayDelegate.qml'
--- app/components/DayDelegate.qml 2015-06-18 01:42:03 +0000
+++ app/components/DayDelegate.qml 2015-06-21 15:05:50 +0000
@@ -18,14 +18,13 @@
import QtQuick 2.4
import Ubuntu.Components 1.2
-import Ubuntu.Components.ListItems 0.1 as ListItem
-ListItem.Standard {
+ListItem {
id: dayDelegate
height: collapsedHeight
property int collapsedHeight: units.gu(8)
- property int expandedHeight: collapsedHeight + units.gu(4) + extraInfoColumn.childrenRect.height
+ property int expandedHeight: collapsedHeight + units.gu(4) + extraInfoColumn.height
property alias day: dayLabel.text
property alias image: weatherImage.name
@@ -40,9 +39,6 @@
property alias wind: windForecast.value
property alias uvIndex: uvIndexForecast.value
- // Standard divider is not full width so add a ThinDivider to the bottom
- showDivider: false
-
state: "normal"
states: [
State {
@@ -101,65 +97,70 @@
locationPages.collapseOtherDelegates(index)
}
- ListItem.ThinDivider {
- anchors {
- bottom: parent.bottom
- }
- }
+ Item {
+ id: mainInfo
- Label {
- id: dayLabel
+ height: collapsedHeight
anchors {
left: parent.left
- right: weatherImage.left
- rightMargin: units.gu(1)
- top: parent.top
- topMargin: (collapsedHeight - dayLabel.height) / 2
- }
- elide: Text.ElideRight
- font.weight: Font.Light
- fontSize: "medium"
- }
-
- Icon {
- id: weatherImage
- anchors {
- horizontalCenter: parent.horizontalCenter
- verticalCenter: dayLabel.verticalCenter
- }
- height: units.gu(3)
- width: units.gu(3)
- }
-
- Label {
- id: lowLabel
- anchors {
- left: weatherImage.right
- right: highLabel.left
- rightMargin: units.gu(1)
- verticalCenter: dayLabel.verticalCenter
- }
- elide: Text.ElideRight
- font.pixelSize: units.gu(2)
- font.weight: Font.Light
- fontSize: "medium"
- height: units.gu(2)
- horizontalAlignment: Text.AlignRight
- verticalAlignment: Text.AlignTop // AlignTop appears to align bottom?
- }
-
- Label {
- id: highLabel
- anchors {
- bottom: lowLabel.bottom
right: parent.right
- }
- color: UbuntuColors.orange
- elide: Text.ElideRight
- font.pixelSize: units.gu(3)
- font.weight: Font.Normal
- height: units.gu(3)
- verticalAlignment: Text.AlignTop // AlignTop appears to align bottom?
+ margins: units.gu(2)
+ }
+
+ Label {
+ id: dayLabel
+ anchors {
+ left: parent.left
+ right: weatherImage.left
+ rightMargin: units.gu(1)
+ top: parent.top
+ topMargin: (collapsedHeight - dayLabel.height) / 2
+ }
+ elide: Text.ElideRight
+ font.weight: Font.Light
+ fontSize: "medium"
+ }
+
+ Icon {
+ id: weatherImage
+ anchors {
+ horizontalCenter: parent.horizontalCenter
+ verticalCenter: dayLabel.verticalCenter
+ }
+ height: units.gu(3)
+ width: units.gu(3)
+ }
+
+ Label {
+ id: lowLabel
+ anchors {
+ left: weatherImage.right
+ right: highLabel.left
+ rightMargin: units.gu(1)
+ verticalCenter: dayLabel.verticalCenter
+ }
+ elide: Text.ElideRight
+ font.pixelSize: units.gu(2)
+ font.weight: Font.Light
+ fontSize: "medium"
+ height: units.gu(2)
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignTop // AlignTop appears to align bottom?
+ }
+
+ Label {
+ id: highLabel
+ anchors {
+ bottom: lowLabel.bottom
+ right: parent.right
+ }
+ color: UbuntuColors.orange
+ elide: Text.ElideRight
+ font.pixelSize: units.gu(3)
+ font.weight: Font.Normal
+ height: units.gu(3)
+ verticalAlignment: Text.AlignTop // AlignTop appears to align bottom?
+ }
}
Item {
@@ -168,13 +169,12 @@
bottom: parent.bottom
left: parent.left
right: parent.right
- top: dayLabel.bottom
- topMargin: units.gu(2)
+ top: mainInfo.bottom
+ bottomMargin: units.gu(2)
}
opacity: 0
visible: opacity !== 0
-
Column {
id: extraInfoColumn
anchors {
=== modified file 'app/components/ForecastDetailsDelegate.qml'
--- app/components/ForecastDetailsDelegate.qml 2015-06-18 01:42:03 +0000
+++ app/components/ForecastDetailsDelegate.qml 2015-06-21 15:05:50 +0000
@@ -18,7 +18,6 @@
import QtQuick 2.4
import Ubuntu.Components 1.2
-import Ubuntu.Components.ListItems 0.1 as ListItem
Row {
height: icon.height
=== added file 'app/components/StandardListItem.qml'
--- app/components/StandardListItem.qml 1970-01-01 00:00:00 +0000
+++ app/components/StandardListItem.qml 2015-06-21 15:05:50 +0000
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2015 Canonical Ltd
+ *
+ * This file is part of Ubuntu Weather App
+ *
+ * Ubuntu Weather 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 Weather 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 QtQuick.Layouts 1.1
+import Ubuntu.Components 1.2
+
+ListItem {
+ id: listItem
+
+ property alias title: _title.text
+ property alias icon: _icon.name
+ property alias showIcon: _icon.visible
+
+ RowLayout {
+ anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter; margins: units.gu(2) }
+ height: _icon.height
+ spacing: units.gu(2)
+
+ Label {
+ id: _title
+ anchors.verticalCenter: _icon.verticalCenter
+ elide: Text.ElideRight
+ Layout.fillWidth: true
+ }
+
+ Icon {
+ id: _icon
+ height: units.gu(2); width: height
+ name: "go-next"
+ }
+ }
+}
=== modified file 'app/components/WeatherListItem.qml'
--- app/components/WeatherListItem.qml 2015-06-18 01:42:03 +0000
+++ app/components/WeatherListItem.qml 2015-06-21 15:05:50 +0000
@@ -19,8 +19,6 @@
import QtQuick 2.4
import Ubuntu.Components 1.2
-import Ubuntu.Components.ListItems 0.1 as ListItem
-
ListItemWithActions {
id: root
=== modified file 'app/ui/AddLocationPage.qml'
--- app/ui/AddLocationPage.qml 2015-06-18 01:42:03 +0000
+++ app/ui/AddLocationPage.qml 2015-06-21 15:05:50 +0000
@@ -18,7 +18,6 @@
import QtQuick 2.4
import Ubuntu.Components 1.2
-import Ubuntu.Components.ListItems 1.0 as ListItem
import Ubuntu.Components.Popups 1.0
import "../components"
import "../data/CitiesList.js" as Cities
@@ -187,8 +186,14 @@
section.criteria: ViewSection.FirstCharacter
section.labelPositioning: ViewSection.InlineLabels
- section.delegate: ListItem.Header {
- text: section
+ section.delegate: ListItem {
+ height: headerText.implicitHeight + units.gu(1)
+ Label {
+ id: headerText
+ text: section
+ anchors { left: parent.left; right: parent.right; margins: units.gu(2) }
+ font.weight: Font.DemiBold
+ }
}
model: ListModel {
@@ -200,8 +205,8 @@
onRowsAboutToBeInserted: loading = false
}
- delegate: ListItem.Empty {
- showDivider: false
+ delegate: ListItem {
+ divider.visible: false
Column {
anchors {
left: parent.left
=== modified file 'app/ui/LocationPane.qml'
--- app/ui/LocationPane.qml 2015-06-18 01:42:03 +0000
+++ app/ui/LocationPane.qml 2015-06-21 15:05:50 +0000
@@ -162,20 +162,16 @@
now: locationItem.currentTemp
}
- ListItem.ThinDivider {}
+ // TODO: Migrate this to using the new SDK list item when possible.
+ ListItem.ThinDivider { anchors { leftMargin: units.gu(-2); rightMargin: units.gu(-2) } }
}
Column {
id: weekdayColumn
+
+ anchors.top: locationTop.bottom
+ height: childrenRect.height
width: parent.width
- height: childrenRect.height
- anchors {
- top: locationTop.bottom
- left: parent.left
- leftMargin: units.gu(2)
- right: parent.right
- rightMargin: units.gu(2)
- }
Repeater {
id: mainPageWeekdayListView
model: ListModel{}
=== modified file 'app/ui/SettingsPage.qml'
--- app/ui/SettingsPage.qml 2015-06-18 01:42:03 +0000
+++ app/ui/SettingsPage.qml 2015-06-21 15:05:50 +0000
@@ -18,42 +18,34 @@
import QtQuick 2.4
import Ubuntu.Components 1.2
-import Ubuntu.Components.ListItems 0.1 as ListItem
+import "../components"
Page {
title: i18n.tr("Settings")
Flickable {
- anchors {
- fill: parent
- }
+ clip: true
+ anchors.fill: parent
+ contentHeight: settingsColumn.height
height: parent.height
- contentHeight: settingsColumn.childrenRect.height
Column {
id: settingsColumn
- anchors {
- fill: parent
- }
-
- ListItem.SingleValue {
- progression: true
- text: i18n.tr("Units")
-
+
+ anchors.fill: parent
+
+ StandardListItem {
+ title: i18n.tr("Units")
onClicked: mainPageStack.push(Qt.resolvedUrl("settings/UnitsPage.qml"))
}
- ListItem.SingleValue {
- progression: true
- text: i18n.tr("Data Provider")
-
+ StandardListItem {
+ title: i18n.tr("Data Provider")
onClicked: mainPageStack.push(Qt.resolvedUrl("settings/DataProviderPage.qml"))
}
- ListItem.SingleValue {
- progression: true
- text: i18n.tr("Refresh Interval")
-
+ StandardListItem {
+ title: i18n.tr("Refresh Interval")
onClicked: mainPageStack.push(Qt.resolvedUrl("settings/RefreshIntervalPage.qml"))
}
}
=== modified file 'app/ui/settings/DataProviderPage.qml'
--- app/ui/settings/DataProviderPage.qml 2015-06-18 01:42:03 +0000
+++ app/ui/settings/DataProviderPage.qml 2015-06-21 15:05:50 +0000
@@ -18,7 +18,6 @@
import QtQuick 2.4
import Ubuntu.Components 1.2
-import Ubuntu.Components.ListItems 0.1 as ListItem
import "../../components"
Page {
@@ -33,13 +32,15 @@
ExpandableListItem {
id: dataProviderSetting
- listViewHeight: dataProviderModel.count*units.gu(6) - units.gu(1)
+ listViewHeight: dataProviderModel.count*units.gu(7) - units.gu(1)
model: dataProviderModel
text: i18n.tr("Provider")
subText: settings.service === "weatherchannel" ? "The Weather Channel" : "OpenWeatherMap"
- delegate: ListItem.Standard {
- text: model.text
+ delegate: StandardListItem {
+ title: model.text
+ icon: "ok"
+ showIcon: dataProviderSetting.subText === model.text
onClicked: {
if (model.text === "The Weather Channel") {
settings.service = "weatherchannel"
@@ -48,16 +49,6 @@
}
refreshData(false, true)
}
-
- Icon {
- width: units.gu(2)
- height: width
- name: "ok"
- visible: dataProviderSetting.subText === model.text
- anchors.right: parent.right
- anchors.rightMargin: units.gu(2)
- anchors.verticalCenter: parent.verticalCenter
- }
}
}
}
=== modified file 'app/ui/settings/RefreshIntervalPage.qml'
--- app/ui/settings/RefreshIntervalPage.qml 2015-06-18 01:42:03 +0000
+++ app/ui/settings/RefreshIntervalPage.qml 2015-06-21 15:05:50 +0000
@@ -18,7 +18,6 @@
import QtQuick 2.4
import Ubuntu.Components 1.2
-import Ubuntu.Components.ListItems 0.1 as ListItem
import "../../components"
Page {
@@ -38,27 +37,19 @@
ExpandableListItem {
id: dataProviderSetting
- listViewHeight: refreshModel.count*units.gu(6)
+ listViewHeight: refreshModel.count*units.gu(7) - units.gu(1)
model: refreshModel
text: i18n.tr("Interval")
subText: i18n.tr("%1 minute", "%1 minutes", Math.floor(settings.refreshInterval / 60).toString()).arg(Math.floor(settings.refreshInterval / 60).toString())
- delegate: ListItem.Standard {
- text: model.text
+ delegate: StandardListItem {
+ title: model.text
+ icon: "ok"
+ showIcon: settings.refreshInterval === model.interval
onClicked: {
settings.refreshInterval = model.interval
refreshData(false, true)
}
-
- Icon {
- width: units.gu(2)
- height: width
- name: "ok"
- visible: settings.refreshInterval === model.interval
- anchors.right: parent.right
- anchors.rightMargin: units.gu(2)
- anchors.verticalCenter: parent.verticalCenter
- }
}
}
}
=== modified file 'app/ui/settings/UnitsPage.qml'
--- app/ui/settings/UnitsPage.qml 2015-06-18 01:42:03 +0000
+++ app/ui/settings/UnitsPage.qml 2015-06-21 15:05:50 +0000
@@ -18,7 +18,6 @@
import QtQuick 2.4
import Ubuntu.Components 1.2
-import Ubuntu.Components.ListItems 0.1 as ListItem
import "../../components"
Page {
@@ -27,6 +26,7 @@
flickable: null
Flickable {
+ clip: true
anchors.fill: parent
height: parent.height
contentHeight: unitsColumn.childrenRect.height
@@ -86,84 +86,60 @@
ExpandableListItem {
id: temperatureSetting
- listViewHeight: temperatureModel.count*units.gu(6) - units.gu(0.5)
+ listViewHeight: temperatureModel.count*units.gu(7) - units.gu(1)
model: temperatureModel
text: i18n.tr("Temperature")
subText: settings.tempScale === "°C" ? i18n.tr("°C")
: i18n.tr("°F")
- delegate: ListItem.Standard {
- text: model.text
+ delegate: StandardListItem {
+ title: model.text
+ icon: "ok"
+ showIcon: settings.tempScale === model.value
onClicked: {
settings.tempScale = model.value
refreshData(true)
}
-
- Icon {
- width: units.gu(2)
- height: width
- name: "ok"
- visible: settings.tempScale === model.value
- anchors.right: parent.right
- anchors.rightMargin: units.gu(2)
- anchors.verticalCenter: parent.verticalCenter
- }
}
}
ExpandableListItem {
id: precipationSetting
- listViewHeight: precipationModel.count*units.gu(6) - units.gu(0.5)
+ listViewHeight: precipationModel.count*units.gu(7) - units.gu(1)
model: precipationModel
text: i18n.tr("Precipitation")
subText: settings.precipUnits === "mm" ? i18n.tr("mm")
: i18n.tr("in")
- delegate: ListItem.Standard {
- text: model.text
+ delegate: StandardListItem {
+ title: model.text
+ icon: "ok"
+ showIcon: settings.precipUnits === model.value
onClicked: {
settings.precipUnits = model.value
refreshData(true)
}
-
- Icon {
- width: units.gu(2)
- height: width
- name: "ok"
- visible: settings.precipUnits === model.value
- anchors.right: parent.right
- anchors.rightMargin: units.gu(2)
- anchors.verticalCenter: parent.verticalCenter
- }
}
}
ExpandableListItem {
id: windSetting
- listViewHeight: windSpeedModel.count*units.gu(6) - units.gu(0.5)
+ listViewHeight: windSpeedModel.count*units.gu(7) - units.gu(1)
model: windSpeedModel
text: i18n.tr("Wind Speed")
subText: settings.windUnits === "kph" ? i18n.tr("kph")
: i18n.tr("mph")
- delegate: ListItem.Standard {
- text: model.text
+ delegate: StandardListItem {
+ title: model.text
+ icon: "ok"
+ showIcon: settings.windUnits === model.value
onClicked: {
settings.windUnits = model.value
refreshData(true)
}
-
- Icon {
- width: units.gu(2)
- height: width
- name: "ok"
- visible: settings.windUnits === model.value
- anchors.right: parent.right
- anchors.rightMargin: units.gu(2)
- anchors.verticalCenter: parent.verticalCenter
- }
}
}
}
=== modified file 'po/com.ubuntu.weather.pot'
--- po/com.ubuntu.weather.pot 2015-06-18 01:42:03 +0000
+++ po/com.ubuntu.weather.pot 2015-06-21 15:05:50 +0000
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: ubuntu-weather-app\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-06-09 19:05-0500\n"
+"POT-Creation-Date: 2015-06-21 15:00+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -66,35 +66,35 @@
msgid "Cancel selection"
msgstr ""
-#: ../app/ui/AddLocationPage.qml:30
+#: ../app/ui/AddLocationPage.qml:29
msgid "Select a city"
msgstr ""
-#: ../app/ui/AddLocationPage.qml:46 ../app/ui/AddLocationPage.qml:68
+#: ../app/ui/AddLocationPage.qml:45 ../app/ui/AddLocationPage.qml:67
msgid "Back"
msgstr ""
-#: ../app/ui/AddLocationPage.qml:53
+#: ../app/ui/AddLocationPage.qml:52
msgid "City"
msgstr ""
-#: ../app/ui/AddLocationPage.qml:95
+#: ../app/ui/AddLocationPage.qml:94
msgid "Search city"
msgstr ""
-#: ../app/ui/AddLocationPage.qml:274
+#: ../app/ui/AddLocationPage.qml:279
msgid "No city found"
msgstr ""
-#: ../app/ui/AddLocationPage.qml:287
+#: ../app/ui/AddLocationPage.qml:292
msgid "Couldn't load weather data, please try later again!"
msgstr ""
-#: ../app/ui/AddLocationPage.qml:297
+#: ../app/ui/AddLocationPage.qml:302
msgid "Location already added."
msgstr ""
-#: ../app/ui/AddLocationPage.qml:300
+#: ../app/ui/AddLocationPage.qml:305
msgid "OK"
msgstr ""
@@ -110,34 +110,34 @@
msgid "Settings"
msgstr ""
-#: ../app/ui/SettingsPage.qml:41 ../app/ui/settings/UnitsPage.qml:25
+#: ../app/ui/SettingsPage.qml:38 ../app/ui/settings/UnitsPage.qml:24
msgid "Units"
msgstr ""
-#: ../app/ui/SettingsPage.qml:48 ../app/ui/settings/DataProviderPage.qml:25
+#: ../app/ui/SettingsPage.qml:43 ../app/ui/settings/DataProviderPage.qml:24
msgid "Data Provider"
msgstr ""
-#: ../app/ui/SettingsPage.qml:55 ../app/ui/settings/RefreshIntervalPage.qml:25
+#: ../app/ui/SettingsPage.qml:48 ../app/ui/settings/RefreshIntervalPage.qml:24
msgid "Refresh Interval"
msgstr ""
-#: ../app/ui/settings/DataProviderPage.qml:38
+#: ../app/ui/settings/DataProviderPage.qml:37
msgid "Provider"
msgstr ""
+#: ../app/ui/settings/RefreshIntervalPage.qml:30
#: ../app/ui/settings/RefreshIntervalPage.qml:31
#: ../app/ui/settings/RefreshIntervalPage.qml:32
#: ../app/ui/settings/RefreshIntervalPage.qml:33
-#: ../app/ui/settings/RefreshIntervalPage.qml:34
-#: ../app/ui/settings/RefreshIntervalPage.qml:44
+#: ../app/ui/settings/RefreshIntervalPage.qml:43
#, qt-format
msgid "%1 minute"
msgid_plural "%1 minutes"
msgstr[0] ""
msgstr[1] ""
-#: ../app/ui/settings/RefreshIntervalPage.qml:43
+#: ../app/ui/settings/RefreshIntervalPage.qml:42
msgid "Interval"
msgstr ""
@@ -158,28 +158,28 @@
#. TRANSLATORS: The strings are standard measurement units
#. of precipitation in millimeters and are shown in the settings page.
#. Only the abbreviated form of millimeters should be used.
-#: ../app/ui/settings/UnitsPage.qml:57 ../app/ui/settings/UnitsPage.qml:120
+#: ../app/ui/settings/UnitsPage.qml:57 ../app/ui/settings/UnitsPage.qml:112
msgid "mm"
msgstr ""
#. TRANSLATORS: The strings are standard measurement units
#. of precipitation in inches and are shown in the settings page.
#. Only the abbreviated form of inches should be used.
-#: ../app/ui/settings/UnitsPage.qml:62 ../app/ui/settings/UnitsPage.qml:121
+#: ../app/ui/settings/UnitsPage.qml:62 ../app/ui/settings/UnitsPage.qml:113
msgid "in"
msgstr ""
#. TRANSLATORS: The strings are standard measurement units
#. of wind speed in kilometers per hour and are shown in the settings page.
#. Only the abbreviated form of kilometers per hour should be used.
-#: ../app/ui/settings/UnitsPage.qml:73 ../app/ui/settings/UnitsPage.qml:148
+#: ../app/ui/settings/UnitsPage.qml:73 ../app/ui/settings/UnitsPage.qml:132
msgid "kph"
msgstr ""
#. TRANSLATORS: The strings are standard measurement units
#. of wind speed in miles per hour and are shown in the settings page.
#. Only the abbreviated form of miles per hour should be used.
-#: ../app/ui/settings/UnitsPage.qml:78 ../app/ui/settings/UnitsPage.qml:149
+#: ../app/ui/settings/UnitsPage.qml:78 ../app/ui/settings/UnitsPage.qml:133
msgid "mph"
msgstr ""
@@ -187,11 +187,11 @@
msgid "Temperature"
msgstr ""
-#: ../app/ui/settings/UnitsPage.qml:119
+#: ../app/ui/settings/UnitsPage.qml:111
msgid "Precipitation"
msgstr ""
-#: ../app/ui/settings/UnitsPage.qml:147
+#: ../app/ui/settings/UnitsPage.qml:131
msgid "Wind Speed"
msgstr ""
Follow ups