Merge lp:~tpeeters/ubuntu-ui-toolkit/unity-action into lp:ubuntu-ui-toolkit
- unity-action
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Zoltan Balogh | ||||
Approved revision: | 597 | ||||
Merged at revision: | 631 | ||||
Proposed branch: | lp:~tpeeters/ubuntu-ui-toolkit/unity-action | ||||
Merge into: | lp:ubuntu-ui-toolkit | ||||
Diff against target: |
384 lines (+114/-40) 8 files modified
components.api (+3/-4) debian/control (+2/-0) modules/Ubuntu/Components/Action.qml (+12/-11) modules/Ubuntu/Components/MainView.qml (+24/-0) modules/Ubuntu/Components/Page.qml (+30/-2) tests/unit/tst_components/tst_mainview.qml (+15/-0) tests/unit/tst_components/tst_page.qml (+14/-0) tests/unit/tst_components/tst_tabs.qml (+14/-23) |
||||
To merge this branch: | bzr merge lp:~tpeeters/ubuntu-ui-toolkit/unity-action | ||||
Related bugs: |
|
||||
Related blueprints: |
Unified Action API in the Ubunt UI toolkit
(Undefined)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Ubuntu SDK team | Pending | ||
Review via email: mp+173900@code.launchpad.net |
Commit message
Use UnityActions to make Actions available to HUD:
- Action now inherits UnityActions.Action
- Added "actions" property to MainView to contain global actions that are available in HUD as long as the app is running.
- Added "actions" property to Page to contain local actions that are available in HUD when the Page is active.
Description of the change
Use UnityActions to make Actions available to HUD:
- Action now inherits UnityActions.Action
- Added "actions" property to MainView to contain global actions that are available in HUD as long as the app is running.
- Added "actions" property to Page to contain local actions that are available in HUD when the Page is active.
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:587
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:591
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:593
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:594
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Tim Peeters (tpeeters) wrote : | # |
Jenkins fails until we have the unity-actions packages in saucy.
- 595. By Tim Peeters
-
trigger rebuild
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:595
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 596. By Tim Peeters
-
merge trunk
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:596
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 597. By Tim Peeters
-
update dependency package name
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:597
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'components.api' |
2 | --- components.api 2013-07-12 05:22:28 +0000 |
3 | +++ components.api 2013-07-16 16:15:40 +0000 |
4 | @@ -7,12 +7,9 @@ |
5 | property bool __acceptEvents |
6 | property internal __mouseArea |
7 | modules/Ubuntu/Components/Action.qml |
8 | -QtObject |
9 | - property string text |
10 | +UnityActions.Action |
11 | property url iconSource |
12 | - signal triggered(var caller) |
13 | property bool visible |
14 | - property bool enabled |
15 | property Component itemHint |
16 | modules/Ubuntu/Components/ActionItem.qml |
17 | StyledItem |
18 | @@ -86,6 +83,7 @@ |
19 | property color footerColor |
20 | property bool automaticOrientation |
21 | default property internal contentsItem |
22 | + property list<Action> actions |
23 | property ToolbarActions tools |
24 | onToolsChanged |
25 | modules/Ubuntu/Components/ModelSectionCounter.qml |
26 | @@ -109,6 +107,7 @@ |
27 | PageTreeNode |
28 | property string title |
29 | property Flickable flickable |
30 | + property list<Action> actions |
31 | modules/Ubuntu/Components/PageStack.qml |
32 | PageTreeNode |
33 | property bool __showHeader |
34 | |
35 | === modified file 'debian/control' |
36 | --- debian/control 2013-07-10 12:09:37 +0000 |
37 | +++ debian/control 2013-07-16 16:15:40 +0000 |
38 | @@ -19,6 +19,7 @@ |
39 | qtdeclarative5-qtquick2-plugin, |
40 | qtdeclarative5-test-plugin, |
41 | qtdeclarative5-window-plugin, |
42 | + qtdeclarative5-unity-action-plugin, |
43 | Standards-Version: 3.9.4 |
44 | Homepage: https://launchpad.net/ubuntu-ui-toolkit |
45 | # If you aren't a member of ~ubuntu-sdk-team but need to upload packaging |
46 | @@ -34,6 +35,7 @@ |
47 | libqt5svg5, |
48 | qtdeclarative5-qtquick2-plugin, |
49 | qtdeclarative5-window-plugin, |
50 | + qtdeclarative5-unity-action-plugin, |
51 | ubuntu-ui-toolkit-theme, |
52 | ${misc:Depends}, |
53 | ${shlibs:Depends}, |
54 | |
55 | === modified file 'modules/Ubuntu/Components/Action.qml' |
56 | --- modules/Ubuntu/Components/Action.qml 2013-06-18 16:48:04 +0000 |
57 | +++ modules/Ubuntu/Components/Action.qml 2013-07-16 16:15:40 +0000 |
58 | @@ -1,5 +1,5 @@ |
59 | /* |
60 | - * Copyright 2012 Canonical Ltd. |
61 | + * Copyright 2013 Canonical Ltd. |
62 | * |
63 | * This program is free software; you can redistribute it and/or modify |
64 | * it under the terms of the GNU Lesser General Public License as published by |
65 | @@ -15,6 +15,7 @@ |
66 | */ |
67 | |
68 | import QtQuick 2.0 |
69 | +import Ubuntu.Unity.Action 1.0 as UnityActions |
70 | |
71 | /*! |
72 | \qmltype Action |
73 | @@ -26,25 +27,29 @@ |
74 | |
75 | Examples: See \l Page |
76 | */ |
77 | -QtObject { |
78 | +UnityActions.Action { |
79 | id: action |
80 | |
81 | + // FIXME: the properties that are not defined here, but only documented using qmlproperty |
82 | + // do not show up in the documentation. Best is to replace these docs by a reference |
83 | + // to UnityActions.Action when they become available online. |
84 | + |
85 | /*! |
86 | - \preliminary |
87 | The title of the action. |
88 | + \qmlproperty string Ubuntu.Components.Action::text |
89 | */ |
90 | - property string text |
91 | |
92 | /*! |
93 | - \preliminary |
94 | The image associated with the action. |
95 | + \qmlproperty url iconSource |
96 | */ |
97 | + // TODO: Move iconSource to unity action if possible |
98 | property url iconSource |
99 | |
100 | /*! |
101 | Called when the action is triggered. |
102 | + \qmlsignal Ubuntu.Components.Action::triggered(var property) |
103 | */ |
104 | - signal triggered(var caller) |
105 | |
106 | /*! |
107 | \deprecated |
108 | @@ -57,19 +62,15 @@ |
109 | |
110 | /*! |
111 | Enable the action. It may be visible, but disabled. |
112 | + \qmlproperty bool enabled |
113 | */ |
114 | - property bool enabled: true |
115 | |
116 | /*! |
117 | \deprecated |
118 | \b {itemHint is DEPRECATED. Use \l ActionItem to specify |
119 | the representation of an \l Action.} |
120 | - Proposed Component to use as a representation for this action. |
121 | - Depending on the component that displays the action, the Component |
122 | - given here can replace the default representation of the action. |
123 | */ |
124 | property Component itemHint |
125 | - |
126 | /*! \internal */ |
127 | onItemHintChanged: print("Action.itemHint is a DEPRECATED property. Use ActionItems to specify the representation of an Action.") |
128 | } |
129 | |
130 | === modified file 'modules/Ubuntu/Components/MainView.qml' |
131 | --- modules/Ubuntu/Components/MainView.qml 2013-07-15 10:45:50 +0000 |
132 | +++ modules/Ubuntu/Components/MainView.qml 2013-07-16 16:15:40 +0000 |
133 | @@ -15,6 +15,7 @@ |
134 | */ |
135 | |
136 | import QtQuick 2.0 |
137 | +import Ubuntu.Unity.Action 1.0 as UnityActions |
138 | |
139 | /*! |
140 | \qmltype MainView |
141 | @@ -254,6 +255,22 @@ |
142 | } |
143 | } |
144 | |
145 | + /*! |
146 | + A global list of actions that will be available to the system (including HUD) |
147 | + as long as the application is running. For actions that are not always available to the |
148 | + system, but only when a certain \l Page is active, see the actions property of \l Page. |
149 | + |
150 | + \qmlproperty list<Action> actions |
151 | + */ |
152 | + property alias actions: unityActionManager.actions |
153 | + |
154 | + Object { |
155 | + id: internal |
156 | + UnityActions.ActionManager { |
157 | + id: unityActionManager |
158 | + } |
159 | + } |
160 | + |
161 | __propagated: QtObject { |
162 | /*! |
163 | \internal |
164 | @@ -268,6 +285,13 @@ |
165 | It will be used by the active \l Page to set the toolbar actions. |
166 | */ |
167 | property Toolbar toolbar: toolbarItem |
168 | + |
169 | + /*! |
170 | + \internal |
171 | + The action manager that has the global context for the MainView's actions, |
172 | + and to which a local context can be added for each Page that has actions.actions. |
173 | + */ |
174 | + property var actionManager: unityActionManager |
175 | } |
176 | |
177 | /*! |
178 | |
179 | === modified file 'modules/Ubuntu/Components/Page.qml' |
180 | --- modules/Ubuntu/Components/Page.qml 2013-07-15 15:55:04 +0000 |
181 | +++ modules/Ubuntu/Components/Page.qml 2013-07-16 16:15:40 +0000 |
182 | @@ -15,6 +15,8 @@ |
183 | */ |
184 | |
185 | import QtQuick 2.0 |
186 | +import Ubuntu.Unity.Action 1.0 as UnityActions |
187 | + |
188 | /*! |
189 | \qmltype Page |
190 | \inqmlmodule Ubuntu.Components 0.1 |
191 | @@ -121,7 +123,10 @@ |
192 | property Flickable flickable: internal.getFlickableChild(page) |
193 | |
194 | /*! \internal */ |
195 | - onActiveChanged: internal.updateHeaderAndToolbar() |
196 | + onActiveChanged: { |
197 | + internal.updateHeaderAndToolbar(); |
198 | + internal.updateActions(); |
199 | + } |
200 | /*! \internal */ |
201 | onTitleChanged: internal.updateHeaderAndToolbar() |
202 | /*! \internal */ |
203 | @@ -131,8 +136,31 @@ |
204 | /*! \internal */ |
205 | onFlickableChanged: internal.updateHeaderAndToolbar() |
206 | |
207 | - Item { |
208 | + /*! |
209 | + Local actions. These actions will be made available outside the application |
210 | + (for example, to HUD) when the Page is active. For actions that are always available |
211 | + when the application is running, use the actions property of \l MainView. |
212 | + |
213 | + \qmlproperty list<Action> actions |
214 | + */ |
215 | + property alias actions: actionContext.actions |
216 | + |
217 | + Object { |
218 | id: internal |
219 | + |
220 | + UnityActions.ActionContext { |
221 | + id: actionContext |
222 | + |
223 | + Component.onCompleted: { |
224 | + var manager = page.__propagated.actionManager; |
225 | + if (manager) manager.addLocalContext(actionContext); |
226 | + } |
227 | + } |
228 | + |
229 | + function updateActions() { |
230 | + actionContext.active = page.active; |
231 | + } |
232 | + |
233 | property Header header: page.__propagated && page.__propagated.header ? page.__propagated.header : null |
234 | property Toolbar toolbar: page.__propagated && page.__propagated.toolbar ? page.__propagated.toolbar : null |
235 | |
236 | |
237 | === modified file 'tests/unit/tst_components/tst_mainview.qml' |
238 | --- tests/unit/tst_components/tst_mainview.qml 2013-07-10 16:58:55 +0000 |
239 | +++ tests/unit/tst_components/tst_mainview.qml 2013-07-16 16:15:40 +0000 |
240 | @@ -25,10 +25,15 @@ |
241 | id: mainView |
242 | } |
243 | |
244 | + Action { |
245 | + id: action0 |
246 | + } |
247 | + |
248 | function initTestCase() { |
249 | compare(mainView.active, true, "MainView always active."); |
250 | compare(mainView.automaticOrientation, false, "Automatic orientation off by default."); |
251 | compare(mainView.applicationName, "", "Application name is empty string by default."); |
252 | + compare(mainView.actions.length, 0, "No actions defined by default") |
253 | } |
254 | |
255 | function test_automaticOrientation() { |
256 | @@ -45,4 +50,14 @@ |
257 | mainView.applicationName = ""; |
258 | compare(mainView.applicationName, "", "Application name can be unset."); |
259 | } |
260 | + |
261 | + function test_actions() { |
262 | + // FIXME: Check the contents of mainView.actions. This is currently not |
263 | + // possible because UnityActions.ActionContext.actions does not support it, |
264 | + // so changes to UnityActions are needed. |
265 | + mainView.actions = [action0]; |
266 | + compare(mainView.actions.length, 1, "Actions can be added to page actions"); |
267 | + mainView.actions = []; |
268 | + compare(mainView.actions.length, 0, "Page action list can be cleared"); |
269 | + } |
270 | } |
271 | |
272 | === modified file 'tests/unit/tst_components/tst_page.qml' |
273 | --- tests/unit/tst_components/tst_page.qml 2013-07-12 15:28:38 +0000 |
274 | +++ tests/unit/tst_components/tst_page.qml 2013-07-16 16:15:40 +0000 |
275 | @@ -22,6 +22,10 @@ |
276 | width: 200 |
277 | height: 200 |
278 | |
279 | + Action { |
280 | + id: action0 |
281 | + } |
282 | + |
283 | Flickable { |
284 | id: testFlickable |
285 | } |
286 | @@ -59,6 +63,7 @@ |
287 | compare(page.__propagated.header, mainView.__propagated.header, "page header equals mainView header") |
288 | compare(page.__propagated.header.title, page.title, "header title is same as page title") |
289 | compare(page.__propagated.header.visible, false, "header is not visible initially because there is no title") |
290 | + compare(page.actions.length, 0, "page actions list empty by default") |
291 | } |
292 | |
293 | function test_0_noHeader_bug1162028_bug1161910() { |
294 | @@ -97,6 +102,15 @@ |
295 | compare(page.pageStack, null, "is not set by default") |
296 | } |
297 | |
298 | + function test_actions() { |
299 | + // FIXME: Check the contents of page.actions. This is currently not |
300 | + // possible because UnityActions.ActionContext.actions does not support it, |
301 | + // so changes to UnityActions are needed. |
302 | + page.actions = [action0]; |
303 | + compare(page.actions.length, 1, "Actions can be added to page actions"); |
304 | + page.actions = []; |
305 | + compare(page.actions.length, 0, "Page action list can be cleared"); |
306 | + } |
307 | function test_flickable_bug1200642_bug1192591() { |
308 | compare(page.flickable, pageFlickable, "page flickable is correctly detected"); |
309 | compare(page.__propagated.header.flickable, pageFlickable, "header flickable is correctly detected"); // bug 1200642 FAIL |
310 | |
311 | === modified file 'tests/unit/tst_components/tst_tabs.qml' |
312 | --- tests/unit/tst_components/tst_tabs.qml 2013-06-21 12:36:51 +0000 |
313 | +++ tests/unit/tst_components/tst_tabs.qml 2013-07-16 16:15:40 +0000 |
314 | @@ -52,28 +52,28 @@ |
315 | |
316 | function test_flickable() { |
317 | // ensure that the flickable of the header is set to the flickable of the selected tab. |
318 | - tabsFlick.selectedTabIndex = 0; |
319 | - compare(mainViewFlick.__propagated.header.flickable, flickable1, "Header flickable correctly initialized"); |
320 | - tabsFlick.selectedTabIndex = 1; |
321 | - compare(mainViewFlick.__propagated.header.flickable, flickable2, "Header flickable correctly updated"); |
322 | - tabsFlick.selectedTabIndex = 0; |
323 | + tabs.selectedTabIndex = 3; |
324 | + compare(mainView.__propagated.header.flickable, flickable1, "Header flickable correctly initialized"); |
325 | + tabs.selectedTabIndex = 4; |
326 | + compare(mainView.__propagated.header.flickable, flickable2, "Header flickable correctly updated"); |
327 | + tabs.selectedTabIndex = 0; |
328 | } |
329 | |
330 | function test_pageLoader() { |
331 | - tabsFlick.selectedTabIndex = 0; |
332 | + tabs.selectedTabIndex = 0; |
333 | compare(loader.item, null, "Page not loaded when tab is not selected"); |
334 | - tabsFlick.selectedTabIndex = 2; |
335 | - compare(tabsFlick.currentPage, loader, "Selected loader for current page"); |
336 | + tabs.selectedTabIndex = 5; |
337 | + compare(tabs.currentPage, loader, "Selected loader for current page"); |
338 | compare(loader.item.title, "Loaded page", "Loaded item is a page"); |
339 | - tabsFlick.selectedTabIndex = 0; |
340 | + tabs.selectedTabIndex = 0; |
341 | compare(loader.item, null, "Loaded page was properly unloaded"); |
342 | } |
343 | |
344 | function test_bug1088740() { |
345 | - tabsFlick.selectedTabIndex = 2; |
346 | - compare(mainViewFlick.__propagated.header.flickable, loader.item.flick, "Header flickable correctly updated with Loader"); |
347 | + tabs.selectedTabIndex = 5; |
348 | + compare(mainView.__propagated.header.flickable, loader.item.flick, "Header flickable correctly updated with Loader"); |
349 | compare(loader.item.flick.contentHeight, 1000, "Header flickable is correct flickable"); |
350 | - tabsFlick.selectedTabIndex = 0; |
351 | + tabs.selectedTabIndex = 0; |
352 | } |
353 | |
354 | Tabs { |
355 | @@ -101,15 +101,7 @@ |
356 | page: Page { |
357 | id: page3 |
358 | } |
359 | - } |
360 | - } |
361 | - } |
362 | - |
363 | - MainView { |
364 | - id: mainViewFlick |
365 | - |
366 | - Tabs { |
367 | - id: tabsFlick |
368 | + } |
369 | Tab { |
370 | id: tabFlick1 |
371 | page: Page { |
372 | @@ -132,11 +124,10 @@ |
373 | id: tabFlickLoader |
374 | page: Loader { |
375 | id: loader |
376 | - sourceComponent: tabsFlick.selectedTabIndex != 2 ? null : pageComponent |
377 | + sourceComponent: tabs.selectedTabIndex != 5 ? null : pageComponent |
378 | } |
379 | } |
380 | } |
381 | - |
382 | Component { |
383 | id: pageComponent |
384 | Page { |
FAILED: Continuous integration, rev:584 jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- ci/299/ jenkins. qa.ubuntu. com/job/ generic- mediumtests- saucy/935/ console jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- saucy-amd64- ci/156/ console jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- saucy-armhf- ci/156/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy/939/ console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ ubuntu- ui-toolkit- ci/299/ rebuild
http://