Merge lp:~dandrader/unity8/remove_revealer into lp:unity8

Proposed by Daniel d'Andrada
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 893
Merged at revision: 903
Proposed branch: lp:~dandrader/unity8/remove_revealer
Merge into: lp:unity8
Diff against target: 607 lines (+0/-582)
4 files modified
qml/Components/Revealer.qml (+0/-241)
tests/qmltests/CMakeLists.txt (+0/-1)
tests/qmltests/Components/RevealingRectangle.qml (+0/-78)
tests/qmltests/Components/tst_Revealer.qml (+0/-262)
To merge this branch: bzr merge lp:~dandrader/unity8/remove_revealer
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+219511@code.launchpad.net

Commit message

Remove Revealer component

It's not used anywhere anymore. It's been replaced by DragHandle.

Description of the change

 * Are there any related MPs required for this MP to build/function as expected? Please list.
No.

 * Did you perform an exploratory manual test run of your code change and any related functionality?
No, but it's not really applicable to this case.

 * Did you make sure that your branch does not contain spurious tags?
Yes.

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
Not applicable.

 * If you changed the UI, has there been a design review?
Not applicable.

To post a comment you must log in.
Revision history for this message
Albert Astals Cid (aacid) wrote :

* Did you perform an exploratory manual test run of the code change and any related functionality?
Yes, everything still works as Reveleaer wasn't used

* Did CI run pass? If not, please explain why.
Not yet, will wait for it before top approving

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

One day we'll get qmluitests back!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'qml/Components/Revealer.qml'
2--- qml/Components/Revealer.qml 2013-10-25 14:26:29 +0000
3+++ qml/Components/Revealer.qml 1970-01-01 00:00:00 +0000
4@@ -1,241 +0,0 @@
5-/*
6- * Copyright (C) 2013 Canonical, Ltd.
7- *
8- * This program is free software; you can redistribute it and/or modify
9- * it under the terms of the GNU General Public License as published by
10- * the Free Software Foundation; version 3.
11- *
12- * This program is distributed in the hope that it will be useful,
13- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15- * GNU General Public License for more details.
16- *
17- * You should have received a copy of the GNU General Public License
18- * along with this program. If not, see <http://www.gnu.org/licenses/>.
19- */
20-
21-import QtQuick 2.0
22-import Ubuntu.Components 0.1
23-
24-Item {
25- id: revealer
26-
27- property Showable target
28- property var hintingAnimation: hintingAnimation
29- property string boundProperty: orientation == Qt.Vertical ? "y" : "x"
30- property int orientation: Qt.Vertical
31- property int direction: Qt.LeftToRight
32- property real openedValue: orientation == Qt.Vertical ? y : x
33- property real closedValue: orientation == Qt.Vertical ? y + (direction == Qt.LeftToRight ? -height : height) : x + (direction == Qt.LeftToRight ? -width : width)
34- property real hintDisplacement: 0
35- property real handleSize: units.gu(2)
36- property real dragVelocity: draggingArea.dragVelocity != 0 ? Math.abs(draggingArea.dragVelocity) : -1
37- property real dragVelocityThreshold: units.gu(5)
38- property bool dragging: false
39- property bool pressed: draggingArea.pressed
40- property int lateralPosition: draggingArea.lateralPosition
41- property real dragPosition
42- property bool openOnPress: true
43-
44- signal openPressed(int mouseX, int mouseY)
45- signal openReleased(int mouseX, int mouseY)
46- signal closePressed
47- signal openClicked
48- signal closeClicked
49-
50- dragPosition: {
51- var value
52- if (orientation == Qt.Vertical) {
53- value = draggingArea.dragValue + draggingArea.y
54- if (direction == Qt.RightToLeft) {
55- value += draggingArea.height - height
56- }
57- } else {
58- value = draggingArea.dragValue + draggingArea.x
59- if (direction == Qt.RightToLeft) {
60- value += draggingArea.width - width
61- }
62- }
63- if (__opened) {
64- if (direction == Qt.LeftToRight) {
65- value += handleSize
66- } else {
67- value -= handleSize
68- }
69- } else if (dragging) {
70- if (direction == Qt.LeftToRight) {
71- value += hintDisplacement
72- } else {
73- value -= hintDisplacement
74- }
75- }
76-
77- return value
78- }
79- property var draggingArea: leftDraggingArea.enabled ? leftDraggingArea : rightDraggingArea
80-
81- property real __hintValue: closedValue + (direction == Qt.LeftToRight ? hintDisplacement : -hintDisplacement)
82-
83- function dragToValue(dragPosition) {
84- return dragPosition + closedValue
85- }
86-
87- property bool __opened: target.shown
88- enabled: target.available
89-
90- // Can be replaced with a fake implementation during tests
91- // property var __getCurrentTimeMs: function () { return new Date().getTime() }
92- property var __dateTime: new function() {
93- this.getCurrentTimeMs = function() {return new Date().getTime()}
94- }
95-
96- Component.onCompleted: target[boundProperty] = __opened ? openedValue : closedValue
97- onOpenedValueChanged: if (__opened && !dragging) target[boundProperty] = openedValue
98- onClosedValueChanged: if (!__opened && !dragging) target[boundProperty] = closedValue
99-
100- function __computeValue(dragPosition) {
101- return MathUtils.clamp(dragToValue(dragPosition), __hintValue, openedValue)
102- }
103-
104- function __open() {
105- hintingAnimation.stop()
106- target.show()
107- }
108-
109- function __close() {
110- hintingAnimation.stop()
111- target.hide()
112- }
113-
114- function __hint() {
115- target.showAnimation.stop()
116- target.hideAnimation.stop()
117- hintingAnimation.restart()
118- }
119-
120- function __settle() {
121- hintingAnimation.stop()
122- if (__opened) target.show()
123- else target.hide()
124- }
125-
126- function __startDragging() {
127- hintingAnimation.stop()
128- dragging = true
129- }
130-
131- function __endDragging(dragVelocity) {
132- dragging = false
133- if (revealer.direction == Qt.RightToLeft) {
134- dragVelocity = -dragVelocity
135- }
136- if (Math.abs(dragVelocity) >= dragVelocityThreshold) {
137- if (dragVelocity > 0) __open()
138- else __close()
139- } else {
140- __settle()
141- }
142- }
143-
144- Binding {
145- id: dragBinding
146-
147- target: revealer.target
148- property: revealer.boundProperty
149- value: __computeValue(dragPosition)
150- when: dragging
151- }
152-
153- SmoothedAnimation {
154- id: hintingAnimation
155-
156- target: revealer.target
157- property: revealer.boundProperty
158- duration: 150
159- to: revealer.__hintValue
160- }
161-
162- DraggingArea {
163- id: leftDraggingArea
164-
165- property bool isOpeningArea: revealer.direction == Qt.LeftToRight
166-
167- height: orientation == Qt.Vertical ? handleSize : parent.height
168- width: orientation == Qt.Horizontal ? handleSize : parent.width
169- orientation: revealer.orientation
170- enabled: isOpeningArea ? !revealer.__opened : revealer.__opened
171-
172- __dateTime: revealer.__dateTime
173-
174- onPressed: {
175- if (isOpeningArea) {
176- if (revealer.openOnPress) {
177- revealer.openPressed(mouseX, mouseY)
178- __hint()
179- }
180- } else {
181- revealer.closePressed()
182- }
183- }
184- onReleased: {
185- if (isOpeningArea && revealer.openOnPress) {
186- revealer.openReleased(mouseX, mouseY)
187- __settle()
188- }
189- }
190- onDragStart: __startDragging()
191- onDragEnd: __endDragging(dragVelocity)
192- onClicked: {
193- if (clickValidated) {
194- if (isOpeningArea) {
195- if (revealer.openOnPress) revealer.openClicked()
196- } else {
197- revealer.closeClicked()
198- }
199- }
200- }
201- }
202-
203- DraggingArea {
204- id: rightDraggingArea
205-
206- property bool isOpeningArea: revealer.direction == Qt.RightToLeft
207-
208- x: orientation == Qt.Vertical ? 0 : parent.width - width
209- y: orientation == Qt.Vertical ? parent.height - height : 0
210- height: orientation == Qt.Vertical ? handleSize : parent.height
211- width: orientation == Qt.Horizontal ? handleSize : parent.width
212- orientation: revealer.orientation
213- enabled: isOpeningArea ? !revealer.__opened : revealer.__opened
214-
215- __dateTime: revealer.__dateTime
216-
217- onPressed: {
218- if (isOpeningArea) {
219- if (revealer.openOnPress) {
220- revealer.openPressed(mouseX, mouseY)
221- __hint()
222- }
223- } else {
224- revealer.closePressed()
225- }
226- }
227- onReleased: {
228- if (isOpeningArea && revealer.openOnPress) {
229- revealer.openReleased(mouseX, mouseY)
230- __settle()
231- }
232- }
233- onDragStart: __startDragging()
234- onDragEnd: __endDragging(dragVelocity)
235- onClicked: {
236- if (clickValidated) {
237- if (isOpeningArea) {
238- if (revealer.openOnPress) revealer.openClicked()
239- } else {
240- revealer.closeClicked()
241- }
242- }
243- }
244- }
245-}
246
247=== modified file 'tests/qmltests/CMakeLists.txt'
248--- tests/qmltests/CMakeLists.txt 2014-05-06 07:55:56 +0000
249+++ tests/qmltests/CMakeLists.txt 2014-05-14 12:48:24 +0000
250@@ -28,7 +28,6 @@
251 add_qml_test(Components Rating)
252 add_qml_test(Components ResponsiveFlowView)
253 add_qml_test(Components ResponsiveGridView)
254-add_qml_test(Components Revealer)
255 add_qml_test(Components SeeMore)
256 add_qml_test(Components Showable)
257 add_qml_test(Components PageHeaderLabel)
258
259=== removed file 'tests/qmltests/Components/RevealingRectangle.qml'
260--- tests/qmltests/Components/RevealingRectangle.qml 2013-12-17 16:04:47 +0000
261+++ tests/qmltests/Components/RevealingRectangle.qml 1970-01-01 00:00:00 +0000
262@@ -1,78 +0,0 @@
263-/*
264- * Copyright (C) 2013 Canonical, Ltd.
265- *
266- * This program is free software; you can redistribute it and/or modify
267- * it under the terms of the GNU General Public License as published by
268- * the Free Software Foundation; version 3.
269- *
270- * This program is distributed in the hope that it will be useful,
271- * but WITHOUT ANY WARRANTY; without even the implied warranty of
272- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
273- * GNU General Public License for more details.
274- *
275- * You should have received a copy of the GNU General Public License
276- * along with this program. If not, see <http://www.gnu.org/licenses/>.
277- */
278-
279-import QtQuick 2.0
280-import Ubuntu.Components 0.1
281-import "../../../qml/Components"
282-
283-Item {
284- id: revealingRectangle
285-
286- property int orientation: Qt.Vertical
287- property int direction: Qt.LeftToRight
288- property Revealer revealer: __revealer
289- property Showable showable: __showable
290-
291- Revealer {
292- id: __revealer
293-
294- target: __showable
295- width: target.width
296- height: target.height
297- x: orientation == Qt.Vertical ? 0 : direction == Qt.LeftToRight ? 0 : parent.width - width
298- y: orientation == Qt.Horizontal ? 0 : direction == Qt.LeftToRight ? 0 : parent.height - height
299- handleSize: orientation == Qt.Vertical ? handle.height : handle.width
300- hintDisplacement: handleSize
301- orientation: revealingRectangle.orientation
302- direction: revealingRectangle.direction
303- }
304-
305- Showable {
306- id: __showable
307-
308- width: orientation == Qt.Horizontal ? units.gu(24) : parent.width
309- height: orientation == Qt.Vertical ? units.gu(24) : parent.height
310-
311- shown: false
312- showAnimation: SmoothedAnimation {
313- property: orientation == Qt.Horizontal ? "x" : "y"
314- velocity: __revealer.dragVelocity
315- duration: 200
316- to: __revealer.openedValue
317- }
318- hideAnimation: SmoothedAnimation {
319- property: orientation == Qt.Horizontal ? "x" : "y"
320- velocity: __revealer.dragVelocity
321- duration: 200
322- to: __revealer.closedValue
323- }
324-
325- Rectangle {
326- anchors.fill: parent
327- color: "red"
328- }
329-
330- Rectangle {
331- id: handle
332-
333- x: orientation == Qt.Vertical ? 0 : direction == Qt.LeftToRight ? parent.width - width : 0
334- y: orientation == Qt.Horizontal ? 0 : direction == Qt.LeftToRight ? parent.height - height : 0
335- width: orientation == Qt.Horizontal ? units.gu(2) : parent.width
336- height: orientation == Qt.Vertical ? units.gu(2) : parent.height
337- color: "black"
338- }
339- }
340-}
341
342=== removed file 'tests/qmltests/Components/tst_Revealer.qml'
343--- tests/qmltests/Components/tst_Revealer.qml 2013-06-05 22:03:08 +0000
344+++ tests/qmltests/Components/tst_Revealer.qml 1970-01-01 00:00:00 +0000
345@@ -1,262 +0,0 @@
346-/*
347- * Copyright 2013 Canonical Ltd.
348- *
349- * This program is free software; you can redistribute it and/or modify
350- * it under the terms of the GNU General Public License as published by
351- * the Free Software Foundation; version 3.
352- *
353- * This program is distributed in the hope that it will be useful,
354- * but WITHOUT ANY WARRANTY; without even the implied warranty of
355- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
356- * GNU General Public License for more details.
357- *
358- * You should have received a copy of the GNU General Public License
359- * along with this program. If not, see <http://www.gnu.org/licenses/>.
360- */
361-
362-import QtQuick 2.0
363-import QtTest 1.0
364-import Unity.Test 0.1 as UT
365-import ".."
366-
367-/*
368- There's a revealer on each window edge. If you press and hold any edge you
369- should see a black bar appearing from that edge. If you them slide the
370- pointer/finger towards the opposite edge, that black bar should follow
371- the movement up to around the center of the window. Next to the black bar,
372- which represents the "handle" area of the Revealer, You should see a red rectangle,
373- which is the main body of the Showable concrolled by the Revealer (Showable = red
374- + black rects).
375- */
376-Item {
377- width: units.gu(75)
378- height: units.gu(50)
379-
380- RevealingRectangle {
381- id: topRevealingRectangle
382- anchors.fill: parent
383- orientation: Qt.Vertical
384- direction: Qt.LeftToRight
385- }
386-
387- RevealingRectangle {
388- id: bottomRevealingRectangle
389- anchors.fill: parent
390- orientation: Qt.Vertical
391- direction: Qt.RightToLeft
392- }
393-
394- RevealingRectangle {
395- id: leftRevealingRectangle
396- anchors.fill: parent
397- orientation: Qt.Horizontal
398- direction: Qt.LeftToRight
399- }
400-
401- RevealingRectangle {
402- id: rightRevealingRectangle
403- anchors.fill: parent
404- orientation: Qt.Horizontal
405- direction: Qt.RightToLeft
406- }
407-
408- UT.UnityTestCase {
409- name: "Revealer"
410- when: windowShown
411-
412- /*
413- A bit of the showable should be displayed when you press over the
414- handle area of the Revealer.
415-
416- Once released, it should go out of sight again.
417- */
418- function test_showHintOnPress() {
419- var revealer = topRevealingRectangle.revealer
420- var showable = topRevealingRectangle.showable
421-
422- // It starts out of sight
423- compare(showable.y, -showable.height)
424-
425- // (item, x, y, button, modifiers, delay)
426- mousePress(revealer,
427- revealer.width/2,
428- revealer.handleSize/2,
429- Qt.LeftButton, Qt.NoModifier, 0);
430-
431- tryCompare(showable, "y", -showable.height + revealer.handleSize)
432-
433- // (item, x, y, button, modifiers, delay)
434- mouseRelease(revealer,
435- revealer.width/2,
436- revealer.handleSize/2,
437- Qt.LeftButton, Qt.NoModifier, 0);
438-
439- tryCompare(showable, "y", -showable.height)
440- }
441-
442- /*
443- Press over the handle area of the Revealer and drag it to pull
444- its target Showable. Release it half-way and the Showable will
445- continue moving by itself until it's completely shown.
446-
447-
448- Press over the handle area and drag it back to hide the Showable.
449- Release it half-way and it will continue moving by itself until it's
450- completely hidden again.
451- */
452- function test_dragToRevealAndDragBackToHide_top() {
453- var revealer = topRevealingRectangle.revealer
454- var showable = topRevealingRectangle.showable
455- revealer.__dateTime = fakeDateTime
456-
457- // It starts out of sight
458- compare(showable.y, -showable.height)
459-
460- mouseFlick(revealer,
461- revealer.width/2, // from_x
462- revealer.handleSize/2, // from_y
463- revealer.width/2, // to_x
464- showable.height/2); // to_y
465-
466- // Should eventually get fully extended
467- tryCompare(showable, "y", 0)
468-
469- // Now drag it back to get it hidden
470-
471- mouseFlick(revealer,
472- revealer.width/2,
473- showable.height - (revealer.handleSize/2),
474- revealer.width/2,
475- showable.height/2)
476-
477- // Should eventually be completely out of sight
478- tryCompare(showable, "y", -showable.height)
479- }
480-
481- function test_dragToRevealAndDragBackToHide_bottom() {
482- var revealer = bottomRevealingRectangle.revealer
483- var showable = bottomRevealingRectangle.showable
484- var revRect = bottomRevealingRectangle
485- revealer.__dateTime = fakeDateTime
486-
487- // It starts out of sight
488- compare(showable.y, revRect.height)
489-
490- mouseFlick(revealer,
491- revealer.width/2, // from_x
492- revealer.height - revealer.handleSize/2, // from_y
493- revealer.width/2, // to_x
494- revealer.height - showable.height/2); // to_y
495-
496- // Should eventually get fully extended
497- tryCompare(showable, "y", revRect.height - showable.height)
498-
499- // Now drag it back to get it hidden
500-
501- mouseFlick(revealer,
502- revealer.width/2,
503- revealer.handleSize/2,
504- revealer.width/2,
505- revealer.height - showable.height/2)
506-
507- // Should eventually be completely out of sight
508- tryCompare(showable, "y", revRect.height)
509- }
510-
511- function test_dragToRevealAndDragBackToHide_left() {
512- var revealer = leftRevealingRectangle.revealer
513- var showable = leftRevealingRectangle.showable
514- revealer.__dateTime = fakeDateTime
515-
516- // It starts out of sight
517- compare(showable.x, -showable.width)
518-
519- mouseFlick(revealer,
520- revealer.handleSize/2, // from_x
521- revealer.height/2, // from_y
522- showable.width/2, // to_x
523- revealer.height/2) // to_y
524-
525- // Should eventually get fully extended
526- tryCompare(showable, "x", 0)
527-
528- // Now drag it back to get it hidden
529-
530- mouseFlick(revealer,
531- showable.width - (revealer.handleSize/2),
532- revealer.height/2,
533- showable.width/2,
534- revealer.height/2)
535-
536- // Should eventually be completely out of sight
537- tryCompare(showable, "x", -showable.width)
538- }
539-
540- function test_dragToRevealAndDragBackToHide_right() {
541- var revealer = rightRevealingRectangle.revealer
542- var showable = rightRevealingRectangle.showable
543- var revRect = rightRevealingRectangle
544- revealer.__dateTime = fakeDateTime
545-
546- // It starts out of sight
547- compare(showable.x, revRect.width)
548-
549- mouseFlick(revealer,
550- revealer.width - revealer.handleSize/2, // from_x
551- revealer.height/2, // from_y
552- revealer.width - showable.width/2, // to_x
553- revealer.height/2) // to_y
554-
555- // Should eventually get fully extended
556- tryCompare(showable, "x", revRect.width - showable.width)
557-
558- // Now drag it back to get it hidden
559-
560- mouseFlick(revealer,
561- revealer.handleSize/2,
562- revealer.height/2,
563- revealer.width - showable.width/2,
564- revealer.height/2)
565-
566- // Should eventually be completely out of sight
567- tryCompare(showable, "x", revRect.width)
568- }
569-
570- /*
571- Start dragging down (pulling the showable into view) and then,
572- midway, drag a bit upwards and release it.
573- The showable should keep moving away, ending up hidden again.
574- */
575- function test_dragForthAndBackReturnsOriginalState() {
576- var revealer = topRevealingRectangle.revealer
577- var showable = topRevealingRectangle.showable
578- revealer.__dateTime = fakeDateTime
579-
580- // It starts out of sight
581- compare(showable.y, -showable.height)
582-
583- mouseFlick(revealer,
584- revealer.width/2, // from_x
585- revealer.handleSize/2, // from_y
586- revealer.width/2, // to_x
587- showable.height/2, // to_y
588- true /* do press */, false /* don't release */);
589-
590- // Should be about half-extended
591- verify(showable.y > -showable.height*3/4)
592- verify(showable.y < -showable.height*1/4)
593-
594-
595- // Now drag it back a bit
596- mouseFlick(revealer,
597- revealer.width/2, // from_x
598- showable.height/2, // from_y
599- revealer.width/2, // to_x
600- showable.height/4, // to_y
601- false /* don't press */, true /* do release */);
602-
603- // Should eventually be completely out of sight again
604- tryCompare(showable, "y", -showable.height)
605- }
606- }
607-}

Subscribers

People subscribed via source and target branches