Merge lp:~jonas-drange/ubuntu-system-settings/cellular-connectiontype-fixdesign into lp:ubuntu-system-settings

Proposed by Jonas G. Drange
Status: Work in progress
Proposed branch: lp:~jonas-drange/ubuntu-system-settings/cellular-connectiontype-fixdesign
Merge into: lp:ubuntu-system-settings
Diff against target: 556 lines (+239/-184)
9 files modified
plugins/cellular/CMakeLists.txt (+1/-0)
plugins/cellular/Components/CMakeLists.txt (+0/-1)
plugins/cellular/Components/MultiSim.qml (+16/-64)
plugins/cellular/Components/RadioSingleSim.qml (+0/-91)
plugins/cellular/Components/SingleSim.qml (+16/-12)
plugins/cellular/PageCarrierAndApn.qml (+0/-1)
plugins/cellular/PageCarriersAndApns.qml (+0/-1)
plugins/cellular/PageChooseConnectionType.qml (+171/-0)
tests/autopilot/ubuntu_system_settings/__init__.py (+35/-14)
To merge this branch: bzr merge lp:~jonas-drange/ubuntu-system-settings/cellular-connectiontype-fixdesign
Reviewer Review Type Date Requested Status
Ken VanDine Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+251184@code.launchpad.net

Commit message

[cellular] moving "Connection type" closer to design

Description of the change

[cellular] moving "Connection type" closer to design

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) wrote :

The code looks fine, and works properly. Make sure it still merges cleanly with trunk though, we've had a couple landings in this panel recently.

review: Approve
1337. By Jonas G. Drange

merge trunk

1338. By Jonas G. Drange

avoid having long sim names, or long mno names overlap

1339. By Jonas G. Drange

merge trunk

Revision history for this message
Jonas G. Drange (jonas-drange) wrote :

Errors were found during testing.

Unmerged revisions

1339. By Jonas G. Drange

merge trunk

1338. By Jonas G. Drange

avoid having long sim names, or long mno names overlap

1337. By Jonas G. Drange

merge trunk

1336. By Jonas G. Drange

rewrite the connection type story

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/cellular/CMakeLists.txt'
2--- plugins/cellular/CMakeLists.txt 2015-03-26 21:57:53 +0000
3+++ plugins/cellular/CMakeLists.txt 2015-05-28 14:45:56 +0000
4@@ -9,6 +9,7 @@
5 CustomApnEditor.qml
6 PageChooseApn.qml
7 PageChooseCarrier.qml
8+ PageChooseConnectionType.qml
9 PageCarrierAndApn.qml
10 PageCarriersAndApns.qml
11 PageComponent.qml
12
13=== modified file 'plugins/cellular/Components/CMakeLists.txt'
14--- plugins/cellular/Components/CMakeLists.txt 2014-11-12 12:46:51 +0000
15+++ plugins/cellular/Components/CMakeLists.txt 2015-05-28 14:45:56 +0000
16@@ -3,7 +3,6 @@
17 DefaultSim.qml
18 MultiSim.qml
19 NoSim.qml
20- RadioSingleSim.qml
21 Sim.qml
22 SimEditor.qml
23 SingleSim.qml
24
25=== modified file 'plugins/cellular/Components/MultiSim.qml'
26--- plugins/cellular/Components/MultiSim.qml 2015-01-21 20:44:20 +0000
27+++ plugins/cellular/Components/MultiSim.qml 2015-05-28 14:45:56 +0000
28@@ -73,13 +73,27 @@
29 ListItem.Divider {}
30
31 ListItem.SingleValue {
32- text: i18n.tr("Carriers")
33+ text: i18n.tr("Carriers & APNs")
34 id: chooseCarrier
35 objectName: "carrierApnEntry"
36 progression: enabled
37+ onClicked: {
38+ pageStack.push(Qt.resolvedUrl("../PageCarriersAndApns.qml"), {
39+ sims: sims,
40+ title: text
41+ });
42+ }
43+ }
44+
45+ ListItem.SingleValue {
46+ text: i18n.tr("Connection type")
47+ objectName: "connectionTypeEntry"
48+ progression: enabled
49 showDivider: false
50+ value: poweredSim ? poweredSim.techToString(
51+ poweredSim.radioSettings.technologyPreference) : ""
52 onClicked: {
53- pageStack.push(Qt.resolvedUrl("../PageCarriersAndApns.qml"), {
54+ pageStack.push(Qt.resolvedUrl("../PageChooseConnectionType.qml"), {
55 sims: sims
56 });
57 }
58@@ -97,68 +111,6 @@
59 anchors { left: parent.left; right: parent.right }
60 }
61
62- ListItem.Divider {}
63-
64- SettingsItemTitle { text: i18n.tr("Connection type:") }
65-
66- Repeater {
67- model: sims
68-
69- ListItem.ItemSelector {
70- id: radio
71- property var sim: modelData
72-
73- expanded: true
74- text: sim.title
75- model: sim.radioSettings.modemTechnologies
76- delegate: OptionSelectorDelegate {
77- objectName: sim.path + "_radio_" + modelData
78- text: sim.techToString(modelData)
79- }
80- enabled: sim.radioSettings.technologyPreference !== ""
81- selectedIndex: sim.radioSettings.technologyPreference !== "" ?
82- model.indexOf(sim.radioSettings.technologyPreference) : -1
83-
84- onDelegateClicked: {
85- if (model[index] === 'umts_enable') {
86- sim.radioSettings.technologyPreference = 'umts';
87- umtsModemChanged(sim, poweredSim ? poweredSim.path : "");
88- sim.mtkSettings.has3G = true;
89- } else {
90- sim.radioSettings.technologyPreference = model[index];
91- }
92- }
93-
94- Connections {
95- target: sim.radioSettings
96- onTechnologyPreferenceChanged: radio.selectedIndex =
97- sim.radioSettings.modemTechnologies.indexOf(preference)
98-
99- onModemTechnologiesChanged: {
100- if ((technologies.indexOf('umts') === -1)
101- && (sim.mtkSettings.has3G === false)) {
102- radio.model = sim.addUmtsEnableToModel(technologies);
103- } else {
104- radio.model = technologies;
105- }
106- radio.selectedIndex = sim.radioSettings.technologyPreference !== "" ?
107- model.indexOf(sim.radioSettings.technologyPreference) : -1
108- }
109- ignoreUnknownSignals: true
110- }
111-
112- Component.onCompleted: {
113- if ((sim.radioSettings.modemTechnologies.indexOf('umts') === -1)
114- && (sim.mtkSettings.has3G === false)) {
115- radio.model = sim.addUmtsEnableToModel(sim.radioSettings.modemTechnologies);
116- } else {
117- radio.model = sim.radioSettings.modemTechnologies;
118- }
119- }
120- }
121- }
122-
123-
124 GSettings {
125 id: phoneSettings
126 schema.id: "com.ubuntu.phone"
127
128=== removed file 'plugins/cellular/Components/RadioSingleSim.qml'
129--- plugins/cellular/Components/RadioSingleSim.qml 2015-01-21 20:44:20 +0000
130+++ plugins/cellular/Components/RadioSingleSim.qml 1970-01-01 00:00:00 +0000
131@@ -1,91 +0,0 @@
132-/*
133- * Copyright (C) 2014 Canonical Ltd
134- *
135- * This program is free software: you can redistribute it and/or modify
136- * it under the terms of the GNU General Public License version 3 as
137- * published by the Free Software Foundation.
138- *
139- * This program is distributed in the hope that it will be useful,
140- * but WITHOUT ANY WARRANTY; without even the implied warranty of
141- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
142- * GNU General Public License for more details.
143- *
144- * You should have received a copy of the GNU General Public License
145- * along with this program. If not, see <http://www.gnu.org/licenses/>.
146- *
147- * Authors:
148- * Jonas G. Drange <jonas.drange@canonical.com>
149- *
150-*/
151-import QtQuick 2.0
152-import SystemSettings 1.0
153-import Ubuntu.Components 0.1
154-import Ubuntu.Components.ListItems 0.1 as ListItem
155-
156-Column {
157- id: radioSingleSim
158- height: childrenRect.height
159-
160- property bool enabled: sim.radioSettings.technologyPreference !== ""
161-
162- SettingsItemTitle { text: i18n.tr("Connection type:") }
163-
164- ListItem.ItemSelector {
165- id: selector
166-
167- showDivider: false
168- expanded: true
169-
170- // an empty string is not a valid preference, which means
171- // we disregard the interace and disable the selector
172- enabled: parent.enabled
173- model: sim.radioSettings.modemTechnologies
174- delegate: OptionSelectorDelegate {
175- objectName: sim.path + "_radio_" + modelData
176- text: sim.techToString(modelData)
177- showDivider: false
178- }
179- selectedIndex:
180- sim.radioSettings.technologyPreference !== "" ?
181- model.indexOf(sim.radioSettings.technologyPreference) : -1
182-
183- onDelegateClicked: {
184- if (model[index] === 'umts_enable') {
185- sim.radioSettings.technologyPreference = 'umts';
186- radioSingleSim.parent.umtsModemChanged(sim, sim.connMan.powered ? sim.path : "");
187- sim.mtkSettings.has3G = true;
188- } else {
189- sim.radioSettings.technologyPreference = model[index];
190- }
191- }
192-
193- Connections {
194- target: sim.radioSettings
195-
196- onTechnologyPreferenceChanged: selector.selectedIndex =
197- sim.radioSettings.modemTechnologies.indexOf(preference)
198-
199- onModemTechnologiesChanged: {
200- if ((technologies.indexOf('umts') === -1)
201- && (sim.mtkSettings.has3G === false)) {
202- selector.model = sim.addUmtsEnableToModel(technologies);
203- } else {
204- selector.model = technologies;
205- }
206- selector.selectedIndex = sim.radioSettings.technologyPreference !== "" ?
207- selector.model.indexOf(sim.radioSettings.technologyPreference) : -1
208- }
209- ignoreUnknownSignals: true
210- }
211-
212- Component.onCompleted: {
213- if ((sim.radioSettings.modemTechnologies.indexOf('umts') === -1)
214- && (sim.mtkSettings.has3G === false)) {
215- selector.model = sim.addUmtsEnableToModel(
216- sim.radioSettings.modemTechnologies);
217- } else {
218- selector.model = sim.radioSettings.modemTechnologies;
219- }
220- }
221- }
222-}
223
224=== modified file 'plugins/cellular/Components/SingleSim.qml'
225--- plugins/cellular/Components/SingleSim.qml 2015-01-20 12:23:34 +0000
226+++ plugins/cellular/Components/SingleSim.qml 2015-05-28 14:45:56 +0000
227@@ -81,25 +81,29 @@
228 visible: showAllUI
229 }
230
231- ListItem.Divider {
232- visible: radio.visible
233- }
234-
235- RadioSingleSim {
236- id: radio
237- anchors { left: parent.left; right: parent.right }
238- visible: radio.enabled
239- }
240-
241 ListItem.Divider {}
242
243 ListItem.SingleValue {
244- text: i18n.tr("Carrier");
245+ text: i18n.tr("Carrier & APN");
246 id: chooseCarrier
247 objectName: "carrierApnEntry"
248 progression: enabled
249+ value: sim.netReg.name
250 onClicked: pageStack.push(Qt.resolvedUrl("../PageCarrierAndApn.qml"), {
251- sim: sim
252+ sim: sim,
253+ title: text
254 })
255 }
256+
257+ ListItem.SingleValue {
258+ text: i18n.tr("Connection type")
259+ objectName: "connectionTypeEntry"
260+ progression: enabled
261+ value: sim.techToString(sim.radioSettings.technologyPreference)
262+ onClicked: {
263+ pageStack.push(Qt.resolvedUrl("../PageChooseConnectionType.qml"), {
264+ sims: [sim]
265+ });
266+ }
267+ }
268 }
269
270=== modified file 'plugins/cellular/PageCarrierAndApn.qml'
271--- plugins/cellular/PageCarrierAndApn.qml 2015-03-27 10:01:48 +0000
272+++ plugins/cellular/PageCarrierAndApn.qml 2015-05-28 14:45:56 +0000
273@@ -24,7 +24,6 @@
274
275 ItemPage {
276 id: root
277- title: i18n.tr("Carrier")
278 objectName: "carrierApnPage"
279 flickable: null
280
281
282=== modified file 'plugins/cellular/PageCarriersAndApns.qml'
283--- plugins/cellular/PageCarriersAndApns.qml 2015-03-27 10:01:48 +0000
284+++ plugins/cellular/PageCarriersAndApns.qml 2015-05-28 14:45:56 +0000
285@@ -24,7 +24,6 @@
286
287 ItemPage {
288 id: root
289- title: i18n.tr("Carriers")
290 objectName: "carrierApnPage"
291 flickable: null
292
293
294=== added file 'plugins/cellular/PageChooseConnectionType.qml'
295--- plugins/cellular/PageChooseConnectionType.qml 1970-01-01 00:00:00 +0000
296+++ plugins/cellular/PageChooseConnectionType.qml 2015-05-28 14:45:56 +0000
297@@ -0,0 +1,171 @@
298+/*
299+ * This file is part of system-settings
300+ *
301+ * Copyright (C) 2015 Canonical Ltd.
302+ *
303+ * Contact: Jonas G. Drange <jonas.drange@canonical.com>
304+ *
305+ * This program is free software: you can redistribute it and/or modify it
306+ * under the terms of the GNU General Public License version 3, as published
307+ * by the Free Software Foundation.
308+ *
309+ * This program is distributed in the hope that it will be useful, but
310+ * WITHOUT ANY WARRANTY; without even the implied warranties of
311+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
312+ * PURPOSE. See the GNU General Public License for more details.
313+ *
314+ * You should have received a copy of the GNU General Public License along
315+ * with this program. If not, see <http://www.gnu.org/licenses/>.
316+ */
317+
318+import QtQuick 2.0
319+import SystemSettings 1.0
320+import Ubuntu.Components 1.1
321+import Ubuntu.Components.ListItems 1.0 as ListItem
322+
323+ItemPage {
324+ id: root
325+ title: i18n.tr("Connection type")
326+ objectName: "connectionTypePage"
327+
328+ property var sims
329+
330+ Flickable {
331+ id: scrollWidget
332+ anchors.fill: parent
333+ contentWidth: parent.width
334+ contentHeight: contentItem.childrenRect.height
335+ boundsBehavior: (contentHeight > root.height) ?
336+ Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
337+
338+ Column {
339+ anchors {
340+ left: parent.left
341+ right: parent.right
342+ }
343+ spacing: units.gu(2)
344+
345+ Repeater {
346+ id: repeater
347+ model: sims
348+
349+ Column {
350+
351+ anchors {
352+ left: parent.left
353+ right: parent.right
354+ }
355+
356+ spacing: 0
357+
358+ property var sim: modelData
359+
360+ ListItem.Standard {
361+ anchors { left: parent.left; right: parent.right }
362+ visible: repeater.count > 1
363+
364+ Row {
365+ anchors {
366+ left: parent.left
367+ leftMargin: units.gu(2)
368+ right: parent.right
369+ rightMargin: units.gu(2)
370+ }
371+ height: simName.height
372+ spacing: units.gu(2)
373+
374+ Label {
375+ id: simName
376+ anchors {
377+ top: parent.top
378+ topMargin: units.gu(3)
379+ }
380+ text: sim.title
381+ width: (parent.width / 2) - parent.spacing
382+ elide: Text.ElideRight
383+ }
384+
385+ Label {
386+ id: simReg
387+ anchors {
388+ top: parent.top
389+ topMargin: units.gu(3)
390+ }
391+ text: sim.netReg.name
392+ width: (parent.width / 2) - parent.spacing
393+ elide: Text.ElideRight
394+ horizontalAlignment: Text.AlignRight
395+ opacity: 0.75
396+ }
397+ }
398+ highlightWhenPressed: false
399+ }
400+
401+ ListItem.ItemSelector {
402+ id: radio
403+
404+ expanded: true
405+ model: sim.radioSettings.modemTechnologies
406+ delegate: OptionSelectorDelegate {
407+ objectName: sim.path + "_radio_" + modelData
408+ text: sim.techToString(modelData)
409+ }
410+ enabled: sim.radioSettings.technologyPreference !== ""
411+ selectedIndex: sim.radioSettings.technologyPreference !== "" ?
412+ model.indexOf(sim.radioSettings.technologyPreference) : -1
413+
414+ onDelegateClicked: {
415+ if (model[index] === 'umts_enable') {
416+ sim.radioSettings.technologyPreference = 'umts';
417+ umtsModemChanged(sim, poweredSim ? poweredSim.path : "");
418+ sim.mtkSettings.has3G = true;
419+ } else {
420+ sim.radioSettings.technologyPreference = model[index];
421+ }
422+ }
423+
424+ Connections {
425+ target: sim.radioSettings
426+ onTechnologyPreferenceChanged: radio.selectedIndex =
427+ sim.radioSettings.modemTechnologies.indexOf(preference)
428+
429+ onModemTechnologiesChanged: {
430+ if ((technologies.indexOf('umts') === -1)
431+ && (sim.mtkSettings.has3G === false)) {
432+ radio.model = sim.addUmtsEnableToModel(technologies);
433+ } else {
434+ radio.model = technologies;
435+ }
436+ radio.selectedIndex = sim.radioSettings.technologyPreference !== "" ?
437+ model.indexOf(sim.radioSettings.technologyPreference) : -1
438+ }
439+ ignoreUnknownSignals: true
440+ }
441+
442+ Component.onCompleted: {
443+ if ((sim.radioSettings.modemTechnologies.indexOf('umts') === -1)
444+ && (sim.mtkSettings.has3G === false)) {
445+ radio.model = sim.addUmtsEnableToModel(sim.radioSettings.modemTechnologies);
446+ } else {
447+ radio.model = sim.radioSettings.modemTechnologies;
448+ }
449+ }
450+ }
451+ }
452+ }
453+
454+ Label {
455+ anchors {
456+ left: parent.left
457+ right: parent.right
458+ margins: units.gu(2)
459+ }
460+
461+ fontSize: "small"
462+ horizontalAlignment: Text.AlignHCenter
463+ width: parent.width
464+ text: i18n.tr("Faster connections may reduce battery life.")
465+ }
466+ }
467+ }
468+}
469
470=== modified file 'tests/autopilot/ubuntu_system_settings/__init__.py'
471--- tests/autopilot/ubuntu_system_settings/__init__.py 2015-05-12 16:29:02 +0000
472+++ tests/autopilot/ubuntu_system_settings/__init__.py 2015-05-28 14:45:56 +0000
473@@ -240,25 +240,27 @@
474 @autopilot.logging.log_action(logger.debug)
475 def set_connection_type(self, radio_type, sim='/ril_0',
476 scroll_to_and_click=None):
477- self._set_connection_type(radio_type, sim, scroll_to_and_click)
478+ type_page = self._click_connection_type_entry(scroll_to_and_click)
479+ type_page._set_connection_type(radio_type, sim, scroll_to_and_click)
480
481 @autopilot.logging.log_action(logger.debug)
482- def _set_connection_type(self, radio_type, sim, scroll_to_and_click):
483+ def _click_connection_type_entry(self, scroll_to_and_click):
484 t = self.wait_select_single(
485- 'OptionSelectorDelegate',
486- objectName='%s_radio_%s' % (sim, radio_type))
487+ objectName='connectionTypeEntry')
488 if scroll_to_and_click:
489 scroll_to_and_click(t)
490 else:
491 t.swipe_into_view()
492
493 self.pointing_device.click_object(t)
494+ return self.get_root_instance().wait_select_single(
495+ objectName='connectionTypePage')
496
497 @autopilot.logging.log_action(logger.debug)
498 def change_carrier(self, carrier, sim=None):
499- carrierApnPage = self._click_carrier_apn()
500- chooseCarrierPage = carrierApnPage.open_carrier(sim)
501- chooseCarrierPage.set_carrier(carrier)
502+ carrier_apn_page = self._click_carrier_apn()
503+ choose_carrier_page = carrier_apn_page.open_carrier(sim)
504+ choose_carrier_page.set_carrier(carrier)
505
506 @autopilot.logging.log_action(logger.debug)
507 def _click_carrier_apn(self):
508@@ -335,6 +337,25 @@
509 disconnected_list.select_many('LabelVisual')]
510
511
512+class PageChooseConnectionType(
513+ ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
514+
515+ """Autopilot helper for connection type selection page"""
516+
517+ @autopilot.logging.log_action(logger.debug)
518+ def _set_connection_type(self, radio_type, sim, scroll_to_and_click):
519+ t = self.wait_select_single(
520+ 'OptionSelectorDelegate',
521+ objectName='%s_radio_%s' % (sim, radio_type))
522+ if scroll_to_and_click:
523+ scroll_to_and_click(t)
524+ return
525+ else:
526+ t.swipe_into_view()
527+
528+ self.pointing_device.click_object(t)
529+
530+
531 class PageCarrierAndApn(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
532
533 """Autopilot helper for carrier/apn entry page (singlesim)."""
534@@ -381,17 +402,17 @@
535 # wait for animation, since page.animationRunning.wait_for(False)
536 # does not work?
537 sleep(0.5)
538- allOperators = self.select_single(objectName="allOperators")
539- otherOperators = self.select_single(objectName="otherOperators")
540+ all_operators = self.select_single(objectName="allOperators")
541+ other_operators = self.select_single(objectName="otherOperators")
542
543- if allOperators.visible:
544- opList = allOperators
545- elif otherOperators.visible:
546- opList = otherOperators
547+ if all_operators.visible:
548+ op_list = all_operators
549+ elif other_operators.visible:
550+ op_list = other_operators
551 else:
552 raise Exception("No operator list visible.")
553
554- item = opList.select_single(text=carrier, objectName="carrier")
555+ item = op_list.select_single(text=carrier, objectName="carrier")
556 self.pointing_device.click_object(item)
557
558

Subscribers

People subscribed via source and target branches