Merge lp:~nick-dedekind/ubuntu-settings-components/transfer-menu into lp:~registry/ubuntu-settings-components/trunk

Proposed by Nick Dedekind
Status: Merged
Approved by: Michał Sawicz
Approved revision: 74
Merged at revision: 74
Proposed branch: lp:~nick-dedekind/ubuntu-settings-components/transfer-menu
Merge into: lp:~registry/ubuntu-settings-components/trunk
Prerequisite: lp:~nick-dedekind/ubuntu-settings-components/menu.plugin
Diff against target: 374 lines (+304/-1)
8 files modified
SettingsComponents.qml (+19/-0)
Ubuntu/Settings/Menus/CMakeLists.txt (+1/-0)
Ubuntu/Settings/Menus/TransferMenu.qml (+96/-0)
Ubuntu/Settings/Menus/plugin.cpp (+6/-0)
Ubuntu/Settings/Menus/types.h (+43/-0)
debian/changelog (+2/-1)
tests/qmltests/CMakeLists.txt (+1/-0)
tests/qmltests/Menus/tst_TransferMenu.qml (+136/-0)
To merge this branch: bzr merge lp:~nick-dedekind/ubuntu-settings-components/transfer-menu
Reviewer Review Type Date Requested Status
Michał Sawicz (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Andrea Cimitan (community) Needs Fixing
Review via email: mp+224672@code.launchpad.net

Commit message

Added TransferMenu

Description of the change

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

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

 * Did you make sure that your branch does not contain spurious tags?
Yes

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

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

I've asked Cimi to review this as he's a member of ubuntu-settings-components and I'm not; however, FWIW:

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

Yes.

Manual test conducted in conjunction with
https://code.launchpad.net/~nick-dedekind/ubuntu-settings-components/transfer-menu/+merge/224672 and https://code.launchpad.net/~charlesk/indicator-transfer/per-transfer-actions/+merge/224537. The manual tests in the indicator-transfer MP put these new transfer menu components on display.

> * Did CI run pass? If not, please explain why.

Yes.

Revision history for this message
Andrea Cimitan (cimi) wrote :

I'd test what should change with active: true or false (visibility).

review: Needs Fixing
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

> I'd test what should change with active: true or false (visibility).

Done. & added stateText test

Revision history for this message
Michał Sawicz (saviq) wrote :

Bump changelog so we can depend on it?

More inline.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Oh and one more thing... Do (should) the enum values come from somewhere?

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

Fixed review comments

Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

> Oh and one more thing... Do (should) the enum values come from somewhere?

They come from indicator-transfer
http://bazaar.launchpad.net/~charlesk/indicator-transfer/per-transfer-actions/view/head:/include/transfer/transfer.h

would need to do some shizzle in there if we wanted to export to includes.

Revision history for this message
Michał Sawicz (saviq) wrote :

> > Oh and one more thing... Do (should) the enum values come from somewhere?
>
> They come from indicator-transfer
> http://bazaar.launchpad.net/~charlesk/indicator-transfer/per-transfer-
> actions/view/head:/include/transfer/transfer.h
>
> would need to do some shizzle in there if we wanted to export to includes.

I'd just be worried that this get out of sync... There's probably no lib from the indicator that we could link to?

review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

> > > Oh and one more thing... Do (should) the enum values come from somewhere?
> >
> > They come from indicator-transfer
> > http://bazaar.launchpad.net/~charlesk/indicator-transfer/per-transfer-
> > actions/view/head:/include/transfer/transfer.h
> >
> > would need to do some shizzle in there if we wanted to export to includes.
>
> I'd just be worried that this get out of sync... There's probably no lib from
> the indicator that we could link to?

Not for the transfer indicator specifically. There's libindicator, but I don't think it's used for the indicators we use.

Revision history for this message
Michał Sawicz (saviq) wrote :

Yup.

review: Approve
75. By Nick Dedekind

updated debian packaging

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'SettingsComponents.qml'
--- SettingsComponents.qml 2014-07-01 12:51:28 +0000
+++ SettingsComponents.qml 2014-07-07 15:54:19 +0000
@@ -159,6 +159,25 @@
159 onPlay: { mediaPlayer.running = !mediaPlayer.running; }159 onPlay: { mediaPlayer.running = !mediaPlayer.running; }
160 }160 }
161161
162 TransferMenu {
163 text: "Video Downloading"
164 stateText: "3 minutes remaning"
165 iconSource: "tests/artwork/speak-now.jpg"
166 progress: 0.6
167 active: true
168 removable: true
169 confirmRemoval: true
170 }
171
172 TransferMenu {
173 text: "Video Downloading"
174 iconSource: "tests/artwork/speak-now.jpg"
175 progress: 0.6
176 active: false
177 removable: true
178 confirmRemoval: true
179 }
180
162 AccessPointMenu {181 AccessPointMenu {
163 checked: true182 checked: true
164 secure: true183 secure: true
165184
=== modified file 'Ubuntu/Settings/Menus/CMakeLists.txt'
--- Ubuntu/Settings/Menus/CMakeLists.txt 2014-07-07 15:54:19 +0000
+++ Ubuntu/Settings/Menus/CMakeLists.txt 2014-07-07 15:54:19 +0000
@@ -11,6 +11,7 @@
1111
12set(UbuntuSettingsMenusQml_SOURCES12set(UbuntuSettingsMenusQml_SOURCES
13 plugin.cpp13 plugin.cpp
14 types.h
14)15)
15add_definitions(-DUBUNTUSETTINGSCOMPONENTS_LIBRARY)16add_definitions(-DUBUNTUSETTINGSCOMPONENTS_LIBRARY)
1617
1718
=== added file 'Ubuntu/Settings/Menus/TransferMenu.qml'
--- Ubuntu/Settings/Menus/TransferMenu.qml 1970-01-01 00:00:00 +0000
+++ Ubuntu/Settings/Menus/TransferMenu.qml 2014-07-07 15:54:19 +0000
@@ -0,0 +1,96 @@
1/*
2 * Copyright 2014 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
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import Ubuntu.Components.ListItems 0.1 as ListItem
20import QtQuick.Layouts 1.1
21
22ListItem.Empty {
23 id: menu
24
25 property alias iconSource: icon.source
26 property alias text: label.text
27 property alias stateText: stateLabel.text
28 property alias progress: progressBar.value
29 property bool active: false
30
31 property alias maximum: progressBar.maximumValue
32
33 implicitHeight: row.height + units.gu(2)
34
35 RowLayout {
36 id: row
37 anchors {
38 left: parent.left
39 right: parent.right
40 verticalCenter: parent.verticalCenter
41 leftMargin: menu.__contentsMargins
42 rightMargin: menu.__contentsMargins
43 }
44
45 UbuntuShape {
46 id: imageShape
47 Layout.preferredWidth: units.gu(5)
48 Layout.preferredHeight: units.gu(5)
49
50 Layout.alignment: Qt.AlignTop
51
52 image: Image {
53 objectName: "icon"
54 id: icon
55
56 sourceSize {
57 width: units.gu(5)
58 height: units.gu(5)
59 }
60 }
61 }
62
63 ColumnLayout {
64 spacing: units.gu(0.5)
65
66 Label {
67 id: label
68 objectName: "text"
69 Layout.fillWidth: true
70
71 elide: Text.ElideRight
72 maximumLineCount: 1
73 }
74
75 ProgressBar {
76 id: progressBar
77 objectName: "progress"
78 visible: menu.active
79 value: 0.0
80
81 Layout.preferredHeight: units.gu(2)
82 Layout.fillWidth: true
83 }
84
85 Label {
86 id: stateLabel
87 objectName: "stateText"
88 Layout.fillWidth: true
89 visible: menu.active
90
91 elide: Text.ElideRight
92 maximumLineCount: 1
93 }
94 }
95 }
96}
097
=== modified file 'Ubuntu/Settings/Menus/plugin.cpp'
--- Ubuntu/Settings/Menus/plugin.cpp 2014-07-07 15:54:19 +0000
+++ Ubuntu/Settings/Menus/plugin.cpp 2014-07-07 15:54:19 +0000
@@ -14,8 +14,14 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17// local
17#include "plugin.h"18#include "plugin.h"
19#include "types.h"
20
21// Qt
22#include <QtQml/qqml.h>
1823
19void UbuntuSettingsComponentsPlugin::registerTypes(const char *uri)24void UbuntuSettingsComponentsPlugin::registerTypes(const char *uri)
20{25{
26 qmlRegisterUncreatableType<TransferState>(uri, 0, 1, "TransferState", "Can't create TransferState class");
21}27}
2228
=== added file 'Ubuntu/Settings/Menus/types.h'
--- Ubuntu/Settings/Menus/types.h 1970-01-01 00:00:00 +0000
+++ Ubuntu/Settings/Menus/types.h 2014-07-07 15:54:19 +0000
@@ -0,0 +1,43 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
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
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 General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef UBUNTUSETTINGSMENUSTYPES_H
18#define UBUNTUSETTINGSMENUSTYPES_H
19
20#include "pluginglobal.h"
21
22#include <QObject>
23
24class UBUNTUSETTINGSCOMPONENTS_EXPORT TransferState : public QObject
25{
26 Q_OBJECT
27 Q_ENUMS(TransferStates)
28public:
29 enum TransferStates {
30 Queued,
31 Running,
32 Paused,
33 Canceled,
34 Hashing,
35 Processing,
36 Finished,
37 Error
38 };
39
40 TransferState(QObject* parent = 0): QObject(parent) {}
41};
42
43#endif // UBUNTUSETTINGSMENUSTYPES_H
044
=== modified file 'debian/changelog'
--- debian/changelog 2014-07-07 15:54:19 +0000
+++ debian/changelog 2014-07-07 15:54:19 +0000
@@ -2,8 +2,9 @@
22
3 [ Nick Dedekind ]3 [ Nick Dedekind ]
4 * Added plugin module for Ubuntu.Settings.Menus4 * Added plugin module for Ubuntu.Settings.Menus
5 * Added TransferMenu
56
6 -- Nicholas Dedekind <nicholas.dedekind@gmail.com> Mon, 07 Jul 2014 16:43:16 +01007 -- Nicholas Dedekind <nicholas.dedekind@gmail.com> Mon, 07 Jul 2014 12:28:37 +0100
78
8ubuntu-settings-components (0.2+14.10.20140701.2-0ubuntu2) utopic; urgency=medium9ubuntu-settings-components (0.2+14.10.20140701.2-0ubuntu2) utopic; urgency=medium
910
1011
=== modified file 'tests/qmltests/CMakeLists.txt'
--- tests/qmltests/CMakeLists.txt 2014-07-07 15:54:19 +0000
+++ tests/qmltests/CMakeLists.txt 2014-07-07 15:54:19 +0000
@@ -31,3 +31,4 @@
31add_qml_test(Menus UserSessionMenu)31add_qml_test(Menus UserSessionMenu)
32add_qml_test(Menus TextMessageMenu)32add_qml_test(Menus TextMessageMenu)
33add_qml_test(Menus TimeZoneMenu)33add_qml_test(Menus TimeZoneMenu)
34add_qml_test(Menus TransferMenu)
3435
=== added file 'tests/qmltests/Menus/tst_TransferMenu.qml'
--- tests/qmltests/Menus/tst_TransferMenu.qml 1970-01-01 00:00:00 +0000
+++ tests/qmltests/Menus/tst_TransferMenu.qml 2014-07-07 15:54:19 +0000
@@ -0,0 +1,136 @@
1/*
2 * Copyright 2014 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
17import QtQuick 2.0
18import QtTest 1.0
19import Ubuntu.Components 0.1
20import Ubuntu.Settings.Menus 0.1
21import "../utils.js" as UtilsJS
22
23Item {
24 width: units.gu(42)
25 height: units.gu(75)
26
27 Flickable {
28 id: flickable
29
30 anchors.fill: parent
31 contentWidth: column.width
32 contentHeight: column.height
33
34 Item {
35 id: column
36
37 width: flickable.width
38 height: childrenRect.height
39
40 TransferMenu {
41 id: transferMenu
42
43 text: "Downloading Movie"
44 progress: 0
45 active: false
46 iconSource: Qt.resolvedUrl("../../artwork/avatar.png")
47 }
48 TransferMenu {
49 id: transferMenu2
50 anchors.top: transferMenu.bottom
51
52 text: "Syncing Data"
53 progress: 0.6
54 active: true
55 iconSource: Qt.resolvedUrl("../../artwork/rhythmbox.png")
56 }
57 }
58 }
59
60 TestCase {
61 name: "TransferMenu"
62 when: windowShown
63
64 function init() {
65 transferMenu.text = "";
66 transferMenu.iconSource = "";
67 transferMenu.progress = 0;
68 transferMenu.active = false;
69 }
70
71 function test_iconSource_data() {
72 return [ { icon: Qt.resolvedUrl("../../artwork/avatar.png") },
73 { icon: Qt.resolvedUrl("../../artwork/rhythmbox.png") }
74 ];
75 }
76
77 function test_iconSource(data) {
78 transferMenu.iconSource = data.icon;
79
80 var icon = UtilsJS.findChild(transferMenu, "icon");
81 compare(icon.source, data.icon, "Icon does not match data");
82 }
83
84 function test_text_data() {
85 return [ { text: "Text 1" },
86 { text: "Text 2" }
87 ];
88 }
89
90 function test_text(data) {
91 transferMenu.text = data.text;
92
93 var text = UtilsJS.findChild(transferMenu, "text");
94 compare(text.text, data.text, "Text does not match data");
95 }
96
97 function test_stateText_data() {
98 return [ { stateText: "State 1" },
99 { stateText: "State 2" }
100 ];
101 }
102
103 function test_stateText(data) {
104 transferMenu.stateText = data.stateText;
105
106 var stateText = UtilsJS.findChild(transferMenu, "stateText");
107 compare(stateText.text, data.stateText, "State text does not match data");
108 }
109
110 function test_progress_data() {
111 return [ { progress: 0.5 },
112 { progress: 1.0 }
113 ];
114 }
115
116 function test_progress(data) {
117 transferMenu.progress = data.progress;
118
119 var progress = UtilsJS.findChild(transferMenu, "progress");
120 compare(progress.value, data.progress, "Progress does not match expected value");
121 }
122
123 function test_active() {
124 var progress = UtilsJS.findChild(transferMenu, "progress");
125 var stateText = UtilsJS.findChild(transferMenu, "stateText");
126
127 transferMenu.active = true;
128 compare(progress.visible, true, "Progress should be visible when active");
129 compare(stateText.visible, true, "State should be visible when active");
130
131 transferMenu.active = false;
132 compare(progress.visible, false, "Progress should not be visible when inactive");
133 compare(stateText.visible, false, "State should not be visible when inactive");
134 }
135 }
136}

Subscribers

People subscribed via source and target branches

to all changes: