Merge lp:~tpeeters/ubuntu-ui-toolkit/60-back-override into lp:ubuntu-ui-toolkit/staging
- 60-back-override
- Merge into staging
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Florian Boucault | ||||
Approved revision: | 1062 | ||||
Merged at revision: | 1035 | ||||
Proposed branch: | lp:~tpeeters/ubuntu-ui-toolkit/60-back-override | ||||
Merge into: | lp:ubuntu-ui-toolkit/staging | ||||
Prerequisite: | lp:~tpeeters/ubuntu-ui-toolkit/55-MainView-Page-clean | ||||
Diff against target: |
177 lines (+63/-6) 7 files modified
components.api (+1/-0) modules/Ubuntu/Components/Header.qml (+8/-0) modules/Ubuntu/Components/MainView.qml (+5/-0) modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml (+16/-3) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py (+15/-0) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py (+13/-1) tests/resources/toolbar/headerTools.qml (+5/-2) |
||||
To merge this branch: | bzr merge lp:~tpeeters/ubuntu-ui-toolkit/60-back-override | ||||
Related bugs: |
|
||||
Related blueprints: |
New header and bottom edge
(Essential)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Florian Boucault (community) | Approve | ||
Review via email: mp+218042@code.launchpad.net |
Commit message
Description of the change
Add the possibility to override the back button in the header.
- 1057. By Tim Peeters
-
rename customLeftButton to customBackButton
- 1058. By Tim Peeters
-
check that back is not null
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1058
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 1059. By Tim Peeters
-
fix flake8 too long lines
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1059
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 1060. By Tim Peeters
-
trigger jenkins
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1060
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 1061. By Tim Peeters
-
no change
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1061
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 1062. By Tim Peeters
-
merge trunk
Florian Boucault (fboucault) wrote : | # |
All good for me aside from the idea that private variables exist: I don't think they do even when their names are prefixed with underscores.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1062
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'components.api' | |||
2 | --- components.api 2014-04-30 13:19:18 +0000 | |||
3 | +++ components.api 2014-05-05 11:48:20 +0000 | |||
4 | @@ -71,6 +71,7 @@ | |||
5 | 71 | property var tabsModel | 71 | property var tabsModel |
6 | 72 | property var pageStack | 72 | property var pageStack |
7 | 73 | property var actions | 73 | property var actions |
8 | 74 | property var __customBackAction | ||
9 | 74 | property Flickable flickable | 75 | property Flickable flickable |
10 | 75 | property bool useDeprecatedToolbar | 76 | property bool useDeprecatedToolbar |
11 | 76 | Icon 0.1 1.0 | 77 | Icon 0.1 1.0 |
12 | 77 | 78 | ||
13 | === modified file 'modules/Ubuntu/Components/Header.qml' | |||
14 | --- modules/Ubuntu/Components/Header.qml 2014-04-30 13:19:18 +0000 | |||
15 | +++ modules/Ubuntu/Components/Header.qml 2014-05-05 11:48:20 +0000 | |||
16 | @@ -109,6 +109,14 @@ | |||
17 | 109 | */ | 109 | */ |
18 | 110 | property var actions: null | 110 | property var actions: null |
19 | 111 | 111 | ||
20 | 112 | /*! | ||
21 | 113 | \internal | ||
22 | 114 | Action shown before the title. Setting this will disable the back | ||
23 | 115 | button and tabs drawer button in the new header and replace it with a button | ||
24 | 116 | representing the action below. | ||
25 | 117 | */ | ||
26 | 118 | property var __customBackAction: null | ||
27 | 119 | |||
28 | 112 | // FIXME: Currently autopilot can only get visual items, but once bug #1273956 | 120 | // FIXME: Currently autopilot can only get visual items, but once bug #1273956 |
29 | 113 | // is fixed to support non-visual items, a QtObject may be used. | 121 | // is fixed to support non-visual items, a QtObject may be used. |
30 | 114 | // --timp - 2014-03-20 | 122 | // --timp - 2014-03-20 |
31 | 115 | 123 | ||
32 | === modified file 'modules/Ubuntu/Components/MainView.qml' | |||
33 | --- modules/Ubuntu/Components/MainView.qml 2014-05-01 23:51:43 +0000 | |||
34 | +++ modules/Ubuntu/Components/MainView.qml 2014-05-05 11:48:20 +0000 | |||
35 | @@ -342,6 +342,11 @@ | |||
36 | 342 | title: internal.activePage ? internal.activePage.title : "" | 342 | title: internal.activePage ? internal.activePage.title : "" |
37 | 343 | flickable: internal.activePage ? internal.activePage.flickable : null | 343 | flickable: internal.activePage ? internal.activePage.flickable : null |
38 | 344 | pageStack: internal.activePage ? internal.activePage.pageStack : null | 344 | pageStack: internal.activePage ? internal.activePage.pageStack : null |
39 | 345 | __customBackAction: internal.activePage && internal.activePage.tools && | ||
40 | 346 | internal.activePage.tools.hasOwnProperty("back") && | ||
41 | 347 | internal.activePage.tools.back && | ||
42 | 348 | internal.activePage.tools.back.hasOwnProperty("action") ? | ||
43 | 349 | internal.activePage.tools.back.action : null | ||
44 | 345 | 350 | ||
45 | 346 | property Item tabBar: null | 351 | property Item tabBar: null |
46 | 347 | Binding { | 352 | Binding { |
47 | 348 | 353 | ||
48 | === modified file 'modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml' | |||
49 | --- modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml 2014-05-01 15:19:12 +0000 | |||
50 | +++ modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml 2014-05-05 11:48:20 +0000 | |||
51 | @@ -74,6 +74,16 @@ | |||
52 | 74 | height: headerStyle.contentHeight | 74 | height: headerStyle.contentHeight |
53 | 75 | 75 | ||
54 | 76 | AbstractButton { | 76 | AbstractButton { |
55 | 77 | id: customBackButton | ||
56 | 78 | objectName: "customBackButton" | ||
57 | 79 | height: parent ? parent.height : undefined | ||
58 | 80 | width: visible ? units.gu(5) : 0 | ||
59 | 81 | action: styledItem.__customBackAction | ||
60 | 82 | visible: null !== styledItem.__customBackAction | ||
61 | 83 | style: Theme.createStyleComponent("HeaderButtonStyle.qml", backButton) | ||
62 | 84 | } | ||
63 | 85 | |||
64 | 86 | AbstractButton { | ||
65 | 77 | id: backButton | 87 | id: backButton |
66 | 78 | objectName: "backButton" | 88 | objectName: "backButton" |
67 | 79 | height: parent ? parent.height : undefined | 89 | height: parent ? parent.height : undefined |
68 | @@ -81,7 +91,8 @@ | |||
69 | 81 | 91 | ||
70 | 82 | iconName: "back" | 92 | iconName: "back" |
71 | 83 | visible: styledItem.pageStack !== null && | 93 | visible: styledItem.pageStack !== null && |
73 | 84 | styledItem.pageStack.depth > 1 | 94 | styledItem.pageStack.depth > 1 && |
74 | 95 | !customBackButton.visible | ||
75 | 85 | 96 | ||
76 | 86 | text: "back" | 97 | text: "back" |
77 | 87 | style: Theme.createStyleComponent("HeaderButtonStyle.qml", backButton) | 98 | style: Theme.createStyleComponent("HeaderButtonStyle.qml", backButton) |
78 | @@ -98,7 +109,8 @@ | |||
79 | 98 | width: visible ? units.gu(5) : 0 | 109 | width: visible ? units.gu(5) : 0 |
80 | 99 | 110 | ||
81 | 100 | iconName: "navigation-menu" | 111 | iconName: "navigation-menu" |
83 | 101 | visible: styledItem.tabsModel !== null && !backButton.visible | 112 | visible: styledItem.tabsModel !== null && !backButton.visible && |
84 | 113 | !customBackButton.visible | ||
85 | 102 | text: visible ? styledItem.tabsModel.count + " tabs" : "" | 114 | text: visible ? styledItem.tabsModel.count + " tabs" : "" |
86 | 103 | style: Theme.createStyleComponent("HeaderButtonStyle.qml", tabsButton) | 115 | style: Theme.createStyleComponent("HeaderButtonStyle.qml", tabsButton) |
87 | 104 | 116 | ||
88 | @@ -166,7 +178,8 @@ | |||
89 | 166 | id: numberOfSlots | 178 | id: numberOfSlots |
90 | 167 | property int requested: styledItem.actions && styledItem.actions.hasOwnProperty("length") ? | 179 | property int requested: styledItem.actions && styledItem.actions.hasOwnProperty("length") ? |
91 | 168 | styledItem.actions.length : 0 | 180 | styledItem.actions.length : 0 |
93 | 169 | property int left: tabsButton.visible || backButton.visible ? 1 : 0 | 181 | property int left: tabsButton.visible || backButton.visible || |
94 | 182 | customBackButton.visible ? 1 : 0 | ||
95 | 170 | property int right: 3 - left | 183 | property int right: 3 - left |
96 | 171 | property int overflow: actionsOverflowButton.visible ? 1 : 0 | 184 | property int overflow: actionsOverflowButton.visible ? 1 : 0 |
97 | 172 | property int used: Math.min(right - overflow, requested) | 185 | property int used: Math.min(right - overflow, requested) |
98 | 173 | 186 | ||
99 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py' | |||
100 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2014-04-30 19:11:34 +0000 | |||
101 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2014-05-05 11:48:20 +0000 | |||
102 | @@ -50,6 +50,21 @@ | |||
103 | 50 | raise _common.ToolkitException('Back button in header not visible') | 50 | raise _common.ToolkitException('Back button in header not visible') |
104 | 51 | self.pointing_device.click_object(back_button) | 51 | self.pointing_device.click_object(back_button) |
105 | 52 | 52 | ||
106 | 53 | def click_custom_back_button(self): | ||
107 | 54 | if self.useDeprecatedToolbar: | ||
108 | 55 | raise _common.ToolkitException( | ||
109 | 56 | 'Old header has no custom back button') | ||
110 | 57 | try: | ||
111 | 58 | custom_back_button = self.select_single( | ||
112 | 59 | 'AbstractButton', objectName='customBackButton') | ||
113 | 60 | except dbus.StateNotFoundError: | ||
114 | 61 | raise _common.ToolkitException( | ||
115 | 62 | 'Missing custom back button in header') | ||
116 | 63 | if not custom_back_button.visible: | ||
117 | 64 | raise _common.ToolkitException( | ||
118 | 65 | 'Custom back button in header not visible') | ||
119 | 66 | self.pointing_device.click_object(custom_back_button) | ||
120 | 67 | |||
121 | 53 | def _get_animating(self): | 68 | def _get_animating(self): |
122 | 54 | if self.useDeprecatedToolbar: | 69 | if self.useDeprecatedToolbar: |
123 | 55 | tab_bar_style = self.select_single('TabBarStyle') | 70 | tab_bar_style = self.select_single('TabBarStyle') |
124 | 56 | 71 | ||
125 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py' | |||
126 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-04-30 19:11:34 +0000 | |||
127 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-05-05 11:48:20 +0000 | |||
128 | @@ -41,6 +41,13 @@ | |||
129 | 41 | } | 41 | } |
130 | 42 | 42 | ||
131 | 43 | tools: ToolbarItems { | 43 | tools: ToolbarItems { |
132 | 44 | back: ToolbarButton { | ||
133 | 45 | action: Action { | ||
134 | 46 | iconName: "cancel" | ||
135 | 47 | text: "cancel" | ||
136 | 48 | onTriggered: label.text = "Cancel button clicked." | ||
137 | 49 | } | ||
138 | 50 | } | ||
139 | 44 | Repeater { | 51 | Repeater { |
140 | 45 | model: 5 | 52 | model: 5 |
141 | 46 | ToolbarButton { | 53 | ToolbarButton { |
142 | @@ -74,7 +81,7 @@ | |||
143 | 74 | self.assertEqual(self.label.text, 'Button 1 clicked.') | 81 | self.assertEqual(self.label.text, 'Button 1 clicked.') |
144 | 75 | 82 | ||
145 | 76 | def test_click_header_overflow_action_button(self): | 83 | def test_click_header_overflow_action_button(self): |
147 | 77 | # there are more than 3 buttons, so the first two go in the header | 84 | # custom back button and first action button go in the header |
148 | 78 | # and the others in the overflow. | 85 | # and the others in the overflow. |
149 | 79 | self.header.click_action_button('action3') | 86 | self.header.click_action_button('action3') |
150 | 80 | self.assertEqual(self.label.text, 'Button 3 clicked.') | 87 | self.assertEqual(self.label.text, 'Button 3 clicked.') |
151 | @@ -86,3 +93,8 @@ | |||
152 | 86 | self.assertEqual( | 93 | self.assertEqual( |
153 | 87 | str(error), | 94 | str(error), |
154 | 88 | 'Button not found in header or overflow') | 95 | 'Button not found in header or overflow') |
155 | 96 | |||
156 | 97 | # back button and tabs button are tested in pagestack and tabs tests | ||
157 | 98 | def test_click_custom_back_button(self): | ||
158 | 99 | self.header.click_custom_back_button() | ||
159 | 100 | self.assertEqual(self.label.text, 'Cancel button clicked.') | ||
160 | 89 | 101 | ||
161 | === modified file 'tests/resources/toolbar/headerTools.qml' | |||
162 | --- tests/resources/toolbar/headerTools.qml 2014-04-28 16:48:41 +0000 | |||
163 | +++ tests/resources/toolbar/headerTools.qml 2014-05-05 11:48:20 +0000 | |||
164 | @@ -68,8 +68,11 @@ | |||
165 | 68 | } | 68 | } |
166 | 69 | 69 | ||
167 | 70 | back: ToolbarButton { | 70 | back: ToolbarButton { |
170 | 71 | text: "cancel" | 71 | action: Action { |
171 | 72 | iconSource: Qt.resolvedUrl("../../../modules/Ubuntu/Components/artwork/back.png") | 72 | text: "cancel" |
172 | 73 | iconName: "cancel" | ||
173 | 74 | onTriggered: print("cancelled!") | ||
174 | 75 | } | ||
175 | 73 | anchors.verticalCenter: parent.verticalCenter | 76 | anchors.verticalCenter: parent.verticalCenter |
176 | 74 | } | 77 | } |
177 | 75 | } | 78 | } |
FAILED: Continuous integration, rev:1057 jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- ci/158/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- trusty- touch/571/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- trusty/ 5197/console jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- trusty- amd64-ci/ 158/console jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- trusty- armhf-ci/ 158/console jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- trusty- i386-ci/ 158/console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- armhf/4865/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- amd64/5420/ console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- sdk-team- ubuntu- ui-toolkit- staging- ci/158/ rebuild
http://