Merge lp:~pete-woods/ubuntu-settings-components/add-ethernet-item into lp:ubuntu-settings-components

Proposed by Pete Woods
Status: Rejected
Rejected by: Pete Woods
Proposed branch: lp:~pete-woods/ubuntu-settings-components/add-ethernet-item
Merge into: lp:ubuntu-settings-components
Diff against target: 264 lines (+225/-0)
5 files modified
debian/changelog (+6/-0)
plugins/Ubuntu/Settings/Menus/EthernetItem.qml (+85/-0)
plugins/Ubuntu/Settings/Menus/qmldir (+1/-0)
tests/qmltests/CMakeLists.txt (+1/-0)
tests/qmltests/Menus/tst_EthernetItem.qml (+132/-0)
To merge this branch: bzr merge lp:~pete-woods/ubuntu-settings-components/add-ethernet-item
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Disapprove
Michał Sawicz Abstain
Unity8 CI Bot continuous-integration Approve
Review via email: mp+311503@code.launchpad.net

Commit message

Add Menus.EthernetItem in support of indicator-network

Description of the change

* Are there any related MPs required for this MP to build/function as expected? Please list.

N/A

 * Did you perform an exploratory manual test run of your code change and any related functionality?

Tested on laptop. Phone/tablet devices don't have ethernet support.

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?

N/A

 * If you changed the UI, has there been a design review?

Yes, implementation was carried out with design team oversight.

 * If you changed localized strings, has the POT file been updated?

N/A

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:173
https://unity8-jenkins.ubuntu.com/job/lp-ubuntu-settings-components-ci/114/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3375
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1936
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1936
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/1936
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3403
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3253
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3253/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3253
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3253/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3253
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3253/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3253
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3253/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3253
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3253/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3253
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3253/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3253
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3253/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3253
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3253/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3253
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3253/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-ubuntu-settings-components-ci/114/rebuild

review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Please bump changelog here so you can depend on the new item.

review: Needs Fixing
174. By Pete Woods

Dump debian version

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:174
https://unity8-jenkins.ubuntu.com/job/lp-ubuntu-settings-components-ci/115/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3386
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1946
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1946
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/1946
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3414
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3265
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3265/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3265
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3265/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3265
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3265/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3265
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3265/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3265
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3265/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3265
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3265/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3265
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3265/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3265
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3265/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3265
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3265/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-ubuntu-settings-components-ci/115/rebuild

review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Thanks!

review: Abstain
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Looks good, but I think you can just reuse the BaseLayoutMenu with some "hacks".
And I'd avoid to send the triggered event when tapping on the item only.

So please, use this http://paste.ubuntu.com/23548192/ and you can just update the tests.
Also, please include an item in examples/OtherComponents.qml.

I'm also refactoring these components so that we don't have to use many typed items, but having a such checkable item that can be more generic.

Anyway it's fine for now... I was just wondering where's the design of the statusIcon item, as I didn't see it in the docs I've.

PS: if you'd need to add this to unity8, you also could add a breaks line to debian control to the bumped unity8 version, not to make autopkgtests angry on upgrade.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Ah, if instead tapping in the item should toggle the switch, do the same we do in the SwitchMenu (or just rebase on that with something like http://paste.ubuntu.com/23548269/)

Revision history for this message
Pete Woods (pete-woods) wrote :

Hmm. You've managed to make this code so trivial that it seems pointless even adding this widget at all.

Revision history for this message
Pete Woods (pete-woods) wrote :

Especially as I got feedback from design to not include the icon any more.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Ok, I think we can reject this then... Having more generic items is something I'd prefer to solve this kind of cases ;-).

review: Disapprove

Unmerged revisions

174. By Pete Woods

Dump debian version

173. By Pete Woods

Add EthernetItem widget

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2016-11-16 18:54:00 +0000
+++ debian/changelog 2016-11-25 13:42:57 +0000
@@ -1,3 +1,9 @@
1ubuntu-settings-components (0.12-0ubuntu1) UNRELEASED; urgency=medium
2
3 * Add Menus.EthernetItem in support of indicator-network.
4
5 -- Pete <pete.woods@canonical.com> Fri, 25 Nov 2016 13:41:29 +0000
6
1ubuntu-settings-components (0.11+17.04.20161116.1-0ubuntu1) zesty; urgency=medium7ubuntu-settings-components (0.11+17.04.20161116.1-0ubuntu1) zesty; urgency=medium
28
3 * Menus: add Pointer and Touch styles to be used depending on the user9 * Menus: add Pointer and Touch styles to be used depending on the user
410
=== added file 'plugins/Ubuntu/Settings/Menus/EthernetItem.qml'
--- plugins/Ubuntu/Settings/Menus/EthernetItem.qml 1970-01-01 00:00:00 +0000
+++ plugins/Ubuntu/Settings/Menus/EthernetItem.qml 2016-11-25 13:42:57 +0000
@@ -0,0 +1,85 @@
1/*
2 * Copyright 2014-2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Pete Woods <pete.woods@canonical.com>
17 */
18
19import QtQuick 2.4
20import QtQuick.Layouts 1.1
21import Ubuntu.Components 1.3
22import Ubuntu.Settings.Menus.Style 0.1
23
24BaseMenu {
25 id: menu
26 property alias statusIcon: statusIcon.name
27 property alias statusText: labelStatus.text
28 property alias name: labelName.text
29 property alias checked: switcher.checked
30
31 menuHeight: slotsLayout.height
32
33 StyledSlotsLayout {
34 id: slotsLayout
35 objectName: "ethernetSlotsLayout"
36 style: menuStyle
37
38 mainSlot: ColumnLayout {
39 spacing: units.gu(0.5)
40
41 Label {
42 id: labelName
43 objectName: "labelName"
44 elide: Text.ElideRight
45 color: menu.foregroundColor
46 font.bold: true
47 font.pixelSize: menuStyle.fontSize
48 }
49
50 Row {
51 id: statusRow
52 spacing: units.gu(1)
53 height: labelStatus.height
54
55 Label {
56 id: labelStatus
57 objectName: "labelStatus"
58 elide: Text.ElideRight
59 opacity: 0.6
60 color: menu.foregroundColor
61 font.pixelSize: menuStyle.fontSize
62 }
63
64 Icon {
65 id: statusIcon
66 objectName: "statusIcon"
67 color: menuStyle.iconColor
68
69 height: menuStyle.iconSize
70 width: height
71
72 visible: name !== ""
73 }
74 }
75 }
76
77 Switch {
78 id: switcher
79 objectName: "switcher"
80 onClicked: menu.triggered(checked)
81
82 SlotsLayout.position: SlotsLayout.Trailing
83 }
84 }
85}
086
=== modified file 'plugins/Ubuntu/Settings/Menus/qmldir'
--- plugins/Ubuntu/Settings/Menus/qmldir 2016-10-10 22:27:38 +0000
+++ plugins/Ubuntu/Settings/Menus/qmldir 2016-11-25 13:42:57 +0000
@@ -8,6 +8,7 @@
8ButtonMenu 0.1 ButtonMenu.qml8ButtonMenu 0.1 ButtonMenu.qml
9CalendarMenu 0.1 CalendarMenu.qml9CalendarMenu 0.1 CalendarMenu.qml
10CheckableMenu 0.1 CheckableMenu.qml10CheckableMenu 0.1 CheckableMenu.qml
11EthernetItem 0.1 EthernetItem.qml
11EventMenu 0.1 EventMenu.qml12EventMenu 0.1 EventMenu.qml
12GroupedMessageMenu 0.1 GroupedMessageMenu.qml13GroupedMessageMenu 0.1 GroupedMessageMenu.qml
13MediaPlayerMenu 0.1 MediaPlayerMenu.qml14MediaPlayerMenu 0.1 MediaPlayerMenu.qml
1415
=== modified file 'tests/qmltests/CMakeLists.txt'
--- tests/qmltests/CMakeLists.txt 2016-10-11 13:51:11 +0000
+++ tests/qmltests/CMakeLists.txt 2016-11-25 13:42:57 +0000
@@ -9,6 +9,7 @@
9add_usc_qmltest(Menus ButtonMenu)9add_usc_qmltest(Menus ButtonMenu)
10add_usc_qmltest(Menus CalendarMenu)10add_usc_qmltest(Menus CalendarMenu)
11add_usc_qmltest(Menus CheckableMenu)11add_usc_qmltest(Menus CheckableMenu)
12add_usc_qmltest(Menus EthernetItem)
12add_usc_qmltest(Menus EventMenu)13add_usc_qmltest(Menus EventMenu)
13add_usc_qmltest(Menus GroupedMessageMenu)14add_usc_qmltest(Menus GroupedMessageMenu)
14add_usc_qmltest(Menus MediaPlayerMenu)15add_usc_qmltest(Menus MediaPlayerMenu)
1516
=== added file 'tests/qmltests/Menus/tst_EthernetItem.qml'
--- tests/qmltests/Menus/tst_EthernetItem.qml 1970-01-01 00:00:00 +0000
+++ tests/qmltests/Menus/tst_EthernetItem.qml 2016-11-25 13:42:57 +0000
@@ -0,0 +1,132 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by Pete Woods <pete.woods@canonical.com>
17 */
18
19import QtQuick 2.4
20import QtTest 1.0
21import Ubuntu.Test 0.1
22import Ubuntu.Settings.Menus 0.1
23
24Item {
25 width: units.gu(42)
26 height: units.gu(75)
27
28 Column {
29 anchors.fill: parent
30
31 EthernetItem {
32 id: ethernetItem
33 }
34
35 EthernetItem {
36 id: checkedEthernetItem
37 checked: true
38 }
39
40 EthernetItem {
41 id: clickEthernetItem
42 }
43 }
44
45 SignalSpy {
46 id: signalSpy
47 }
48
49 UbuntuTestCase {
50 name: "BaseMenu"
51 when: windowShown
52
53 function getSwitchItem(item) {
54 var switchItem = findChild(item, "switcher");
55 verify(switchItem !== undefined)
56 return switchItem
57 }
58
59 function cleanup() {
60 clickEthernetItem.checked = false
61 signalSpy.clear()
62 }
63
64 function test_checked() {
65 compare(getSwitchItem(ethernetItem).checked, false, "should be unchecked by default")
66 }
67
68 function test_unChecked() {
69 compare(getSwitchItem(checkedEthernetItem).checked, true, "should be checked")
70 }
71
72 function checkedData() {
73 return [ {tag: "unchecked", checked: false}, {tag: "checked", checked: true}]
74 }
75
76 function test_changing_data() {
77 return checkedData()
78 }
79
80 function test_changing(data) {
81 clickEthernetItem.checked = data.checked
82 compare(getSwitchItem(clickEthernetItem).checked, data.checked, "switch should be %1".arg(data.tag))
83 }
84
85 function test_clickEvent_data() {
86 return checkedData()
87 }
88
89 function test_clickEvent(data) {
90 signalSpy.target = clickEthernetItem
91 signalSpy.signalName = "onClicked"
92 clickEthernetItem.checked = data.checked
93 mouseClick(clickEthernetItem, clickEthernetItem.width/2, clickEthernetItem.height/2)
94 compare(signalSpy.count, 1)
95 }
96
97 function test_onCheckedChanged_data() {
98 return checkedData()
99 }
100
101 function test_onCheckedChanged(data) {
102 clickEthernetItem.checked = data.checked
103 signalSpy.clear()
104 signalSpy.target = clickEthernetItem
105 signalSpy.signalName = "onTriggered"
106 mouseClick(clickEthernetItem, clickEthernetItem.width/2, clickEthernetItem.height/2)
107 compare(signalSpy.count, 1)
108 }
109
110 function getChild(name) {
111 var child = findChild(ethernetItem, name)
112 verify(child !== undefined)
113 return child
114 }
115
116 function test_nameStatusIcon_data() {
117 return [{name: "Ethernet (eth0)", statusText: "Connected", statusIcon: "network-wired-connected"},
118 {name: "Ethernet", statusText: "Connecting", statusIcon: "network-wired-active"},
119 {name: "Ethernet", statusText: "Disabled", statusIcon: "network-wired-disabled"}]
120 }
121
122 function test_nameStatusIcon(data) {
123 ethernetItem.name = data.name
124 ethernetItem.statusText = data.statusText
125 ethernetItem.statusIcon = data.statusIcon
126
127 compare(getChild("labelName").text, data.name)
128 compare(getChild("labelStatus").text, data.statusText)
129 compare(getChild("statusIcon").name, data.statusIcon)
130 }
131 }
132}

Subscribers

People subscribed via source and target branches

to all changes: