Merge lp:~bzoltan/ubuntu-ui-toolkit/landing_120514 into lp:ubuntu-ui-toolkit

Proposed by Zoltan Balogh
Status: Merged
Approved by: Zsombor Egri
Approved revision: 1044
Merged at revision: 1019
Proposed branch: lp:~bzoltan/ubuntu-ui-toolkit/landing_120514
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 479 lines (+171/-43)
19 files modified
components.api (+1/-0)
modules/Ubuntu/Components/Header.qml (+0/-3)
modules/Ubuntu/Components/MainView.qml (+3/-0)
modules/Ubuntu/Components/Page.qml (+7/-0)
modules/Ubuntu/Components/Popups/internalPopupUtils.js (+1/-1)
modules/Ubuntu/Components/TabBar.qml (+1/-1)
modules/Ubuntu/Components/TextArea.qml (+1/-1)
modules/Ubuntu/Components/TextCursor.qml (+5/-3)
modules/Ubuntu/Components/TextField.qml (+4/-5)
modules/Ubuntu/Components/Themes/Ambiance/BubbleShape.qml (+15/-7)
modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml (+24/-2)
modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml (+7/-7)
modules/Ubuntu/Components/Themes/Ambiance/TextCursorStyle.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/TextSelectionEndCursorStyle.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/TextSelectionStartCursorStyle.qml (+1/-1)
tests/resources/inputs/TextInputs.qml (+6/-0)
tests/resources/navigation/StackWithTabs.qml (+10/-10)
tests/resources/toolbar/headerTextInput.qml (+66/-0)
tests/unit/tst_components/tst_pagestack.qml (+17/-0)
To merge this branch: bzr merge lp:~bzoltan/ubuntu-ui-toolkit/landing_120514
Reviewer Review Type Date Requested Status
Zsombor Egri Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+219179@code.launchpad.net

Commit message

[ Tim Peeters ]
* Make it possible to replace the title in the header with a
  custom Item. Fixes: https://bugs.launchpad.net/bugs/1314948
* Use selectedIndex of the tabs model instead of the TabBar
  everywhere in TabBarStyle to fix a bug that uses Tabs on a
  PageStack. Fixes: https://bugs.launchpad.net/bugs/1316736
* Fix the positioning of a popover pointer on a small screen
  in portrait mode. Fixes: https://bugs.launchpad.net/bugs/1208833

[ Christian Dywan ]
* Export to load modules from source and allow arguments.
* linearSecondsPicker check it's not resetting and
  count is correct

[ Zsombor Egri ]
* Text input caret positioning fix for the cases when TextField
  has overlay primary items and when RTL is enabled.

Description of the change

[ Tim Peeters ]
* Make it possible to replace the title in the header with a
  custom Item. Fixes: https://bugs.launchpad.net/bugs/1314948
* Use selectedIndex of the tabs model instead of the TabBar
  everywhere in TabBarStyle to fix a bug that uses Tabs on a
  PageStack. Fixes: https://bugs.launchpad.net/bugs/1316736
* Fix the positioning of a popover pointer on a small screen
  in portrait mode. Fixes: https://bugs.launchpad.net/bugs/1208833

[ Christian Dywan ]
* Export to load modules from source and allow arguments.
* linearSecondsPicker check it's not resetting and
  count is correct

[ Zsombor Egri ]
* Text input caret positioning fix for the cases when TextField
  has overlay primary items and when RTL is enabled.

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

merge trunk

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: Needs Fixing (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) :
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-05-06 12:15:15 +0000
3+++ components.api 2014-05-12 12:41:11 +0000
4@@ -235,6 +235,7 @@
5 Page 0.1 1.0
6 PageTreeNode
7 property string title
8+ property Item __customHeaderContents
9 property Flickable flickable
10 property list<Action> actions
11 PageStack 0.1 1.0
12
13=== modified file 'modules/Ubuntu/Components/Header.qml'
14--- modules/Ubuntu/Components/Header.qml 2014-05-02 11:09:58 +0000
15+++ modules/Ubuntu/Components/Header.qml 2014-05-12 12:41:11 +0000
16@@ -78,13 +78,10 @@
17 }
18
19 /*!
20- \deprecated
21 The contents of the header. If this is set, \l title will be ignored.
22- This property is now DEPRECATED. Set tabsModel to show tabs navigation in header.
23 */
24 property Item contents: null
25 onContentsChanged: {
26- print("Header.contents property is now DEPRECATED. Set tabsModel to show tabs navigation.");
27 header.show();
28 }
29
30
31=== modified file 'modules/Ubuntu/Components/MainView.qml'
32--- modules/Ubuntu/Components/MainView.qml 2014-05-02 14:02:40 +0000
33+++ modules/Ubuntu/Components/MainView.qml 2014-05-12 12:41:11 +0000
34@@ -348,6 +348,9 @@
35 internal.activePage.tools.back.hasOwnProperty("action") ?
36 internal.activePage.tools.back.action : null
37
38+ contents: internal.activePage ?
39+ internal.activePage.__customHeaderContents : null
40+
41 property Item tabBar: null
42 Binding {
43 target: headerItem
44
45=== modified file 'modules/Ubuntu/Components/Page.qml'
46--- modules/Ubuntu/Components/Page.qml 2014-05-02 10:26:18 +0000
47+++ modules/Ubuntu/Components/Page.qml 2014-05-12 12:41:11 +0000
48@@ -89,6 +89,13 @@
49 property Item tools: ToolbarItems { }
50
51 /*!
52+ \internal
53+ Set this property to replace the title label in the header by any Item.
54+ It will be automatically anchored to fill the title space in the header.
55+ */
56+ property Item __customHeaderContents: null
57+
58+ /*!
59 Optional flickable that controls the header. This property
60 is automatically set to the first child of the page that is Flickable
61 and anchors to the top of the page or fills the page. For example:
62
63=== modified file 'modules/Ubuntu/Components/Popups/internalPopupUtils.js'
64--- modules/Ubuntu/Components/Popups/internalPopupUtils.js 2013-07-13 03:11:26 +0000
65+++ modules/Ubuntu/Components/Popups/internalPopupUtils.js 2014-05-12 12:41:11 +0000
66@@ -154,7 +154,7 @@
67 if (simplePos.checkVerticalPosition(foreground, ycoord, 0, area.height/4)) {
68 foreground.y = ycoord;
69 pointer.direction = "up";
70- pointer.y = this.above(null, callerMargins, caller);
71+ pointer.y = this.below(null, callerMargins, caller);
72 pointer.x = this.closestToHorizontalCenter(pointerTarget, pointer.horizontalMargin);
73 return;
74 }
75
76=== modified file 'modules/Ubuntu/Components/TabBar.qml'
77--- modules/Ubuntu/Components/TabBar.qml 2014-04-24 17:44:56 +0000
78+++ modules/Ubuntu/Components/TabBar.qml 2014-05-12 12:41:11 +0000
79@@ -151,7 +151,7 @@
80
81 if (model.count > 0) {
82 if (internal.checkRoles()) {
83- model.selectedIndex = Math.max(Math.min(tabBar.selectedIndex, model.count - 1), 0);
84+ model.selectedIndex = Math.max(Math.min(model.selectedIndex, model.count - 1), 0);
85 }
86 } else {
87 internal.modelChecked = false;
88
89=== modified file 'modules/Ubuntu/Components/TextArea.qml'
90--- modules/Ubuntu/Components/TextArea.qml 2014-05-02 12:00:30 +0000
91+++ modules/Ubuntu/Components/TextArea.qml 2014-05-12 12:41:11 +0000
92@@ -875,7 +875,7 @@
93 input: editor
94 flickable: flicker
95 selectionModeTimeout: control.__styleInstance.selectionModeTimeout
96- frameDistance: Qt.point(internal.frameSpacing, internal.frameSpacing)
97+ frameDistance: Qt.point(flicker.x, flicker.y)
98 }
99 }
100 }
101
102=== modified file 'modules/Ubuntu/Components/TextCursor.qml'
103--- modules/Ubuntu/Components/TextCursor.qml 2014-05-06 09:20:16 +0000
104+++ modules/Ubuntu/Components/TextCursor.qml 2014-05-12 12:41:11 +0000
105@@ -199,9 +199,11 @@
106 // positions caret to the dragged position
107 function positionCaret() {
108 if (dragger.drag.active) {
109- handler.positionCaret(positionProperty,
110- dragger.thumbStartX + dragger.dragAmountX + handler.flickable.contentX,
111- dragger.thumbStartY + dragger.dragAmountY + handler.flickable.contentY);
112+ var dx = dragger.thumbStartX + dragger.dragAmountX + handler.flickable.contentX;
113+ var dy = dragger.thumbStartY + dragger.dragAmountY + handler.flickable.contentY;
114+ // consider only the x-distance because of the overlays
115+ dx -= handler.frameDistance.x;
116+ handler.positionCaret(positionProperty, dx, dy);
117 }
118 }
119 }
120
121=== modified file 'modules/Ubuntu/Components/TextField.qml'
122--- modules/Ubuntu/Components/TextField.qml 2014-05-02 12:00:30 +0000
123+++ modules/Ubuntu/Components/TextField.qml 2014-05-12 12:41:11 +0000
124@@ -1006,12 +1006,11 @@
125 flickable: flicker
126 selectionModeTimeout: control.__styleInstance.selectionModeTimeout
127 /*
128- In x direction we use 2 times the configured spacing, as we have
129- both the overlay and the Flickable aligned with margins. On y
130- direction we only use the simple spacing, the Flickable moves the
131- top downwards.
132+ In x direction we use the Flickable x position as we can have overlays
133+ which can shift the cursor caret. On y direction we only use the topMargin
134+ spacing.
135 */
136- frameDistance: Qt.point(2 * internal.spacing, internal.spacing)
137+ frameDistance: Qt.point(flicker.x, flicker.topMargin)
138 }
139 }
140 }
141
142=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/BubbleShape.qml'
143--- modules/Ubuntu/Components/Themes/Ambiance/BubbleShape.qml 2014-04-23 08:50:20 +0000
144+++ modules/Ubuntu/Components/Themes/Ambiance/BubbleShape.qml 2014-05-12 12:41:11 +0000
145@@ -137,16 +137,24 @@
146 id: arrow
147
148 visible: bubbleShape.direction != "none"
149- property var directionToRotation: {"down": 0,
150- "up": 180,
151- "left": 90,
152- "right": -90,
153- "none": 0
154- }
155+
156+ function directionToRotation(direction) {
157+ switch (direction) {
158+ case "up":
159+ return 180;
160+ case "left":
161+ return 90;
162+ case "right":
163+ return -90;
164+ default: // "down" or "none"
165+ return 0;
166+ }
167+ }
168+
169 x: -width / 2.0
170 y: -height
171 transformOrigin: Item.Bottom
172- rotation: directionToRotation[bubbleShape.direction]
173+ rotation: directionToRotation(bubbleShape.direction)
174 source: "artwork/bubble_arrow.png"
175 }
176 }
177
178=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml'
179--- modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml 2014-05-02 11:15:25 +0000
180+++ modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml 2014-05-12 12:41:11 +0000
181@@ -152,23 +152,45 @@
182 left: leftButtonContainer.right
183 right: actionsContainer.left
184 top: parent.top
185+ // don't keep a margin if there is already a button with spacing
186+ leftMargin: leftButtonContainer.width > 0 ? 0 : headerStyle.textLeftMargin
187 }
188 height: headerStyle.contentHeight
189
190 Label {
191 LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
192
193+ visible: !styledItem.contents
194 anchors {
195 left: parent.left
196 verticalCenter: parent.verticalCenter
197- // don't keep a margin if there is already a button with spacing
198- leftMargin: leftButtonContainer.width > 0 ? 0 : headerStyle.textLeftMargin
199 }
200 text: styledItem.title
201 font.weight: headerStyle.fontWeight
202 fontSize: headerStyle.fontSize
203 color: headerStyle.textColor
204 }
205+
206+ Item {
207+ // This Item is used to make the custom header item invisible
208+ // when styledItem.contents is unset and its parent is not updated
209+ // when the bindings below is no longer active
210+ id: contentsContainer
211+ anchors.fill: parent
212+ visible: styledItem.contents
213+ }
214+ Binding {
215+ target: styledItem.contents
216+ property: "anchors.fill"
217+ value: contentsContainer
218+ when: styledItem.contents
219+ }
220+ Binding {
221+ target: styledItem.contents
222+ property: "parent"
223+ value: contentsContainer
224+ when: styledItem.contents
225+ }
226 }
227
228 Row {
229
230=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml'
231--- modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml 2014-04-24 17:44:56 +0000
232+++ modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml 2014-05-12 12:41:11 +0000
233@@ -59,7 +59,7 @@
234 automaytically through ListModel changes.
235 */
236 function sync() {
237- buttonView.selectButton(styledItem.selectedIndex);
238+ buttonView.selectButton(styledItem.model.selectedIndex);
239 }
240
241 property var tabsModel : styledItem ? styledItem.model : null
242@@ -69,14 +69,14 @@
243
244 onSelectionModeChanged: {
245 if (!styledItem.selectionMode) {
246- buttonView.selectButton(styledItem.selectedIndex);
247+ buttonView.selectButton(styledItem.model.selectedIndex);
248 }
249 }
250 }
251
252 Connections {
253- target: styledItem
254- onSelectedIndexChanged: buttonView.selectButton(styledItem.selectedIndex)
255+ target: styledItem.model
256+ onSelectedIndexChanged: buttonView.selectButton(styledItem.model.selectedIndex)
257 }
258
259 /*
260@@ -126,7 +126,7 @@
261 // to avoid seeing fading animations of the unselected button when switching
262 // tabs from outside the tab bar.
263 property bool selected: (styledItem.selectionMode && buttonView.needsScrolling) ?
264- styledItem.selectedIndex === index :
265+ styledItem.model.selectedIndex === index :
266 buttonView.selectedButtonIndex === button.buttonIndex
267 property real offset: theRow.rowNumber + 1 - button.x / theRow.width;
268 property int buttonIndex: index + theRow.rowNumber*repeater.count
269@@ -171,9 +171,9 @@
270 // The indicator image must be visible after the selected tab button, when the
271 // tab bar is not in selection mode, or after the "last" button (starting with
272 // the selected one), when the tab bar is in selection mode.
273- property bool isLastAfterSelected: index === (styledItem.selectedIndex === 0 ?
274+ property bool isLastAfterSelected: index === (styledItem.model.selectedIndex === 0 ?
275 repeater.count-1 :
276- styledItem.selectedIndex - 1)
277+ styledItem.model.selectedIndex - 1)
278 opacity: (styledItem.selectionMode ? isLastAfterSelected : selected) ? 1 : 0
279 Behavior on opacity {
280 NumberAnimation {
281
282=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/TextCursorStyle.qml'
283--- modules/Ubuntu/Components/Themes/Ambiance/TextCursorStyle.qml 2014-05-06 09:20:16 +0000
284+++ modules/Ubuntu/Components/Themes/Ambiance/TextCursorStyle.qml 2014-05-12 12:41:11 +0000
285@@ -75,7 +75,7 @@
286 top: parent.bottom
287 horizontalCenter: parent.horizontalCenter
288 topMargin: -units.gu(0.5)
289- horizontalCenterOffset: units.gu(0.7)
290+ horizontalCenterOffset: LayoutMirroring.enabled ? -units.gu(0.7) : units.gu(0.7)
291 }
292 }
293 }
294
295=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/TextSelectionEndCursorStyle.qml'
296--- modules/Ubuntu/Components/Themes/Ambiance/TextSelectionEndCursorStyle.qml 2014-05-06 09:20:16 +0000
297+++ modules/Ubuntu/Components/Themes/Ambiance/TextSelectionEndCursorStyle.qml 2014-05-12 12:41:11 +0000
298@@ -60,7 +60,7 @@
299 top: parent.bottom
300 horizontalCenter: parent.horizontalCenter
301 topMargin: -units.gu(0.5)
302- horizontalCenterOffset: units.gu(0.7)
303+ horizontalCenterOffset: LayoutMirroring.enabled ? -units.gu(0.7) : units.gu(0.7)
304 }
305 }
306 }
307
308=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/TextSelectionStartCursorStyle.qml'
309--- modules/Ubuntu/Components/Themes/Ambiance/TextSelectionStartCursorStyle.qml 2014-05-06 09:20:16 +0000
310+++ modules/Ubuntu/Components/Themes/Ambiance/TextSelectionStartCursorStyle.qml 2014-05-12 12:41:11 +0000
311@@ -60,7 +60,7 @@
312 top: parent.bottom
313 horizontalCenter: parent.horizontalCenter
314 topMargin: -units.gu(0.5)
315- horizontalCenterOffset: -units.gu(0.7)
316+ horizontalCenterOffset: LayoutMirroring.enabled ? -(units.gu(0.7) - caretItem.width) : units.gu(0.7)
317 }
318 }
319 }
320
321=== modified file 'tests/resources/inputs/TextInputs.qml'
322--- tests/resources/inputs/TextInputs.qml 2014-05-02 12:00:30 +0000
323+++ tests/resources/inputs/TextInputs.qml 2014-05-12 12:41:11 +0000
324@@ -48,6 +48,12 @@
325 id: field
326 objectName: "Standard"
327 width: units.gu(30)
328+ primaryItem: Icon {
329+ width: height
330+ height: parent.height - units.gu(1)
331+ name: "search"
332+ }
333+
334 text: "The orange (specifically, the sweet orange) is the fruit of the citrus species Citrus × ​sinensis in the family Rutaceae."
335 }
336 Button {
337
338=== modified file 'tests/resources/navigation/StackWithTabs.qml'
339--- tests/resources/navigation/StackWithTabs.qml 2014-04-28 15:39:24 +0000
340+++ tests/resources/navigation/StackWithTabs.qml 2014-05-12 12:41:11 +0000
341@@ -32,16 +32,6 @@
342 Tab {
343 title: "Tab 1"
344 page: Page {
345- Button {
346- anchors.centerIn: parent
347- onClicked: pageStack.push(page3)
348- text: "Press"
349- }
350- }
351- }
352- Tab {
353- title: "Tab 2"
354- page: Page {
355 Column {
356 anchors {
357 centerIn: parent
358@@ -76,6 +66,16 @@
359 }
360 }
361 }
362+ Tab {
363+ title: "Tab 2"
364+ page: Page {
365+ Button {
366+ anchors.centerIn: parent
367+ onClicked: pageStack.push(page3)
368+ text: "Press"
369+ }
370+ }
371+ }
372 }
373 Page {
374 id: page3
375
376=== added file 'tests/resources/toolbar/headerTextInput.qml'
377--- tests/resources/toolbar/headerTextInput.qml 1970-01-01 00:00:00 +0000
378+++ tests/resources/toolbar/headerTextInput.qml 2014-05-12 12:41:11 +0000
379@@ -0,0 +1,66 @@
380+/*
381+ * Copyright (C) 2014 Canonical Ltd.
382+ *
383+ * This program is free software; you can redistribute it and/or modify
384+ * it under the terms of the GNU Lesser General Public License as published by
385+ * the Free Software Foundation; version 3.
386+ *
387+ * This program is distributed in the hope that it will be useful,
388+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
389+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
390+ * GNU Lesser General Public License for more details.
391+ *
392+ * You should have received a copy of the GNU Lesser General Public License
393+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
394+ */
395+
396+import QtQuick 2.0
397+import Ubuntu.Components 1.1
398+
399+MainView {
400+ width: units.gu(50)
401+ height: units.gu(80)
402+ useDeprecatedToolbar: false
403+
404+ Page {
405+ title: "test page"
406+
407+ id: page
408+
409+ __customHeaderContents: Item {
410+ TextField {
411+ anchors {
412+ left: parent.left
413+ verticalCenter: parent.verticalCenter
414+ }
415+ }
416+ }
417+
418+ Label {
419+ anchors.centerIn: parent
420+ text: "Hello, world"
421+ }
422+
423+ tools: ToolbarItems {
424+ ToolbarButton {
425+ action: Action {
426+ iconName: "contact"
427+ text: "oh"
428+ onTriggered: print("lala")
429+ enabled: false
430+ }
431+ }
432+
433+ back: ToolbarButton {
434+ action: Action {
435+ text: "cancel"
436+ iconName: "cancel"
437+ onTriggered: {
438+ page.__customHeaderContents = null;
439+ }
440+ }
441+ anchors.verticalCenter: parent.verticalCenter
442+ }
443+ }
444+ }
445+}
446
447=== modified file 'tests/unit/tst_components/tst_pagestack.qml'
448--- tests/unit/tst_components/tst_pagestack.qml 2014-04-25 05:28:37 +0000
449+++ tests/unit/tst_components/tst_pagestack.qml 2014-05-12 12:41:11 +0000
450@@ -96,6 +96,17 @@
451 pageStack.clear();
452 }
453
454+ function test_pop_to_tabs_bug1316736() {
455+ pageStack.push(tabs);
456+ tabs.selectedTabIndex = 1;
457+ pageStack.push(page1);
458+ compare(tabs.active, false, "Tabs on a PageStack, but not on top, are inactive");
459+ pageStack.pop();
460+ compare(tabs.active, true, "Tabs on top of PageStack is active");
461+ compare(tabs.selectedTabIndex, 1, "Pushing and popping another page on top of Tabs does not change selectedTabsIndex");
462+ pageStack.clear();
463+ }
464+
465 MainView {
466 id: mainView
467 PageStack {
468@@ -119,5 +130,11 @@
469
470 Tabs {
471 id: tabs
472+ Tab {
473+ id: tab1
474+ }
475+ Tab {
476+ id: tab2
477+ }
478 }
479 }

Subscribers

People subscribed via source and target branches

to status/vote changes: