Merge lp:~tpeeters/ubuntu-ui-toolkit/30-optIn-tabsDrawer into lp:ubuntu-ui-toolkit/staging

Proposed by Tim Peeters
Status: Merged
Approved by: Zsombor Egri
Approved revision: 999
Merged at revision: 1019
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/30-optIn-tabsDrawer
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~tpeeters/ubuntu-ui-toolkit/20-tabbarInStyle
Diff against target: 560 lines (+318/-58)
10 files modified
components.api (+1/-0)
modules/Ubuntu/Components/Header.qml (+19/-2)
modules/Ubuntu/Components/MainView.qml (+9/-1)
modules/Ubuntu/Components/Page.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml (+146/-0)
modules/Ubuntu/Components/Themes/Ambiance/qmldir (+1/-0)
tests/autopilot/ubuntuuitoolkit/emulators.py (+93/-20)
tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py (+42/-32)
tests/resources/navigation/SimpleTabs.qml (+2/-0)
tests/resources/navigation/Tabs.qml (+4/-2)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/30-optIn-tabsDrawer
Reviewer Review Type Date Requested Status
Zsombor Egri Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+216960@code.launchpad.net

Commit message

First version of the tabs in a drawer.

Description of the change

First version of the tabs in a drawer.

To post a comment you must log in.
989. By Tim Peeters

link bugs

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: Needs Fixing (continuous-integration)
990. By Tim Peeters

improve AP test and fix flake8 warning

991. By Tim Peeters

no need to document something obvious

992. By Tim Peeters

fix spelling in comment

993. By Tim Peeters

update components.api

Revision history for this message
Zsombor Egri (zsombi) wrote :

29 + property bool useDeprecatedToolbar: true
Is this a name you want to keep there fro the next 5-10 years? :) if it is just a temporary use, use __useDeprecatedToolbar.

On the other hand, as we discussed on mumble, toolbar might be turned back on desktop, so in case we want to keep the API as stable, we need to chose a better name for it.

review: Needs Information
Revision history for this message
Zsombor Egri (zsombi) wrote :

74 + * Copyright 2012 Canonical Ltd.

Living in the past? :)

review: Needs Fixing
Revision history for this message
Zsombor Egri (zsombi) wrote :

89 +import Ubuntu.Components 0.1
90 +import Ubuntu.Components.Popups 0.1
91 +import Ubuntu.Components.ListItems 0.1 as ListItem

Please import 1.0 everywhere!

review: Needs Fixing
Revision history for this message
Tim Peeters (tpeeters) wrote :

useDeprecatedToolbar property was added to Header only, which is not part of the public API. Header should be internal (but it is not defined like that in qmldir, I don't see why not, maybe unity8 was using it?).

MainView useDeprecatedToolbar already landed in trunk some time ago.

Revision history for this message
Zsombor Egri (zsombi) wrote :

Also, do you see the header style API is stable enough? if yes, maybe we should get the ComboButton first and add the style API doc there as well.

review: Needs Fixing
Revision history for this message
Zsombor Egri (zsombi) wrote :

101 + /*!
102 + The source of the image that separates the header from the contents of a \l MainView.
103 + The separator will be drawn over the contents.
104 + */
105 + property url separatorSource: "artwork/PageHeaderBaseDividerLight.sci"
106 +
107 + /*!
108 + The source of an additional image attached to the bottom of the separator. The contents
109 + of the \l MainView will be drawn on top of the separator bottom image.
110 + */
111 + property url separatorBottomSource: "artwork/PageHeaderBaseDividerBottom.png"

I do not see these should be part of the style API...

994. By Tim Peeters

update imports of Ubuntu.Components to 1.0

Revision history for this message
Tim Peeters (tpeeters) wrote :

> Also, do you see the header style API is stable enough? if yes, maybe we
> should get the ComboButton first and add the style API doc there as well.

HeaderStyle implementation will depend on Header API. We decided not to work out the full new API for header stuff yet before the sprint, so I propose to wait until after that.

NewHeaderStyle is not a completely new API. It is a copy of HeaderStyle, with some additions. Eventually I think we will remove HeaderStyle and rename NewHeaderStyle to HeaderStyle when we don't need the TabBar any more.

995. By Tim Peeters

update comments

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
996. By Tim Peeters

fix test program

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:995
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/85/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/405
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/5030
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/85
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/85
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/85/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/85
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/369
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4650
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4650/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6366
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4330
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5218
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5218/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/85/rebuild

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

PASSED: Continuous integration, rev:996
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/86/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/410
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/5034
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/86
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/86
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/86/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/86
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/373
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4656
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4656/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6374
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4334
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5223
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5223/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/86/rebuild

review: Approve (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

I discussed combining pagestack and tabs with Benjamin Keyser, and he agrees that you cannot have flat nav below deep nav (so don't push Tabs on a PageStack), because that would be confusing for the user. This matches the statement "We don’t combine flat with deep navigation in the same view." from http://design.ubuntu.com/apps/global-patterns/navigation

Revision history for this message
Tim Peeters (tpeeters) wrote :

> 101 + /*!
> 102 + The source of the image that separates the header from the
> contents of a \l MainView.
> 103 + The separator will be drawn over the contents.
> 104 + */
> 105 + property url separatorSource:
> "artwork/PageHeaderBaseDividerLight.sci"
> 106 +
> 107 + /*!
> 108 + The source of an additional image attached to the bottom of the
> separator. The contents
> 109 + of the \l MainView will be drawn on top of the separator bottom
> image.
> 110 + */
> 111 + property url separatorBottomSource:
> "artwork/PageHeaderBaseDividerBottom.png"
>
> I do not see these should be part of the style API...

NewHeaderStyle is a copy of HeaderStyle, with some new things added. I didn't rewrite what is there already to make the API better. Let's make this style API public after Malta.

997. By Tim Peeters

update copyright year

998. By Tim Peeters

merge staging

Revision history for this message
Tim Peeters (tpeeters) wrote :

I tested the tabs in gallery-app and clock-app on device (with useDeprecatedToolbar: false in MainView) and it works fine :)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:998
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/92/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/420
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/5044
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/92
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/92
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/92/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/92
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/380
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4666
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4666/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6385
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4341
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5233
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5233/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/92/rebuild

review: Approve (continuous-integration)
999. By Tim Peeters

merge staging :) 20- is in there now

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:999
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/93/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/424
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/5048
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/93
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/93
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/93/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/93
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/384
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4670
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4670/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6391
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4345
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5237
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5237/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/93/rebuild

review: Approve (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

Ok, good to go now!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'components.api'
2--- components.api 2014-04-24 18:39:13 +0000
3+++ components.api 2014-04-24 20:35:57 +0000
4@@ -62,6 +62,7 @@
5 property Item contents
6 property var tabsModel
7 property Flickable flickable
8+ property bool useDeprecatedToolbar
9 Icon 0.1 1.0
10 Item
11 property string name
12
13=== modified file 'modules/Ubuntu/Components/Header.qml'
14--- modules/Ubuntu/Components/Header.qml 2014-04-23 18:14:56 +0000
15+++ modules/Ubuntu/Components/Header.qml 2014-04-24 20:35:57 +0000
16@@ -1,5 +1,5 @@
17 /*
18- * Copyright 2013 Canonical Ltd.
19+ * Copyright 2013-2014 Canonical Ltd.
20 *
21 * This program is free software; you can redistribute it and/or modify
22 * it under the terms of the GNU Lesser General Public License as published by
23@@ -94,6 +94,17 @@
24 */
25 property var tabsModel: null
26
27+ // FIXME: Currently autopilot can only get visual items, but once bug #1273956
28+ // is fixed to support non-visual items, a QtObject may be used.
29+ // --timp - 2014-03-20
30+ Item {
31+ // FIXME: This is a workaround to be able to get the properties of
32+ // tabsModel in an autopilot test.
33+ objectName: "tabsModelProperties"
34+ property int count: tabsModel ? tabsModel.count : 0
35+ property int selectedIndex: tabsModel ? tabsModel.selectedIndex : -1
36+ }
37+
38 /*!
39 The flickable that controls the movement of the header.
40 Will be set automatically by Pages inside a MainView, but can
41@@ -106,6 +117,11 @@
42 header.show();
43 }
44
45+ /*!
46+ Set by \l MainView
47+ */
48+ property bool useDeprecatedToolbar: true
49+
50 QtObject {
51 id: internal
52
53@@ -193,5 +209,6 @@
54 }
55 }
56
57- style: Theme.createStyleComponent("HeaderStyle.qml", header)
58+ style: header.useDeprecatedToolbar ? Theme.createStyleComponent("HeaderStyle.qml", header) :
59+ Theme.createStyleComponent("NewHeaderStyle.qml", header)
60 }
61
62=== modified file 'modules/Ubuntu/Components/MainView.qml'
63--- modules/Ubuntu/Components/MainView.qml 2014-04-23 18:14:56 +0000
64+++ modules/Ubuntu/Components/MainView.qml 2014-04-24 20:35:57 +0000
65@@ -1,5 +1,5 @@
66 /*
67- * Copyright 2012-2013 Canonical Ltd.
68+ * Copyright 2012-2014 Canonical Ltd.
69 *
70 * This program is free software; you can redistribute it and/or modify
71 * it under the terms of the GNU Lesser General Public License as published by
72@@ -380,6 +380,8 @@
73 window.title = headerItem.title
74 }
75 }
76+
77+ useDeprecatedToolbar: mainView.useDeprecatedToolbar
78 }
79
80 Connections {
81@@ -448,6 +450,12 @@
82
83 /*!
84 \internal
85+ Tabs needs to know whether to use a TabBar or the new header.
86+ */
87+ property alias useDeprecatedToolbar: mainView.useDeprecatedToolbar
88+
89+ /*!
90+ \internal
91 The action manager that has the global context for the MainView's actions,
92 and to which a local context can be added for each Page that has actions.actions.
93 */
94
95=== modified file 'modules/Ubuntu/Components/Page.qml'
96--- modules/Ubuntu/Components/Page.qml 2014-04-20 19:25:12 +0000
97+++ modules/Ubuntu/Components/Page.qml 2014-04-24 20:35:57 +0000
98@@ -1,5 +1,5 @@
99 /*
100- * Copyright 2012 Canonical Ltd.
101+ * Copyright 2012-2014 Canonical Ltd.
102 *
103 * This program is free software; you can redistribute it and/or modify
104 * it under the terms of the GNU Lesser General Public License as published by
105
106=== added file 'modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml'
107--- modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml 1970-01-01 00:00:00 +0000
108+++ modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml 2014-04-24 20:35:57 +0000
109@@ -0,0 +1,146 @@
110+/*
111+ * Copyright 2014 Canonical Ltd.
112+ *
113+ * This program is free software; you can redistribute it and/or modify
114+ * it under the terms of the GNU Lesser General Public License as published by
115+ * the Free Software Foundation; version 3.
116+ *
117+ * This program is distributed in the hope that it will be useful,
118+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
119+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
120+ * GNU Lesser General Public License for more details.
121+ *
122+ * You should have received a copy of the GNU Lesser General Public License
123+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
124+ */
125+import QtQuick 2.0
126+import Ubuntu.Components 1.0
127+import Ubuntu.Components.Popups 1.0
128+import Ubuntu.Components.ListItems 1.0 as ListItem
129+
130+Item {
131+ id: headerStyle
132+ /*!
133+ The height of the headercontents, which is the full height of
134+ the header minus the separators shown at the bottom of it.
135+ */
136+ property real contentHeight: units.gu(7.5)
137+
138+ /*!
139+ The source of the image that separates the header from the contents of a \l MainView.
140+ The separator will be drawn over the contents.
141+ */
142+ property url separatorSource: "artwork/PageHeaderBaseDividerLight.sci"
143+
144+ /*!
145+ The source of an additional image attached to the bottom of the separator. The contents
146+ of the \l MainView will be drawn on top of the separator bottom image.
147+ */
148+ property url separatorBottomSource: "artwork/PageHeaderBaseDividerBottom.png"
149+
150+ property int fontWeight: Font.Light
151+ property string fontSize: "x-large"
152+ property color textColor: Theme.palette.selected.backgroundText
153+ property real textLeftMargin: units.gu(2)
154+
155+ implicitHeight: headerStyle.contentHeight + separator.height + separatorBottom.height
156+
157+ BorderImage {
158+ id: separator
159+ anchors {
160+ bottom: parent.bottom
161+ left: parent.left
162+ right: parent.right
163+ }
164+ source: headerStyle.separatorSource
165+ }
166+ Image {
167+ id: separatorBottom
168+ anchors {
169+ top: separator.bottom
170+ left: parent.left
171+ right: parent.right
172+ }
173+ source: headerStyle.separatorBottomSource
174+ }
175+
176+ Item {
177+ id: leftButtonContainer
178+ anchors {
179+ left: parent.left
180+ top: parent.top
181+ bottom: parent.bottom
182+ }
183+ width: childrenRect.width
184+
185+ AbstractButton {
186+ id: tabsButton
187+ objectName: "tabsButton"
188+ height: parent ? parent.height : undefined
189+ width: visible ? units.gu(5) : 0
190+
191+ iconName: "navigation-menu"
192+ visible: styledItem.tabsModel !== null
193+ text: visible ? styledItem.tabsModel.count + " tabs" : ""
194+
195+ // FIXME: We currently use an AbstractButton with ToolbarButtonStyle because
196+ // a ToolbarButton does not have its own MouseArea to handle interaction,
197+ // that was done in the Toolbar.
198+ style: Theme.createStyleComponent("ToolbarButtonStyle.qml", tabsButton)
199+
200+ onTriggered: {
201+ tabsPopover.show();
202+ }
203+
204+ Popover {
205+ id: tabsPopover
206+ objectName: "tabsPopover"
207+ parent: QuickUtils.rootItem(tabsPopover)
208+ caller: tabsButton
209+ Column {
210+ anchors {
211+ left: parent.left
212+ top: parent.top
213+ right: parent.right
214+ }
215+ Repeater {
216+ model: styledItem.tabsModel
217+ ListItem.Standard {
218+ visible: index !== styledItem.tabsModel.selectedIndex
219+ text: tab.title // FIXME: only "title" doesn't work with i18n.tr(). Why not?
220+ objectName: "tabButton" + index
221+ onClicked: {
222+ styledItem.tabsModel.selectedIndex = index;
223+ tabsPopover.hide();
224+ }
225+ }
226+ }
227+ }
228+ }
229+ }
230+ }
231+
232+ Item {
233+ id: foreground
234+ anchors {
235+ left: leftButtonContainer.right
236+ right: parent.right
237+ top: parent.top
238+ }
239+ height: headerStyle.contentHeight
240+
241+ Label {
242+ LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
243+
244+ anchors {
245+ left: parent.left
246+ verticalCenter: parent.verticalCenter
247+ leftMargin: headerStyle.textLeftMargin
248+ }
249+ text: styledItem.title
250+ font.weight: headerStyle.fontWeight
251+ fontSize: headerStyle.fontSize
252+ color: headerStyle.textColor
253+ }
254+ }
255+}
256
257=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/qmldir'
258--- modules/Ubuntu/Components/Themes/Ambiance/qmldir 2013-12-04 10:47:19 +0000
259+++ modules/Ubuntu/Components/Themes/Ambiance/qmldir 2014-04-24 20:35:57 +0000
260@@ -4,6 +4,7 @@
261 internal CheckBoxStyle CheckBoxStyle.qml
262 internal DialogForegroundStyle DialogForegroundStyle.qml
263 internal HeaderStyle HeaderStyle.qml
264+internal NewHeaderStyle NewHeaderStyle.qml
265 MainViewStyle 0.1 MainViewStyle.qml
266 ListItemOptionSelector 0.1 ListItemOptionSelector.qml
267 OptionSelectorStyle 0.1 OptionSelectorStyle.qml
268
269=== modified file 'tests/autopilot/ubuntuuitoolkit/emulators.py'
270--- tests/autopilot/ubuntuuitoolkit/emulators.py 2014-04-14 22:01:49 +0000
271+++ tests/autopilot/ubuntuuitoolkit/emulators.py 2014-04-24 20:35:57 +0000
272@@ -143,20 +143,12 @@
273 current_tab.visible.wait_for(True)
274 return current_tab
275
276- @autopilot_logging.log_action(logger.info)
277- def switch_to_tab_by_index(self, index):
278- """Open a tab.
279-
280- :parameter index: The index of the tab to open.
281- :return: The newly opened tab.
282- :raise ToolkitEmulatorException: If the tab index is out of range.
283-
284- """
285- logger.debug('Switch to tab with index {0}.'.format(index))
286+ def _switch_to_tab_in_deprecated_tabbar_by_index(self, index):
287 tabs = self.get_tabs()
288 number_of_tabs = tabs.get_number_of_tabs()
289 if index >= number_of_tabs:
290 raise ToolkitEmulatorException('Tab index out of range.')
291+
292 current_tab = tabs.get_current_tab()
293 number_of_switches = 0
294 while not tabs.selectedTabIndex == index:
295@@ -171,6 +163,33 @@
296 number_of_switches += 1
297 return current_tab
298
299+ def _switch_to_tab_in_drawer_by_index(self, index):
300+ tabs = self.get_tabs()
301+ number_of_tabs = tabs.get_number_of_tabs()
302+ if index >= number_of_tabs:
303+ raise ToolkitEmulatorException('Tab index out of range.')
304+
305+ if (index != tabs.selectedTabIndex):
306+ self.get_header().switch_to_tab_by_index(index)
307+ current_tab = tabs.get_current_tab()
308+ return current_tab
309+
310+ @autopilot_logging.log_action(logger.info)
311+ def switch_to_tab_by_index(self, index):
312+ """Open a tab.
313+
314+ :parameter index: The index of the tab to open.
315+ :return: The newly opened tab.
316+ :raise ToolkitEmulatorException: If the tab index is out of range.
317+
318+ """
319+ logger.debug('Switch to tab with index {0}.'.format(index))
320+
321+ if (self.useDeprecatedToolbar):
322+ return self._switch_to_tab_in_deprecated_tabbar_by_index(index)
323+ else:
324+ return self._switch_to_tab_in_drawer_by_index(index)
325+
326 @autopilot_logging.log_action(logger.info)
327 def switch_to_previous_tab(self):
328 """Open the previous tab.
329@@ -226,16 +245,13 @@
330 self.pointing_device = get_pointing_device()
331
332 def _get_animating(self):
333- tab_bar_style = self.select_single('TabBarStyle')
334- return tab_bar_style.animating
335-
336- @autopilot_logging.log_action(logger.info)
337- def switch_to_next_tab(self):
338- """Open the next tab.
339-
340- :raise ToolkitEmulatorException: If the main view has no tabs.
341-
342- """
343+ if (self.useDeprecatedToolbar):
344+ tab_bar_style = self.select_single('TabBarStyle')
345+ return tab_bar_style.animating
346+ else:
347+ return False
348+
349+ def _switch_to_next_tab_in_deprecated_tabbar(self):
350 try:
351 tab_bar = self.select_single(TabBar)
352 except dbus.StateNotFoundError:
353@@ -243,6 +259,63 @@
354 tab_bar.switch_to_next_tab()
355 self._get_animating().wait_for(False)
356
357+ def _switch_to_next_tab_in_drawer(self):
358+ tabs_model_properties = self.select_single(
359+ 'QQuickItem', objectName='tabsModelProperties')
360+ next_tab_index = (tabs_model_properties.selectedIndex
361+ + 1) % tabs_model_properties.count
362+ self._switch_to_tab_in_drawer_by_index(next_tab_index)
363+
364+ @autopilot_logging.log_action(logger.info)
365+ def switch_to_next_tab(self):
366+ """Open the next tab.
367+
368+ :raise ToolkitEmulatorException: If the main view has no tabs.
369+
370+ """
371+ if (self.useDeprecatedToolbar):
372+ self._switch_to_next_tab_in_deprecated_tabbar()
373+ else:
374+ self._switch_to_next_tab_in_drawer()
375+
376+ def _switch_to_tab_in_drawer_by_index(self, index):
377+ try:
378+ tabs_drawer_button = self.select_single(
379+ 'AbstractButton', objectName='tabsButton')
380+ except dbus.StateNotFoundError:
381+ raise ToolkitEmulatorException(_NO_TABS_ERROR)
382+ self.pointing_device.click_object(tabs_drawer_button)
383+
384+ tabs_model_properties = self.select_single(
385+ 'QQuickItem', objectName='tabsModelProperties')
386+
387+ if (tabs_model_properties.selectedIndex == index):
388+ return
389+
390+ try:
391+ tab_button = self.get_root_instance().select_single(
392+ 'Standard', objectName='tabButton' + str(index))
393+ except dbus.StateNotFoundError:
394+ raise ToolkitEmulatorException(
395+ "Tab button {0} not found.".format(index))
396+
397+ self.pointing_device.click_object(tab_button)
398+
399+ @autopilot_logging.log_action(logger.info)
400+ def switch_to_tab_by_index(self, index):
401+ """Open a tab. This only supports the new tabs in the header
402+
403+ :parameter index: The index of the tab to open.
404+ :raise ToolkitEmulatorException: If the tab index is out of range or
405+ useDeprecatedToolbar is set.
406+
407+ """
408+ if (self.useDeprecatedToolbar):
409+ raise ToolkitEmulatorException(
410+ "Header.swtich_to_tab_by_index only works with new header")
411+ else:
412+ self._switch_to_tab_in_drawer_by_index(index)
413+
414
415 class Toolbar(UbuntuUIToolkitEmulatorBase):
416 """Toolbar Autopilot emulator."""
417
418=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py'
419--- tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2014-04-20 19:25:12 +0000
420+++ tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2014-04-24 20:35:57 +0000
421@@ -242,56 +242,66 @@
422 'Toolbar must be opened before calling click_button().')
423
424
425-class TabsTestCase(tests.QMLStringAppTestCase):
426-
427- test_qml = ("""
428+TEST_TABS_QML_FORMAT = ("""
429 import QtQuick 2.0
430 import Ubuntu.Components 1.0
431-import Ubuntu.Components.ListItems 1.0 as ListItem
432
433-MainView {
434+MainView {{
435 width: units.gu(70)
436 height: units.gu(60)
437+ useDeprecatedToolbar: {use_deprecated_toolbar}
438
439- Tabs {
440+ Tabs {{
441 id: tabs
442- Tab {
443+ Tab {{
444 objectName: "tab1"
445 title: "Tab1"
446- Page {
447- tools: ToolbarItems {
448- ToolbarButton {
449+ Page {{
450+ tools: ToolbarItems {{
451+ ToolbarButton {{
452 text: "Test1"
453- }
454- }
455- }
456- }
457- Tab {
458+ }}
459+ }}
460+ }}
461+ }}
462+ Tab {{
463 objectName: "tab2"
464 title: "Tab2"
465- Page {
466- tools: ToolbarItems {
467- ToolbarButton {
468+ Page {{
469+ tools: ToolbarItems {{
470+ ToolbarButton {{
471 text: "Test2"
472- }
473- }
474- }
475- }
476- Tab {
477+ }}
478+ }}
479+ }}
480+ }}
481+ Tab {{
482 objectName: "tab3"
483 title: "Tab3"
484- Page {
485- tools: ToolbarItems {
486- ToolbarButton {
487+ Page {{
488+ tools: ToolbarItems {{
489+ ToolbarButton {{
490 text: "Test3"
491- }
492- }
493- }
494- }
495- }
496-}
497+ }}
498+ }}
499+ }}
500+ }}
501+ }}
502+}}
503 """)
504
505+
506+class TabsTestCase(tests.QMLStringAppTestCase):
507+
508+ scenarios = [
509+ ('deprecated tabs', dict(
510+ test_qml=TEST_TABS_QML_FORMAT.format(
511+ use_deprecated_toolbar='true'))),
512+ ('drawer tabs', dict(
513+ test_qml=TEST_TABS_QML_FORMAT.format(
514+ use_deprecated_toolbar='false')))
515+ ]
516+
517 def test_tabs_custom_emulator(self):
518 self.assertIsInstance(self.main_view.get_tabs(), emulators.Tabs)
519
520
521=== modified file 'tests/resources/navigation/SimpleTabs.qml'
522--- tests/resources/navigation/SimpleTabs.qml 2014-04-20 19:25:12 +0000
523+++ tests/resources/navigation/SimpleTabs.qml 2014-04-24 20:35:57 +0000
524@@ -20,6 +20,8 @@
525 MainView {
526 width: 800
527 height: 600
528+ useDeprecatedToolbar: false
529+
530 Tabs {
531 id: tabs
532 selectedTabIndex: 1
533
534=== modified file 'tests/resources/navigation/Tabs.qml'
535--- tests/resources/navigation/Tabs.qml 2014-04-20 19:25:12 +0000
536+++ tests/resources/navigation/Tabs.qml 2014-04-24 20:35:57 +0000
537@@ -21,6 +21,8 @@
538 MainView {
539 width: 800
540 height: 600
541+ id: mainView
542+ useDeprecatedToolbar: false
543
544 Tabs {
545 id: tabs
546@@ -40,12 +42,12 @@
547 height: childrenRect.height
548 Button {
549 text: "tab bar on"
550- enabled: !tabs.tabBar.selectionMode
551+ enabled: mainView.useDeprecatedToolbar && !tabs.tabBar.selectionMode
552 onClicked: tabs.tabBar.selectionMode = true;
553 }
554 Button {
555 text: "tab bar off"
556- enabled: tabs.tabBar.selectionMode
557+ enabled: mainView.useDeprecatedToolbar && tabs.tabBar.selectionMode
558 onClicked: tabs.tabBar.selectionMode = false;
559 }
560 }

Subscribers

People subscribed via source and target branches