Merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/textFromOuterSpaceTrunk into lp:ubuntu-ui-toolkit

Proposed by Cris Dywan
Status: Merged
Approved by: Zoltan Balogh
Approved revision: 1248
Merged at revision: 1249
Proposed branch: lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/textFromOuterSpaceTrunk
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 166 lines (+26/-17)
5 files modified
src/Ubuntu/Components/1.2/TextCursor.qml (+6/-5)
src/Ubuntu/Components/1.3/TextCursor.qml (+6/-5)
src/Ubuntu/Components/Themes/Ambiance/1.2/TextCursorStyle.qml (+6/-3)
src/Ubuntu/Components/Themes/Ambiance/1.3/TextCursorStyle.qml (+6/-3)
tests/unit_x11/tst_components/tst_textinput_touch.qml (+2/-1)
To merge this branch: bzr merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/textFromOuterSpaceTrunk
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu SDK team Pending
Review via email: mp+276265@code.launchpad.net

Commit message

Smaller handlers, entirely draggable caret

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Components/1.2/TextCursor.qml'
2--- src/Ubuntu/Components/1.2/TextCursor.qml 2015-06-10 17:23:51 +0000
3+++ src/Ubuntu/Components/1.2/TextCursor.qml 2015-10-30 13:44:09 +0000
4@@ -157,9 +157,9 @@
5 //dragged item
6 property Item draggedItem: Item {
7 objectName: cursorItem.positionProperty + "_draggeditem"
8- width: caret.width + units.gu(4)
9+ width: caret.width + units.gu(2)
10 onWidthChanged: draggedItem.moveToCaret()
11- height: caret.height + units.gu(4)
12+ height: cursorItem.height + caret.height + units.gu(2)
13 parent: fakeCursor.parent
14 visible: caret.visible
15
16@@ -204,8 +204,10 @@
17 if (!caret) {
18 return;
19 }
20- draggedItem.x = fakeCursor.x - draggedItem.width / 2;
21- draggedItem.y = fakeCursor.y + caret.y - caret.height / 2;
22+ // The style may render handlers either on top or bottom
23+ var flip = caret.rotation == 180;
24+ draggedItem.x = fakeCursor.x + (flip ? -units.gu(1) : -draggedItem.width + units.gu(1));
25+ draggedItem.y = fakeCursor.y - caret.height - units.gu(0.5);
26 }
27 // positions caret to the dragged position
28 function positionCaret() {
29@@ -214,7 +216,6 @@
30 var dy = dragger.dragStartY + dragger.dragAmountY + handler.flickable.contentY;
31 dx -= handler.frameDistance.x;
32 dy -= handler.frameDistance.y;
33- dy -= draggedItem.height / 2;
34 handler.positionCaret(positionProperty, dx, dy);
35 }
36 }
37
38=== modified file 'src/Ubuntu/Components/1.3/TextCursor.qml'
39--- src/Ubuntu/Components/1.3/TextCursor.qml 2015-08-11 17:15:59 +0000
40+++ src/Ubuntu/Components/1.3/TextCursor.qml 2015-10-30 13:44:09 +0000
41@@ -158,9 +158,9 @@
42 //dragged item
43 property Item draggedItem: Item {
44 objectName: cursorItem.positionProperty + "_draggeditem"
45- width: caret.width + units.gu(4)
46+ width: caret.width + units.gu(2)
47 onWidthChanged: draggedItem.moveToCaret()
48- height: caret.height + units.gu(4)
49+ height: cursorItem.height + caret.height + units.gu(2)
50 parent: fakeCursor.parent
51 visible: caret.visible
52
53@@ -206,8 +206,10 @@
54 if (!caret) {
55 return;
56 }
57- draggedItem.x = fakeCursor.x - draggedItem.width / 2;
58- draggedItem.y = fakeCursor.y + caret.y - caret.height / 2;
59+ // The style may render handlers either on top or bottom
60+ var flip = caret.rotation == 180;
61+ draggedItem.x = fakeCursor.x + (flip ? -units.gu(1) : -draggedItem.width + units.gu(1));
62+ draggedItem.y = fakeCursor.y - caret.height - units.gu(0.5);
63 }
64 // positions caret to the dragged position
65 function positionCaret() {
66@@ -216,7 +218,6 @@
67 var dy = dragger.dragStartY + dragger.dragAmountY + handler.flickable.contentY;
68 dx -= handler.frameDistance.x;
69 dy -= handler.frameDistance.y;
70- dy -= draggedItem.height / 2;
71 handler.positionCaret(positionProperty, dx, dy);
72 }
73 }
74
75=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.2/TextCursorStyle.qml'
76--- src/Ubuntu/Components/Themes/Ambiance/1.2/TextCursorStyle.qml 2015-04-24 14:52:19 +0000
77+++ src/Ubuntu/Components/Themes/Ambiance/1.2/TextCursorStyle.qml 2015-10-30 13:44:09 +0000
78@@ -57,7 +57,7 @@
79 width: cursorWidth
80 // FIXME: Extend the palette and use palette values here
81 color: UbuntuColors.blue
82- visible: styledItem.positionProperty === "cursorPosition" && (blinkTimer.timerShowCursor || !blinkTimer.running)
83+ visible: blinkTimer.timerShowCursor || !blinkTimer.running
84 Timer {
85 id: blinkTimer
86 interval: cursorStyle.cursorVisibleTimeout
87@@ -66,7 +66,7 @@
88 styledItem.visible &&
89 shouldBlink
90 repeat: true
91- property bool shouldBlink: !styledItem.readOnly && !styledItem.contextMenuVisible
92+ property bool shouldBlink: styledItem.positionProperty === "cursorPosition" && !styledItem.readOnly && !styledItem.contextMenuVisible
93 property bool timerShowCursor: true
94 onTriggered: {
95 interval = (interval == cursorStyle.cursorVisibleTimeout) ?
96@@ -82,8 +82,11 @@
97 id: caretItem
98 source: Qt.resolvedUrl("../artwork/caret_noshadow.png")
99 objectName: "text_cursor_style_caret_" + styledItem.positionProperty
100+ property bool flip: styledItem.positionProperty !== "selectionStart"
101+ rotation: flip ? 180 : 0
102 anchors {
103- top: parent.bottom
104+ top: flip ? parent.bottom : undefined
105+ bottom: flip ? undefined : parent.top
106 horizontalCenter: parent.horizontalCenter
107 horizontalCenterOffset: cursorWidth / 2
108 }
109
110=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/TextCursorStyle.qml'
111--- src/Ubuntu/Components/Themes/Ambiance/1.3/TextCursorStyle.qml 2015-04-25 07:36:13 +0000
112+++ src/Ubuntu/Components/Themes/Ambiance/1.3/TextCursorStyle.qml 2015-10-30 13:44:09 +0000
113@@ -57,7 +57,7 @@
114 width: cursorWidth
115 // FIXME: Extend the palette and use palette values here
116 color: UbuntuColors.blue
117- visible: styledItem.positionProperty === "cursorPosition" && (blinkTimer.timerShowCursor || !blinkTimer.running)
118+ visible: blinkTimer.timerShowCursor || !blinkTimer.running
119 Timer {
120 id: blinkTimer
121 interval: cursorStyle.cursorVisibleTimeout
122@@ -66,7 +66,7 @@
123 styledItem.visible &&
124 shouldBlink
125 repeat: true
126- property bool shouldBlink: !styledItem.readOnly && !styledItem.contextMenuVisible
127+ property bool shouldBlink: styledItem.positionProperty === "cursorPosition" && !styledItem.readOnly && !styledItem.contextMenuVisible
128 property bool timerShowCursor: true
129 onTriggered: {
130 interval = (interval == cursorStyle.cursorVisibleTimeout) ?
131@@ -82,8 +82,11 @@
132 id: caretItem
133 source: Qt.resolvedUrl("../artwork/caret_noshadow.png")
134 objectName: "text_cursor_style_caret_" + styledItem.positionProperty
135+ property bool flip: styledItem.positionProperty !== "selectionStart"
136+ rotation: flip ? 180 : 0
137 anchors {
138- top: parent.bottom
139+ top: flip ? parent.bottom : undefined
140+ bottom: flip ? undefined : parent.top
141 horizontalCenter: parent.horizontalCenter
142 horizontalCenterOffset: cursorWidth / 2
143 }
144
145=== modified file 'src/Ubuntu/Components/Themes/Ambiance/artwork/caret_noshadow@27.png'
146Binary files src/Ubuntu/Components/Themes/Ambiance/artwork/caret_noshadow@27.png 2015-06-03 20:07:08 +0000 and src/Ubuntu/Components/Themes/Ambiance/artwork/caret_noshadow@27.png 2015-10-30 13:44:09 +0000 differ
147=== modified file 'tests/unit_x11/tst_components/tst_textinput_touch.qml'
148--- tests/unit_x11/tst_components/tst_textinput_touch.qml 2015-03-10 11:49:27 +0000
149+++ tests/unit_x11/tst_components/tst_textinput_touch.qml 2015-10-30 13:44:09 +0000
150@@ -192,7 +192,7 @@
151 if(TestExtras.openGLflavor() == "opengles2" &&
152 TestExtras.cpuArchitecture() != "arm")
153 skip("This test doesn't pass with OpenGLES other than arm");
154- data.input.focus = true;
155+ TestExtras.touchClick(0, data.input, centerOf(data.input));
156 popupSpy.target = findChild(data.input, "input_handler");
157
158 TestExtras.touchLongPress(0, data.input, guPoint(1, 1));
159@@ -283,6 +283,7 @@
160 data.input.focus = true;
161 data.input.cursorPosition = data.initialCursorPosition;
162 data.input.selectWord();
163+ verify(data.input.selectedText !== "", "No word selected initially!");
164 var selectedText = data.input.selectedText;
165
166 var caret = findChild(data.input, "input_handler")[data.cursorName + "Cursor"];

Subscribers

People subscribed via source and target branches

to status/vote changes: