Merge lp:~tpeeters/ubuntu-ui-toolkit/tabBarInStyle into lp:ubuntu-ui-toolkit

Proposed by Tim Peeters
Status: Rejected
Rejected by: Tim Peeters
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/tabBarInStyle
Merge into: lp:ubuntu-ui-toolkit
Prerequisite: lp:~tpeeters/ubuntu-ui-toolkit/tabsModelIndex
Diff against target: 224 lines (+51/-34)
8 files modified
CHANGES (+1/-0)
components.api (+1/-0)
modules/Ubuntu/Components/Header.qml (+13/-2)
modules/Ubuntu/Components/Tabs.qml (+8/-18)
modules/Ubuntu/Components/Themes/Ambiance/HeaderStyle.qml (+23/-1)
tests/resources/navigation/TabView.qml (+1/-9)
tests/unit/tst_components/tst_pagestack.qml (+3/-3)
tests/unit_x11/tst_components/tst_hide_chrome.qml (+1/-1)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/tabBarInStyle
Reviewer Review Type Date Requested Status
Tim Peeters Disapprove
PS Jenkins bot continuous-integration Needs Fixing
Zsombor Egri Approve
Review via email: mp+211575@code.launchpad.net

Commit message

Move the TabBar instance from Tabs to the HeaderStyle.

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

update components.api

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)
Revision history for this message
Zsombor Egri (zsombi) wrote :

Code looks good. Thanks!!

review: Approve
980. By Tim Peeters

merge tabsModelIndex

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

fix test

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

merge tabsModelIndex branch

983. By Tim Peeters

deprecate Header.contents property

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

superseded

review: Disapprove

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CHANGES'
2--- CHANGES 2014-04-09 21:55:20 +0000
3+++ CHANGES 2014-04-09 21:55:21 +0000
4@@ -85,6 +85,7 @@
5 * ADDED IN: Empty: property bool waitingConfirmationForRemoval
6 * ADDED IN: Empty: function cancelItemRemoval()
7 * CHANGED in CrossFadeImage: readonly property size sourceSize TO property size sourceSize
8+* DEPRECATED in Header: property Item contents
9
10 Compatibility Breaks
11 ********************
12
13=== modified file 'components.api'
14--- components.api 2014-04-01 12:57:27 +0000
15+++ components.api 2014-04-09 21:55:21 +0000
16@@ -60,6 +60,7 @@
17 function hide()
18 property string title
19 property Item contents
20+ property var tabsModel
21 property Flickable flickable
22 modules/Ubuntu/Components/Icon.qml
23 Item
24
25=== modified file 'modules/Ubuntu/Components/Header.qml'
26--- modules/Ubuntu/Components/Header.qml 2014-03-12 09:36:00 +0000
27+++ modules/Ubuntu/Components/Header.qml 2014-04-09 21:55:21 +0000
28@@ -54,7 +54,7 @@
29 internal.movementEnded();
30 }
31
32- visible: title || contents
33+ visible: title || contents || tabsModel
34 onVisibleChanged: {
35 internal.checkFlickableMargins();
36 }
37@@ -80,10 +80,21 @@
38 onTitleChanged: contentsChanged()
39
40 /*!
41+ \deprecated
42 The contents of the header. If this is set, \l title will be ignored.
43+ This property is now DEPRECATED. Set tabsModel to show tabs navigation in header.
44 */
45 property Item contents: null
46- onContentsChanged: header.show()
47+ onContentsChanged: {
48+ print("Header.contents property is now DEPRECATED. Set tabsModel to show tabs navigation.");
49+ header.show();
50+ }
51+
52+ /*!
53+ A model of tabs to represent in the header.
54+ This is automatically set by \l Tabs.
55+ */
56+ property var tabsModel: null
57
58 /*!
59 The flickable that controls the movement of the header.
60
61=== modified file 'modules/Ubuntu/Components/Tabs.qml'
62--- modules/Ubuntu/Components/Tabs.qml 2014-04-08 12:38:35 +0000
63+++ modules/Ubuntu/Components/Tabs.qml 2014-04-09 21:55:21 +0000
64@@ -176,14 +176,14 @@
65 readonly property Item currentPage: selectedTab ? selectedTab.page : null
66
67 /*!
68+ \deprecated
69 The \l TabBar that will be shown in the header
70 and provides scrollable tab buttons.
71+ This property is DEPRECATED. TabBar is now part of the header style.
72 */
73- property TabBar tabBar: TabBar {
74- id: bar
75- model: tabsModel
76- visible: tabs.active
77- }
78+ property TabBar tabBar: internal.header && internal.header.__styleInstance &&
79+ internal.header.__styleInstance.hasOwnProperty("__tabBar") ?
80+ internal.header.__styleInstance.__tabBar : null
81
82 /*!
83 Children are placed in a separate item that has functionality to extract the Tab items.
84@@ -205,10 +205,7 @@
85 */
86 signal modelChanged()
87
88- /*!
89- \internal
90- required by TabsStyle
91- */
92+ // Needed to set the tabs model of the header
93 ListModel {
94 id: tabsModel
95
96@@ -292,13 +289,6 @@
97 id: internal
98 property Header header: tabs.__propagated ? tabs.__propagated.header : null
99
100- Binding {
101- target: tabBar
102- property: "animate"
103- when: internal.header && internal.header.hasOwnProperty("animate")
104- value: internal.header.animate
105- }
106-
107 /*
108 List of connected Repeaters to avoid repeater "hammering" of itemAdded() signal.
109 */
110@@ -439,8 +429,8 @@
111
112 Binding {
113 target: internal.header
114- property: "contents"
115- value: tabs.active ? tabs.tabBar: null
116+ property: "tabsModel"
117+ value: tabsModel
118 when: internal.header && tabs.active
119 }
120 }
121
122=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/HeaderStyle.qml'
123--- modules/Ubuntu/Components/Themes/Ambiance/HeaderStyle.qml 2014-03-12 09:36:00 +0000
124+++ modules/Ubuntu/Components/Themes/Ambiance/HeaderStyle.qml 2014-04-09 21:55:21 +0000
125@@ -43,6 +43,12 @@
126
127 implicitHeight: headerStyle.contentHeight + separator.height + separatorBottom.height
128
129+ /*!
130+ \internal
131+ Tabs needs to call sync of the TabBar
132+ */
133+ property TabBar __tabBar: tabBarLoader.sourceComponent ? tabBarLoader.item : null
134+
135 BorderImage {
136 id: separator
137 anchors {
138@@ -81,7 +87,7 @@
139 }
140 text: styledItem.title
141 font.weight: headerStyle.fontWeight
142- visible: !styledItem.contents
143+ visible: !styledItem.tabsModel && !styledItem.contents
144 fontSize: headerStyle.fontSize
145 color: headerStyle.textColor
146 }
147@@ -98,5 +104,21 @@
148 value: foreground
149 when: styledItem.contents
150 }
151+
152+ Loader {
153+ id: tabBarLoader
154+ sourceComponent: styledItem.tabsModel && !styledItem.contents ? tabBarComponent : null
155+ anchors.fill: parent
156+ }
157+
158+ Component {
159+ id: tabBarComponent
160+ TabBar {
161+ id: tabBar
162+ anchors.fill: parent
163+ model: styledItem.tabsModel
164+ animate: styledItem.animate
165+ }
166+ }
167 }
168 }
169
170=== modified file 'tests/resources/navigation/TabView.qml'
171--- tests/resources/navigation/TabView.qml 2014-04-09 21:55:20 +0000
172+++ tests/resources/navigation/TabView.qml 2014-04-09 21:55:21 +0000
173@@ -45,15 +45,7 @@
174
175 Header {
176 id: header
177- contents: TabBar {
178- id: tabBar
179- model: pages
180- anchors {
181- top: parent.top
182- left: parent.left
183- right: parent.right
184- }
185- }
186+ tabsModel: pages
187 }
188
189 Component {
190
191=== modified file 'tests/unit/tst_components/tst_pagestack.qml'
192--- tests/unit/tst_components/tst_pagestack.qml 2013-07-29 10:05:05 +0000
193+++ tests/unit/tst_components/tst_pagestack.qml 2014-04-09 21:55:21 +0000
194@@ -85,14 +85,14 @@
195 pageStack.push(tabs);
196 compare(pageStack.currentPage, tabs, "Tabs can be pushed on a PageStack");
197 compare(tabs.active, true, "Tabs on top of a PageStack are active");
198- compare(mainView.__propagated.header.contents, tabs.tabBar, "Pushing Tabs on PageStack updates the header contents");
199+ compare(mainView.__propagated.header.__styleInstance.__tabBar, tabs.tabBar, "Pushing Tabs on PageStack updates the header contents");
200 pageStack.push(page1);
201 compare(pageStack.currentPage, page1, "A page can be pushed on top of a Tabs");
202 compare(tabs.active, false, "Tabs on a PageStack, but not on top, are inactive");
203- compare(mainView.__propagated.header.contents, null, "Contents of inactive Tabs is not applied to header");
204+ compare(mainView.__propagated.header.__styleInstance.__tabBar, null, "Contents of inactive Tabs is not applied to header");
205 pageStack.pop();
206 compare(tabs.active, true, "Tabs on top of PageStack is active");
207- compare(mainView.__propagated.header.contents, tabs.tabBar, "Active Tabs controls header contents");
208+ compare(mainView.__propagated.header.__styleInstance.__tabBar, tabs.tabBar, "Active Tabs controls header contents");
209 pageStack.clear();
210 }
211
212
213=== modified file 'tests/unit_x11/tst_components/tst_hide_chrome.qml'
214--- tests/unit_x11/tst_components/tst_hide_chrome.qml 2013-12-04 21:01:53 +0000
215+++ tests/unit_x11/tst_components/tst_hide_chrome.qml 2014-04-09 21:55:21 +0000
216@@ -72,7 +72,7 @@
217 function setTabBarSelectionMode(newSelectionMode) {
218 var tabBar = tabs.tabBar;
219 var header = mainView.__propagated.header;
220- compare(tabBar, header.contents, "TabBar is not the active header contents");
221+ compare(tabBar, header.__styleInstance.__tabBar, "TabBar is not the active header contents");
222 header.show();
223 tabBar.selectionMode = newSelectionMode;
224 compare(tabBar.selectionMode, newSelectionMode, "Failed to set the tab bar selection mode");

Subscribers

People subscribed via source and target branches

to status/vote changes: