on xenial help sign in
better tablet mode detection, use layouts on the TZ page and move the models up
0a23eb2Lukáš Tinkl
qml/Wizard/Page.qml+3−3
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2013,2015 Canonical, Ltd.
2+ * Copyright (C) 2013-2016 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ import Wizard 0.1
20
20
21Item {
21Item {
22 readonly property real maximumContentWidth: units.gu(50)
22 readonly property real maximumContentWidth: units.gu(50)
23− readonly property bool desktopLook: width > maximumContentWidth
23+ readonly property bool desktopLook: width > units.gu(60) && width > height
24
24
25 readonly property real buttonMargin: units.gu(3)
25 readonly property real buttonMargin: units.gu(3)
26 readonly property real buttonWidth: (width - buttonMargin * 2) / 2 -
26 readonly property real buttonWidth: (width - buttonMargin * 2) / 2 -
@@ -32,7 +32,7 @@ Item {
32 readonly property real bottomMargin: units.gu(3)
32 readonly property real bottomMargin: units.gu(3)
33 readonly property real leftMargin: Math.max(units.gu(3), (width - maximumContentWidth) / 3)
33 readonly property real leftMargin: Math.max(units.gu(3), (width - maximumContentWidth) / 3)
34 readonly property real rightMargin: leftMargin
34 readonly property real rightMargin: leftMargin
35− readonly property real customMargin: desktopLook ? units.gu(11) : units.gu(4) // margin for the content
35+ readonly property real customMargin: desktopLook ? units.gu(8) : units.gu(4) // margin for the content
36 readonly property real staticMargin: units.gu(3)
36 readonly property real staticMargin: units.gu(3)
37
37
38 // colors
38 // colors
qml/Wizard/Pages.qml+11−1
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2013,2014,2015 Canonical, Ltd.
2+ * Copyright (C) 2013-2016 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -40,6 +40,16 @@ Item {
40 property alias simManager0: simManager0
40 property alias simManager0: simManager0
41 property alias simManager1: simManager1
41 property alias simManager1: simManager1
42
42
43+ TimeZoneModel { // preload the heavy models
44+ id: tzModel
45+ }
46+
47+ TimeZoneFilterModel {
48+ id: tzFilterModel
49+ sourceModel: tzModel
50+ country: countryCode
51+ }
52+
43 UbuntuSecurityPrivacyPanel {
53 UbuntuSecurityPrivacyPanel {
44 id: securityPrivacy
54 id: securityPrivacy
45 objectName: "securityPrivacy"
55 objectName: "securityPrivacy"
qml/Wizard/Pages/50-timezone.qml+47−60
@@ -15,12 +15,12 @@
15 */
15 */
16
16
17import QtQuick 2.4
17import QtQuick 2.4
18+import QtQuick.Layouts 1.2
18import QtGraphicalEffects 1.0
19import QtGraphicalEffects 1.0
19import Ubuntu.Components 1.3
20import Ubuntu.Components 1.3
20import Wizard 0.1
21import Wizard 0.1
21import Ubuntu.SystemSettings.TimeDate 1.0
22import Ubuntu.SystemSettings.TimeDate 1.0
22import Utils 0.1 as Utils
23import Utils 0.1 as Utils
23−import QtQuick.Window 2.2
24import ".." as LocalComponents
24import ".." as LocalComponents
25
25
26LocalComponents.Page {
26LocalComponents.Page {
@@ -77,17 +77,6 @@ LocalComponents.Page {
77 id: timeDatePanel
77 id: timeDatePanel
78 }
78 }
79
79
80− TimeZoneModel {
81− id: tzModel
82− }
83−
84− TimeZoneFilterModel {
85− id: tzFilterModel
86− sourceModel: tzModel
87− filter: searchField.text
88− country: root.countryCode
89− }
90−
91 Component.onCompleted: {
80 Component.onCompleted: {
92 if (tzList.count == 1) { // preselect the first (and only) TZ
81 if (tzList.count == 1) { // preselect the first (and only) TZ
93 var tz = tzList.itemAt(0,0);
82 var tz = tzList.itemAt(0,0);
@@ -96,6 +85,7 @@ LocalComponents.Page {
96 }
85 }
97 }
86 }
98
87
88+ tzFilterModel.filter = Qt.binding(function() { return searchField.text; });
99 theme.palette.normal.backgroundText = "#cdcdcd";
89 theme.palette.normal.backgroundText = "#cdcdcd";
100 searchField.forceActiveFocus();
90 searchField.forceActiveFocus();
101 }
91 }
@@ -113,7 +103,7 @@ LocalComponents.Page {
113 Column {
103 Column {
114 anchors.verticalCenter: parent.verticalCenter
104 anchors.verticalCenter: parent.verticalCenter
115 anchors.left: parent.left
105 anchors.left: parent.left
116− anchors.leftMargin: column.anchors.leftMargin == 0 ? staticMargin : 0
106+ anchors.leftMargin: staticMargin
117 anchors.right: image.left
107 anchors.right: image.left
118 anchors.rightMargin: units.gu(2)
108 anchors.rightMargin: units.gu(2)
119
109
@@ -140,7 +130,7 @@ LocalComponents.Page {
140 anchors {
130 anchors {
141 right: parent.right
131 right: parent.right
142 verticalCenter: parent.verticalCenter
132 verticalCenter: parent.verticalCenter
143− rightMargin: column.anchors.rightMargin == 0 ? staticMargin : 0
133+ rightMargin: staticMargin
144 }
134 }
145 fillMode: Image.PreserveAspectFit
135 fillMode: Image.PreserveAspectFit
146 height: units.gu(1.5)
136 height: units.gu(1.5)
@@ -162,8 +152,12 @@ LocalComponents.Page {
162 }
152 }
163 }
153 }
164
154
165− Item {
155+ GridLayout {
166− id: column
156+ id: masterLayout
157+ columns: 2
158+ rows: 1
159+ flow: GridLayout.TopToBottom
160+ columnSpacing: units.gu(2)
167 anchors {
161 anchors {
168 fill: content
162 fill: content
169 topMargin: units.gu(4)
163 topMargin: units.gu(4)
@@ -171,62 +165,55 @@ LocalComponents.Page {
171 rightMargin: desktopLook ? staticMargin : 0
165 rightMargin: desktopLook ? staticMargin : 0
172 }
166 }
173
167
174− LocalComponents.WizardTextField {
168+ ColumnLayout {
175− id: searchField
169+ anchors.left: desktopLook ? undefined : parent.left
176− objectName: "tzFilter"
177− anchors.left: parent.left
170+ anchors.right: desktopLook ? undefined : parent.right
178− anchors.right: !desktopLook ? parent.right : undefined
171+ Layout.fillWidth: !desktopLook
179− anchors.leftMargin: column.anchors.leftMargin == 0 ? staticMargin : 0
172+ Layout.fillHeight: true
180− anchors.rightMargin: column.anchors.rightMargin == 0 ? staticMargin : 0
181− placeholderText: i18n.tr("Enter your city")
182− inputMethodHints: Qt.ImhNoPredictiveText
183− onTextChanged: resetViews();
184− }
185
173
186− Rectangle {
174+ LocalComponents.WizardTextField {
187− id: divider
188− anchors.left: parent.left
189− anchors.right: !desktopLook ? parent.right : undefined
190− anchors.top: searchField.bottom
175+ id: searchField
191− anchors.topMargin: units.gu(3)
176+ objectName: "tzFilter"
192− height: units.dp(1)
177+ anchors.left: parent.left
193− color: dividerColor
178+ anchors.right: parent.right
194− visible: tzList.count > 0
179+ anchors.leftMargin: !desktopLook ? staticMargin : 0
180+ anchors.rightMargin: !desktopLook ? staticMargin : 0
181+ placeholderText: i18n.tr("Enter your city")
182+ inputMethodHints: Qt.ImhNoPredictiveText
183+ onTextChanged: resetViews();
195− }
184+ }
196−
197− ListView {
198− id: tzList
199− objectName: "tzList"
200− clip: true
201− currentIndex: -1
202− snapMode: ListView.SnapToItem
203
185
204− anchors {
186+ Rectangle {
205− left: parent.left
187+ Layout.fillWidth: true
206− right: !desktopLook ? parent.right : undefined
207− top: divider.bottom
188+ id: divider
208− bottom: parent.bottom
189+ anchors.topMargin: units.gu(3)
190+ height: units.dp(1)
191+ color: dividerColor
192+ visible: tzList.count > 0
209 }
193 }
210
194
195+ ListView {
196+ Layout.fillHeight: true
197+ Layout.fillWidth: true
198+ id: tzList
199+ objectName: "tzList"
200+ clip: true
201+ currentIndex: -1
211− model: tzFilterModel
202+ model: tzFilterModel
212− delegate: tzComponent
203+ delegate: tzComponent
204+ }
213 }
205 }
214
206
215 Item {
207 Item {
208+ Layout.fillWidth: desktopLook
209+ Layout.fillHeight: true
216 id: mapContainer
210 id: mapContainer
217− visible: content.width > maximumContentWidth + map.width
211+ visible: desktopLook
218 enabled: visible
212 enabled: visible
219− anchors {
220− left: tzList.right
221− right: parent.right
222− top: parent.top
223− bottom: parent.bottom
224− leftMargin: units.gu(2)
225− }
226
213
227 Item {
214 Item {
228 id: map
215 id: map
229− width: column.width - tzList.width
216+ width: parent.width
230 height: width / 1.95 // keep our aspect ratio
217 height: width / 1.95 // keep our aspect ratio
231 anchors {
218 anchors {
232 centerIn: parent
219 centerIn: parent