Merge lp:~tpeeters/ubuntu-ui-toolkit/panel-opened-ro into lp:ubuntu-ui-toolkit

Proposed by Tim Peeters
Status: Merged
Approved by: Zoltan Balogh
Approved revision: 761
Merged at revision: 754
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/panel-opened-ro
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 194 lines (+37/-27)
5 files modified
CHANGES (+1/-1)
modules/Ubuntu/Components/Panel.qml (+30/-21)
tests/resources/navigation/MyCustomPage.qml (+1/-1)
tests/resources/toolbar/panels.qml (+2/-1)
tests/unit/tst_components/tst_toolbar.qml (+3/-3)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/panel-opened-ro
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Tim Peeters Approve
Zsombor Egri Approve
Review via email: mp+184663@code.launchpad.net

Commit message

Smarter automatic updating of Panel's opened property.

Panel.open() and Panel.close() should be used to open/close a Panel, or when using a toolbar with ToolbarItems from a Page, set Page.tools.opened to open/close the toolbar.

No API or behavior changes since the panel-open-close branch. Toolbar behavior changes will be done in a following MR.

To post a comment you must log in.
Revision history for this message
Tim Peeters (tpeeters) wrote :

work in progress, don't approve.

751. By Tim Peeters

remove commented-out code

752. By Tim Peeters

merge panel-open-close branch

753. By Tim Peeters

make opened property read-write again to avoind API breaks, and re-bind its value when it is updated

754. By Tim Peeters

semicolon

755. By Tim Peeters

update toolbar tests

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

done, but merge this one first: https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/panel-open-close/+merge/183892

Taking very small steps to avoid app (+tests) breakage.

756. By Tim Peeters

formatting

757. By Tim Peeters

formatting

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: Approve (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

gallery-app autopilot tests PASSED on pending image of 11 sept.

webbrowser-app autopilot tests FAILED on pending image of 11 sept. Log: https://pastebin.canonical.com/97312/

review: Needs Fixing
758. By Tim Peeters

fix typo in CHANGES

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

Code looks good, runs well, let me know if you have anything to add/change so I can top-approve!

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

re-trigger jenkins

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 :

So, after changing one line in CHANGES (not a code update), jenkins gives completely different results than it did before.

760. By Tim Peeters

re-trigger jenkins

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 :

webbrowser autopilot test passes with 20130913 image.

Fails with that image and this MR: https://pastebin.canonical.com/97519/

Packages from this MR pass webbrowser autopilot tests with this pending version of webbrowser-app: https://code.launchpad.net/~osomon/webbrowser-app/new-panel-api/+merge/185222

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

autopilot tests also PASSED for:
- gallery_app
- notes_app
- dialer_app
- messaging_app

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

another try with CI. Failures seem not related to the code changes. Maybe something outside the UITK got fixed in the meanwhile.

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) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CHANGES'
2--- CHANGES 2013-09-04 14:39:00 +0000
3+++ CHANGES 2013-09-17 13:30:57 +0000
4@@ -51,7 +51,7 @@
5 * CHANGED IN Tabs: property Component __headerContents TO property TabBar tabBar
6 * CHANGED IN Header: property Component contents TO property Item contents
7 * ADDED IN Panel: function open()
8-* ADDED IN Panel: function closed()
9+* ADDED IN Panel: function close()
10 * DEPRECATED IN Panel: writable property opened. Will be made read-only.
11
12 Compatibility Breaks
13
14=== modified file 'modules/Ubuntu/Components/Panel.qml'
15--- modules/Ubuntu/Components/Panel.qml 2013-09-09 19:11:39 +0000
16+++ modules/Ubuntu/Components/Panel.qml 2013-09-17 13:30:57 +0000
17@@ -175,18 +175,27 @@
18 Use edge swipes to open/close the panel.
19 The opened property is not updated until the swipe gesture is completed.
20 */
21- property bool opened: false
22+ // opened is true if state is spread, or if state is moving/hint and the previous state was spread.
23+ property bool opened: (panel.state === "spread") ||
24+ (panel.state === "moving" && internal.previousState === "spread")
25 /*! \internal */
26+ // FIXME: When opened is made read-only, onOpenedChanged can be removed entirely.
27 onOpenedChanged: {
28 if (internal.openedChangedWarning) {
29 console.log("DEPRECATED use of Panel.opened property. This property will be made read-only,
30 please use the opened property of the Page tools or use Panel.open() and Panel.close().");
31- }
32-
33- if (opened) {
34- panel.open();
35- } else {
36- panel.close();
37+
38+ if (opened) {
39+ panel.open();
40+ } else {
41+ panel.close();
42+ }
43+
44+ // re-establish the previous binding for opened.
45+ panel.opened = Qt.binding(function() {
46+ return (panel.state === "spread") ||
47+ (panel.state === "moving" && internal.previousState === "spread");
48+ })
49 }
50
51 internal.openedChangedWarning = true;
52@@ -196,18 +205,18 @@
53 Open the panel
54 */
55 function open() {
56+ // FIXME: When opened is made readonly, openedChangedWarning must be removed
57 internal.openedChangedWarning = false;
58 panel.state = "spread";
59- opened = true;
60 }
61
62 /*!
63 Close the panel
64 */
65 function close() {
66+ // FIXME: When opened is made readonly, openedChangedWarning must be removed.
67 internal.openedChangedWarning = false;
68 panel.state = "";
69- opened = false;
70 }
71
72 /*!
73@@ -367,8 +376,7 @@
74 panel.locked = true;
75 } else { // don't force hidden
76 panel.locked = internal.savedLocked;
77-
78- if (internal.savedLocked) {
79+ if (panel.locked) {
80 if (internal.savedOpened) {
81 panel.open();
82 } else {
83@@ -387,12 +395,7 @@
84 internal.movingDelta = panel.hintSize + draggingArea.initialPosition - bar.size;
85 } else if (state == "moving" && internal.previousState == "spread") {
86 internal.movingDelta = draggingArea.initialPosition;
87- } else if (state == "spread") {
88- panel.open();
89- } else if (state == "") {
90- panel.close();
91 }
92- internal.previousState = state;
93 }
94
95 Toolkit.InverseMouseArea {
96@@ -478,9 +481,11 @@
97 onPositionChanged: {
98 if (panel.locked) return;
99 if (panel.state == "hint" && mousePosition < initialPosition - dragThreshold) {
100+ internal.previousState = "hint";
101 panel.state = "moving";
102 pressedItem = null;
103 } else if (panel.state == "spread" && mousePosition > initialPosition + dragThreshold) {
104+ internal.previousState = "spread";
105 panel.state = "moving";
106 pressedItem = null;
107 }
108@@ -503,18 +508,22 @@
109 function finishMoving() {
110 if (draggingArea.dragVelocity < -44) {
111 if (internal.align === Qt.AlignBottom || internal.align === Qt.AlignRight) {
112- panel.state = "spread";
113+ panel.open();
114 } else {
115- panel.state = "";
116+ panel.close();
117 }
118 } else if (draggingArea.dragVelocity > 44) {
119 if (internal.align === Qt.AlignBottom || internal.align === Qt.AlignRight) {
120- panel.state = "";
121+ panel.close();
122 } else {
123- panel.state = "spread";
124+ panel.open();
125 }
126 } else {
127- panel.state = (bar.position < bar.size / 2) ? "spread" : "";
128+ if (bar.position < bar.size / 2) {
129+ panel.open();
130+ } else {
131+ panel.close();
132+ }
133 }
134 }
135 }
136
137=== modified file 'tests/resources/navigation/MyCustomPage.qml'
138--- tests/resources/navigation/MyCustomPage.qml 2013-08-01 13:16:42 +0000
139+++ tests/resources/navigation/MyCustomPage.qml 2013-09-17 13:30:57 +0000
140@@ -22,7 +22,7 @@
141
142 Flickable {
143 anchors.fill: parent
144- contentHeight: parent.height + units.gu(10)
145+ contentHeight: height + units.gu(10)
146 Label {
147 anchors {
148 top: parent.top
149
150=== modified file 'tests/resources/toolbar/panels.qml'
151--- tests/resources/toolbar/panels.qml 2013-09-03 10:51:40 +0000
152+++ tests/resources/toolbar/panels.qml 2013-09-17 13:30:57 +0000
153@@ -93,7 +93,7 @@
154 }
155 height: toolbar.height
156
157- Item {
158+ StyledItem {
159 id: toolbar
160 anchors {
161 left: parent.left
162@@ -103,6 +103,7 @@
163 height: units.gu(8)
164 property bool opened: bottomLeftPanel.opened
165 property bool animating: bottomLeftPanel.animating
166+ style: Theme.createStyleComponent("ToolbarStyle.qml", toolbar)
167 Label {
168 anchors.centerIn: parent
169 text: "This looks like a standard toolbar"
170
171=== modified file 'tests/unit/tst_components/tst_toolbar.qml'
172--- tests/unit/tst_components/tst_toolbar.qml 2013-09-03 10:51:40 +0000
173+++ tests/unit/tst_components/tst_toolbar.qml 2013-09-17 13:30:57 +0000
174@@ -50,9 +50,9 @@
175
176 function test_opened() {
177 compare(mainView.__propagated.toolbar.tools.opened, false, "Toolbar initially closed");
178- mainView.__propagated.toolbar.opened = true;
179+ mainView.__propagated.toolbar.open()
180 compare(mainView.__propagated.toolbar.opened, true, "Toolbar can be made opened");
181- mainView.__propagated.toolbar.opened = false;
182+ mainView.__propagated.toolbar.close();
183 compare(mainView.__propagated.toolbar.opened, false, "Toolbar can be made closed");
184 page.tools.opened = true;
185 compare(mainView.__propagated.toolbar.opened, true, "Toolbar can be made opened by setting page.tools.opened");
186@@ -74,7 +74,7 @@
187
188 function test_bug1192673() {
189 toolbarItems.opened = false;
190- mainView.__propagated.toolbar.opened = true;
191+ mainView.__propagated.toolbar.open();
192 compare(toolbarItems.opened, true, "opening the toolbar updates toolbarItems.opened");
193 toolbarItems.opened = false;
194 compare(mainView.__propagated.toolbar.opened, false, "setting toolbarActions.opened to false closes the toolbar");

Subscribers

People subscribed via source and target branches

to status/vote changes: