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
1=== modified file 'debian/changelog'
2--- debian/changelog 2016-11-16 18:54:00 +0000
3+++ debian/changelog 2016-11-25 13:42:57 +0000
4@@ -1,3 +1,9 @@
5+ubuntu-settings-components (0.12-0ubuntu1) UNRELEASED; urgency=medium
6+
7+ * Add Menus.EthernetItem in support of indicator-network.
8+
9+ -- Pete <pete.woods@canonical.com> Fri, 25 Nov 2016 13:41:29 +0000
10+
11 ubuntu-settings-components (0.11+17.04.20161116.1-0ubuntu1) zesty; urgency=medium
12
13 * Menus: add Pointer and Touch styles to be used depending on the user
14
15=== added file 'plugins/Ubuntu/Settings/Menus/EthernetItem.qml'
16--- plugins/Ubuntu/Settings/Menus/EthernetItem.qml 1970-01-01 00:00:00 +0000
17+++ plugins/Ubuntu/Settings/Menus/EthernetItem.qml 2016-11-25 13:42:57 +0000
18@@ -0,0 +1,85 @@
19+/*
20+ * Copyright 2014-2016 Canonical Ltd.
21+ *
22+ * This program is free software; you can redistribute it and/or modify
23+ * it under the terms of the GNU Lesser General Public License as published by
24+ * the Free Software Foundation; version 3.
25+ *
26+ * This program is distributed in the hope that it will be useful,
27+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
28+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29+ * GNU Lesser General Public License for more details.
30+ *
31+ * You should have received a copy of the GNU Lesser General Public License
32+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
33+ *
34+ * Author: Pete Woods <pete.woods@canonical.com>
35+ */
36+
37+import QtQuick 2.4
38+import QtQuick.Layouts 1.1
39+import Ubuntu.Components 1.3
40+import Ubuntu.Settings.Menus.Style 0.1
41+
42+BaseMenu {
43+ id: menu
44+ property alias statusIcon: statusIcon.name
45+ property alias statusText: labelStatus.text
46+ property alias name: labelName.text
47+ property alias checked: switcher.checked
48+
49+ menuHeight: slotsLayout.height
50+
51+ StyledSlotsLayout {
52+ id: slotsLayout
53+ objectName: "ethernetSlotsLayout"
54+ style: menuStyle
55+
56+ mainSlot: ColumnLayout {
57+ spacing: units.gu(0.5)
58+
59+ Label {
60+ id: labelName
61+ objectName: "labelName"
62+ elide: Text.ElideRight
63+ color: menu.foregroundColor
64+ font.bold: true
65+ font.pixelSize: menuStyle.fontSize
66+ }
67+
68+ Row {
69+ id: statusRow
70+ spacing: units.gu(1)
71+ height: labelStatus.height
72+
73+ Label {
74+ id: labelStatus
75+ objectName: "labelStatus"
76+ elide: Text.ElideRight
77+ opacity: 0.6
78+ color: menu.foregroundColor
79+ font.pixelSize: menuStyle.fontSize
80+ }
81+
82+ Icon {
83+ id: statusIcon
84+ objectName: "statusIcon"
85+ color: menuStyle.iconColor
86+
87+ height: menuStyle.iconSize
88+ width: height
89+
90+ visible: name !== ""
91+ }
92+ }
93+ }
94+
95+ Switch {
96+ id: switcher
97+ objectName: "switcher"
98+ onClicked: menu.triggered(checked)
99+
100+ SlotsLayout.position: SlotsLayout.Trailing
101+ }
102+ }
103+}
104
105=== modified file 'plugins/Ubuntu/Settings/Menus/qmldir'
106--- plugins/Ubuntu/Settings/Menus/qmldir 2016-10-10 22:27:38 +0000
107+++ plugins/Ubuntu/Settings/Menus/qmldir 2016-11-25 13:42:57 +0000
108@@ -8,6 +8,7 @@
109 ButtonMenu 0.1 ButtonMenu.qml
110 CalendarMenu 0.1 CalendarMenu.qml
111 CheckableMenu 0.1 CheckableMenu.qml
112+EthernetItem 0.1 EthernetItem.qml
113 EventMenu 0.1 EventMenu.qml
114 GroupedMessageMenu 0.1 GroupedMessageMenu.qml
115 MediaPlayerMenu 0.1 MediaPlayerMenu.qml
116
117=== modified file 'tests/qmltests/CMakeLists.txt'
118--- tests/qmltests/CMakeLists.txt 2016-10-11 13:51:11 +0000
119+++ tests/qmltests/CMakeLists.txt 2016-11-25 13:42:57 +0000
120@@ -9,6 +9,7 @@
121 add_usc_qmltest(Menus ButtonMenu)
122 add_usc_qmltest(Menus CalendarMenu)
123 add_usc_qmltest(Menus CheckableMenu)
124+add_usc_qmltest(Menus EthernetItem)
125 add_usc_qmltest(Menus EventMenu)
126 add_usc_qmltest(Menus GroupedMessageMenu)
127 add_usc_qmltest(Menus MediaPlayerMenu)
128
129=== added file 'tests/qmltests/Menus/tst_EthernetItem.qml'
130--- tests/qmltests/Menus/tst_EthernetItem.qml 1970-01-01 00:00:00 +0000
131+++ tests/qmltests/Menus/tst_EthernetItem.qml 2016-11-25 13:42:57 +0000
132@@ -0,0 +1,132 @@
133+/*
134+ * Copyright 2016 Canonical Ltd.
135+ *
136+ * This program is free software; you can redistribute it and/or modify
137+ * it under the terms of the GNU Lesser General Public License as published by
138+ * the Free Software Foundation; version 3.
139+ *
140+ * This program is distributed in the hope that it will be useful,
141+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
142+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
143+ * GNU Lesser General Public License for more details.
144+ *
145+ * You should have received a copy of the GNU Lesser General Public License
146+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
147+ *
148+ * Authored by Pete Woods <pete.woods@canonical.com>
149+ */
150+
151+import QtQuick 2.4
152+import QtTest 1.0
153+import Ubuntu.Test 0.1
154+import Ubuntu.Settings.Menus 0.1
155+
156+Item {
157+ width: units.gu(42)
158+ height: units.gu(75)
159+
160+ Column {
161+ anchors.fill: parent
162+
163+ EthernetItem {
164+ id: ethernetItem
165+ }
166+
167+ EthernetItem {
168+ id: checkedEthernetItem
169+ checked: true
170+ }
171+
172+ EthernetItem {
173+ id: clickEthernetItem
174+ }
175+ }
176+
177+ SignalSpy {
178+ id: signalSpy
179+ }
180+
181+ UbuntuTestCase {
182+ name: "BaseMenu"
183+ when: windowShown
184+
185+ function getSwitchItem(item) {
186+ var switchItem = findChild(item, "switcher");
187+ verify(switchItem !== undefined)
188+ return switchItem
189+ }
190+
191+ function cleanup() {
192+ clickEthernetItem.checked = false
193+ signalSpy.clear()
194+ }
195+
196+ function test_checked() {
197+ compare(getSwitchItem(ethernetItem).checked, false, "should be unchecked by default")
198+ }
199+
200+ function test_unChecked() {
201+ compare(getSwitchItem(checkedEthernetItem).checked, true, "should be checked")
202+ }
203+
204+ function checkedData() {
205+ return [ {tag: "unchecked", checked: false}, {tag: "checked", checked: true}]
206+ }
207+
208+ function test_changing_data() {
209+ return checkedData()
210+ }
211+
212+ function test_changing(data) {
213+ clickEthernetItem.checked = data.checked
214+ compare(getSwitchItem(clickEthernetItem).checked, data.checked, "switch should be %1".arg(data.tag))
215+ }
216+
217+ function test_clickEvent_data() {
218+ return checkedData()
219+ }
220+
221+ function test_clickEvent(data) {
222+ signalSpy.target = clickEthernetItem
223+ signalSpy.signalName = "onClicked"
224+ clickEthernetItem.checked = data.checked
225+ mouseClick(clickEthernetItem, clickEthernetItem.width/2, clickEthernetItem.height/2)
226+ compare(signalSpy.count, 1)
227+ }
228+
229+ function test_onCheckedChanged_data() {
230+ return checkedData()
231+ }
232+
233+ function test_onCheckedChanged(data) {
234+ clickEthernetItem.checked = data.checked
235+ signalSpy.clear()
236+ signalSpy.target = clickEthernetItem
237+ signalSpy.signalName = "onTriggered"
238+ mouseClick(clickEthernetItem, clickEthernetItem.width/2, clickEthernetItem.height/2)
239+ compare(signalSpy.count, 1)
240+ }
241+
242+ function getChild(name) {
243+ var child = findChild(ethernetItem, name)
244+ verify(child !== undefined)
245+ return child
246+ }
247+
248+ function test_nameStatusIcon_data() {
249+ return [{name: "Ethernet (eth0)", statusText: "Connected", statusIcon: "network-wired-connected"},
250+ {name: "Ethernet", statusText: "Connecting", statusIcon: "network-wired-active"},
251+ {name: "Ethernet", statusText: "Disabled", statusIcon: "network-wired-disabled"}]
252+ }
253+
254+ function test_nameStatusIcon(data) {
255+ ethernetItem.name = data.name
256+ ethernetItem.statusText = data.statusText
257+ ethernetItem.statusIcon = data.statusIcon
258+
259+ compare(getChild("labelName").text, data.name)
260+ compare(getChild("labelStatus").text, data.statusText)
261+ compare(getChild("statusIcon").name, data.statusIcon)
262+ }
263+ }
264+}

Subscribers

People subscribed via source and target branches

to all changes: